Line segment aliasing processing method, device, electronic device and storage medium

By determining the angle between the line segment and the X-axis, moving and filling the rectangle, the problem of high complexity of line segment aliasing processing is solved, improving processing efficiency and enhancing the visual experience.

CN111784795BActive Publication Date: 2024-11-01BEIJING PIXEL SOFTWARE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010487078.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-01
Publication Date
2024-11-01
Estimated Expiration
2040-06-01

AI Technical Summary

Technical Problem

The prior art has high complexity when dealing with line segment abstention, making it difficult to effectively reduce line segment abstention phenomenon, affecting the user's visual experience.

Method used

通过确定线段与坐标系X轴的夹角,沿X轴为中心线确定矩形的长度和宽度,移动矩形使其中心线与线段重合,并对矩形进行填充,降低处理复杂度。

Benefits of technology

It realizes the weakening of line segment abstention at low complexity, improves processing efficiency, and solves the problem of single line segment color through texture filling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111784795B_ABST
    Figure CN111784795B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and storage medium for processing line segment distortion, the method comprising: determining the angle between the line connecting the first end point and the second end point and the first direction of the X-axis in the coordinate system; taking the X-axis as the center line, determining a rectangle with a length equal to the length of the line and a width equal to a predetermined width along the first direction; based on the angle, moving the rectangle so that the center line of the moved rectangle coincides with the line; filling the moved rectangle. Taking the X-axis as the center line, the four vertices of the rectangle are determined simply and quickly along the first direction, based on the angle, by moving the rectangle so that the center line of the moved rectangle coincides with the line, so as to ensure that the length, position and shape of the center line of the rectangle are consistent with the line, and by filling the moved rectangle, the line segment distortion phenomenon is reduced with low complexity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for processing line segment aliasing. Background Art

[0002] Line segment aliasing refers to the phenomenon that straight line segments or polygon boundaries appear jagged, stepped or truncated, resulting in a poor visual experience for users. In order to eliminate or reduce line segment aliasing, the existing technology generally directly draws line segments and then selects one or more of the following methods to solve the aliasing, such as: improving resolution, using diverse sampling, and anti-aliasing. However, these methods require processing a large number of pixels, which is highly complex. Summary of the invention

[0003] In view of this, an object of the embodiments of the present application is to provide a method, device, electronic device and storage medium for processing line segment aliasing, so as to reduce the line segment aliasing phenomenon with lower processing complexity.

[0004] In a first aspect, an embodiment of the present application provides a method for processing line segment aliasing, the method comprising: determining an angle between a line between a first endpoint and a second endpoint and a first direction of an X-axis in a coordinate system; taking the X-axis as a center line, determining a rectangle along the first direction with a length equal to the length of the line and a width equal to a predetermined width; based on the angle, moving the rectangle so that the center line of the moved rectangle coincides with the line; and filling the moved rectangle.

[0005] In the above implementation process, after determining the angle between the line connecting the first endpoint and the second endpoint and the first direction of the X-axis in the coordinate system, with the X-axis as the center line, the four vertices of a rectangle with a length equal to the length of the line and a width equal to a predetermined width are simply and quickly determined along the first direction, and then based on the angle, the rectangle is moved so that the center line of the moved rectangle coincides with the line to ensure that the length, position and shape of the center line of the moved rectangle are consistent with the line, and by filling the moved rectangle, the line segment distortion phenomenon between the first endpoint and the second endpoint is reduced with lower complexity.

[0006] Based on the first aspect, in a possible design, the rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width is determined along the first direction with the X-axis as the center line, including: taking the origin of the coordinate system as the starting point, the X-axis as the center line, and determining along the first direction the rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width.

[0007] In the above implementation process, taking the origin of the coordinate system as the starting point and the X-axis as the center line along the first direction, the four vertices of a rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width can be determined more quickly, and then the rectangle can be determined more quickly.

[0008] Based on the first aspect, in a possible design, the rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width is determined along the first direction with the X-axis as the center line, including: taking the projection coordinates of the first endpoint or the second endpoint on the X-axis as the starting point, the X-axis as the center line, and determining along the first direction the rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width.

[0009] In the above implementation process, the four vertices of the rectangle are determined with the projection coordinates of the first endpoint or the second endpoint on the X-axis as the starting point, and then the rectangle can be moved so that the center line of the moved rectangle coincides with the connecting line, and the moving trajectory is shorter during the moving process, thereby improving the processing efficiency of the distorted line segment.

