Drawing method and device of mirror image elements in canvas, electronic equipment and storage medium
By extracting data from the graphics library of the source element and determining the coordinates and rotation angle according to the mirror type, the mirror element is drawn directly in the canvas, which solves the problems of low drawing efficiency of mirror elements and asynchronous data in the existing technology, and achieves efficient Mirror element drawing and data consistency.
Patent Information
- Application Number
- CN202410821104.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-01
AI Technical Summary
The existing technology is inefficient in the drawing process of mirror elements in the canvas and can easily lead to data out-of-synchronization problems.
Extract graphic data from the graphics library of the source element, determine the coordinates and rotation angle of the mirror element based on the mirror type and graphic data, and draw the mirror element directly in the canvas to avoid generating additional data.
It improves the drawing efficiency of mirror elements, ensures data consistency, and avoids operational errors caused by data out-of-synchronization.
Smart Images

Figure CN118736044A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of label printing, and in particular to a method, device, electronic device and storage medium for drawing mirror elements in a canvas. Background Art
[0002] In the label printing industry, when editing print content, it is often necessary to mirror elements in the canvas. Due to business background requirements, the drawing of mirrored elements is usually troublesome and requires additional data generation to mirror the elements.
[0003] Furthermore, when modifying the source element, the mirrored element needs to be modified at the same time. The existing drawing method has a relatively low drawing efficiency and may cause data asynchrony. Summary of the invention
[0004] In view of this, it is necessary to provide a method, device, electronic device and storage medium for drawing mirror elements in a canvas, so as to solve the problems of low performance and data asynchrony when redrawing existing mirror elements in a canvas.
[0005] In order to solve the above problem, the present invention provides a method for drawing a mirror element in a canvas, comprising: When performing a mirroring operation on a source element, extracting corresponding graphic data from a graphic library of the source element; Determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data; Based on the coordinates and the rotation angle, the mirror element is drawn in the canvas.
[0006] In a possible implementation, when performing the mirroring operation on the source element, before extracting the corresponding graphic data from the graphic library of the source element, the process further includes: When performing a target operation on the source element, cache the graphic data corresponding to the source element in the graphic library; The target operation includes any of the following: Generate, move, rotate or resize.
[0007] In a possible implementation, the graphic data includes: The source element's x-coordinate, the source element's y-coordinate, the source element's width, and the source element's width.
[0008] In a possible implementation, determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data includes: When the mirroring type is mirroring at the center of the canvas, the rotation angle is determined to be 180 degrees; Determine the x-coordinate of the mirrored element based on the canvas width, the x-coordinate of the source element, and the width of the source element; Determines the y coordinate of the mirrored element based on the canvas height, the source element's y coordinate, and the source element's height.
[0009] In a possible implementation, determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data includes: When the mirroring type is mirroring with the perpendicular line in the canvas, the rotation angle is determined to be 180 degrees; Determine the x-coordinate of the mirrored element based on the canvas width, the x-coordinate of the source element, and the width of the source element; Determines the y coordinate of the mirrored element based on the y coordinate of the source element.
[0010] In a possible implementation, determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data includes: When the mirroring type is mirroring along the horizontal midline of the canvas, the rotation angle is determined to be 180 degrees; Based on the x-coordinate of the source element, determine the x-coordinate of the mirrored element; Determines the y coordinate of the mirrored element based on the canvas height, the source element's y coordinate, and the source element's height.
[0011] The present invention also provides a device for drawing mirror elements in a canvas, comprising: An extraction module, used for extracting corresponding graphic data from a graphic library of the source element when performing a mirroring operation on the source element; A determination module, used to determine the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data; A drawing module is used to draw the mirror element in a canvas based on the coordinates and the rotation angle.
[0012] On the other hand, the present invention also provides an electronic device, including a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the method for drawing a mirror element in a canvas described in any of the above implementations.
[0013] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for drawing a mirror element in a canvas described in any of the above implementations is implemented.
[0014] On the other hand, the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the method for drawing a mirror element in a canvas as described in any of the above implementations.
[0015] The beneficial effect of the present invention is as follows: the method for drawing a mirror element in a canvas provided by the present invention extracts corresponding graphic data from a graphic library of the source element when a mirror operation is performed on the source element, and determines the coordinates and rotation angle of the mirror element according to the mirror type and the graphic data, thereby drawing the mirror element in the canvas according to the coordinates and rotation angle. By using only the source element without generating additional data, the source element is mirrored, that is, only the graphic data of the source element is drawn in the canvas with different coordinates and rotation angles, thereby improving the drawing efficiency and ensuring the consistency of the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 One of the method flow charts of an embodiment of the method for drawing a mirror element in a canvas provided by the present invention; Figure 2 A second method flow chart of an embodiment of a method for drawing a mirror element in a canvas provided by the present invention; Figure 3 A schematic structural diagram of an embodiment of a device for drawing a mirror image element in a canvas provided by the present invention; Figure 4 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. 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 are within the scope of protection of the present invention.
[0019] In the description of the embodiments of the present invention, unless otherwise specified, "multiple" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone.
[0020] The descriptions of "first", "second", etc. involved in the embodiments of the present invention are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0021] Figure 1 One of the method flow charts of an embodiment of the method for drawing a mirror element in a canvas provided by the present invention is as follows: Figure 1 As shown, the drawing method of the mirror element in the canvas includes: S101, when performing a mirroring operation on a source element, extracting corresponding graphic data from a graphic library of the source element; S102, determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data; S103: Draw the mirror element on a canvas based on the coordinates and the rotation angle.
[0022] It should be noted that the source element and the mirror element refer to the two objects involved in the mirror transformation operation. The source element is the original graphic or object, whose coordinates and size have been determined on the canvas; the mirror element is the new graphic or object obtained by mirroring the source element, and its position, size and rotation angle are usually adjusted according to specific mirroring rules.
[0023] Compared with the prior art, the method for drawing a mirror element in a canvas provided by an embodiment of the present invention extracts corresponding graphic data from the graphic library of the source element when a mirror operation is performed on the source element, and determines the coordinates and rotation angle of the mirror element according to the mirror type and the graphic data, thereby drawing the mirror element in the canvas according to the coordinates and rotation angle. By mirroring the source element using only the source element without generating additional data, that is, only the graphic data of the source element is drawn in the canvas with different coordinates and rotation angles, the drawing efficiency is improved and the consistency of the data is ensured.
[0024] In some embodiments of the present invention, when performing the mirroring operation on the source element, before extracting the corresponding graphic data from the graphic library of the source element, the method further includes: When performing a target operation on the source element, cache the graphic data corresponding to the source element in the graphic library; The target operation includes any of the following: Generate, move, rotate or resize.
[0025] Before performing the mirroring operation on the source element, in order to ensure the validity of the operation and data consistency, when performing any target operation on the source element, the graphic data corresponding to the source element needs to be cached in the graphic library.
[0026] In some embodiments of the present invention, the graphic data includes: The source element's x-coordinate, the source element's y-coordinate, the source element's width, and the source element's width.
[0027] Optionally, the graphic data may also include position information, size information, color information, shape information, border information, shadow information, gradient information, and the like.
[0028] Among them, the position information includes the coordinate position of each element on the canvas, usually including the x and y coordinate values of the upper left corner; the size information includes the width and height of the element, which is used to determine the size and shape of the element; the color information includes the color data of the element, which can be a color value in RGB or RGBA format, which is used to define the fill color, border color, etc. of the element; the shape information includes the shape type of the element, such as rectangle, circle, ellipse, polygon, etc., which is used to determine the appearance shape of the element; the border information includes the border attributes of the element, including border width, border style (solid line, dotted line, etc.) and border color, etc.; the shadow information includes the shadow attributes of the element, including the offset, blur, color, etc. of the shadow, which is used to add a shadow effect; the gradient information includes the gradient attributes of the element, including the gradient type (linear gradient, radial gradient, etc.), gradient direction, gradient color, etc., which is used to define the gradient fill effect of the element.
[0029] Target operations include any of the following: generate, move, rotate, or resize.
[0030] The generation operation includes: creating a new source element; the movement operation includes: changing the position of the source element; the rotation operation includes: rotating the source element around a certain point or axis; the resizing operation includes: changing the size of the source element.
[0031] Therefore, when performing a mirroring operation, the graphic data of the source element can be extracted from the graphic library to ensure that the data used for the mirroring operation is the latest data after the target operation. This ensures data consistency and operation continuity, and can avoid operation errors caused by data asynchrony.
[0032] The method for drawing mirror elements in a canvas provided by an embodiment of the present invention can ensure that the data used for the mirror operation is the latest data by caching the graphic data corresponding to the source element in the graphic library when performing a target operation on the source element, thereby ensuring data consistency and operation continuity, and avoiding operation errors caused by data asynchrony.
[0033] In some embodiments of the present invention, determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data includes: When the mirroring type is mirroring at the center of the canvas, the rotation angle is determined to be 180 degrees; Determine the x-coordinate of the mirrored element based on the canvas width, the x-coordinate of the source element, and the width of the source element; Determines the y coordinate of the mirrored element based on the canvas height, the source element's y coordinate, and the source element's height.
[0034] When mirroring with the center of the canvas, in this case, the mirrored element will be rotated 180 degrees around the center point of the canvas, and its coordinates and rotation angle need to be recalculated.
[0035] Rotation Angle: The mirrored element is rotated 180 degrees relative to the source element.
[0036] Coordinates of mirrored elements: The x coordinate of the mirrored element = canvas width - x coordinate of the source element - width of the source element; The y coordinate of the mirrored element = canvas height - y coordinate of the source element - height of the source element.
[0037] In some embodiments of the present invention, determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data includes: When the mirroring type is mirroring with the perpendicular line in the canvas, the rotation angle is determined to be 180 degrees; Determine the x-coordinate of the mirrored element based on the canvas width, the x-coordinate of the source element, and the width of the source element; Determines the y coordinate of the mirrored element based on the y coordinate of the source element.
[0038] When mirroring about the vertical midline of the canvas, in this case, the mirrored element will be mirrored around the vertical midline of the canvas, its x coordinate will change, and its y coordinate will remain unchanged.
[0039] Rotation Angle: The mirrored element is rotated 180 degrees relative to the source element.
[0040] Coordinates of mirrored elements: The x coordinate of the mirrored element = canvas width - x coordinate of the source element - width of the source element; The y coordinate of the mirrored element = the y coordinate of the source element (remains unchanged).
[0041] In some embodiments of the present invention, determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data includes: When the mirroring type is mirroring along the horizontal midline of the canvas, the rotation angle is determined to be 180 degrees; Based on the x-coordinate of the source element, determine the x-coordinate of the mirrored element; Determines the y coordinate of the mirrored element based on the canvas height, the source element's y coordinate, and the source element's height.
[0042] When mirroring the horizontal center line of the canvas, in this case, the mirrored element will be mirrored around the horizontal center line of the canvas, its y coordinate will change, and the x coordinate will remain unchanged.
[0043] Rotation Angle: The mirrored element is rotated 180 degrees relative to the source element.
[0044] Coordinates of mirrored elements: The x coordinate of the mirrored element = the x coordinate of the source element (remains unchanged); The y coordinate of the mirrored element = canvas height - y coordinate of the source element - height of the source element.
[0045] The method for drawing a mirror element in a canvas provided by an embodiment of the present invention mirrors the source element by using only the source element without generating additional data, that is, only the graphic data of the source element is drawn in the canvas with different coordinates and rotation angles, thereby improving the drawing efficiency and ensuring the consistency of the data.
[0046] Figure 2 The second method flow chart of an embodiment of the method for drawing a mirror element in a canvas provided by the present invention is as follows: Figure 2 As shown, the drawing method of the mirror element in the canvas includes: Step 1: When generating elements, cache element graphic data.
[0047] When an element is generated, the element's graphic data (including coordinates, shape, color and other information) is cached for use in subsequent mirroring operations.
[0048] Step 2: During the mirroring operation, extract the graphic data of the element.
[0049] When a mirroring operation is required, the graphic data of the element is extracted from the cache, including coordinate information, shape, etc.
[0050] Step 3: Recalculate the coordinates and rotation angle of the mirror element based on the mirror type and coordinate points.
[0051] Depending on the type of mirroring (horizontal or vertical) and the coordinate points of the mirroring, the coordinates of the mirrored elements and the possible rotation angles are recalculated. For horizontal mirroring, a simple coordinate transformation can be performed with a fixed axis; for vertical mirroring, a coordinate transformation around a specific axis is required.
[0052] Exemplarily, the following three methods may be included: (1) Mirror the image with the center of the canvas. The mirror element is rotated 180° with the source element. The x coordinate = canvas width - x coordinate of the source element - width of the source element. The y coordinate = canvas height - y coordinate of the source element - height of the source element. (2) Mirror the image along the perpendicular line in the canvas. The mirrored element rotates 180°, the y coordinate remains unchanged, and the x coordinate = canvas width - source element x coordinate - source element width; (3) If the image is mirrored along the horizontal center line of the canvas, the mirrored element will rotate 180°, the x-coordinate will remain unchanged, and the y-coordinate = canvas height - source element y-coordinate - source element height.
[0053] Step 4: Draw the mirrored element onto the canvas with the calculated coordinates and angles.
[0054] According to the calculated coordinates and rotation angle of the mirrored element, the mirrored element is drawn on the canvas. This realizes the drawing of the mirrored element and greatly improves the drawing efficiency of the mirrored element, because it is no longer necessary to recalculate all the graphic data of the element, and only the mirroring operation can be performed based on the cached data.
[0055] The method for drawing mirror elements in a canvas provided by an embodiment of the present invention meets the business needs of mirror elements, and also greatly improves the drawing efficiency of mirror elements, solves related problems such as redrawing of mirror elements in the canvas, low performance and data asynchrony, and after the optimization processing of this embodiment, the generation and drawing efficiency of mirror elements is greatly improved.
[0056] In order to better implement the method for drawing a mirror image element in a canvas in an embodiment of the present invention, based on the method for drawing a mirror image element in a canvas, an embodiment of the present invention further provides a device for drawing a mirror image element in a canvas. Figure 3 A schematic diagram of the structure of an embodiment of a device for drawing mirror elements in a canvas provided by the present invention is shown in FIG. Figure 3 As shown, the drawing device 300 of the mirror element in the canvas includes: An extraction module 310 is used to extract corresponding graphic data from a graphic library of the source element when performing a mirroring operation on the source element; A determination module 320, for determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data; The drawing module 330 is used to draw the mirror element in a canvas based on the coordinates and the rotation angle.
[0057] The device 300 for drawing mirror elements in a canvas provided in the above embodiment can implement the technical solution described in the above embodiment of the method for drawing mirror elements in a canvas. The specific implementation principles of the above modules or units can refer to the corresponding contents in the embodiment of the method for drawing mirror elements in a canvas, which will not be repeated here.
[0058] Optionally, it also includes: A cache module, used for caching the graphic data corresponding to the source element into the graphic library when performing a target operation on the source element; The target operation includes any of the following: Generate, move, rotate or resize.
[0059] Optionally, the graphic data includes: The source element's x-coordinate, the source element's y-coordinate, the source element's width, and the source element's width.
[0060] Optionally, the determining module 320 is specifically configured to: When the mirroring type is mirroring at the center of the canvas, the rotation angle is determined to be 180 degrees; Determine the x-coordinate of the mirrored element based on the canvas width, the x-coordinate of the source element, and the width of the source element; Determines the y coordinate of the mirrored element based on the canvas height, the source element's y coordinate, and the source element's height.
[0061] Optionally, the determining module 320 is specifically configured to: When the mirroring type is mirroring with the perpendicular line in the canvas, the rotation angle is determined to be 180 degrees; Determine the x-coordinate of the mirrored element based on the canvas width, the x-coordinate of the source element, and the width of the source element; Determines the y coordinate of the mirrored element based on the y coordinate of the source element.
[0062] Optionally, the determining module 320 is specifically configured to: When the mirroring type is mirroring along the horizontal midline of the canvas, the rotation angle is determined to be 180 degrees; Based on the x-coordinate of the source element, determine the x-coordinate of the mirrored element; Determines the y coordinate of the mirrored element based on the canvas height, the source element's y coordinate, and the source element's height.
[0063] like Figure 4 As shown, the present invention also provides an electronic device 400. The electronic device 400 includes a processor 401, a memory 402 and a display 403. Figure 4 Only some components of the electronic device 400 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0064] In some embodiments, the processor 401 may be a central processing unit (CPU), a microprocessor or other data processing chip, which is used to run the program code or process data stored in the memory 402, such as the method for drawing mirror elements in the canvas of the present invention.
[0065] In some embodiments, processor 401 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, processor 401 may be local or remote. In some embodiments, processor 401 may be implemented in a cloud platform. In some embodiments, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-cloud, etc., or any combination thereof.
[0066] In some embodiments, the memory 402 may be an internal storage unit of the electronic device 400, such as a hard disk or memory of the electronic device 400. In other embodiments, the memory 402 may also be an external storage device of the electronic device 400, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the electronic device 400.
[0067] Furthermore, the memory 402 may include both an internal storage unit of the electronic device 400 and an external storage device. The memory 402 is used to store application software installed in the electronic device 400 and various data.
[0068] In some embodiments, the display 403 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an organic light-emitting diode (OLED) touch device, etc. The display 403 is used to display information on the electronic device 400 and to display a visual user interface. The components 401-403 of the electronic device 400 communicate with each other via a system bus.
[0069] In one embodiment, when the processor 401 executes the drawing program of the mirror element in the canvas in the memory 402, the following steps may be implemented: When performing a mirroring operation on a source element, extracting corresponding graphic data from a graphic library of the source element; Determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data; Based on the coordinates and the rotation angle, the mirror element is drawn in the canvas.
[0070] It should be understood that: when the processor 401 executes the drawing program of the mirror element in the canvas in the memory 402, in addition to the above functions, other functions can also be implemented. For details, please refer to the description of the corresponding method embodiment above.
[0071] Furthermore, the embodiment of the present invention does not specifically limit the type of the electronic device 400 mentioned, and the electronic device 400 may be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer, etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with IOS, Android, Microsoft or other operating systems. The above-mentioned portable electronic device may also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, the electronic device 400 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0072] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the steps or functions of the method for drawing a mirror element in a canvas provided in the above-mentioned method embodiments.
[0073] Accordingly, an embodiment of the present application also provides a computer-readable storage medium, which is used to store computer-readable programs or instructions. When the program or instructions are executed by a processor, the steps or functions of the method for drawing a mirror element in a canvas provided in the above-mentioned method embodiments can be implemented.
[0074] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0075] The above is a detailed introduction to the method, device, electronic device and storage medium for drawing mirror elements in the canvas provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for drawing a mirror element in a canvas, characterized in that: include: When performing a mirroring operation on a source element, extracting corresponding graphic data from a graphic library of the source element; Determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data; Based on the coordinates and the rotation angle, the mirror element is drawn in the canvas.
2. The method for drawing a mirror element in a canvas according to claim 1, characterized in that: When performing the mirroring operation on the source element, before extracting the corresponding graphic data from the graphic library of the source element, the method further includes: When performing a target operation on the source element, cache the graphic data corresponding to the source element in the graphic library; The target operation includes any of the following: Generate, move, rotate or resize.
3. The method for drawing a mirror image element in a canvas according to claim 1, characterized in that: The graphic data includes: The source element's x-coordinate, the source element's y-coordinate, the source element's width, and the source element's width.
4. The method for drawing a mirror element in a canvas according to claim 3, characterized in that: The determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data includes: When the mirroring type is mirroring at the center of the canvas, the rotation angle is determined to be 180 degrees; Determine the x-coordinate of the mirrored element based on the canvas width, the x-coordinate of the source element, and the width of the source element; Determines the y coordinate of the mirrored element based on the canvas height, the source element's y coordinate, and the source element's height.
5. The method for drawing a mirror element in a canvas according to claim 3, characterized in that: The determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data includes: When the mirroring type is mirroring with the perpendicular line in the canvas, the rotation angle is determined to be 180 degrees; Determine the x-coordinate of the mirrored element based on the canvas width, the x-coordinate of the source element, and the width of the source element; Determines the y coordinate of the mirrored element based on the y coordinate of the source element.
6. The method for drawing a mirror element in a canvas according to claim 3, characterized in that: The determining the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data includes: When the mirroring type is mirroring along the horizontal midline of the canvas, the rotation angle is determined to be 180 degrees; Based on the x-coordinate of the source element, determine the x-coordinate of the mirrored element; Determines the y coordinate of the mirrored element based on the canvas height, the source element's y coordinate, and the source element's height.
7. A device for drawing mirror elements in a canvas, characterized in that: include: An extraction module, used for extracting corresponding graphic data from a graphic library of the source element when performing a mirroring operation on the source element; A determination module, used to determine the coordinates and rotation angle of the mirror element based on the mirror type and the graphic data; A drawing module is used to draw the mirror element in a canvas based on the coordinates and the rotation angle.
8. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the method for drawing a mirror element in a canvas as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for drawing a mirror element in a canvas as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for drawing a mirror element in a canvas as claimed in any one of claims 1 to 6 is implemented.
