Button picture generation method, system and equipment
Through the automated button drawing generation method, virtual buttons are arranged and color filled with physical rules is used to solve the problem of low manual processing efficiency in the existing technology, and efficient and automated button drawing production is achieved, supporting users' self-service operations.
Patent Information
- Application Number
- CN202510866073.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2045-06-26
AI Technical Summary
During the existing button painting process, the two steps of base plate production and drawing generation need to be manually processed, which is inefficient, cannot be mass-produced, and cannot provide customized tools for end users, and the production link is too long.
In response to user input, the virtual buttons are automatically arranged on the virtual base plate using preset physical rules, and the base plate file with button position information is generated, and the color is filled according to the original image to generate the image file of the target button drawing.
It realizes automatic and efficient production of button painting production, shortens production time, from 1-2 days to within half an hour, improves the yield rate to more than 90%, supports self-service operation of end users, and realizes one-stop production completion.
Smart Images

Figure CN120472043A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer image production, and in particular to a method, system and device for generating button paintings. Background Art
[0002] Button painting is a unique artistic form that creates a unique, three-dimensional aesthetic by stitching together custom buttons in a variety of colors. Creating a button painting is laborious and time-consuming, requiring the original image to be processed and its pixels mapped onto the corresponding buttons. While maintaining the highest possible fidelity, a corresponding drawing is generated to indicate the button's position and color.
[0003] The production of a "button painting" involves two main steps: baseplate creation and blueprint generation. The existing baseplate production process requires design using industrial design software such as Rhino 3D. Circular elements of various sizes are placed on a blank baseplate, depending on the baseplate's dimensions. The placement is manually adjusted to ensure as many elements as possible fill the entire baseplate and reduce blank space. Manual fine-tuning is then performed to avoid element overlap. Baseplates are created as vector graphics files (dxf - Graphics Interchange Files), which contain a path description of the placed elements. This file is used for subsequent communication with the factory to generate the corresponding baseplate.
[0004] Drawing generation plays a crucial role in the button painting process. After the baseplate is created, color information is extracted from the original image element by element based on the baseplate's element information (position and size). Using a pre-defined printing palette, the original image's color information is converted to similar colors within the palette, generating a color-coded vector drawing. This preview of the button painting and a list of button colors are provided to facilitate subsequent production process integration with the factory and the generation of a shipping list. During the user experience of the button painting assembly process, color numbers and positioning are provided.
[0005] In the existing solution, both the base plate production and the drawing generation steps need to be handled manually, which is inefficient, cannot be mass-produced, and cannot provide customized tools for end users. The production chain is too long. Summary of the Invention
[0006] The present invention provides a button painting generation method, system and device, and provides a solution for automatically generating interactive animations based on motion capture. It at least solves the problem in existing solutions that the two steps of base plate production and drawing generation both need to be manually processed, which is inefficient, cannot be mass-produced, cannot provide customized tools for end users, and the production chain is too long.
[0007] This application provides a button painting generation method, comprising: In response to receiving a user input, obtaining a virtual base and a virtual button of a target button drawing; Arranging the virtual buttons on the virtual base plate based on a preset physical rule, and obtaining a base plate file that at least records position information of each virtual button; The virtual buttons in the base file are filled with colors according to the original image corresponding to the target button painting to obtain an image file of the target button painting.
[0008] Optionally, in response to receiving the user input, obtaining the virtual base and virtual button of the target button drawing includes: In response to receiving user input, obtaining the shape and size of the virtual base of the target button drawing; and / or In response to receiving the user input, the size of the virtual button of the target button image and the ratio of the number of virtual buttons of different sizes are obtained.
[0009] Optionally, the preset physical rules include: Setting gravity rules for the virtual base and / or virtual buttons; and / or Collision rules are set for the virtual base plate and / or virtual button.
[0010] Optionally, arranging the virtual buttons on the virtual base plate based on a preset physical rule to obtain a base plate file that records at least position information of each virtual button includes: Arranging the virtual buttons on the virtual base plate based on preset physical rules, and obtaining a blank area according to the arrangement result; Repeat the above steps for a preset number of times to obtain the arrangement result with the smallest blank area; The arrangement result with the smallest blank area is used to obtain a base plate file that at least records the position information of each virtual button.
[0011] Optionally, the step of filling the virtual button in the base file with color according to the original image corresponding to the target button painting to obtain the image file of the target button painting includes: According to the original image corresponding to the target button painting, a coordinate mapping between the original image and the base plate file is established; Obtaining the original color corresponding to each virtual button according to the coordinate mapping and the position information of each virtual button; The virtual buttons in the base file are filled with colors according to the original colors corresponding to the virtual buttons to obtain an image file of the target button painting.
[0012] Optionally, the step of filling the virtual buttons in the base file with colors according to the original colors corresponding to the virtual buttons to obtain an image file of a target button drawing includes: Filling the virtual buttons in the base file with colors according to the original colors corresponding to the virtual buttons to obtain original color data; Loading printing colors in a color palette file, and replacing the colors in the original color data with the printing colors to obtain printing color data; An image file of a target button painting is obtained according to the printing color data.
[0013] Optionally, the step of loading printing colors in a color palette file and replacing colors in the original color data with the printing colors to obtain printing color data includes: Load all printing colors in the color palette file and obtain the RGB components corresponding to each printing color; According to the original color data, the printing color closest to each color in the original color data is obtained, and the printing color data is obtained after replacing the corresponding color in the original color data with the printing color.
[0014] Optionally, the method further includes designing the surface of each virtual button in the image file.
[0015] Optionally, the method further includes traversing each virtual button in the image file or the base plate file to obtain the type and quantity of the virtual buttons.
[0016] In another aspect, a button painting generation method further includes: In Pymunk, configure the Pygame window as a virtual baseboard and configure the instances in the Pygame window as virtual buttons based on user input; Based on the preset pymunk spatial gravity and instance collision rules, the virtual buttons are arranged in free fall on the virtual base plate, and a base plate file is obtained that records at least position information of each virtual button; Filling the virtual buttons in the base file with colors according to the original image corresponding to the target button drawing, to obtain a base file recording at least position information and color information of each virtual button; A vector file of a target button image is obtained based on a base file that records at least position information and color information of each virtual button.
[0017] In yet another aspect, a button painting generation system includes a baseboard construction module and a button painting configuration module; The baseboard building blocks are configured to: In response to receiving a user input, obtaining a virtual base and a virtual button of a target button drawing; Arranging the virtual buttons on the virtual base plate based on a preset physical rule, and obtaining a base plate file that at least records position information of each virtual button; The button painting configuration module is configured as follows: The virtual buttons in the base file are filled with colors according to the original image corresponding to the target button painting to obtain an image file of the target button painting.
[0018] On the other hand, an embodiment of the present application further provides a device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above method.
[0019] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and a processor executes the computer program to implement the above method.
[0020] Compared with the prior art, the present invention has the following advantages and beneficial effects: The present invention provides a button painting generation method, system, and device. These methods include obtaining a virtual base and virtual buttons of a target button painting in response to user input; arranging the virtual buttons within the virtual base based on preset physical rules to obtain a base file containing at least the positional information of each virtual button; and filling the virtual buttons in the base file with color based on an original image corresponding to the target button painting to obtain an image file of the target button painting. This method addresses at least the problem of existing solutions requiring manual processing for both base production and drawing generation, resulting in low efficiency, impracticality for mass production, a lack of customization tools for end users, and a lengthy production process. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] To more clearly illustrate the specific embodiments of this application or the technical solutions in the prior art, the following briefly describes the drawings required for the specific embodiments or the description of the prior art. Similar elements or parts are generally identified by similar reference numerals throughout the drawings. Elements or parts in the drawings are not necessarily drawn to scale.
[0022] Figure 1 Schematic diagram of the process of button painting generation method in this application; Figure 2 This is a schematic diagram showing the button image file in this application; Figure 3 This is a schematic diagram showing the button image file in this application; Figure 4 This is a schematic diagram showing the button image file in this application; Figure 5 A schematic structural diagram of a device in this application; Markings in the figure: 101 - processor, 102 - communication bus, 103 - network interface, 104 - user interface, 105 - memory.
[0023] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the present invention, the following will provide a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work should fall within the scope of protection of the present invention.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] Example 1 like Figure 1 As shown, a button painting generation method includes: S1. In response to receiving a user input, obtaining a virtual base and a virtual button of a target button drawing.
[0027] The user's input may at least be used to set parameters such as the shape, size or resolution of the virtual base plate.
[0028] The user's input may be used to at least set the ratio of virtual buttons of different categories.
[0029] The parameters such as shape, size or resolution of each category of virtual buttons can be preset, and the user can directly select the category of the virtual button, or the user can directly input the parameters such as shape, size or resolution of each category of virtual buttons.
[0030] Optionally, parameters such as shape, size or resolution of the virtual base of the target button painting correspond to the shape and size of the target button painting.
[0031] Optionally, parameters such as shape, size, or resolution of each category of virtual buttons correspond to the shape and size of stock buttons.
[0032] Optionally, the virtual button is configured as an entity that can move within the virtual baseboard window.
[0033] S2. Arrange the virtual buttons on the virtual base plate based on preset physical rules, and obtain a base plate file that at least records the position information of each virtual button.
[0034] Physics rules may include gravity rules and collision rules, as well as friction simulation and bottom plate shaking simulation rules.
[0035] During the two aforementioned baseplate production steps, virtual buttons to be filled are randomly placed on the baseplate using a physics engine simulation based on the provided baseplate dimensions. Collision detection, gravity simulation, friction simulation, and baseplate sway simulation are implemented to ensure that the virtual buttons are filled as much as possible onto the baseplate without overlapping. Once the placement is stable, the corresponding position information is exported and written into the baseplate file.
[0036] Optionally, a fine-tuning function can also be provided. For virtual buttons that are not satisfactory in the interface display, the user can manually remove or move them to ensure a more reasonable bottom panel layout.
[0037] The above method can be used to quickly complete the work of making the base plate.
[0038] S3. Fill the virtual button in the base file with color according to the original image corresponding to the target button painting to obtain an image file of the target button painting.
[0039] The base file contains the position information of all virtual buttons, that is, the location and size of the buttons in the button painting. Based on the original image input by the user, such as a hand-drawn drawing or photo, the virtual buttons in the base file are filled with color to obtain the image file of the target button painting.
[0040] For each virtual button, a certain range of colors is taken from the corresponding position in the original image, and the average value is taken to obtain the color that the virtual button corresponding to the position needs to display.
[0041] Optionally, to create an interactive preview, you can use the interfaces provided by Three.js and the Web GL API to load a 3D model of the virtual button and render it onto the webpage's Canvas. Users can drag, scale, and rotate the model, add spotlights, parallel lights, and ambient light effects, and utilize Physically Based Rendering technology to enhance the realism of the rendering. Users can also export the rendering with one click, improving ease of use.
[0042] After the image file or base plate file is generated, the program traverses all elements, counts the number of various types of physical buttons required according to the type of virtual buttons, and generates a bill of materials file.
[0043] The new technology significantly improves the efficiency of image transposition, eliminating the previous manual adjustments required for each painting. The time it takes to create a single work has been reduced from one to two days to under half an hour. This also significantly increases the yield rate of finished products. Using algorithmic processing, the accuracy of the work has been greatly improved, minimizing data errors in baseplates and other files, raising the yield rate to over 90%.
[0044] This technology also enables public deployment. Previously, button art production could only be achieved through customer submission of images, followed by lengthy post-processing by professional operators. With this technology, deployed on web pages and mini-programs, users can now fully self-service their own operations, submitting images, previewing the results, and placing orders all in one place.
[0045] Example 2 This embodiment provides a button drawing generation method based on the first embodiment, including: S1. In response to receiving a user input, obtaining a virtual base and a virtual button of a target button drawing.
[0046] Optionally, in response to receiving a user input, obtaining a virtual base and a virtual button of a target button drawing includes: In response to receiving user input, obtaining the shape and size of the virtual base of the target button drawing; and / or In response to receiving the user input, the size of the virtual button of the target button image and the ratio of the number of virtual buttons of different sizes are obtained.
[0047] Optionally, the virtual base plate can be a regular graphic or a custom graphic, but is generally consistent with the shape of the original image corresponding to the target button painting.
[0048] Optionally, in Pymunk, configure the Pygame window as a virtual baseboard and configure the instances in the Pygame window as virtual buttons based on user input.
[0049] S2. Arrange the virtual buttons on the virtual base plate based on preset physical rules, and obtain a base plate file that at least records the position information of each virtual button.
[0050] Optional, pre-set physics rules include: Setting gravity rules for the virtual base and / or virtual buttons; and / or Setting collision rules for the virtual base and / or virtual buttons; and / or Sets friction rules for the virtual base and / or virtual buttons.
[0051] Optionally, the process of arranging the virtual buttons on the virtual baseboard based on preset physical rules can be repeated multiple times, and the virtual button arrangement that best meets the expectations is selected as the final result. Based on the final result, a baseboard file containing at least the position information of each virtual button is obtained. The result that best meets the expectations can be a result manually selected by the user or a result that meets preset conditions.
[0052] Optionally, arranging the virtual buttons on the virtual base plate based on a preset physical rule and obtaining a base plate file that records at least the position information of each virtual button includes: Arrange the virtual buttons on the virtual base plate based on preset physical rules, and obtain the blank area according to the arrangement result; Repeat the above steps for a preset number of times to obtain the arrangement result with the smallest blank area; The arrangement result with the smallest blank area is used to obtain a base plate file that at least records the position information of each virtual button.
[0053] Alternatively, a method for arranging virtual buttons on a virtual baseplate based on preset physical rules involves using a physics engine simulation to randomly place the circular elements to be filled on the baseplate. This involves introducing collision detection, gravity simulation, friction simulation, and baseplate sway simulation to fill the baseplate with as many elements as possible and ensure that they do not overlap. Once the placement is stable, the corresponding position information is exported and written to the baseplate file. A fine-tuning function is provided, allowing you to manually remove or move elements that are not satisfactory in the interface to ensure a reasonable baseplate layout.
[0054] Optionally, when the original image corresponding to the target button painting is a custom graphic, the original image may be completed into a regular image, and a regular virtual base may be set according to the shape of the regular image completed from the original image.
[0055] Optionally, when the original image corresponding to the target button painting is a custom graphic, a virtual base plate that can completely cover the original image can be set according to the shape of the original image. The virtual base plate is a regular graphic. After the virtual buttons are arranged in the virtual base plate based on preset physical rules, a sliding window is set using the shape of the original image. The sliding window is slid on the virtual base plate to obtain the arrangement scheme of virtual buttons that best meets the expectations as the final result. According to the final result, a base plate file that at least records the position information of each virtual button is obtained.
[0056] Optionally, the baseboard file may be a file that can store entity position information, such as an SVG file or a CSV file. The baseboard file records the coordinate data of each virtual button on the virtual baseboard.
[0057] S3. Fill the virtual button in the base file with color according to the original image corresponding to the target button painting to obtain an image file of the target button painting.
[0058] Optionally, color-filling the virtual button in the base file according to the original image corresponding to the target button painting to obtain the image file of the target button painting includes: According to the original image corresponding to the target button painting, a coordinate mapping between the original image and the base plate file is established; According to the coordinate mapping and the position information of each virtual button, the original color corresponding to each virtual button is obtained; The virtual buttons in the base file are filled with colors according to the original colors corresponding to the virtual buttons to obtain the image file of the target button painting.
[0059] Optionally, the virtual buttons in the base file are filled with colors according to the original colors corresponding to the virtual buttons to obtain an image file of the target button drawing, including: Fill the virtual buttons in the base file with colors according to the original colors corresponding to the virtual buttons to obtain the original color data; Load the printing colors in the color palette file, and use the printing colors to replace the colors in the original color data to obtain the printing color data; According to the printing color data, the image file of the target button painting is obtained.
[0060] Optionally, print colors in a swatch file are loaded, and the print colors are used to replace the colors in the original color data to obtain print color data, including: Load all printing colors in the color palette file and obtain the RGB components corresponding to each printing color; According to the original color data, the printing color closest to each color in the original color data is obtained, and the printing color data is obtained after replacing the corresponding color in the original color data with the printing color.
[0061] Optionally, the image file may be a file such as an SVG file or a CSV file that can store entity position information and color information. The image file records the coordinate data of each virtual button on the virtual baseboard and the color data of each virtual button.
[0062] Optionally, the method further includes designing the surface of each virtual button in the image file.
[0063] Optionally, the surface of each virtual button in the image file is designed including material design, texture design, etc.
[0064] Optionally, the method further includes traversing each virtual button in the image file to obtain the type and quantity of the virtual buttons.
[0065] Optionally, you can also render the image file and export the corresponding image.
[0066] Example 3 A button painting generation method further includes: In Pymunk, configure the Pygame window as a virtual baseboard and configure the instances in the Pygame window as virtual buttons based on user input; Based on the preset pymunk spatial gravity and instance collision rules, the virtual buttons are arranged in a free-falling manner on the virtual base plate, and a base plate file is obtained that records at least the position information of each virtual button; Filling the virtual buttons in the base file with colors according to the original image corresponding to the target button painting, to obtain a base file that records at least the position information and color information of each virtual button; A vector file of a target button image is obtained based on a base file that records at least position information and color information of each virtual button.
[0067] Optionally, in Pymunk, configure the Pygame window as a virtual baseboard and configure the instances in the Pygame window as virtual buttons based on user input, including: Based on user input, configuring the shape and size of the Pygame window in Pymunk to obtain a virtual base for the target button drawing; and / or Based on user input, the size of the instance and the ratio of the number of instances of different sizes are configured in the Pygame window to obtain the virtual button.
[0068] Optionally, based on the preset pymunk spatial gravity and instance collision rules, virtual buttons are arranged in a free-falling manner on a virtual base plate, and a base plate file that records at least position information of each virtual button is obtained, including: Arrange the virtual buttons on the virtual base based on preset physical rules, and obtain a blank area according to the arrangement result; the blank area is equal to the area of the virtual base minus the area of all virtual buttons; Repeat the above steps for a preset number of times to obtain the arrangement result with the smallest blank area; The arrangement result with the smallest blank area is used to obtain a base plate file that at least records the position information of each virtual button.
[0069] Optionally, obtaining a vector file of a target button drawing based on a base plate file that records at least the position information and color information of each virtual button includes: According to the original image corresponding to the target button painting, a coordinate mapping between the original image and the base plate file is established; According to the coordinate mapping and the position information of each virtual button, the original color corresponding to each virtual button is obtained; The virtual buttons in the base file are filled with colors according to the original colors corresponding to the virtual buttons to obtain a vector file of the target button drawing.
[0070] Optionally, the virtual buttons in the base file are filled with colors according to the original colors corresponding to the virtual buttons to obtain a vector file of the target button drawing, including: Fill the virtual buttons in the base file with colors according to the original colors corresponding to the virtual buttons to obtain the original color data; Load the printing colors in the color palette file, and use the printing colors to replace the colors in the original color data to obtain the printing color data; According to the printing color data, the vector file of the target button painting is obtained.
[0071] Optionally, print colors in a swatch file are loaded, and the print colors are used to replace the colors in the original color data to obtain print color data, including: Load all printing colors in the color palette file and obtain the RGB components corresponding to each printing color; According to the original color data, the printing color closest to each color in the original color data is obtained, and the printing color data is obtained after replacing the corresponding color in the original color data with the printing color.
[0072] Optionally, the method also includes designing the surface of each virtual button in the vector file.
[0073] Optionally, the method further includes traversing each virtual button in the vector file or the base plate file to obtain the type and quantity of the virtual buttons.
[0074] Example 4 like Figures 2 to 4 As shown, this embodiment is an optional example, a button picture generation method, including: Use Pymunk to perform the simulation. Based on the user-entered board size (e.g., 600x900, 900x600, 600x900, A4 horizontal, or A4 vertical), a Pygame window is created as a virtual board. Small and large virtual button instances are created in a certain ratio, such as 1:3, and the rigid body sizes are set according to the virtual button's dimensions. The virtual button instances are placed in the Pygame window and the Pymunk space gravity is set to (0, 900) to allow them to fall freely. After falling, the virtual button instances undergo collision detection, resulting in a small displacement, similar to a real-world collision. When the velocities of all virtual button instances fall below a critical value, the simulation is considered stable and ends. The area of the blank space is calculated by subtracting the area of all virtual buttons within the virtual board from the area of the virtual board. To minimize the remaining area, a maximum number of repetitions (e.g., 10) is set. The optimal solution is obtained through multiple simulations. After all simulations are completed, the information of the optimal virtual button instance is written into the base file. The base file uses the CSV format. Each line describes a circle, such as x corresponds to the x-coordinate, y corresponds to the y-coordinate, and radius corresponds to the radius. Specifically, (100, 50, 5.9) means that a virtual button with a radius of 5.9 needs to be placed at the canvas coordinate (x=100, y=50).
[0075] After the base file is generated, a picture is selected based on the user's input, and all data records in the base file are traversed to extract the position description of each virtual button, including the x-coordinate, y-coordinate, and radius. Based on the x-coordinate, y-coordinate, and radius information, the corresponding pixel color information, i.e., RGBA value, is obtained at the corresponding position in the picture. The RGBA value is marked as the original color, and the original primary color of all virtual buttons is obtained as the original primary color data. All the printing colors in the color palette file are loaded, and the printing color closest to the original color of each virtual button is found as the final color that the virtual button at the corresponding position needs to display, and the printing color data is obtained. Finally, the image file of the target button painting is obtained based on the printing color data. Generally speaking, the image file of the target button painting is an SVG file, which includes the x-coordinate, y-coordinate, radius, and color data of each virtual button.
[0076] Specifically, the effect of importing image files into a web page for display is as follows Figure 2 shown.
[0077] The specific color replacement process is as follows: load all printed colors. Extract the RGB components corresponding to each color. Use KDTree from the Python Scipy library to construct a K-dimensional tree. Enter the original color and find the nearest value of the corresponding RGB component. Replace the original color with the nearest value in the printed color. This completes the color replacement process.
[0078] Optionally, use a Python script to traverse the elements in the drawing SVG file, merge virtual buttons of the same model, and generate a corresponding material distribution list file. Each line records a specific color and the required number of buttons. The distribution list file can be used as a reference for subsequent product production and packaging.
[0079] Optionally, you can import a pre-made 3D model file of a virtual button into the Threejs page environment and load it using the SVGLoader in Threejs. After the SVG file is loaded, iterate over each virtual button element, create a corresponding 3D object, and set the color using the information in the drawing.
[0080] Specifically, the effect of adding the virtual button 3D model file to the Threejs page environment is as follows Figure 3 shown.
[0081] Optionally, you can also use the Physically Based Rendering technology to set the specific properties including: Set roughness to control the microscopic roughness of the material surface; Set metalness to define whether the material is metal. Metal surfaces are mainly highly reflective, while non-metal surfaces are mainly diffusely reflective. Set up directional light and ambient light, and according to the size of the frame, set up multiple spotlights on the top, add environmental texture maps to increase the realism of the rendering, add orbit control, users can rotate, zoom, move and other operations on the canvas, and cooperate with multi-scene maps to simulate real display effects; Sets the color of the button, as specified by the fill color attribute in the SVG file.
[0082] Specifically, the image after setting using Physically Based Rendering technology is as follows Figure 4 shown.
[0083] Optionally, you can also add a color selection component to freely switch the background color, or choose to use the original image as the background effect.
[0084] Optionally, after adjusting the effect, use multi-target rendering to export the high-resolution rendering to an image and download it. The rendering is highly consistent with the final appearance of the physical product, which can quickly help users customize content settings and selections, maximizing efficiency.
[0085] Specifically, an example of an SVG file XML <svg width="420" height="594" xmlns="http: / / www.w3.org / 2000 / svg"> <g> <circle cx="190.14" cy="559.68" r="7.8" stroke-width="1" fill="#003a40">< / circle> < / g> <g> <circle cx="240.58" cy="557.93" r="7.8" stroke-width="1" fill="#003a40">< / circle> < / g> <g> <circle cx="205.7" cy="561.81" r="7.8" stroke-width="1" fill="#efedde">< / circle> < / g> < / svg> Among them, svg width="420" height="594" indicates the size of the virtual base is 420*594, circle is the virtual button, cx="190.14" represents the x coordinate is 190.14, cy="559.68" represents the y coordinate is 559.68, r="7.8" represents the radius of the virtual button is 7.8, stroke-width="1" represents the line width is 1, fill="#003a40" represents the color is #003a40.
[0086] Example 5 A button painting generation system includes a baseboard construction module and a button painting configuration module; The baseboard building blocks are configured as: In response to receiving a user input, obtaining a virtual base and a virtual button of a target button drawing; Arranging the virtual buttons on the virtual base plate based on preset physical rules, and obtaining a base plate file that at least records position information of each virtual button; The button painting configuration module is configured as follows: According to the original image corresponding to the target button painting, the virtual button in the base file is filled with color to obtain the vector file of the target button painting.
[0087] Optionally, in response to receiving a user input, obtaining a virtual base and a virtual button of a target button drawing includes: In response to receiving user input, obtaining the shape and size of the virtual base of the target button drawing; and / or In response to receiving the user input, the size of the virtual button of the target button image and the ratio of the number of virtual buttons of different sizes are obtained.
[0088] Optional, pre-set physics rules include: Setting gravity rules for the virtual base and / or virtual buttons; and / or Set collision rules for the virtual base and / or virtual buttons.
[0089] Optionally, arranging the virtual buttons on the virtual base plate based on a preset physical rule and obtaining a base plate file that records at least the position information of each virtual button includes: Arrange the virtual buttons on the virtual base plate based on preset physical rules, and obtain the blank area according to the arrangement result; Repeat the above steps for a preset number of times to obtain the arrangement result with the smallest blank area; The arrangement result with the smallest blank area is used to obtain a base plate file that at least records the position information of each virtual button.
[0090] Optionally, color-filling the virtual button in the base file according to the original image corresponding to the target button painting to obtain the image file of the target button painting includes: According to the original image corresponding to the target button painting, a coordinate mapping between the original image and the base plate file is established; According to the coordinate mapping and the position information of each virtual button, the original color corresponding to each virtual button is obtained; The virtual buttons in the base file are filled with colors according to the original colors corresponding to the virtual buttons to obtain the image file of the target button painting.
[0091] Optionally, the virtual buttons in the base file are filled with colors according to the original colors corresponding to the virtual buttons to obtain an image file of the target button drawing, including: Fill the virtual buttons in the base file with colors according to the original colors corresponding to the virtual buttons to obtain the original color data; Load the printing colors in the color palette file, and use the printing colors to replace the colors in the original color data to obtain the printing color data; According to the printing color data, the image file of the target button painting is obtained.
[0092] Optionally, print colors in a swatch file are loaded, and the print colors are used to replace the colors in the original color data to obtain print color data, including: Load all printing colors in the color palette file and obtain the RGB components corresponding to each printing color; According to the original color data, the printing color closest to each color in the original color data is obtained, and the printing color data is obtained after replacing the corresponding color in the original color data with the printing color.
[0093] Optionally, the method further includes designing the surface of each virtual button in the image file.
[0094] Optionally, the method further includes traversing each virtual button in the image file to obtain the type and quantity of the virtual buttons.
[0095] Example 6 This embodiment provides a device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement any of the above methods.
[0096] Specifically, such as Figure 5 As shown, Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application. The device is an electronic device and may include: a processor 101, such as a central processing unit (CPU), a communication bus 102, a user interface 104, a network interface 103, and a memory 105. Among them, the communication bus 102 is used to realize the connection and communication between these components. The user interface 104 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and optionally the user interface 104 may also include a standard wired interface and a wireless interface. The network interface 103 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 105 may optionally be a storage device independent of the aforementioned processor 101. The memory 105 may be a high-speed random access memory (RAM) memory, or a stable non-volatile memory (NVM), such as at least one disk storage. The processor 101 may be a general-purpose processor, including a central processing unit, a network processor, etc., or may be a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component.
[0097] Those skilled in the art will understand that Figure 5 The structure shown in the figure does not constitute a limitation to the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0098] like Figure 5 As shown, the memory 105 as a storage medium may include an operating system, a network communication module, a user interface module, and an application program for implementing the button picture generating method.
[0099] exist Figure 5In the electronic device shown, the network interface 103 is mainly used for data communication with the network server; the user interface 104 is mainly used for data interaction with the user; the processor 101 and the memory 105 in this application can be set in the electronic device, and the electronic device calls the application program stored in the memory 105 for implementing the button painting generation method through the processor 101 to implement the above method.
[0100] Example 7 This embodiment provides a computer-readable storage medium, on which a computer program is stored. A processor executes the computer program to implement any of the above methods.
[0101] In some embodiments, the computer-readable storage medium may be a memory device such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface mount memory, optical disk, or CD-ROM; or various devices including any one or any combination of the above memories. The computer may be various computing devices including smart terminals and servers.
[0102] In the above embodiments of the present disclosure, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0103] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0104] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected to achieve the purpose of the present embodiment according to actual needs.
[0105] In addition, the functional units in the various embodiments of the present disclosure may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0106] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a non-volatile storage medium, including a number of instructions for enabling a device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present disclosure. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program code.
[0107] The above is only a preferred embodiment of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present disclosure. These improvements and modifications should also be regarded as within the scope of protection of the present disclosure.
Claims
1. A button painting generation method, characterized in that: include: In response to receiving a user input, obtaining a virtual base and a virtual button of a target button drawing; Arranging the virtual buttons on the virtual base plate based on a preset physical rule, and obtaining a base plate file that at least records position information of each virtual button; The virtual buttons in the base file are filled with colors according to the original image corresponding to the target button painting to obtain an image file of the target button painting.
2. The button painting generation method according to claim 1, characterized in that: The step of obtaining a virtual base plate and a virtual button of a target button drawing in response to receiving a user input includes: In response to receiving user input, obtaining the shape and size of the virtual base of the target button drawing; and / or In response to receiving the user input, the size of the virtual button of the target button image and the ratio of the number of virtual buttons of different sizes are obtained.
3. The button painting generation method according to claim 1, characterized in that: The preset physical rules include: Setting gravity rules for the virtual base and / or virtual buttons; and / or Collision rules are set for the virtual base plate and / or virtual button.
4. The button painting generation method according to claim 1, characterized in that: The method of arranging the virtual buttons on the virtual base plate based on a preset physical rule and obtaining a base plate file that records at least position information of each virtual button includes: Arranging the virtual buttons on the virtual base plate based on preset physical rules, and obtaining a blank area according to the arrangement result; Repeat the above steps for a preset number of times to obtain the arrangement result with the smallest blank area; The arrangement result with the smallest blank area is used to obtain a base plate file that at least records the position information of each virtual button.
5. The button painting generation method according to claim 1, characterized in that: The method of filling the virtual button in the base file with color according to the original image corresponding to the target button painting to obtain the image file of the target button painting includes: According to the original image corresponding to the target button painting, a coordinate mapping between the original image and the base plate file is established; Obtaining the original color corresponding to each virtual button according to the coordinate mapping and the position information of each virtual button; The virtual buttons in the base file are filled with colors according to the original colors corresponding to the virtual buttons to obtain an image file of the target button painting.
6. The button painting generation method according to claim 5, characterized in that: The step of filling the virtual buttons in the base file with colors according to the original colors corresponding to the virtual buttons to obtain an image file of a target button drawing includes: Filling the virtual buttons in the base file with colors according to the original colors corresponding to the virtual buttons to obtain original color data; Loading printing colors in a color palette file, and replacing the colors in the original color data with the printing colors to obtain printing color data; An image file of a target button painting is obtained according to the printing color data.
7. The button painting generation method according to claim 6, characterized in that: The step of loading the printing colors in the color palette file and replacing the colors in the original color data with the printing colors to obtain the printing color data comprises: Load all printing colors in the color palette file and obtain the RGB components corresponding to each printing color; According to the original color data, the printing color closest to each color in the original color data is obtained, and the printing color data is obtained after replacing the corresponding color in the original color data with the printing color.
8. The button painting generation method according to claim 1, characterized in that: The method also includes designing the surface of each virtual button in the image file.
9. The button painting generation method according to claim 1, characterized in that: The method also includes traversing each virtual button in the image file or the base plate file to obtain the type and quantity of the virtual buttons.
10. A button painting generating method, characterized in that: Also includes: In Pymunk, configure the Pygame window as a virtual baseboard and configure the instances in the Pygame window as virtual buttons based on user input; Based on the preset pymunk spatial gravity and instance collision rules, the virtual buttons are arranged in free fall on the virtual base plate, and a base plate file is obtained that records at least position information of each virtual button; Filling the virtual buttons in the base file with colors according to the original image corresponding to the target button drawing, to obtain a base file recording at least position information and color information of each virtual button; A vector file of a target button image is obtained based on a base file that records at least position information and color information of each virtual button.
11. A button painting generation system, characterized in that: Includes baseboard construction module and button painting configuration module; The baseboard building blocks are configured to: In response to receiving a user input, obtaining a virtual base and a virtual button of a target button drawing; Arranging the virtual buttons on the virtual base plate based on a preset physical rule, and obtaining a base plate file that at least records position information of each virtual button; The button painting configuration module is configured as follows: The virtual button in the base file is filled with color according to the original image corresponding to the target button painting to obtain a vector file of the target button painting.
12. A device, characterized in that The device includes a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the computer program to implement the method according to any one of claims 1 to 9.
13. A device, characterized in that The device includes a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the computer program to implement the method according to claim 10.
Citation Information
Patent Citations
Method of digital design generation
CA2986327A1
Method of building physical experiment according to hand-painted pattern
CN106710318A
Method, device and system for determining cooperative capability of two persons and electronic equipment
CN116931796A
Crushed animation production method and device, electronic equipment and storage medium
CN117152309A
Image style transfer method and apparatus therefor
WO2022022260A1