[0010] Based on the first aspect, in a possible design, the rectangle is moved based on the angle so that the center line of the moved rectangle coincides with the connecting line, including: dividing the rectangle with the diagonal of the rectangle as a dividing line to obtain two triangles; based on the angle, the triangles are moved respectively so that the center line of the rectangle formed by the two moved triangles coincides with the connecting line; wherein the rectangle formed by the two moved triangles is the moved rectangle.

[0011] Based on the first aspect, in a possible design, filling the moved rectangle includes: filling the two moved triangles respectively.

[0012] Based on the first aspect, in a possible design, filling the moved rectangle includes: filling the moved rectangle with a predetermined texture image.

[0013] In the above implementation process, the color of the line segment between the first endpoint and the second endpoint can have texture through the above method, which solves the problem of single color of the line segment caused by the line segment being a pure color.

[0014] Based on the first aspect, in a possible design, before determining the angle between the line between the first endpoint and the second endpoint and the first direction of the X-axis in the coordinate system, the method also includes: obtaining a configuration file required to create a UI line control; wherein the configuration file includes: the coordinates of the first endpoint and the second endpoint in the coordinate system required to create the UI line control; and parsing the configuration file to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.

[0015] In the above implementation process, the above method can weaken the distortion phenomenon of the control created by using the line segment between the first endpoint and the second endpoint.

[0016] In the second aspect, an embodiment of the present application provides a line segment aliasing processing device, the device comprising: an angle determination unit, used to determine the angle between a line between a first endpoint and a second endpoint and a first direction of an X-axis in a coordinate system; a rectangle determination unit, used to determine a rectangle with a length equal to the length of the line and a width equal to a predetermined width along the first direction with the X-axis as the center line; a moving unit, used to move the rectangle based on the angle so that the center line of the moved rectangle coincides with the line; and a filling unit, used to fill the moved rectangle.

[0017] Based on the second aspect, in a possible design, the rectangle determination unit is specifically used to determine the rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width along the first direction, with the origin of the coordinate system as the starting point and the X-axis as the center line.

[0018] Based on the second aspect, in a possible design, the rectangle determination unit is also used to take the projection coordinates of the first endpoint or the second endpoint on the X-axis as the starting point and the X-axis as the center line, and determine the rectangle along the first direction with a length equal to the length of the connecting line and a width equal to a predetermined width.

[0019] Based on the second aspect, in a possible design, the moving unit is specifically used to divide the rectangle with the diagonal of the rectangle as a dividing line to obtain two triangles; based on the included angle, the triangles are moved respectively so that the center line of the rectangle formed by the two moved triangles coincides with the connecting line; wherein the rectangle formed by the two moved triangles is the moved rectangle.

[0020] Based on the second aspect, in a possible design, the filling unit is specifically used to fill the two moved triangles respectively.

[0021] Based on the second aspect, in a possible design, the filling unit is further used to fill the moved rectangle with a predetermined texture image.

[0022] Based on the second aspect, in a possible design, the device also includes: an acquisition unit, used to acquire a configuration file required to create a UI line control; wherein the configuration file includes: the coordinates of the first endpoint and the second endpoint in the coordinate system required to create the UI line control; a parsing unit, used to parse the configuration file to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.

[0023] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory connected to the processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the electronic device executes the method described in the first aspect.

[0024] In a fourth aspect, an embodiment of the present application provides a storage medium, wherein a computer program is stored in the storage medium. When the computer program is executed on a computer, the computer executes the method described in the first aspect.

[0025] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 A flowchart of a method for processing line segment aliasing provided in an embodiment of the present application.

[0028] Figure 2 This is a schematic diagram of the first rectangle drawing provided in an embodiment of the present application.

[0029] Figure 3 A second rectangular drawing schematic diagram provided in an embodiment of the present application.

[0030] Figure 4 A third rectangular drawing schematic diagram provided in an embodiment of the present application.

[0031] Figure 5 This is a schematic diagram of a fourth rectangle drawing provided in an embodiment of the present application.

[0032] Figure 6 A schematic diagram of a moved rectangle provided in an embodiment of the present application.

[0033] Figure 7 A schematic diagram of the structure of a line segment aliasing processing device provided in an embodiment of the present application.

