A rounded corner drawing method, device, and storage medium
By calculating the rounded corner drawing parameters of polygon vertices, polygon rounded corners are automatically drawn, which solves the problem of low efficiency of manual drawing in the existing technology and achieves efficient and accurate rounded corner drawing effect.
Patent Information
- Application Number
- CN202010332536.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-24
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2040-04-24
AI Technical Summary
Existing office software lacks the automatic rounding function when drawing polygons, resulting in inefficient manual operations by users.
By obtaining the specified drawing distance and graphic parameters of the polygon vertices, the fillet drawing parameters of each vertex are calculated, including the curve node and control point coordinates, and the polygon's fillet is automatically drawn.
It realizes the automatic and accurate drawing of polygon rounded corners, improving drawing efficiency and aesthetics.
Smart Images

Figure CN113553811B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to computer technology, and more particularly to a method, device, and storage medium for drawing rounded corners. Background Art
[0002] When using similar office software such as WPS Office or Microsoft Office, it is sometimes necessary to create rounded polygons. However, existing tools only provide conventional sharp-cornered polygon drawing tools and rounded rectangle drawing tools, and fail to provide functions related to drawing rounded polygons of other shapes (such as rounded hexagons, rounded arrows, etc.). Users can only draw manually, which is often inefficient and takes a lot of users' time. Summary of the Invention
[0003] The present application provides a rounded corner drawing method, device, and storage medium, which can achieve the purpose of automatically and accurately drawing rounded corners for polygons.
[0004] The present application provides a rounded corner drawing method, which obtains the specified drawing distance of the rounded corner corresponding to the vertex of the selected polygon after receiving an instruction to draw the corner of the selected polygon as a rounded corner; determines the rounded corner drawing parameters corresponding to each vertex of the selected polygon based on the obtained specified drawing distance of the rounded corner and the graphic parameters of the selected polygon; the rounded corner drawing parameters corresponding to each vertex include the coordinates of the curve node corresponding to the vertex and the coordinates of the control point of the curve; the specified drawing distance of the rounded corner corresponding to a vertex refers to the distance from the curve node of the rounded corner to the vertex; according to the determined rounded corner drawing parameters, set a curve node for each vertex of the selected polygon and draw it, so as to replace the original angle of the vertex with the drawn curve; the graphic parameters include the coordinates of each vertex of the selected polygon and the angle parameters of each vertex.
[0005] Compared with the related art, the present application determines the specified drawing distance, and then determines the rounded corner drawing parameters corresponding to each vertex of the selected polygon based on the obtained specified drawing distance of the rounded corner and the graphic parameters of the selected polygon; wherein the rounded corner drawing parameters corresponding to each vertex include the coordinates of the curve node corresponding to the vertex and the coordinates of the control point of the curve, thereby realizing automatic and accurate rounded corner drawing for the polygon.
[0006] Other features and advantages of the present application will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present application. Other advantages of the present application can be realized and obtained by the solutions described in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] The accompanying drawings are used to provide an understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0008] Figure 1 This is a flow chart of the rounded corner drawing method according to an embodiment of the present application;
[0009] Figure 2 A schematic diagram of a designated drawing distance obtained in an embodiment of the present application;
[0010] Figure 3 This application shows the process of drawing rounded corners on polygon vertices Figure 1 ;
[0011] Figure 4 This application shows the process of drawing rounded corners on polygon vertices Figure 2 ;
[0012] Figure 5 This application shows the process of drawing rounded corners on polygon vertices Figure 3 ;
[0013] Figure 6 This application shows the process of drawing rounded corners on polygon vertices Figure 4 ;
[0014] Figure 7 A schematic diagram of drawing rounded corners for various graphics using the method of the embodiment of the present application;
[0015] Figure 8 A flowchart of a portion of the computer processing for drawing rounded corners on polygon vertices in this application;
[0016] Figure 9 Another flowchart of the computer processing for drawing rounded corners on polygon vertices in this application;
[0017] Figure 10 This is a schematic diagram of the rounded corner drawing module in an embodiment of the present application. DETAILED DESCRIPTION
[0018] This application describes multiple embodiments, but this description is exemplary rather than restrictive, and it will be apparent to those skilled in the art that there may be more embodiments and implementations within the scope of the embodiments described herein. Although many possible feature combinations are shown in the drawings and discussed in the detailed description, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with any other feature or element in any other embodiment, or may replace any other feature or element in any other embodiment.
[0019] This application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features, and elements disclosed in this application may also be combined with any conventional features or elements to form a unique inventive solution defined by the claims. Any features or elements of any embodiment may also be combined with features or elements from other inventive solutions to form another unique inventive solution defined by the claims. Therefore, it should be understood that any feature shown and / or discussed in this application may be implemented individually or in any appropriate combination. Therefore, except for the limitations made according to the appended claims and their equivalents, the embodiments are not subject to other limitations. In addition, various modifications and changes may be made within the scope of protection of the appended claims.
[0020] In addition, when describing representative embodiments, the specification may have presented the method and / or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps in the specific order described. As will be understood by those skilled in the art, other orders of steps are also possible. Therefore, the specific order of the steps set forth in the specification should not be interpreted as a limitation to the claims. In addition, the claims for the method and / or process should not be limited to performing their steps in the order written, and those skilled in the art can readily understand that these orders can be changed and still remain within the spirit and scope of the embodiments of the present application.
[0021] like Figure 1 As shown, the rounded corner drawing method of the embodiment of the present application includes the following operations:
[0022] S1. Upon receiving an instruction to round the corners of a selected polygon, obtaining a specified drawing distance of the rounded corners corresponding to the vertices of the selected polygon;
[0023] S2. Determine the rounded corner drawing parameters corresponding to each vertex of the selected polygon based on the obtained specified drawing distance of the rounded corner and the graphic parameters of the selected polygon; the rounded corner drawing parameters corresponding to each vertex include the coordinates of the curve node corresponding to the vertex and the coordinates of the control point of the curve; the specified drawing distance of the rounded corner corresponding to a vertex refers to the distance from the curve node of the rounded corner to the vertex; the graphic parameters include the coordinates of each vertex of the selected polygon and the angle parameters of each vertex.
[0024] S3. According to the determined rounded corner drawing parameters, a curve node is set for each vertex of the selected polygon and drawn, and the original corner of the vertex is replaced by the drawn curve.
[0025] like Figure 2As shown, the specified drawing distances R of the five vertices of the pentagon are all equal, that is, the distance from CP to P1 is equal to the distance from CP to P2.
[0026] In an exemplary embodiment, the angle parameters of each vertex include: a relative angle β from each vertex to the next adjacent vertex;
[0027] The relative angle from one vertex to the next adjacent vertex is obtained in the following way:
[0028] Determine the relative angle β between the current vertex and the next adjacent vertex using a first predetermined formula according to the coordinates of the current vertex and the next adjacent vertex;
[0029] In an exemplary embodiment, the first predetermined formula is β=Arctan(a / b); wherein, a=y2-y1, b=x2-x1; x1 represents the horizontal coordinate of the current vertex; x2 represents the horizontal coordinate of the next adjacent vertex; y1 represents the vertical coordinate of the current vertex; y2 represents the horizontal coordinate of the next adjacent vertex.
[0030] In an exemplary embodiment, determining the fillet drawing parameter corresponding to each vertex of the selected polygon according to the obtained specified fillet drawing distance and the graphic parameters of the selected polygon includes:
[0031] Perform the following operations on each vertex and the next adjacent vertex:
[0032] Based on the obtained specified drawing distance r of the fillet, the coordinates of the current vertex (x1, y1), the length c of the connecting line segment from the current vertex P1 to the adjacent next vertex P2, the relative angle β from the current vertex P1 to the adjacent next vertex, and the relative position relationship from the current vertex to the adjacent next vertex, a second predetermined formula is used to determine the coordinates of the curve nodes CP1 and CP2 of the current vertex and the adjacent next vertex located on the connecting line between the current vertex and the adjacent next vertex.
[0033] In an exemplary embodiment, the use of the second predetermined formula to respectively determine the coordinates of the curve nodes CP1 and CP2 of the current vertex and the adjacent next vertex located on the line connecting the current vertex and the adjacent next vertex includes:
[0034] When a is greater than or equal to zero, the abscissa CP1x of the curve node of the current vertex is calculated using the formula: CP1x = x1 + R × |Cos(β)| to obtain the abscissa CP1x of the curve node of the current vertex; the abscissa CP2x of the curve node of the next vertex adjacent to the current vertex is calculated using the formula: CP2x = x1 + (cR) × |Cos(β)| to obtain the abscissa CP2x of the curve node of the next vertex adjacent to the current vertex;
[0035] When b is greater than or equal to zero, the ordinate CP1y of the curve node of the current vertex is calculated using the formula: CP1y=y1+R×|Sin(β)| to obtain the ordinate CP1y of the curve node of the current vertex; the ordinate CP2y of the curve node of the next adjacent vertex is calculated using the formula: CP2y=y1+(cR)×|Sin(β)| to obtain the ordinate CP2y of the curve node of the next adjacent vertex;
[0036] When a is less than zero, the abscissa CP1x of the curve node of the current vertex is calculated using the formula: CP1x = x1-R×|Cos(β)| to obtain the abscissa CP1x of the curve node of the current vertex; the abscissa CP2x of the curve node of the next adjacent vertex is calculated using the formula: CP2x = x1-(cR)×|Cos(β)| to obtain the abscissa CP2x of the curve node of the next adjacent vertex;
[0037] When b is less than zero, the formula for calculating the vertical coordinate CP1y of the curve node of this vertex is used: CP1y=y1-R×|Sin(β)|, to obtain the vertical coordinate CP1y of the curve node of this vertex; the formula for calculating the vertical coordinate CP2y of the curve node of the next adjacent vertex is used: CP2y=y1-(cR)×|Sin(β)|, to obtain the vertical coordinate CP2y of the curve node of the next adjacent vertex.
[0038] In an exemplary embodiment, determining the fillet drawing parameter corresponding to each vertex of the selected polygon according to the obtained specified fillet drawing distance and the graphic parameters of the selected polygon includes:
[0039] Perform the following operations on each vertex:
[0040] Based on the obtained specified drawing distance r of the rounded corner, the coordinates of the current vertex, the relative angle β from each vertex to the next adjacent vertex, and the relative position relationship from each vertex to the next adjacent vertex, a third predetermined formula is used to determine the coordinates of the control points CP1B1, CP1B2, CP2B1, and CP2B2 of the curve of the current vertex and the next adjacent vertex located on the connecting line between the current vertex and the next adjacent vertex.
[0041] In an exemplary embodiment, the method of using a third predetermined formula to determine the coordinates of the control points CP1B1, CP1B2, CP2B1, and CP2B2 of the curve of the current vertex and the adjacent next vertex located on the line connecting the current vertex and the adjacent next vertex includes:
[0042] When a is greater than or equal to zero, the calculation formula of the abscissa CP1B1x of the first control point of the curve of this vertex is adopted: CP1B1x=x1+(R×0.5)×|Cos(β)|, and the abscissa CP1B1x of the first control point of the curve of this vertex is obtained; the calculation formula of the abscissa CP1B2x of the second control point of the curve of this vertex is adopted: CP1B2x=x1-(R×0.5)×|Cos(β)|, and the abscissa CP1B2x of the second control point of the curve of this vertex is obtained; the adjacent lower The calculation formula for the abscissa CP2B1x of the first control point of the curve of a vertex is: CP2B1x = x1 + (cR × 1.5) * |Cos (β) |, and the abscissa CP2B1x of the first control point of the curve of the next adjacent vertex is obtained; the calculation formula for the abscissa CP2B2x of the second control point of the curve of the next adjacent vertex is: CP2B2x = x1 - (cR × 1.5) * |Cos (β) |, and the abscissa CP2B2x of the second control point of the curve of the next adjacent vertex is obtained;
[0043] When a is less than zero, the calculation formula of the abscissa CP1B1x of the first control point of the curve of this vertex is: CP1B1x=x1-(R×0.5)×|Cos(β)|, and the abscissa CP1B1x of the first control point of the curve of this vertex is obtained; the calculation formula of the abscissa CP1B2x of the second control point of the curve of this vertex is: CP1B2x=x1+(R×0.5)×|Cos(β)|, and the abscissa CP1B2x of the second control point of the curve of this vertex is obtained; the adjacent lower The calculation formula for the abscissa CP2B1x of the first control point of the curve of a vertex is: CP2B1x = x1 - (cR × 1.5) * |Cos (β) |, and the abscissa CP2B1x of the first control point of the curve of the next adjacent vertex is obtained; the calculation formula for the abscissa CP2B2x of the second control point of the curve of the next adjacent vertex is: CP2B2x = x1 + (cR × 1.5) * |Cos (β) |, and the abscissa CP2B2x of the second control point of the curve of the next adjacent vertex is obtained;
[0044] When b is greater than or equal to zero, the calculation formula of the ordinate CP1B1y of the first control point of the curve of this vertex is adopted: CP1B1y=y1+(R×0.5)×|Sin(β)|, and the ordinate CP1B1y of the first control point of the curve of this vertex is obtained; the calculation formula of the ordinate CP1B2y of the second control point of the curve of this vertex is adopted: CP1B2y=y1-(R×0.5)×|Sin(β)|, and the ordinate CP1B2y of the second control point of the curve of this vertex is obtained; The calculation formula for the ordinate CP2B1y of the first control point of the curve adjacent to the next vertex is: CP2B1y=y1+(cR×1.5)×|Sin(β)|, and the ordinate CP2B1y of the first control point of the curve adjacent to the next vertex is obtained; the calculation formula for the ordinate CP2B2y of the second control point of the curve adjacent to the next vertex is: y1-(cR×1.5)×|Sin(β)| of CP2B2y, and the ordinate CP2B2y of the second control point of the curve adjacent to the next vertex is obtained.
[0045] When b is less than zero, the calculation formula of the ordinate CP1B1y of the first control point of the curve of this vertex is used: CP1B1y=y1-(R×0.5)×|Sin(β)|, to obtain the ordinate CP1B1y of the first control point of the curve of this vertex; the calculation formula of the ordinate CP1B2y of the second control point of the curve of the next adjacent vertex is used: CP1B2y=y1+(R×0.5)×|Sin(β)|, to obtain the ordinate CP1B2 of the second control point of the curve of the next adjacent vertex y; the calculation formula of the vertical coordinate CP2B1y of the first control point of the curve adjacent to the next vertex is: CP2B1y=y1-(cR×1.5)×|Sin(β)|, to obtain the vertical coordinate CP2B1y of the first control point of the curve adjacent to the next vertex; the calculation formula of the vertical coordinate CP2B2y of the second control point of the curve adjacent to the next vertex is: y1+(cR×1.5)×|Sin(β)|, to obtain the vertical coordinate CP2B2y of the second control point of the curve adjacent to the next vertex.
[0046] In an exemplary embodiment, the length of the connecting line segment from the current vertex to the next adjacent vertex is obtained in the following manner:
[0047] Determine the length c of the connecting line segment from the current vertex to the next adjacent vertex using a predetermined fourth formula according to the coordinates of the current vertex and the next adjacent vertex;
[0048] In an exemplary embodiment, the predetermined fourth formula is: c=((x2-x1)2+(y2-y1) 2 ) 0.5 .
[0049] The rounded corner drawing method of this application can realize the drawing of various polygons, such as Figure 7 As shown, it can be a pentagon, a star, an arrow, etc. Among them, the star can be drawn not only for acute angle vertices, but also for obtuse angle vertices, thereby achieving a more beautiful graphic.
[0050] like Figure 3-6 As shown, the drawing principle and computer processing embodiment of the equal radius fillet or equal cross-section fillet of the present application are described in detail as follows:
[0051] The program will traverse each vertex of the polygon selected by the user, and use the vertical and horizontal coordinates of each vertex to calculate the length c of the line segment between each vertex and the next vertex (the relative distance between the two vertices) using geometric formulas, for example Figure 3 As shown, the distance calculation principle from vertex P1 to vertex P2 is:
[0052] The horizontal coordinate x1 and vertical coordinate y1 of P1 are known, and the horizontal coordinate x2 and vertical coordinate y2 of P2 are also known; then the length of line segment a is y2-y1, and the length of line segment b is x2-x1; according to the relationship between the lengths of the sides of a right triangle: the square of the hypotenuse = the sum of the squares of the two right-angled sides, when the lengths of the two right-angled sides are known, the length of the hypotenuse can be calculated according to the formula, which is c = (a 2 +b 2 ) 0.5 , the formula for converting to the coordinates of two rectangular points is: c=((x2-x1) 2 +(y2-y1) 2 ) 0.5 .
[0053] Then use the vertical and horizontal coordinates of each vertex to calculate the relative angle from each vertex to the next vertex, for example Figure 4 As shown, the relative angle β from P1 to P2 (which can be understood as the inclination angle of line segment c) is calculated as follows: β=Arctan(a / b).
[0054] Then calculate the vertical and horizontal coordinates of the corresponding fillet vertex of each vertex, such as Figure 5 As shown, the horizontal coordinate x of the fillet vertex CP1 is x = x1 ± R × |Cos(β)|, and the vertical coordinate y is y1 ± R × |Sin(β)|; the horizontal coordinate x of CP2 is x = x1 ± (cR) * |Cos(β)|, and the vertical coordinate y = y1 ± (cR) × |Sin(β)|; in the previous four formulas, the "±" symbol represents addition or subtraction. Whether to use addition or subtraction needs to be judged based on the relative position relationship between P1 and P2 (i.e., whether x2-x1 and y2-y1 are greater than or equal to 0, i.e., whether b and a are greater than or equal to 0 as mentioned above). The judgment logic is as follows:
[0055] If b is greater than or equal to 0, the calculation formula for the CP1 horizontal coordinate is x=x1+R×|Cos(β)|, and the calculation formula for the CP2 horizontal coordinate is x=x1+(cR)*|Cos(β|;
[0056] Otherwise, the calculation formula of the CP1 horizontal coordinate is x=x1-R×|Cos(β)|, and the calculation formula of the CP2 horizontal coordinate is x=x1-(cR)*|Cos(β|;
[0057] If a is greater than or equal to 0, the ordinate calculation formula for CP1 is y=y1+R×|Sin(β)|, and the ordinate calculation formula for CP2 is y=y1+(cR)×|Sin(β|;
[0058] Otherwise, the ordinate calculation formula of CP1 is y=y1-R×|Sin(β)|, and the ordinate calculation formula of CP2 is y=y1-(cR)×|Sin(β|;
[0059] Then calculate the vertical and horizontal coordinates of the first and second control points of the fillet vertices CP1 and CP2 on the line from each vertex to the next vertex, such as Figure 6 As shown in the figure, the calculation method for the first and second control points of CP1 and CP2 is:
[0060] The first control point B1 of CP1 has a horizontal coordinate x = x1 ± (R × 0.5) × |Cos(β)| and a vertical coordinate y = y1 ± (R × 0.5) × |Sin(β)|;
[0061] The second control point B2 of CP1 has a horizontal coordinate x = x1 ± (R × 1.5) × |Cos(β)| and a vertical coordinate y = y1 ± (R × 1.5) × |Sin(β)|;
[0062] The first control point B1 of CP2 has a horizontal coordinate x=x1±(cR×1.5)*|Cos(β)| and a vertical coordinate y=y1±(cR×1.5)×|Sin(β)|;
[0063] The second control point B2 of CP2 has a horizontal coordinate x=x1±(cR×0.5)*|Cos(β)| and a vertical coordinate y=y1±(cR×0.5)×|Sin(β)|;
[0064] In the above formula for calculating the coordinates of the control points, the "±" symbol represents addition or subtraction, and the judgment logic of the vertical and horizontal coordinates of CP1 and CP2 is calculated using logical AND.
[0065] After calculating the vertical and horizontal coordinates of the rounded corner vertices and their control points on the line segment from each vertex to the next vertex, use these rounded corner vertex coordinates (curve node coordinates) to create a new graphic at the corresponding coordinates in the document, and add a graphic node at each rounded corner vertex coordinate. Then, adjust the positions of the first and second control points of the node according to the coordinates of the first and second control points of the corresponding rounded corner vertex (control point). Finally, a new polygonal graphic will be obtained, and the corners of the new polygon will be rounded.
[0066] like Figure 8 、 Figure 9 As shown, the computer drawing example of the rounded corner drawing method of the present application includes the following operations:
[0067] M1: The user selects polygon S and initiates a command to draw a rounded polygon;
[0068] M2: Call up the preset parameter setting interface, and the user enters the fillet size value R;
[0069] M3: Traverse all vertices of S (P1 will be used to represent the vertex pointed to by the current loop, and P2 will be used to represent the next vertex), and execute the following steps M4 to M21
[0070] M4: Get the horizontal coordinate x1 and vertical coordinate y1 of P1, and the horizontal coordinate x2 and vertical coordinate y1 of P2;
[0071] M5: Determine whether x2 is greater than or equal to x1; if so, assign variable E = 1; if not, assign variable E to -1;
[0072] M6: Determine whether y2 is greater than or equal to y1; if so, assign variable F = 1; if not, assign variable F to -1;
[0073] M7: Calculate the x-coordinate of the first fillet vertex CP1 on the line segment from P1 to P2. Formula:
[0074] M8: Calculate the y-coordinate value of the first fillet vertex CP1 on the line segment from P1 to P2. Formula:
[0075] M9: Create a graphic path node CP1 at the corresponding coordinates in the document according to the values of x and y;
[0076] M10: Calculate and set the x-coordinate value of the first control point B1 of the fillet vertex CP1. Formula:
[0077] M11: Calculate and set the y-coordinate value of the first control point B1 of the fillet vertex CP1. Formula:
[0078] M12: Calculate and set the x-coordinate value of the first control point B1 of the fillet vertex CP1. Formula:
[0079] M13: Calculate and set the y-coordinate value of the second control point B1 of the fillet vertex CP1. Formula:
[0080] M14: Calculate the x-coordinate of the second fillet vertex CP2 on the line segment from P1 to P2. Formula:
[0081] M15: Calculate the y-coordinate value of the first fillet vertex CP2 on the line segment from P1 to P2. Formula:
[0082] M16: Create a graphic path node CP2 at the corresponding coordinates in the document according to the values of x and y;
[0083] M17: Calculate and set the x-coordinate value of the first control point B1 of the fillet vertex CP2. Formula:
[0084] M18: Calculate and set the y-coordinate value of the first control point B1 of the fillet vertex CP2. Formula:
[0085] M19: Calculate and set the x-coordinate value of the first control point B1 of the fillet vertex CP2. Formula:
[0086] M20: Calculate and set the y-coordinate value of the second control point B1 of the fillet vertex CP2. Formula:
[0087] M21: The next vertex
[0088] M22: Close the new graphic path and generate a new graphic
[0089] like Figure 10 , the rounded corner drawing device of the embodiment of the present application includes the following modules:
[0090] The acquisition module 10 is configured to acquire a designated drawing distance of the rounded corner corresponding to the selected polygon vertex upon receiving an instruction to round the corner of the selected polygon;
[0091] The drawing parameter determination module 20 is used to determine the rounded corner drawing parameters corresponding to each vertex of the selected polygon based on the obtained specified drawing distance of the rounded corner and the graphic parameters of the selected polygon; the rounded corner drawing parameters corresponding to each vertex include the coordinates of the curve node corresponding to the vertex and the coordinates of the control point of the curve; the specified drawing distance corresponding to the rounded corner of a vertex refers to the distance from the curve node of the rounded corner to the vertex; the graphic parameters include the coordinates of each vertex of the selected polygon and the angle parameters of each vertex
[0092] The rounded corner drawing module 30 is used to set a curve node for each vertex of the selected polygon according to the determined rounded corner drawing parameters and draw the curve, so as to replace the original angle of the vertex with the drawn curve.
[0093] An embodiment of the present application further provides a rounded corner drawing device, comprising a processor and a memory, wherein the memory stores a program for rounded corner drawing; the processor is configured to read the program for rounded corner drawing and execute any one of the above methods.
[0094] An embodiment of the present application further provides a computer storage medium having a computer program stored thereon, wherein the computer program implements any of the above methods when executed by a processor.
[0095] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable, and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media generally embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
Claims
1. A method for drawing rounded corners, used in office software, characterized in that: include: M1: The user selects polygon S and initiates a command to draw a rounded polygon; M2: Call up the preset parameter setting interface, and the user enters the fillet size value R; M3: Traverse all vertices of S, P1 represents the vertex pointed to by the current loop, P2 represents the next vertex, and execute the following steps M4 to M21; M4: Get the horizontal coordinate x1 and vertical coordinate y1 of P1, and the horizontal coordinate x2 and vertical coordinate y1 of P2; M5: Determine whether x2 is greater than or equal to x1; if so, assign variable E = 1; if not, assign variable E to -1; M6: Determine whether y2 is greater than or equal to y1; if so, assign variable F = 1; if not, assign variable F to -1; M7: Calculate the x-coordinate of the first fillet vertex CP1 on the line segment from P1 to P2. Formula: ; M8: Calculate the y-coordinate value of the first fillet vertex CP1 on the line segment from P1 to P2. Formula: ; M9: Create a graphic path node CP1 at the corresponding coordinates in the document according to the values of x and y; M10: Calculate and set the x-coordinate value of the first control point B1 of the fillet vertex CP1. Formula: ; M11: Calculate and set the y-coordinate value of the first control point B1 of the fillet vertex CP1. Formula: ; M12: Calculate and set the x-coordinate value of the first control point B1 of the fillet vertex CP1. Formula: ; M13: Calculate and set the y-coordinate value of the second control point B1 of the fillet vertex CP1. Formula: ; M14: Calculate the x-coordinate of the second fillet vertex CP2 on the line segment from P1 to P2. Formula: ; M 15: Calculate the y-coordinate value of the first fillet vertex CP2 on the line segment from P1 to P2. Formula: ; M16: Create a graphic path node CP2 at the corresponding coordinates in the document according to the values of x and y; M17: Calculate and set the x-coordinate value of the first control point B1 of the fillet vertex CP2. Formula: ; M18: Calculate and set the y-coordinate value of the first control point B1 of the fillet vertex CP2. Formula: ; M19: Calculate and set the x-coordinate value of the first control point B1 of the fillet vertex CP2. Formula: ; M20: Calculate and set the y-coordinate value of the second control point B1 of the fillet vertex CP2. Formula: ; M21: Next vertex.
2. A rounded corner drawing device, comprising a processor and a memory, characterized in that: The memory stores a program for rounded corner drawing; the processor is configured to read the program for rounded corner drawing and execute the method according to claim 1.
3. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to claim 1 is implemented.
Citation Information
Patent Citations
Method for drawing arbitrary arc in mobile terminal
CN101958001A
Bezier curve drawing device, bezier curve drawing method, and recording medium
US20110199381A1