Pattern drawing method, chip, electronic equipment and storage medium
By using preset mold extraction and data storage technology with preset mold extraction unit size in embedded display systems, the pattern is directly drawn, which solves the performance bottleneck problem caused by the large amount of calculation in traditional methods, and achieves faster pattern drawing speed.
Patent Information
- Application Number
- CN202510059872.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-08-01
AI Technical Summary
Traditional pattern drawing methods have a large amount of calculation in embedded display systems, resulting in performance bottlenecks and affecting the drawing speed.
By obtaining the patterns drawn by the upper computer, molding is taken according to the preset molding unit size, multiple molding units are generated, and drawing data of each molding unit is stored. When receiving the instructions, the patterns are drawn directly using these data to reduce the calculation amount.
Improves pattern drawing speed, reduces calculation amount, and improves the performance of embedded display systems.
Smart Images

Figure CN120411299A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of display technology, and particularly to a pattern drawing method, a chip, an electronic device, and a storage medium. Background Art
[0002] In the current field of display technology, pattern drawing is a basic operation. Whether in computer graphics, game development, image processing software, or various embedded display systems, an efficient pattern drawing method is indispensable.
[0003] Traditional pattern drawing methods usually rely on operations based on individual pixel points to gradually construct the pattern outline point by point. This often requires calculating the position of each pixel point by parsing geometric formulas. For example, when drawing a circular pattern, methods such as the Bresenham circle drawing algorithm or the midpoint circle drawing method are generally used to calculate the position of each pixel point.
[0004] However, although traditional pattern drawing methods can meet basic drawing requirements, they involve a large amount of mathematical operations. This not only increases the computational amount but also limits the speed of drawing patterns. Especially on resource-constrained embedded display systems, this computational overhead may become a performance bottleneck. Summary of the Invention
[0005] In view of the deficiencies of the prior art, the present application provides a pattern drawing method, a chip, an electronic device, and a storage medium. When receiving a pattern drawing instruction, multiple drawing data are called, and a second target pattern is drawn using a drawing unit equal in size to a preset modulo unit. When drawing the second target pattern, complex calculations are not required, but direct drawing is performed according to each stored drawing data, thereby reducing the computational amount and increasing the speed of drawing patterns.
[0006] To solve the above problems, the present invention provides the following technical solutions:
[0007] In a first aspect, an embodiment of the present application provides a pattern drawing method, including: obtaining a first image including a first target pattern drawn by a host computer; sequentially performing modulo operation on the first image according to a preset modulo unit size to obtain a plurality of modulo units; determining a plurality of drawing data based on the plurality of modulo units, each drawing data including the modulo values of all first pixel points for displaying the first target pattern included in a corresponding modulo unit; storing the plurality of drawing data; when receiving a pattern drawing instruction, calling the plurality of drawing data, and using a drawing unit equal in size to the preset modulo unit to draw a second target pattern.
[0008] In some embodiments, performing modulo operations on the first image in sequence according to the preset modulo unit size to obtain a plurality of modulo units includes: performing a modulo operation on the first image according to the preset modulo unit size to obtain a plurality of initial modulo units; selecting a plurality of final modulo units from the plurality of initial modulo units, wherein the set of pixel points of all the final modulo units includes all the first pixel points.
[0009] In some embodiments, performing a modulo operation on the first image according to the preset modulo unit size to obtain a plurality of initial modulo units includes: constructing a sliding window according to the preset modulo unit size; moving the sliding window multiple times starting from a preset initial position according to a preset rule, and performing a modulo operation on the first image once after each movement of the sliding window to obtain one initial modulo unit, and thus obtaining a plurality of initial modulo units; selecting a plurality of final modulo units from the plurality of initial modulo units includes: generating a plurality of modulo unit combination schemes based on all the initial modulo units, wherein the set of pixel points of all the initial modulo units in each modulo unit combination scheme includes all the first pixel points; selecting, from the plurality of modulo unit combination schemes, a modulo unit combination scheme with the smallest number of pixel points that are not the first pixel points included in the set of pixel points as the target modulo unit combination scheme; determining the plurality of final modulo units based on the target modulo unit combination scheme.
[0010] In some embodiments, performing a modulo operation on the first image according to the preset modulo unit size to obtain a plurality of initial modulo units includes: dividing the first image into a plurality of the initial modulo units according to the preset modulo unit size; selecting a plurality of final modulo units from the plurality of initial modulo units includes: deleting all the initial modulo units that do not include the first pixel points among all the initial modulo units to obtain the plurality of final modulo units.
[0011] In some embodiments, determining a plurality of rendering data based on the plurality of modulo units includes: determining a two-dimensional coordinate system in the first image; determining the coordinates of the calculation points in each modulo unit in the two-dimensional coordinate system and the coordinates of all the first pixel points except the calculation points; determining the modulo value of each first pixel point based on the pixel value of each first pixel point; determining the corresponding rendering data based on the coordinates of the calculation points in each modulo unit in the two-dimensional coordinate system, the coordinates of all the first pixel points except the calculation points, and the modulo value of each first pixel point, thereby obtaining the plurality of rendering data.
[0012] In some embodiments, determining the two-dimensional coordinate system in the first image includes: determining the geometric center point of the first target pattern; using the geometric center point of the first target pattern as the origin of the two-dimensional coordinate system, and then determining the two-dimensional coordinate system.
[0013] In some embodiments, determining the geometric center point of the first target pattern includes: converting the first image into a table display, where one cell in the table represents one pixel point in the first image; when receiving a second selection instruction, determining the pixel point corresponding to the selected cell in the table as the geometric center point of the first target pattern according to the second selection instruction.
[0014] In some embodiments, based on the pixel value of each first pixel point, determining the modulo value of each first pixel point includes: for each first pixel point, when the pixel value of the first pixel point is within a preset numerical range, storing the modulo value of the first pixel point as a first preset value, otherwise storing the modulo value of the first pixel point as a second preset value, where the first preset value indicates that the first pixel point is displayed when drawing the second target pattern, and the second preset value indicates that the first pixel point is not displayed when drawing the second target pattern.
[0015] In some embodiments, based on the pixel value of each first pixel point, determining the modulo value of each first pixel point includes: determining the pixel value of each first pixel point as the modulo value of each first pixel point.
[0016] In some embodiments, when receiving a pattern drawing instruction, calling the multiple drawing data and using a drawing unit equal in size to the preset modulo unit to draw the second target pattern includes: when receiving a pattern drawing instruction, determining the coordinates of a reference point according to the pattern drawing instruction; calling the multiple drawing data based on the coordinates of the reference point, and using a drawing unit equal in size to the preset modulo unit to draw the second target pattern.
[0017] In some embodiments, the reference point is the geometric center point of the second target pattern.
[0018] In some embodiments, the second target pattern is a second circular pattern, and the reference point is the center of the second circular pattern.
[0019] Second aspect, an embodiment of the present application provides a pattern drawing method, including: receiving and storing a plurality of drawing data sent by an electronic device, where the plurality of drawing data is obtained by the electronic device sequentially performing pattern sampling on a first image including a first target pattern according to a preset pattern sampling unit size; when receiving a pattern drawing instruction, calling the plurality of drawing data, and using a drawing unit equal in size to the preset pattern sampling unit to draw a second target pattern.
[0020] Third aspect, an embodiment of the present application provides a chip, the chip includes:
[0021] at least one processor; and, a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the pattern drawing method as described in the first aspect or the second aspect.
[0022] Fourth aspect, an embodiment of the present application provides a display device, including the chip as described in the third aspect and a display module, where the chip is used to draw a second target pattern in the display module.
[0023] Fifth aspect, an embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores an executable program, and the executable program is executed by a processor to implement the pattern drawing method as described in the first aspect or the second aspect.
[0024] Sixth aspect, an embodiment of the present application provides a pattern drawing method, including: drawing a first image including a first target pattern; sequentially performing pattern sampling on the first image according to a preset pattern sampling unit size to obtain a plurality of pattern sampling units; determining a plurality of drawing data based on the plurality of pattern sampling units, where each of the drawing data includes the pattern sampling values of all first pixel points included in a corresponding pattern sampling unit for displaying the first target pattern; storing the plurality of drawing data in a display device.
[0025] Seventh aspect, an embodiment of the present application provides an electronic device, the electronic device includes: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the pattern drawing method as described in the sixth aspect.
[0026] The present application provides a pattern drawing method, a chip, an electronic device, and a storage medium. When receiving a pattern drawing instruction, the present application calls multiple drawing data and uses a drawing unit equal in size to a preset modulo unit to draw a second target pattern, enabling direct drawing based on each stored drawing data without complex calculations when drawing the second target pattern, thereby reducing the amount of calculation and improving the speed of drawing the pattern. Description of the Drawings
[0027] Figure 1 It is a schematic flowchart of an implementation manner of the first pattern drawing method provided by an embodiment of the present application.
[0028] Figure 2 It is a schematic diagram of the first image provided by an embodiment of the present application.
[0029] Figure 3 It is Figure 1 A detailed flowchart of step S200 in
[0030] Figure 4 It is a schematic diagram of the first implementation manner of modulo operation on the first image according to the preset modulo unit size provided by an embodiment of the present application.
[0031] Figure 5 It is a schematic diagram of the second implementation manner of modulo operation on the first image according to the preset modulo unit size provided by an embodiment of the present application.
[0032] Figure 6 It is Figure 1 A detailed flowchart of step S300 in
[0033] Figure 7 It is a schematic diagram of the table obtained by converting the first image into a table display provided by an embodiment of the present application.
[0034] Figure 8 It is a schematic diagram of determining the geometric center point of the first target pattern and multiple modulo units according to a selection instruction provided by an embodiment of the present application.
[0035] Figure 9 It is Figure 1 A detailed flowchart of step S500 in
[0036] Figure 10 It is a schematic flowchart of an implementation manner of the second pattern drawing method provided by an embodiment of the present application.
[0037] Figure 11 It is a schematic flowchart of an implementation manner of the third pattern drawing method provided by an embodiment of the present application.
[0038] Figure 12It is a schematic flowchart of an implementation manner of the fourth pattern drawing method provided by an embodiment of the present application.
[0039] Figure 13 It is a schematic structural diagram of a pattern drawing device provided by an embodiment of the present application.
[0040] Figure 14 It is a schematic structural diagram of a chip provided by an embodiment of the present application.
[0041] Figure 15 It is a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. Specific Embodiments
[0042] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present application.
[0043] In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present invention, "a plurality of" means two or more, unless otherwise specifically defined.
[0044] The present application provides a pattern drawing method, a chip, an electronic device, and a storage medium. By taking samples of a first image according to a preset sampling unit size, a plurality of sampling units are obtained, and the coordinates and sampling values of all first pixel points for displaying a standard circle in each sampling unit are stored. When drawing a circle, complex calculations are not required, but the circle can be directly drawn according to the coordinates and sampling values of all first pixel points in each stored sampling unit, thereby reducing the amount of calculation and improving the circle drawing speed.
[0045] First, it should be noted that the geometric center point of the first target pattern or the geometric center point of the second target pattern in the present application may not be a completely precise geometric center point. Since both the first target pattern and the second target pattern are displayed by a plurality of pixel points, and the geometric center point is a pixel point in the image, the geometric center point of the first target pattern refers to a pixel point that is as close as possible to the precise geometric center point of the first target pattern, and the geometric center point of the second target pattern refers to a pixel point that is as close as possible to the precise geometric center point of the second target pattern.
[0046] Next, the pattern drawing method provided by the present application will be specifically described in conjunction with the accompanying drawings.
[0047] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of an implementation manner of the first pattern drawing method provided by an embodiment of the present application. As Figure 1 shown, in some implementation manners, the first pattern drawing method includes: step S100 to step S500.
[0048] Step S100: Obtain a first image including a first target pattern drawn by a host computer.
[0049] In some implementation manners, the first target pattern is any pattern. For example, the first target pattern may be a circular pattern, an elliptical pattern, a triangular pattern, a rectangular pattern, or an irregular graphic pattern, etc.
[0050] Please refer to Figure 2 , Figure 2 which is a schematic diagram of the first image provided by an embodiment of the present application. As Figure 2 shown, in the first image 1, the first target pattern 10 is displayed in gray. The first target pattern 10 is the first circular pattern.
[0051] In some implementation manners, the pixel points for displaying the first target pattern are first pixel points. For example, as Figure 2 shown, the pixel points with gray color in the first image 1 are first pixel points, and the pixel points with white color are not first pixel points.
[0052] In some implementation manners, the first image is a grayscale image, and the first target pattern includes first pixel points with one or several grayscale values.
[0053] In some implementation manners, the first image is a color image, and the first target pattern includes first pixel points with one or several colors.
[0054] Optionally, each first pixel point has multiple color channel pixel values. For example, each first pixel point has a red channel pixel value, a green channel pixel value, and a blue channel pixel value.
[0055] In some implementation manners, the host computer is a computer with better computing performance than an embedded device, and the pattern drawing method is executed by a display device including an embedded chip (i.e., an embedded processor).
[0056] Optionally, the display device is an embedded display system or other electronic devices.
[0057] In some embodiments, when the first target pattern is the first circular pattern, generally no anti-aliasing processing is performed on the displayed circular pattern when using an embedded chip to draw a circle, and the sawtooth of the displayed circular pattern is obvious and the effect is poor. When the display device including the embedded chip draws the displayed circular pattern, when the host computer has performed anti-aliasing processing on the first circular pattern, the effect of the displayed circular pattern can also be better.
[0058] Step S200: Perform modular arithmetic on the first image in sequence according to the preset modular arithmetic unit size to obtain a plurality of modular arithmetic units.
[0059] In some embodiments, the preset modular arithmetic unit size is N×M, where N represents that the length of the preset modular arithmetic unit is the length of N pixel points, and M represents that the width of the preset modular arithmetic unit is the width of M pixel points.
[0060] Optionally, the value of N is above 2. For example, the value of N is 2, 3, 4, 5, 6, 7 or 10, etc. As long as it is ensured that N is less than the length of the first image.
[0061] Optionally, the value of M is above 2. For example, the value of M is 2, 3, 4, 5, 6, 7 or 10, etc. As long as it is ensured that M is less than the width of the first image.
[0062] In some embodiments, N = M, and at this time the shape of the preset modular arithmetic unit is a square.
[0063] In some embodiments, a chip (such as an embedded chip) can only process or display an image according to the minimum pixel processing unit. At this time, the preset modular arithmetic unit size is made greater than or equal to the minimum pixel processing unit size.
[0064] Preferably, the preset modular arithmetic unit size is equal to the minimum pixel processing unit size. In this way, the preset modular arithmetic unit size can be minimized under the limitation of the processing performance of the chip, so as to perform as fine modular arithmetic on the first image as possible according to the preset modular arithmetic unit size, so that the modular arithmetic unit contains as few pixel points that are not the first pixel points as possible, thereby saving storage space.
[0065] Exemplarily, when the minimum pixel processing unit size is 4×4, the preset modular arithmetic unit size is also 4×4.
[0066] Please refer to Figure 3 , Figure 3 is Figure 1 the detailed flowchart of step S200 in Figure 3 As shown in
[0067] In some embodiments, step S200 includes step S210 to step S220.
[0068] In some embodiments, step S210 includes steps S211 to S212.
[0069] Step S211: Construct a sliding window according to a preset modulo unit size.
[0070] Wherein, the preset modulo unit size is equal to the size of the sliding window.
[0071] Step S212: Move the sliding window multiple times starting from a preset initial position according to a preset rule, and perform modulo operation on the first image once after each movement of the sliding window to obtain an initial modulo unit, and thus obtain multiple initial modulo units.
[0072] In some embodiments, according to a preset rule, starting from the preset initial position, the sliding window steps a first preset number of pixel points in the first direction each time to perform a modulo operation on the first image. When one end of the sliding window reaches the edge of the first image, it steps a second preset number of pixel points in the second direction, and then steps a first preset number of pixel points in the opposite direction of the first direction each time to perform a modulo operation on the first image. When the other end of the sliding window reaches the edge of the first image, it steps a second preset number of pixel points in the second direction, and then returns to execute stepping a first preset number of pixel points in the first direction each time to perform a modulo operation on the first image until the set of pixel points of all the obtained initial modulo units includes all the first pixel points.
[0073] Optionally, the first direction is the horizontal direction and the second direction is the vertical direction.
[0074] Optionally, the first direction is the vertical direction and the second direction is the horizontal direction.
[0075] Please refer to Figure 4 , Figure 4 which is a schematic diagram of the first embodiment of performing modulo operation on the first image according to a preset modulo unit size provided by the embodiments of the present application. Figure 4 For the convenience of illustration, each pixel point in the first image 1 is shown as a square grid. It can be understood that the grid lines will not be displayed when the first image 1 is normally displayed. As Figure 4 shown, in some embodiments, when the preset modulo unit size is 4×4, the initial modulo unit A1, the initial modulo unit A2, and the initial modulo unit A3 are obtained. Figure 4 Other initial modulo units are not shown in
[0076] In some other embodiments, step S210 includes step S213.
[0077] Step S213: Divide the first image into a plurality of initial modulo units according to a preset modulo unit size.
[0078] Please refer to Figure 5 , Figure 5 which is a schematic diagram of the second embodiment of taking modulo of the first image according to a preset modulo unit size provided by the embodiments of the present application. Figure 5 For the convenience of description, each pixel point in the first image 1 is displayed as a square grid. It can be understood that the grid lines will not be displayed when the first image 1 is normally displayed. As Figure 5 shown, when the preset modulo unit size is 4×4, the first image 1 is divided into a plurality of initial modulo units according to the preset modulo unit size, and initial modulo units such as initial modulo unit A4 and initial modulo unit A5 are obtained.
[0079] In some embodiments, when the first image 1 cannot be exactly divided into a plurality of initial modulo units according to the preset modulo unit size, an operation of supplementing blank pixel points is performed on the first image 1 so that the first image 1 can be exactly divided into a plurality of initial modulo units according to the preset modulo unit size.
[0080] Step S220: Select a plurality of final modulo units from the plurality of initial modulo units.
[0081] Among them, the set of pixel points of all the final modulo units includes all the first pixel points. In this way, the second target pattern with the same size as the first target pattern can be completely drawn subsequently.
[0082] In some embodiments, when step S210 includes steps S211 to S212, step S220 includes steps S221 to S223.
[0083] Step S221: Generate a plurality of modulo unit combination schemes based on all the initial modulo units.
[0084] Among them, the set of pixel points of all the initial modulo units in each modulo unit combination scheme includes all the first pixel points.
[0085] In some embodiments, all the modulo unit combination schemes that meet the generation requirements are generated based on all the initial modulo units in an exhaustive manner.
[0086] Optionally, the generation requirement is that each initial modulo unit does not overlap, and the set of pixel points of all the initial modulo units in a modulo unit combination scheme includes all the first pixel points.
[0087] Step S222: From multiple modulo unit combination schemes, select the modulo unit combination scheme with the smallest number of pixels other than the first pixel in the set of pixels of one pixel point as the target modulo unit combination scheme.
[0088] That is to say, in the set of pixels of the target modulo unit combination scheme, the number of pixels other than the first pixel is the smallest among all modulo unit combination schemes. In this way, the pixels other than the first pixel included in the final modulo unit can be minimized, and thus the information unrelated to the first target pattern can be minimized, saving storage space when determining the drawing data based on the modulo unit subsequently.
[0089] Step S223: Determine multiple final modulo units based on the target modulo unit combination scheme.
[0090] Among them, all the initial modulo units included in the target modulo unit combination scheme are the final modulo units, thereby obtaining multiple final modulo units.
[0091] In some other embodiments, when step S210 includes step S213, step S220 includes step S224.
[0092] Step S224: Among all the initial modulo units, delete all the initial modulo units that do not include the first pixel to obtain multiple final modulo units.
[0093] As Figure 5 shown, exemplarily, the initial modulo unit A4 does not include the first pixel, so the initial modulo unit A4 is deleted. The initial modulo unit A5 includes multiple first pixels, so the initial modulo unit A5 is retained.
[0094] After deleting all the initial modulo units that do not include the first pixel, all the retained initial modulo units are the final modulo units. In this way, the pixels other than the first pixel included in the final modulo unit can be minimized, and thus the information unrelated to the first target pattern can be minimized, saving storage space when determining the drawing data based on the modulo unit subsequently.
[0095] In some embodiments, in order to minimize the pixels other than the first pixel included in the modulo unit, the artificial selection method is used to determine each modulo unit. In this way, the flexibility of modulo operation can be improved, further minimizing the pixels other than the first pixel included in the modulo unit, and saving storage space when determining the drawing data based on the modulo unit subsequently.
[0096] In some embodiments, whenever a first selection instruction is received, the first image is modulo-divided according to the first selection instruction by a preset modulo unit size, thereby obtaining a plurality of modulo units.
[0097] In some embodiments, when the first target pattern is the first circular pattern, the first image is modulo-divided in a counterclockwise selection order or a clockwise selection order, thereby obtaining a plurality of modulo units.
[0098] Step S300: Determine a plurality of drawing data based on the plurality of modulo units.
[0099] Wherein, each drawing data includes the modulo values of all the first pixel points for displaying the first target pattern included in a corresponding modulo unit.
[0100] Please refer to Figure 6 , Figure 6 is Figure 1 the detailed flowchart of step S300 in Figure 6 As shown in
[0101] Step S310: Determine the two-dimensional coordinate system in the first image.
[0102] In some embodiments, the two-dimensional coordinate system in the first image is the default image coordinate system.
[0103] Exemplarily, the origin of the default image coordinate system is the upper left corner point of the first image, the X-axis is in the horizontal direction, and the Y-axis is in the vertical direction.
[0104] In some embodiments, the two-dimensional coordinate system in the first image is determined according to the geometric center point of the first target pattern.
[0105] In some embodiments, step S310 includes steps S311 to S312.
[0106] Step S311: Determine the geometric center point of the first target pattern.
[0107] In some embodiments, the geometric center point of the first target pattern is a pixel point in the first image.
[0108] As described above, the first target pattern can be any pattern.
[0109] In some embodiments, the first target pattern is the first circular pattern, and the geometric center point of the first target pattern is the center of the first circular pattern.
[0110] In some embodiments, when the first target pattern is a rectangular pattern, the geometric center point of the first target pattern is the intersection point of the two diagonals of the rectangle; when the first target pattern is a triangular pattern, the geometric center point of the first target pattern is the centroid of the triangle, and so on.
[0111] In some embodiments, the geometric center point of the first target pattern is determined manually. At this time, step S311 includes steps (311.1) to (311.2).
[0112] (311.1) Convert the first image into a table display.
[0113] Wherein, one cell in the table represents one pixel point in the first image.
[0114] In some embodiments, a preset script is used to convert the first image into an Excel table display.
[0115] Optionally, the script can be a python script.
[0116] In some embodiments, the length and width of each cell in the table are adjusted to the same value so that each cell is a square.
[0117] Please refer to Figure 7 , Figure 7 is a schematic diagram of the table obtained by converting the first image into a table display provided by an embodiment of the present application. As Figure 7 shown, one cell in table 2 represents one pixel point in the first image.
[0118] In some embodiments, the first image is converted into an initial table, and then some blank rows and / or columns that are not used to display the first target pattern are deleted to obtain a final table. In this way, it is convenient for the user to perform a selection operation based on the final table.
[0119] (311.2) When the second selection instruction is received, the pixel point corresponding to the selected cell in the table is determined as the geometric center point of the first target pattern according to the second selection instruction.
[0120] Please refer to Figure 8 , Figure 8 is a schematic diagram of determining the geometric center point of the first target pattern and multiple modulo units according to the selection instruction provided by an embodiment of the present application. As Figure 7 and Figure 8 shown, exemplarily, some blank rows and columns in the initial table 2 in Figure 7 that are not used to display the first target pattern are also deleted to obtain Figure 8 the final table 2 in. In this way, it is convenient for the user to perform a selection operation based on the final table.
[0121] As Figure 8 shown, in some embodiments, when the second selection instruction is received, the pixel point corresponding to the selected cell in Table 2 is determined as the geometric center point O of the first target pattern 10 according to the second selection instruction.
[0122] As Figure 8 shown, in some embodiments, the first target pattern 10 is a first circular pattern, and the geometric center point O of the first target pattern 10 is the center of the first circular pattern.
[0123] In some embodiments, when the geometric center point of the first target pattern is not determined manually, steps (311.1) to (311.2) are not executed, but step (311.3) is executed.
[0124] (311.3) Calculate the average coordinate point of all the first pixel points in the default image coordinate system and use it as the geometric center point of the first target pattern.
[0125] In some embodiments, since the first target pattern is displayed by multiple pixel points, the initial coordinate value of the calculated average coordinate point may not be an integer. At this time, the initial coordinate value is rounded to obtain the final coordinate value of the average coordinate point.
[0126] In some embodiments, the initial coordinate value is rounded up or down to obtain the final coordinate value.
[0127] Step S312: Use the geometric center point of the first target pattern as the origin of the two-dimensional coordinate system, and then determine the two-dimensional coordinate system.
[0128] As Figure 8 shown, in some embodiments, the geometric center point O of the first target pattern 10 is used as the origin of the two-dimensional coordinate system, axis X is the first coordinate axis of the two-dimensional coordinate system, axis Y is the second coordinate axis of the two-dimensional coordinate system, and axis X is perpendicular to axis Y.
[0129] In some embodiments, the unit length in the two-dimensional coordinate system is the length of one pixel point.
[0130] As Figure 8 shown, in some embodiments, the axis coordinate scale values of axis X and the axis coordinate scale values of axis Y are also displayed around Table 2. In this way, it is possible to provide a reference for the user to select the modular unit.
[0131] In some embodiments, after step S312, whenever a first selection instruction is received, the first image is modulo-divided according to the first selection instruction and the preset modulo unit size, so as to obtain a plurality of modulo units. Among them, modulo-dividing the table according to the first selection instruction and the preset modulo unit size is equivalent to modulo-dividing the first image.
[0132] Step S320: Determine the coordinates of the calculation points in each modulo unit in the two-dimensional coordinate system and the coordinates of all the first pixel points except the calculation points.
[0133] In some embodiments, the calculation point in each modulo unit is a pixel point at a preset position in the modulo unit. For example, the calculation point in the modulo unit is the upper-left pixel point, the lower-left pixel point, the upper-right pixel point, the lower-right pixel point, or the central pixel point in the modulo unit, etc.
[0134] Optionally, the calculation point is not necessarily a first pixel point.
[0135] As Figure 8 shown, in some embodiments, the calculation point of modulo unit A6 is pixel point 61, and pixel point 61 is not a first pixel point.
[0136] In some embodiments, after determining the coordinates of the calculation points in the modulo unit in the two-dimensional coordinate system, the position of the modulo unit in the two-dimensional coordinate system is determined.
[0137] In some embodiments, the coordinates of the first pixel points except the calculation points are the position coordinates of the first pixel points in the modulo unit.
[0138] In some embodiments, the position coordinates of the first pixel points in the modulo unit are determined by referring to the way of recording matrix coordinates.
[0139] As Figure 8 shown, by way of example, when modulo unit A6 is a 4×4 grid including 16 pixel points, the coordinates of pixel point 61 in the two-dimensional coordinate system are (-8, -3), the position coordinates in modulo unit A6 are (0, 0), the position coordinates of pixel point 62 in modulo unit A6 are (1, 2), the position coordinates of pixel point 63 in modulo unit A6 are (1, 3), and so on. Pixel point 62 and pixel point 63 are both first pixel points.
[0140] In some embodiments, the coordinates of the first pixel points except the calculation points are the position coordinates of the first pixel points in the two-dimensional coordinate system.
[0141] In some embodiments, the coordinates of all the pixel points except the calculation points can also be determined. Among them, it includes determining the coordinates of the pixel points that are not first pixel points, and the method for determining the coordinates refers to the above description.
[0142] As shown Figure 8 exemplarily, the position coordinates of pixel point 64 in modulo unit A6 are (4, 1), and pixel point 64 is not the first pixel point.
[0143] Step S330: Determine the modulo value of each first pixel point based on the pixel value of each first pixel point.
[0144] In some embodiments, the modulo value of the first pixel point is a logical value. At this time, step S330 includes: for each first pixel point, when the pixel value of the first pixel point is within a preset numerical range, store the modulo value of the first pixel point as a first preset numerical value, otherwise store the modulo value of the first pixel point as a second preset numerical value. Wherein, the first preset numerical value indicates that the first pixel point is displayed when drawing the second target pattern, and the first preset numerical value indicates that the first pixel point is not displayed when drawing the second target pattern.
[0145] Exemplarily, when the pixel value of the first pixel point is within [128, 255], store the modulo value of the first pixel point as the first preset numerical value, then store the modulo value of the first pixel point as the second preset numerical value.
[0146] Optionally, the first preset numerical value is 1 and the second preset numerical value is 0.
[0147] Optionally, the first preset numerical value is 0 and the second preset numerical value is 1.
[0148] In some embodiments, the modulo value of the first pixel point is the pixel value. At this time, step S330 includes: determining the pixel value of each first pixel point as the modulo value of each first pixel point.
[0149] In some embodiments, the pixel value of the first pixel point is a gray value, and the gray value of each first pixel point is determined as the modulo value of each first pixel point.
[0150] As described above, in some embodiments, each first pixel point has multiple color channel pixel values. At this time, determine a modulo value based on each color channel pixel value of each first pixel point, and then obtain multiple modulo values. For example, determine the first modulo value based on the red channel pixel value of the first pixel point, determine the second modulo value based on the green channel pixel value, and determine the third modulo value based on the blue channel pixel value.
[0151] In some embodiments, determine the modulo value of all pixel points in each modulo unit based on the pixel values of all pixel points in each modulo unit. Among them, it includes determining the modulo value of pixel points that are not the first pixel point, and the method for determining the modulo value refers to the above description.
[0152] In some embodiments, the modulo value of the pixel points other than the first pixel point is determined as a preset background modulo value.
[0153] Step S340: Based on the coordinates of the calculation points in each modulo unit in the two-dimensional coordinate system, the coordinates of all the first pixel points except the calculation points, and the modulo value of each first pixel point, determine the corresponding rendering data, thereby obtaining a plurality of rendering data.
[0154] Wherein, each rendering data includes the coordinates of the calculation points in the corresponding modulo unit in the two-dimensional coordinate system, the coordinates of all the first pixel points except the calculation points, and the modulo value of each first pixel point.
[0155] In some embodiments, the rendering data further includes the coordinates of all the pixel points except the first pixel points in the modulo unit and the modulo values of all the pixel points except the first pixel points.
[0156] Step S400: Store a plurality of rendering data.
[0157] In some embodiments, the rendering data is stored in the form of an array, and each rendering data is an array.
[0158] In some embodiments, one element in the array corresponds to one pixel point, the position of the element in the array corresponds one-to-one with the position of the pixel point, and the value of the element is the modulo value of the corresponding pixel point.
[0159] Exemplarily, the position coordinates of pixel point 62 in modulo unit A6 are (1, 2), and the position coordinates in the array of the rendering data corresponding to modulo unit A6 are also (1, 2).
[0160] In some embodiments, only the relevant information of all the first pixel points in the corresponding modulo unit is stored in the rendering data, so the array may include empty elements.
[0161] In some embodiments, the relevant information of all the pixel points in the corresponding modulo unit is stored in the rendering data, so the array does not include empty elements.
[0162] In some embodiments, when the preset size of the modulo unit is N×M, and one pixel point corresponds to A modulo values, the rendering data is an array of N×M×A. Wherein, the value of A is greater than 1, for example, A is 1, 2, or 3, etc.
[0163] In some embodiments, other data structures can be used to store the rendering data. For example, the rendering data can be stored in the form of a relational table.
[0164] Step S500: When receiving a pattern drawing instruction, call multiple drawing data, and use a drawing unit equal in size to a preset modulo unit to draw a second target pattern.
[0165] Please refer to Figure 9 , Figure 9 Yes Figure 1 is the detailed flowchart of step S500 in Figure 9 As shown, in some embodiments, step S500 includes steps S510 to S520.
[0166] Step S510: When receiving a pattern drawing instruction, determine the coordinates of a reference point according to the pattern drawing instruction.
[0167] In some embodiments, the reference point is the geometric center point of the second target pattern.
[0168] In some embodiments, the second target pattern is a second circular pattern, and the reference point is the center of the second circular pattern.
[0169] In some embodiments, when the first target pattern is a first circular pattern, the second target pattern is a second circular pattern, and the size of the second circular pattern is equal to the size of the first circular pattern. Optionally, the pixel value of the pixel point used to display the second circular pattern may be the same as or different from the pixel value of the corresponding first pixel point, because in the above step S330, the modulo value of the first pixel point is not necessarily the pixel value of the first pixel point.
[0170] In some embodiments, the first target pattern is a first circular pattern, and the second target pattern is a second circular pattern. The second circular pattern is also the above-mentioned display circular pattern.
[0171] Step S520: Based on the coordinates of the reference point, call multiple drawing data, and use a drawing unit equal in size to a preset modulo unit to draw the second target pattern.
[0172] In some embodiments, take the coordinates of the reference point as the origin of the display coordinate system, and then determine the display coordinate system.
[0173] In some embodiments, when the origin coordinates of the two-dimensional coordinate system are the geometric center point of the first target pattern, and the reference point is the geometric center point of the second target pattern, take the coordinates of the calculation point in the modulo unit corresponding to each drawing data in the two-dimensional coordinate system as the coordinates in the display coordinate system, and then determine the position of the corresponding drawing unit in the display coordinate system. Then, display each first pixel point according to the coordinates of all first pixel points other than the calculation point in the drawing data and the modulo value of each first pixel point, so as to display the corresponding drawing unit. After all drawing units are displayed, the second target pattern is drawn.
[0174] In some embodiments, the modulo value of the first pixel is the pixel value, and when displaying the first pixel, the corresponding modulo value is used to display the first pixel.
[0175] In some embodiments, the first pixel has multiple color channel pixel values. In each color channel, the corresponding modulo value of each color channel of the first pixel is used to display the first pixel, so as to display the first pixel in color.
[0176] In some embodiments, the modulo value of the first pixel is a logical value. When it is determined according to the modulo value of the first pixel that the first pixel needs to be displayed when drawing the second target pattern, the first pixel is displayed as a preset pixel value.
[0177] In some embodiments, when the value of an element in the drawing data is empty, the pixel at the corresponding position of the element is not displayed.
[0178] In some embodiments, when the value of an element in the drawing data is the background modulo value, the pixel at the corresponding position of the element is not displayed.
[0179] In some embodiments, when the origin coordinate of the two-dimensional coordinate system is not the geometric center point of the first target pattern, and the reference point is the geometric center point of the second target pattern, based on the coordinate of the reference point in the default image coordinate system and the coordinate of the origin of the two-dimensional coordinate system in the default image coordinate system, the coordinates in all the drawing data are converted into the coordinates in the display coordinate system. Then, based on the coordinates of the calculation points in the modulo unit corresponding to each drawing data in the display coordinate system, the positions of the corresponding drawing units in the display coordinate system are determined. Then, according to the coordinates of all the first pixels other than the calculation points in the drawing data and the modulo value of each first pixel, each first pixel is displayed, so as to display the corresponding drawing unit. After all the drawing units are displayed, the second target pattern is drawn.
[0180] In some embodiments, converting the coordinates in all the drawing data into the coordinates in the display coordinate system based on the coordinate of the reference point in the default image coordinate system and the coordinate of the origin of the two-dimensional coordinate system in the default image coordinate system includes: subtracting the coordinate of the origin of the two-dimensional coordinate system in the default image coordinate system from the coordinate of the reference point in the default image coordinate system to obtain the first moving vector; adding the first moving vector to all the coordinates in the drawing data, so as to convert the coordinates in all the drawing data into the coordinates in the display coordinate system.
[0181] Please refer to Figure 10 , Figure 10 which is a schematic flowchart of an embodiment of the second pattern drawing method provided by an embodiment of the present application. As Figure 10As shown, in some embodiments, the second pattern drawing method includes steps S600 to S700.
[0182] Step S600: Receive and store multiple drawing data sent by an electronic device.
[0183] Among them, the multiple drawing data are obtained by the electronic device taking molds of a first image including a first target pattern in sequence according to a preset mold-taking unit size. The electronic device here is the above-mentioned host computer. The method for the host computer to determine and store the multiple drawing data refers to the content of steps S100 to S400.
[0184] Step S700: When receiving a pattern drawing instruction, call the multiple drawing data and draw a second target pattern using a drawing unit equal to the preset mold-taking unit size.
[0185] The content of step S700 refers to the content of step S500.
[0186] Please refer to Figure 11 , Figure 11 which is a schematic flowchart of an embodiment of the third pattern drawing method provided by an embodiment of the present application. As Figure 11 shown, in some embodiments, the third pattern drawing method includes steps S801 to S804.
[0187] Step S801: Draw a first image including a first target pattern.
[0188] In some embodiments, when the first target pattern is a first circular pattern, the electronic device draws a first image including the first target pattern according to the obtained center coordinates and radius of the first circular pattern.
[0189] Optionally, the electronic device performs anti-aliasing processing on the first target pattern when drawing the first image to improve the display effect of the first target pattern.
[0190] Step S802: Take molds of the first image in sequence according to a preset mold-taking unit size to obtain multiple mold-taking units.
[0191] The content of step S802 refers to the content of step S200.
[0192] Step S803: Determine multiple drawing data based on the multiple mold-taking units.
[0193] Among them, each drawing data includes the mold-taking values of all first pixel points for displaying the first target pattern included in a corresponding mold-taking unit.
[0194] The content of step S803 refers to the content of step S300.
[0195] Step S804: Store multiple drawing data in a display device.
[0196] Refer to the content of Step S400 for the content of Step S804.
[0197] Please refer to Figure 12 , Figure 12 which is a schematic flowchart of an implementation manner of a fourth pattern drawing method provided by an embodiment of the present application. As Figure 12 shown, in some implementation manners, the fourth pattern drawing method includes: Step S901 to Step S908.
[0198] Step S901: An upper computer draws a first image including a first target pattern.
[0199] Refer to the content of Step S100 for the content of Step S901.
[0200] Step S902: The upper computer converts the first image into a table display.
[0201] Refer to the content of Step (311.1) for the content of Step S902.
[0202] Step S903: When receiving a second selection instruction, the upper computer determines, according to the second selection instruction, the pixel point corresponding to a selected cell in the table as the geometric center point of the first target pattern.
[0203] Refer to the content of Step (311.2) for the content of Step S903.
[0204] Step S904: The upper computer uses the geometric center point of the first target pattern as the origin of a two-dimensional coordinate system, and then determines the two-dimensional coordinate system.
[0205] Refer to the content of Step S312 for the content of Step S904.
[0206] Step S905: Whenever receiving a first selection instruction, the upper computer performs modulo operation on the first image according to the first selection instruction in accordance with a preset modulo unit size, so as to obtain a plurality of modulo units.
[0207] In some implementation manners, the upper computer performs modulo operation on the table according to the first selection instruction in accordance with a preset modulo unit size, which is equivalent to performing modulo operation on the first image.
[0208] As Figure 8 shown, exemplarily, the table 2 is subjected to modulo operation by using a manual selection method, so as to obtain a plurality of modulo units. By this means, the flexibility of modulo operation can be improved, and the modulo units can include as few pixel points other than the first pixel points as possible.
[0209] Step S906: The upper computer determines a plurality of drawing data based on the plurality of modulo units.
[0210] The content of step S906 refers to the content of step S300.
[0211] Step S907: The host computer stores multiple drawing data in the display device.
[0212] The content of step S907 refers to the content of step S400.
[0213] Step S908: When receiving a pattern drawing instruction, the display device calls multiple drawing data and uses a drawing unit equal to the size of the preset modulo unit to draw the second target pattern.
[0214] The content of step S908 refers to the content of step S500.
[0215] In summary, the pattern drawing method provided by the embodiments of the present application has the following advantages:
[0216] 1. By performing modulo operation on the first image according to the size of the preset modulo unit, multiple modulo units are obtained, and the coordinates and modulo values of all first pixel points for displaying the standard circle in each modulo unit are stored. When drawing a circle, complex calculations are not required, but the circle can be directly drawn according to the coordinates and modulo values of all first pixel points in each stored modulo unit, thereby reducing the calculation amount and improving the circle drawing speed. In addition, when the first target pattern is the first circular pattern, when using an embedded chip to draw a circle, generally no anti-aliasing processing is performed on the displayed circular pattern, and the sawtooth of the displayed circular pattern is obvious and the effect is poor. When the displayed circular pattern is drawn by a display device including an embedded chip, when the host computer has performed anti-aliasing processing on the first circular pattern, the effect of the displayed circular pattern can also be better.
[0217] 2. It can make the size of the preset modulo unit the smallest under the limitation of the processing performance of the chip, so as to perform as fine a modulo operation on the first image as possible according to the size of the preset modulo unit, so that the modulo unit contains as few pixel points that are not first pixel points as possible, thereby saving storage space.
[0218] 3. By selecting a modulo unit combination scheme with the smallest number of pixel points that are not first pixel points included in the set of a pixel point as the target modulo unit combination scheme, the final modulo unit can include as few pixel points that are not first pixel points as possible, that is, as little information unrelated to the first target pattern as possible, and storage space can be saved when determining the drawing data based on the modulo unit subsequently.
[0219] 4. By using the method of manual selection to determine each modulo unit, the flexibility of modulo operation can be improved, and further the modulo unit can include as few pixel points that are not first pixel points as possible, and storage space can be saved when determining the drawing data based on the modulo unit subsequently.
[0220] Please refer to Figure 13 , Figure 13 which is a schematic structural diagram of a pattern drawing device provided by an embodiment of the present application. As Figure 13 shown, the pattern drawing device 300 includes an acquisition module 310 and a processing module 320.
[0221] In some embodiments, the acquisition module 310 is configured to acquire a first image including a first target pattern drawn by a host computer.
[0222] In some embodiments, the processing module 320 is configured to perform modulo operations on the first image in sequence according to a preset modulo unit size to obtain a plurality of modulo units; determine a plurality of drawing data based on the plurality of modulo units, where each drawing data includes the modulo values of all first pixel points included in a corresponding modulo unit for displaying the first target pattern; store the plurality of drawing data; when receiving a pattern drawing instruction, call the plurality of drawing data, and draw a second target pattern using a drawing unit equal in size to the preset modulo unit size.
[0223] Please refer to Figure 14 , Figure 14 which is a schematic structural diagram of a chip provided by an embodiment of the present application. As Figure 14 shown, the chip 400 includes: one or more processors 410 and a memory 420, Figure 14 where one processor 410 is taken as an example in
[0224] In some embodiments, the processor 410 and the memory 420 may be connected by a bus or other means, Figure 14 where connection by a bus is taken as an example in
[0225] In some embodiments, the processor 410 is configured to acquire a first image including a first target pattern drawn by a host computer; perform modulo operations on the first image in sequence according to a preset modulo unit size to obtain a plurality of modulo units; determine a plurality of drawing data based on the plurality of modulo units, where each drawing data includes the modulo values of all first pixel points included in a corresponding modulo unit for displaying the first target pattern; store the plurality of drawing data; when receiving a pattern drawing instruction, call the plurality of drawing data, and draw a second target pattern using a drawing unit equal in size to the preset modulo unit size.
[0226] In some embodiments, the processor 410 is configured to receive and store a plurality of drawing data sent by an electronic device, where the plurality of drawing data is obtained by the electronic device performing modulo operations on a first image including a first target pattern in sequence according to a preset modulo unit size; when receiving a pattern drawing instruction, call the plurality of drawing data, and draw a second target pattern using a drawing unit equal in size to the preset modulo unit size.
[0227] In some embodiments, the memory 420, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions / modules of the pattern drawing method in the embodiments of the present application. The processor 410 executes various functional applications and data processing of the chip 400 by running the non-volatile software programs, instructions, and modules stored in the memory 420, that is, implements the first pattern drawing method or the second pattern drawing method in the above method embodiments.
[0228] In some embodiments, the memory 420 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the chip 400, etc. In addition, the memory 420 may include a high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 420 may optionally include a memory remotely set relative to the processor 410, and these remote memories can be connected to the controller through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0229] In some embodiments, one or more modules are stored in the memory 420, and when executed by one or more processors 410, they execute the first pattern drawing method or the second pattern drawing method in any of the above method embodiments. For example, they execute the Figure 1 method steps S100 to S500 described above or Figure 10 the method steps S600 to S700 in
[0230] In some embodiments, the chip 400 can be an embedded chip.
[0231] In some embodiments, the embodiments of the present application further provide a display device, including the chip as described above and a display module, and the chip is used to draw a second target pattern in the display module.
[0232] Please refer to Figure 15 Figure 15 which is a structural block diagram of a computer-readable storage medium provided by the embodiments of the present application. Program code 510 is stored in the computer-readable storage medium 500, and the program code 510 can be called by a processor to execute the first pattern drawing method or the second pattern drawing method described in the above method embodiments.
[0233] The computer-readable storage medium 500 may be an electronic memory such as a flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium includes a non-transitory computer-readable storage medium. The computer-readable storage medium 500 has a storage space for program codes that execute any of the method steps in the above pattern drawing method. These program codes may be read from or written to one or more computer program products. The program codes may be compressed in a suitable form, for example.
[0234] In some embodiments, the embodiments of the present application further provide an electronic device, including: one or more processors and a memory.
[0235] In some embodiments, the processor and the memory may be connected by a bus or other means, for example, connected by a bus.
[0236] In some embodiments, the processor is used to draw a first image including a first target pattern; perform modulo operations on the first image in sequence according to a preset modulo unit size to obtain a plurality of modulo units; determine a plurality of drawing data based on the plurality of modulo units, where each drawing data includes the modulo values of all first pixel points for displaying the first target pattern included in a corresponding modulo unit; and store the plurality of drawing data in a display device.
[0237] In some embodiments, the memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules of the pattern drawing method in the embodiments of the present application. The processor executes various functional applications and data processing of the electronic device by running the non-transitory software programs, instructions, and modules stored in the memory, that is, implements the third pattern drawing method in the above method embodiments.
[0238] In some embodiments, one or more modules are stored in the memory and, when executed by one or more processors, execute the third pattern drawing method in any of the above method embodiments. For example, execute the method steps S801 to S804 described above. Figure 11 in
[0239] In some embodiments, the embodiments of the present application further provide a computer program product, including a computer program that, when executed by a processor, implements the above pattern drawing method.
[0240] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium 500. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the various embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include Read-Only Memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the various embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the various embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., and are not limited thereto.
[0241] In summary, the present application provides a pattern drawing method, a chip, an electronic device, and a storage medium. The pattern drawing method includes: obtaining a first image including a first target pattern drawn by a host computer; performing modulo operation on the first image in sequence according to a preset modulo unit size to obtain a plurality of modulo units; determining a plurality of drawing data based on the plurality of modulo units, where each drawing data includes the modulo values of all first pixel points for displaying the first target pattern included in a corresponding modulo unit; storing the plurality of drawing data; and when receiving a pattern drawing instruction, calling the plurality of drawing data and using a drawing unit equal in size to the preset modulo unit size to draw a second target pattern. By calling the plurality of drawing data and using a drawing unit equal in size to the preset modulo unit size to draw the second target pattern when receiving the pattern drawing instruction, the present application can directly draw according to each stored drawing data without complex calculations when drawing the second target pattern, thereby reducing the amount of calculation and improving the speed of drawing the pattern.
[0242] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements on some of the technical features. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A pattern drawing method, characterized in that, Including: Obtain a first image including a first target pattern drawn by a host computer; Perform modulo operations on the first image in sequence according to a preset modulo unit size to obtain a plurality of modulo units; Determine a plurality of drawing data based on the plurality of modulo units, where each piece of drawing data includes the modulo values of all first pixel points for displaying the first target pattern included in a corresponding modulo unit; Store the plurality of drawing data; When receiving a pattern drawing instruction, call the plurality of drawing data and use a drawing unit equal in size to the preset modulo unit size to draw a second target pattern.
2. The pattern drawing method according to claim 1, wherein The performing modulo operations on the first image in sequence according to a preset modulo unit size to obtain a plurality of modulo units includes: Perform modulo operations on the first image according to the preset modulo unit size to obtain a plurality of initial modulo units; Select a plurality of final modulo units from the plurality of initial modulo units, where the set of pixel points of all the final modulo units includes all the first pixel points.
3. The pattern drawing method according to claim 2, characterized in that, The performing modulo operations on the first image according to the preset modulo unit size to obtain a plurality of initial modulo units includes: Construct a sliding window according to the preset modulo unit size; Move the sliding window multiple times starting from a preset initial position according to a preset rule, and perform a modulo operation on the first image once after each movement of the sliding window to obtain one of the initial modulo units, thereby obtaining a plurality of the initial modulo units; The selecting a plurality of final modulo units from the plurality of initial modulo units includes: Generate a plurality of modulo unit combination schemes based on all the initial modulo units, where the set of pixel points of all the initial modulo units in each modulo unit combination scheme includes all the first pixel points; Select, from the plurality of modulo unit combination schemes, a modulo unit combination scheme with the least number of pixel points that are not the first pixel points in the set of pixel points as the target modulo unit combination scheme; Determine the plurality of final modulo units based on the target modulo unit combination scheme.
4. The pattern drawing method according to claim 2, wherein, The performing modulo operations on the first image according to the preset modulo unit size to obtain a plurality of initial modulo units includes: Divide the first image into a plurality of the initial modulo units according to the preset modulo unit size; The selecting a plurality of final modulo units from the plurality of initial modulo units includes: In all the initial modulo units, delete all the initial modulo units that do not include the first pixel points to obtain the plurality of final modulo units.
5. The pattern drawing method according to any one of claims 1-4, characterized in that, The determining a plurality of drawing data based on the plurality of modulo units includes: Determine the two-dimensional coordinate system in the first image; Determine the coordinates of the calculation points in each modulo unit in the two-dimensional coordinate system and the coordinates of all the first pixel points except the calculation points; Determine the modulo value of each first pixel point based on the pixel value of each first pixel point; Determine the corresponding rendering data based on the coordinates of the calculation points in each of the modulo units in the two-dimensional coordinate system, the coordinates of all the first pixel points except the calculation points, and the modulo values of each of the first pixel points, so as to obtain the multiple rendering data.
6. The pattern drawing method according to claim 5, characterized in that The determining of the two-dimensional coordinate system in the first image includes: Determine the geometric center point of the first target pattern; Use the geometric center point of the first target pattern as the origin of the two-dimensional coordinate system, and then determine the two-dimensional coordinate system.
7. The pattern drawing method according to claim 6, wherein The determining of the geometric center point of the first target pattern includes: Convert the first image into a table display, where one cell in the table represents one pixel point in the first image; When receiving a second selection instruction, determine the pixel point corresponding to the cell selected in the table according to the second selection instruction as the geometric center point of the first target pattern.
8. The pattern drawing method according to claim 5, characterized in that The determining of the modulo value of each of the first pixel points based on the pixel value of each of the first pixel points includes: For each of the first pixel points, when the pixel value of the first pixel point is within a preset numerical range, store the modulo value of the first pixel point as a first preset numerical value, otherwise store the modulo value of the first pixel point as a second preset numerical value. The first preset numerical value indicates that the first pixel point is displayed when rendering the second target pattern, and the second preset numerical value indicates that the first pixel point is not displayed when rendering the second target pattern.
9. The pattern drawing method according to claim 5, wherein The determining of the modulo value of each of the first pixel points based on the pixel value of each of the first pixel points includes: Determine the pixel value of each of the first pixel points as the modulo value of each of the first pixel points.
10. The pattern drawing method according to claim 1, wherein, The step of, when receiving a pattern rendering instruction, calling the multiple rendering data and using a rendering unit equal in size to the preset modulo unit to render the second target pattern includes: When receiving a pattern rendering instruction, determine the coordinates of a reference point according to the pattern rendering instruction; Call the multiple rendering data based on the coordinates of the reference point, and use a rendering unit equal in size to the preset modulo unit to render the second target pattern.
11. The pattern rendering method according to claim 10, wherein The reference point is the geometric center point of the second target pattern.
12. The pattern rendering method according to claim 11, wherein The second target pattern is a second circular pattern, and the reference point is the center of the second circular pattern.
13. A pattern drawing method, characterized in that, It includes: Receive and store multiple rendering data sent by an electronic device, wherein the multiple rendering data are obtained by the electronic device performing modulo operations on a first image including a first target pattern in sequence according to a preset modulo unit size; When receiving a pattern rendering instruction, call the multiple rendering data and use a rendering unit equal in size to the preset modulo unit to render the second target pattern.
14. A chip, characterized in that, The chip includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the pattern drawing method according to any one of claims 1 to 12 or claim 13.
15. A display device, characterized in that, Including a chip and a display module according to claim 14, the chip is used to draw a second target pattern in the display module.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an executable program, and the executable program is executed by a processor to implement the pattern drawing method according to any one of claims 1 to 12 or claim 13.
17. A pattern drawing method, characterized in that, Including: Drawing a first image including a first target pattern; Performing modulo operation on the first image in sequence according to a preset modulo unit size to obtain a plurality of modulo units; Determining a plurality of drawing data based on the plurality of modulo units, each piece of the drawing data including the modulo values of all first pixel points included in a corresponding modulo unit for displaying the first target pattern; Storing the plurality of drawing data in a display device.
18. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the pattern drawing method according to claim 17.