[0034] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0035] Icons: 700 - a processing device for line segment distortion; 710 - an angle determination unit; 720 - a rectangle determination unit; 730 - a moving unit; 740 - a filling unit; 800 - an electronic device; 801 - a processor; 802 - a memory; 803 - a communication interface. DETAILED DESCRIPTION

[0036] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application.

[0037] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0038] Please refer to Figure 1 , Figure 1 A flowchart of a method for processing line segment aliasing provided in an embodiment of the present application is provided below. Figure 1 The process shown is described in detail, and the method includes steps: S11, S12, S13 and S14.

[0039] S11: Determine an angle between a line connecting the first endpoint and the second endpoint and a first direction of an X-axis in the coordinate system.

[0040] S12: Taking the X-axis as the center line, determine a rectangle along the first direction whose length is the length of the connecting line and whose width is a predetermined width.

[0041] S13: Based on the included angle, move the rectangle so that the center line of the moved rectangle coincides with the connecting line.

[0042] S14: Filling the moved rectangle.

[0043] The above method is introduced in detail below.

[0044] Before S11, the method further includes: steps A1 and A2.

[0045] A1: Obtain a configuration file required for creating a user interface (UI) line control; wherein the configuration file includes: coordinates of the first endpoint and the second endpoint in the coordinate system required for creating the UI line control.

[0046] The coordinate system may be a two-dimensional coordinate system constructed with the upper left corner, lower left corner, upper right corner, lower right corner, center or other position of the electronic device interface that creates the UI line control as the origin.

[0047] The configuration file may further include: the width of the UI line control.

[0048] It is understandable that the position and length of the UI line control are determined by the first endpoint and the second endpoint. In the prior art, when creating a UI line control, the straight line between the first endpoint and the second endpoint is directly used as the shape of the UI line control, and the position of the straight line is the position of the UI line control. However, the drawn straight line usually appears jagged, stepped or truncated, resulting in a poor visual experience for users.

[0049] A2: Parse the configuration file to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.

[0050] When the width of the UI line control is included in the configuration file, the configuration file is parsed to obtain the width of the UI line control.

[0051] S11: Determine an angle between a line connecting the first endpoint and the second endpoint and a first direction of an X-axis in a coordinate system.

[0052] The first direction may be the positive direction of the X-axis or the negative direction of the X-axis.

[0053] In the actual implementation process, after obtaining the coordinates of the first endpoint and the second endpoint in the coordinate system by using steps A1 and A2, S11 can be implemented as follows: when the horizontal coordinate of the first endpoint is less than or equal to the horizontal coordinate of the second endpoint, and the vertical coordinate of the first endpoint is less than the vertical coordinate of the second endpoint, a vector is constructed with the first endpoint as the starting point and the second endpoint as the end point. vector The direction is from the first endpoint to the second endpoint, and a vector is determined with the first endpoint as the starting point and the third endpoint as the end point. The ordinate of the third endpoint is the same as the ordinate of the first endpoint, the abscissa of the third endpoint is different from the abscissa of the second endpoint, when the first direction is the positive direction of the X-axis, the abscissa of the third endpoint is greater than the abscissa of the first endpoint, when the first direction is the negative direction of the X-axis, the abscissa of the third endpoint is less than the abscissa of the first endpoint, vector The direction of is from the first end point to the third end point, so the angle is the vector With the vector The angle φ of Find the value of the angle φ.

[0054] In other embodiments, the angle may also be solved using the sine theorem. The method of solving the angle using the sine method is a well-known technique in the art and will not be described in detail herein.

[0055] When the horizontal coordinate of the first endpoint is smaller than the horizontal coordinate of the second endpoint, and the vertical coordinate of the first endpoint is larger than the vertical coordinate of the second endpoint, a vector is constructed with the first endpoint as the starting point and the second endpoint as the end point. vector The direction is from the first endpoint to the second endpoint, and a vector is determined with the second endpoint as the starting point and the fourth endpoint as the end point. The horizontal coordinate of the fourth endpoint is different from the horizontal coordinate of the second endpoint, the vertical coordinate of the fourth endpoint is the same as the vertical coordinate of the second endpoint, and the vector The direction is from the second endpoint to the fourth endpoint. When the first direction is the positive direction of the X-axis, the abscissa of the fourth endpoint is greater than the abscissa of the second endpoint. When the first direction is the negative direction of the X-axis, the abscissa of the fourth endpoint is less than the abscissa of the second endpoint. Therefore, the angle is the vector With the vector The angle φ of The value of the angle φ is obtained. Here, |·| is a modulo operation.

[0056] As an implementation mode, when it is necessary to weaken the distortion phenomenon of the straight line connection between the pre-drawn first endpoint and the second endpoint, a two-dimensional coordinate system is constructed with the upper left corner, lower left corner, upper right corner and lower right corner or other positions of the electronic device interface displaying the straight line as the origin. It can be understood that after the two-dimensional coordinate system is constructed, the coordinates of the first endpoint and the second endpoint in the coordinate system can be obtained, and then the above implementation mode can be used to determine the angle between the straight line and the positive direction of the X-axis of the coordinate system, which will not be repeated here.

[0057] After the angle is determined, step S12 is performed.

[0058] S12: Taking the X-axis as the center line, determine a rectangle along the first direction whose length is the length of the connecting line and whose width is a predetermined width.

[0059] The predetermined width may be set according to user requirements. In the embodiment of the present application, the predetermined width may be 8 mm, 1 cm, etc.

[0060] When the width of the line control is included in the configuration file, the predetermined width is the width of the line control.

[0061] When the width of the line control is not included in the configuration file, the predetermined width can be set according to user requirements.

[0062] As an implementation manner, S12 includes: taking the origin of the coordinate system as the starting point and the X-axis as the center line, and determining the rectangle along the first direction, the rectangle having a length equal to the length of the connecting line and a width equal to a predetermined width.

[0063] Take the X-axis as the center line of the rectangle and the origin of the coordinate system as the starting point of the center line. Figure 2 , the first direction is the positive direction of the X-axis, according to the predetermined width, the horizontal coordinate of the lower left corner vertex of the rectangle is determined to be zero, the vertical coordinate is a negative value, and the absolute value of the vertical coordinate is half of the value of the predetermined width, according to the length of the line between the first endpoint and the second endpoint, the coordinate of the lower right corner vertex of the rectangle is determined along the first direction, the horizontal coordinate of the lower right corner vertex of the rectangle is a positive number, and the absolute value of the horizontal coordinate of the lower right corner vertex of the rectangle is the same as the length of the line, the vertical coordinate of the lower right corner vertex is the same as the vertical coordinate of the lower left corner vertex, the horizontal coordinate of the upper left corner vertex of the rectangle is zero, the vertical coordinate is a positive number, and its absolute value is half of the value of the predetermined width, the horizontal coordinate of the upper right corner vertex of the rectangle is the same as the horizontal coordinate of the lower right corner vertex, and the vertical coordinate of the upper right corner vertex of the rectangle is the same as the vertical coordinate of the upper left corner of the rectangle.

[0064] Please refer to Figure 3, the first direction is the negative direction of the X-axis, according to the predetermined width, the horizontal coordinate of the lower right corner vertex of the rectangle is determined to be zero, the vertical coordinate is a negative value, and the absolute value of the vertical coordinate is half of the value of the predetermined width, according to the length of the line between the first endpoint and the second endpoint, the coordinate of the lower left corner vertex of the rectangle is determined along the first direction, the horizontal coordinate of the lower left corner vertex of the rectangle is a negative number, and the absolute value of the horizontal coordinate of the lower left corner vertex of the rectangle is the same as the length of the line, the vertical coordinate of the lower left corner vertex is the same as the vertical coordinate of the lower right corner vertex, the horizontal coordinate of the upper right corner vertex of the rectangle is zero, the vertical coordinate is a positive number, and its absolute value is half of the value of the predetermined width, the horizontal coordinate of the upper left corner vertex of the rectangle is the same as the horizontal coordinate of the lower left corner vertex, and the vertical coordinate of the upper left corner vertex of the rectangle is the same as the vertical coordinate of the upper right corner of the rectangle.

[0065] As an implementation mode, S12 includes: taking the projection coordinates of the first endpoint or the second endpoint on the X-axis as the starting point and the X-axis as the center line, and determining the rectangle along the first direction with a length equal to the length of the connecting line and a width equal to a predetermined width.

[0066] Take the X-axis as the center line of the rectangle, the first direction as the positive direction of the X-axis, and when the angle is an acute angle or an obtuse angle, please refer to Figure 4 , determine the endpoint with the smaller absolute value of the horizontal coordinate from the first endpoint and the second endpoint, use the projection coordinates of the endpoint with the smaller absolute value of the horizontal coordinate on the X-axis as the starting point of the center line, and determine the horizontal coordinate of the lower left corner vertex of the rectangle as the projection coordinates of the endpoint with the smaller absolute value of the horizontal coordinate on the X-axis according to the predetermined width, the vertical coordinate is a negative value, and the absolute value of the vertical coordinate is half of the value of the predetermined width, and determine the coordinates of the lower right corner vertex of the rectangle along the first direction according to the length of the line between the first endpoint and the second endpoint, and the lower right corner vertex of the rectangle is The horizontal coordinate of the point is greater than the horizontal coordinate of the lower left corner vertex, and the absolute value of the difference between the horizontal coordinates of the lower right corner vertex of the rectangle and the horizontal coordinates of the lower left corner vertex is the same as the length of the connecting line, the vertical coordinate of the lower right corner vertex is the same as the vertical coordinate of the lower left corner vertex, the horizontal coordinate of the upper left corner vertex of the rectangle is the same as the horizontal coordinate of the lower left corner vertex of the rectangle, the vertical coordinate is a positive number, and its absolute value is half of the value of the predetermined width, the horizontal coordinate of the upper right corner vertex of the rectangle is the same as the horizontal coordinate of the lower right corner vertex, and the vertical coordinate of the upper right corner vertex of the rectangle is the same as the vertical coordinate of the upper left corner of the rectangle.

[0067] Take the X-axis as the center line of the rectangle, the first direction as the negative direction of the X-axis, and when the angle is an acute angle or an obtuse angle, please refer to Figure 5, determine the endpoint with the smaller absolute value of the horizontal coordinate from the first endpoint and the second endpoint, use the projection coordinates of the endpoint with the smaller absolute value of the horizontal coordinate on the X-axis as the starting point of the center line, and determine, according to the predetermined width, the horizontal coordinate of the lower right corner vertex of the rectangle as the projection coordinates of the endpoint with the smaller absolute value of the horizontal coordinate on the X-axis, the vertical coordinate is a negative value, and the absolute value of the vertical coordinate is half of the value of the predetermined width, and determine the coordinates of the lower left corner vertex of the rectangle along the first direction according to the length of the line between the first endpoint and the second endpoint, and the lower left corner vertex of the rectangle is The horizontal coordinate of the point is smaller than the horizontal coordinate of the lower right corner vertex, and the absolute value of the difference between the horizontal coordinates of the lower left corner vertex of the rectangle and the horizontal coordinates of the lower right corner vertex is the same as the length of the connecting line, the vertical coordinate of the lower left corner vertex is the same as the vertical coordinate of the lower right corner vertex, the horizontal coordinate of the upper right corner vertex of the rectangle is the same as the horizontal coordinate of the lower right corner vertex of the rectangle, the vertical coordinate is a positive number, and its absolute value is half of the value of the predetermined width, the horizontal coordinate of the upper left corner vertex of the rectangle is the same as the horizontal coordinate of the lower left corner vertex, and the vertical coordinate of the upper left corner vertex of the rectangle is the same as the vertical coordinate of the upper right corner of the rectangle.

[0068] S13: Based on the included angle, move the rectangle so that the center line of the moved rectangle coincides with the connecting line.

[0069] Based on the angle and the first direction, each vertex and each side of the rectangle are rotated and translated so that a center line of a rectangle determined by each moved vertex or the moved rectangle coincides with the connecting line.

[0070] Or the vertices of the rectangle are rotated and translated so that the center line of the rectangle determined by the moved vertices or the moved rectangle coincides with the connecting line.

[0071] It is worth mentioning that the translation includes translation in one, two or more directions of up, down, left and right. When the path length of the translation is zero, the representation does not need translation.

[0072] Please refer to Figure 6 When the first direction is the positive direction of the X-axis and the rotation direction of each vertex of the rectangle is counterclockwise, the rotation angle of the rectangle is the same as the included angle; when the rotation direction of each vertex of the rectangle is clockwise, the rotation angle of the rectangle is the difference between 360 degrees and the included angle.

[0073] When the first direction is the negative direction of the X-axis and the rotation direction of each vertex of the rectangle is clockwise, the rotation angle of the rectangle is the same as the included angle; when the rotation direction of each vertex of the rectangle is counterclockwise, the rotation angle of the rectangle is the difference between 360 degrees and the included angle.

[0074] As an implementation manner, S13 includes steps B1 and B2.

[0075] B1: Divide the rectangle by taking the diagonal line of the rectangle as a dividing line to obtain two triangles.

[0076] It can be understood that the common side of the two triangles is the diagonal line.

[0077] B2: Based on the included angle, the triangles are moved respectively so that the center line of the rectangle formed by the two moved triangles coincides with the connecting line; wherein the rectangle formed by the two moved triangles is the moved rectangle.

[0078] The specific implementation of B2 is the same as that of S13, so it will not be repeated here.

[0079] S14: Filling the moved rectangle.

[0080] As an implementation manner, S14 includes: filling the moved rectangle with a predetermined texture image.

[0081] As an implementation manner, S14 includes: filling the moved rectangle with a predetermined filling color.

[0082] The predetermined filling color may be one or more of black, red, green, etc.

[0083] As an implementation manner, if the moved rectangle is composed of two triangles, S14 includes: filling the two moved triangles respectively.

[0084] As an implementation manner, if a rectangle has been drawn in step S12, the rectangle may be filled before being moved.

[0085] Please refer to Figure 7 , Figure 7 700 is a structural block diagram of a line segment aliasing processing device provided in an embodiment of the present application. Figure 7 The structural block diagram shown is used to illustrate that the device shown includes:

[0086] The angle determination unit 710 is used to determine the angle between the line between the first endpoint and the second endpoint and the first direction of the X-axis in the coordinate system.

[0087] The rectangle determination unit 720 is used to determine a rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width along the first direction with the X-axis as the center line.

[0088] The moving unit 730 is used to move the rectangle based on the angle so that the center line of the moved rectangle coincides with the connecting line.

[0089] The filling unit 740 is used to fill the moved rectangle.

[0090] As an implementation manner, the rectangle determination unit 720 is specifically used to determine the rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width along the first direction with the origin of the coordinate system as the starting point and the X-axis as the center line.

[0091] As an embodiment, the rectangle determination unit 720 is also used to take the projection coordinates of the first endpoint or the second endpoint on the X-axis as the starting point and the X-axis as the center line, and determine the rectangle along the first direction with a length equal to the length of the connecting line and a width equal to a predetermined width.

[0092] As an embodiment, the moving unit 730 is specifically used to divide the rectangle with the diagonal line of the rectangle as a dividing line to obtain two triangles; based on the included angle, the triangles are moved respectively so that the center line of the rectangle formed by the two moved triangles coincides with the connecting line; wherein, the rectangle formed by the two moved triangles is the moved rectangle.

[0093] As an implementation manner, the filling unit 740 is specifically used to fill the two moved triangles respectively.

[0094] As an implementation manner, the filling unit 740 is further configured to fill the moved rectangle with a predetermined texture image.

[0095] As an embodiment, the device also includes: an acquisition unit, used to acquire a configuration file required to create a UI line control; wherein the configuration file includes: the coordinates of the first endpoint and the second endpoint in the coordinate system required to create the UI line control; and a parsing unit, used to parse the configuration file to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.

[0096] For the process of each functional unit realizing its own function in this embodiment, please refer to the above Figure 1-6 The contents described in the illustrated embodiments will not be repeated here.

[0097] Please refer to Figure 8 An embodiment of the present application provides a structural diagram of an electronic device 800. The electronic device 800 may be the server in the above embodiment. The electronic device 800 may be a personal computer (PC), a tablet computer, a smart phone, a personal digital assistant (PDA), etc.

[0098] The electronic device 800 may include: a memory 802, a processor 801, a communication interface 803 and a communication bus, and the communication bus is used to realize the connection and communication of these components.

[0099] The memory 802 is used to store various data such as computing program instructions corresponding to the line segment aliasing processing method and device provided in the embodiment of the present application, wherein the memory 802 can be, but is not limited to, a random access memory (Random Access Memory, RAM), a read-only memory (Read Only Memory, ROM), a programmable read-only memory (Programmable Read-Only Memory, PROM), an erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.

[0100] The processor 801 is used to read and run computer program instructions corresponding to the line segment distortion processing method and device stored in the memory to determine the angle between the line between the first endpoint and the second endpoint and the first direction of the X-axis in the coordinate system; with the X-axis as the center line, determine a rectangle with a length of the line and a width of a predetermined width along the first direction; based on the angle, move the rectangle so that the center line of the moved rectangle coincides with the line; and fill the moved rectangle.

[0101] Among them, the processor 801 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 801 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0102] The communication interface 803 is used to receive or send data.

[0103] In addition, an embodiment of the present application further provides a storage medium, in which a computer program is stored. When the computer program is run on a computer, the computer executes the method provided by any embodiment of the present application.

[0104] In summary, the line segment distortion processing methods, devices, electronic devices and storage media proposed in the embodiments of the present application, after determining the angle between the line connecting the first endpoint and the second endpoint and the first direction of the X-axis in the coordinate system, take the X-axis as the center line and simply and quickly determine the four vertices of a rectangle with a length of the line and a width of a predetermined width along the first direction, and then move the rectangle based on the angle so that the center line of the moved rectangle coincides with the line to ensure that the length, position and shape of the center line of the moved rectangle are consistent with the line, and by filling the moved rectangle, the line segment distortion phenomenon between the first endpoint and the second endpoint is reduced with lower complexity.

[0105] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based device that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0106] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

Claims

1. A method for processing line segment aliasing, It is characterized in that The method comprises: Determine an angle between a line connecting the first endpoint and the second endpoint and a first direction of an X-axis in the coordinate system; Taking the X-axis as the center line, determine a rectangle along the first direction with a length equal to the length of the connecting line and a width equal to a predetermined width; Based on the angle, the rectangle is moved so that the center line of the moved rectangle coincides with the connecting line; Filling the moved rectangle; The step of determining a rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width along the first direction with the X-axis as the center line includes: Taking the projection coordinates of the first endpoint or the second endpoint on the X-axis as a starting point and the X-axis as a center line, determine the rectangle along the first direction, the rectangle having a length equal to the length of the connecting line and a width equal to a predetermined width; The step of moving the rectangle based on the included angle so that the center line of the moved rectangle coincides with the connecting line includes: Dividing the rectangle by taking the diagonal line of the rectangle as a dividing line to obtain two triangles; Based on the included angle, the triangles are moved respectively so that the center line of the rectangle formed by the two moved triangles coincides with the connecting line; wherein the rectangle formed by the two moved triangles is the moved rectangle; Accordingly, filling the moved rectangle includes: The two moved triangles are filled respectively.

2. The method according to claim 1, It is characterized in that The method of determining a rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width along the first direction with the X-axis as the center line includes: Taking the origin of the coordinate system as the starting point and the X-axis as the center line, a rectangle having a length equal to the length of the connecting line and a width equal to a predetermined width is determined along the first direction.

3. The method according to claim 1, It is characterized in that The filling of the moved rectangle includes: The moved rectangle is filled with a predetermined texture image.

4. The method according to claim 1, It is characterized in that Before determining the angle between the line connecting the first endpoint and the second endpoint and the first direction of the X-axis in the coordinate system, the method further includes: Acquire a configuration file required for creating a UI line control; wherein the configuration file includes: coordinates of the first endpoint and the second endpoint in the coordinate system required for creating the UI line control; The configuration file is parsed to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.

5. A device for processing line segment distortion, It is characterized in that The device comprises: An angle determination unit, used to determine an angle between a line connecting the first endpoint and the second endpoint and a first direction of an X-axis in a coordinate system; A rectangle determining unit, configured to determine a rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width along the first direction with the X-axis as the center line; A moving unit, configured to move the rectangle based on the included angle so that a center line of the moved rectangle coincides with the connecting line; A filling unit, used to fill the moved rectangle; The rectangle determination unit is specifically configured to determine the rectangle with a length equal to the length of the connecting line and a width equal to a predetermined width along the first direction, taking the projection coordinates of the first endpoint or the second endpoint on the X-axis as a starting point and the X-axis as a center line; The moving unit is specifically used to divide the rectangle by taking the diagonal line of the rectangle as a dividing line to obtain two triangles; based on the included angle, the triangles are moved respectively so that the center line of the rectangle formed by the two moved triangles coincides with the connecting line; wherein the rectangle formed by the two moved triangles is the moved rectangle; The filling unit is specifically used to fill the two moved triangles respectively.

6. An electronic device, It is characterized in that The method comprises a memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are read and executed by the processor, the method according to any one of claims 1 to 4 is executed.

7. A storage medium, It is characterized in that The storage medium stores computer program instructions, and when the computer program instructions are read and executed by a computer, the method according to any one of claims 1 to 4 is executed.