CN111784795A - Processing method and device for line segment aliasing, electronic equipment and storage medium - Google Patents

Processing method and device for line segment aliasing, electronic equipment and storage medium Download PDF

Info

Publication number
CN111784795A
CN111784795A CN202010487078.6A CN202010487078A CN111784795A CN 111784795 A CN111784795 A CN 111784795A CN 202010487078 A CN202010487078 A CN 202010487078A CN 111784795 A CN111784795 A CN 111784795A
Authority
CN
China
Prior art keywords
rectangle
line
moved
axis
end point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010487078.6A
Other languages
Chinese (zh)
Inventor
陶作柠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN202010487078.6A priority Critical patent/CN111784795A/en
Publication of CN111784795A publication Critical patent/CN111784795A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/206Drawing of charts or graphs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The application provides a method and a device for processing line segment aliasing, electronic equipment and a storage medium, wherein the method comprises the following steps: determining an included angle between a connecting line between the first end point and the second end point and a first direction of an X axis in a coordinate system; determining a rectangle with a length of the connecting line and a width of a predetermined width along the first direction by taking the X axis as a central line; based on the included angle, moving the rectangle to enable the center line of the moved rectangle to be overlapped with the connecting line; and filling the moved rectangle. The method comprises the steps of simply and quickly determining four vertexes of a rectangle along a first direction by taking an X axis as a central line, enabling the central line of the moved rectangle to coincide with a connecting line by moving the rectangle based on included angles so as to ensure that the length, the position and the shape of the central line of the rectangle are consistent with the connecting line, and weakening the phenomenon of line segment aliasing with lower complexity by filling the moved rectangle.

Description

Processing method and device for line segment aliasing, electronic equipment and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method and an apparatus for processing line segment aliasing, an electronic device, and a storage medium.
Background
The line segment aliasing refers to the phenomenon that the boundary of a straight line segment or a polygon is jagged, stepped or truncated, so that the visual experience of a user is poor. In order to eliminate or reduce the phenomenon of line segment aliasing, the prior art generally directly draws line segments, and then selects one or more of the following ways to combine to solve the aliasing, for example: improved resolution, multiple sampling, and Wu antialiasing, however these approaches require processing of a large number of pixels, which is highly complex.
Disclosure of Invention
In view of this, an object of the embodiments of the present application is to provide a method and an apparatus for processing line segment aliasing, an electronic device, and a storage medium, which can weaken the line segment aliasing with low processing complexity.
In a first aspect, an embodiment of the present application provides a method for processing line segment aliasing, where the method includes: determining an included angle between a connecting line between the first end point and the second end point and a first direction of an X axis in a coordinate system; determining a rectangle with a length of the connecting line and a width of a predetermined width along the first direction by taking the X axis as a central line; based on the included angle, moving the rectangle to enable the center line of the moved rectangle to be overlapped with the connecting line; and filling the moved rectangle.
In the implementation process, after an included angle between a connecting line between a first end point and a second end point and a first direction of an X axis in a coordinate system is determined, the length of the connecting line is simply and quickly determined along the first direction by taking the X axis as a central line, the width of the connecting line is four vertexes of a rectangle with a predetermined width, then the rectangle is moved based on the included angle, so that the central line of the moved rectangle is overlapped with the connecting line, the length, the position and the shape of the central line of the moved rectangle are ensured to be consistent with the connecting line, and the phenomenon of line segment aliasing between the first end point and the second end point is weakened by filling the moved rectangle with low complexity.
In a possible design based on the first aspect, the determining, along the first direction with the X axis as a center line, a rectangle with a length equal to the length of the connection line and a width equal to a predetermined width includes: and determining the rectangle with the length of the connecting line and the width of the predetermined width along the first direction by taking the origin of the coordinate system as a starting point and the X axis as a central line.
In the implementation process, the original point of the coordinate system is used as a starting point, the X axis is used as a central line, the length of the rectangular line is determined to be the length of the connecting line along the first direction, the width of the rectangular line is determined to be the four vertexes of the rectangle with the predetermined width, and then the rectangular line can be determined more quickly.
In a possible design based on the first aspect, the determining, along the first direction with the X axis as a center line, a rectangle with a length equal to the length of the connection line and a width equal to a predetermined width includes: and determining the rectangle with the length of the connecting line and the width of the predetermined width along the first direction by taking the projection coordinate of the first end point or the second end point on the X axis as a starting point and the X axis as a central line.
In the implementation process, the projection coordinates of the first end point or the second end point on the X axis are used as starting points to determine four vertexes of the rectangle, and then the rectangle can be moved, so that the moving track in the moving process of the moved rectangle in which the central line and the connecting line are overlapped is shorter, and the processing efficiency of the aliasing line segment is improved.
Based on the first aspect, in a possible design, the moving the rectangle based on the included angle so that a center line of the moved rectangle coincides with the connection line includes: dividing the rectangle by taking a diagonal line of the rectangle as a dividing line to obtain two triangles; based on the included angles, the triangles are respectively moved, so that the central line of a rectangle formed by the two moved triangles is superposed with the connecting line; and the rectangle formed by the two moved triangles is the moved rectangle.
In a possible design based on the first aspect, the filling the moved rectangle includes: and filling the two moved triangles respectively.
In a possible design based on the first aspect, the filling the moved rectangle includes: and filling the moved rectangle by using a predetermined texture picture.
In the implementation process, the color of the line segment between the first endpoint and the second endpoint can be textured in the above mode, and the problem of single color of the line segment caused by the fact that the color of the line segment is pure color is solved.
Based on the first aspect, in a possible design, before determining an angle between a connection line between the first end point and the second end point and a first direction of an X-axis in a coordinate system, the method further includes: acquiring a configuration file required by the creation of a UI drive-by-wire element; wherein, the configuration file comprises: creating coordinates of the first endpoint and the second endpoint in the coordinate system, wherein the coordinates are required by the UI line control part; and analyzing the configuration file to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.
In the implementation process, the aliasing phenomenon of the control created by using the line segment between the first endpoint and the second endpoint can be weakened in the manner.
In a second aspect, an embodiment of the present application provides a device for processing line segment aliasing, where the device includes: the angle determining unit is used for determining an included angle between a connecting line between the first end point and the second end point and a first direction of an X axis in the coordinate system; a rectangle determining unit, configured to determine, along the first direction, a rectangle with a length equal to the length of the connection line and a width equal to a predetermined width, with the X axis as a center line; the moving unit is used for moving the rectangle based on the included angle so as to enable the center line of the moved rectangle to be overlapped with the connecting line; and the filling unit is used for filling the moved rectangle.
Based on the second aspect, in a possible design, the rectangle determining unit is specifically configured to determine the rectangle with a length of the connection line and a width of a predetermined width along the first direction, with an origin of the coordinate system as a starting point and the X axis as a central line.
In a possible design based on the second aspect, the rectangle determining unit is further configured to determine the rectangle with a length equal to the length of the connection line and a width equal to a predetermined width along the first direction, with a projection coordinate of the first end point or the second end point on the X axis as a starting point, the X axis being a central line.
Based on the second aspect, in a possible design, the mobile unit is specifically configured to divide the rectangle by taking a diagonal line of the rectangle as a dividing line, so as to obtain two triangles; based on the included angles, the triangles are respectively moved, so that the central line of a rectangle formed by the two moved triangles is superposed with the connecting line; and the rectangle formed by the two moved triangles is the moved rectangle.
Based on the second aspect, in a possible design, the filling unit is specifically configured to fill the two moved triangles respectively.
Based on the second aspect, in a possible design, the filling unit is further configured to fill the moved rectangle with a predetermined texture picture.
Based on the second aspect, in one possible design, the apparatus further includes: the system comprises an acquisition unit, a control unit and a control unit, wherein the acquisition unit is used for acquiring a configuration file required by the creation of a UI line control piece; wherein, the configuration file comprises: creating coordinates of the first endpoint and the second endpoint in the coordinate system, wherein the coordinates are required by the UI line control part; and the analysis unit is used for analyzing the configuration file to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory connected to the processor, where a computer program is stored in the memory, and when the computer program is executed by the processor, the electronic device is caused to perform the method of the first aspect.
In a fourth aspect, an embodiment of the present application provides a storage medium, in which a computer program is stored, and when the computer program runs on a computer, the computer is caused to execute the method of the first aspect.
Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a schematic flow chart of a processing method for line segment aliasing provided in an embodiment of the present application.
Fig. 2 is a drawing schematic diagram of a first rectangle provided in the embodiment of the present application.
Fig. 3 is a schematic drawing diagram of a second rectangle provided in the embodiment of the present application.
Fig. 4 is a schematic drawing diagram of a third rectangle provided in the embodiment of the present application.
Fig. 5 is a drawing diagram of a fourth rectangle provided in the embodiment of the present application.
Fig. 6 is a schematic diagram of a rectangle after movement according to an embodiment of the present application.
Fig. 7 is a schematic structural diagram of a processing apparatus for line segment aliasing according to an embodiment of the present application.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Icon: 700-processing means of the line segment aliasing; 710-an angle determination unit; 720-rectangle determination unit; 730-a mobile unit; 740-a filler unit; 800-an electronic device; 801-a processor; 802-a memory; 803 — a communication interface.
Detailed Description
The technical solution in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1, fig. 1 is a flowchart of a method for processing line segment aliasing according to an embodiment of the present application, and the flowchart shown in fig. 1 will be described in detail below, where the method includes the steps of: s11, S12, S13 and S14.
S11: an angle between a connecting line between the first end point and the second end point and a first direction of an X-axis in the coordinate system is determined.
S12: and determining a rectangle with the length of the connecting line and the width of the rectangle as a predetermined width along the first direction by taking the X axis as a central line.
S13: and moving the rectangle based on the included angle so as to enable the center line of the moved rectangle to coincide with the connecting line.
S14: and filling the moved rectangle.
The above method is described in detail below.
Prior to S11, the method further comprises: steps a1 and a 2.
A1: acquiring a configuration file required for creating a User Interface (UI) line control piece; wherein, the configuration file comprises: and creating the coordinates of the first endpoint and the second endpoint in the coordinate system, wherein the coordinates are required by the UI line control.
The coordinate system may be a two-dimensional coordinate system constructed with the upper left corner, the lower left corner, the upper right corner, the lower right corner, the center, or other positions of the electronic device interface for creating the UI line control as the origin.
Wherein, the configuration file may further include: a width of the UI line control.
It is understood that the position and the length of the UI linear control element are determined by the first end point and the second end point. In the prior art, when a UI line control element is created, a straight line connecting line between the first endpoint and the second endpoint is directly used as the shape of the UI line control element, and the position of the straight line connecting line is the position of the UI line control element.
A2: and analyzing the configuration file to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.
And when the configuration file comprises the width of the UI line control, analyzing the configuration file to obtain the width of the UI line control.
S11: and determining an included angle between a connecting line between the first end point and the second end point and a first direction of an X axis in a coordinate system.
The first direction may be a positive direction of the X axis, or may be a negative direction of the X axis.
In practical implementation, after obtaining the coordinates of the first endpoint and the second endpoint in the coordinate system through steps a1 and a2, S11 may be implemented in such a way that, when the abscissa of the first endpoint is less than or equal to the abscissa of the second endpoint and the ordinate of the first endpoint is less than the ordinate of the second endpoint, a vector is constructed with the first endpoint as the starting point and the second endpoint as the ending point
Figure BDA0002518286640000071
Vector quantity
Figure BDA0002518286640000072
The direction of the vector is from the first end point to the second end point, and a vector is determined by taking the first end point as a starting point and the third end point as an end point
Figure BDA0002518286640000073
Wherein the ordinate of the third endpoint is the same as the ordinate of the first endpoint, and the abscissa of the third endpoint is the same as the second endpointThe abscissa of the two endpoints is different, when the first direction is the positive direction of the X axis, the abscissa of the third endpoint is larger than the abscissa of the first endpoint, and when the first direction is the negative direction of the X axis, the abscissa of the third endpoint is smaller than the abscissa of the first endpoint, namely a vector
Figure BDA0002518286640000074
Is directed from the first end point to the third end point, whereby said angle is said vector
Figure BDA0002518286640000075
And the vector
Figure BDA0002518286640000076
Angle phi of the angle is determined by the formula
Figure BDA0002518286640000077
And obtaining the value of the included angle phi.
In other embodiments, the included angle may also be solved by using a sine theorem, and the method of solving the included angle by using a sine method is well known in the art and is not described herein again.
Under the condition that the abscissa of the first endpoint is smaller than the abscissa of the second endpoint and the ordinate of the first endpoint is larger than the ordinate of the second endpoint, a vector is constructed by taking the first endpoint as a starting point and the second endpoint as an end point
Figure BDA0002518286640000078
Vector quantity
Figure BDA0002518286640000079
The direction of the vector is from the first end point to the second end point, and the vector is determined by taking the second end point as a starting point and the fourth end point as an end point
Figure BDA00025182866400000710
Wherein the abscissa of the fourth endpoint is different from the abscissa of the second endpoint, and the ordinate of the fourth endpoint is different from the ordinate of the second endpointAre the same in ordinate, vector
Figure BDA0002518286640000081
The direction of the second end point points to the fourth end point, the first direction is in when the positive direction of the X axis, the abscissa of the fourth end point is greater than the abscissa of the second end point, the first direction is when the negative direction of the X axis, the abscissa of the fourth end point is less than the abscissa of the second end point, therefore, the included angle is the vector
Figure BDA0002518286640000082
And the vector
Figure BDA0002518286640000083
Angle phi of the angle is determined by the formula
Figure BDA0002518286640000084
And obtaining the value of the included angle phi. Wherein, | · | is a modulo operation.
As an implementation manner, when the phenomenon of aliasing of a straight line connecting line between a first end point and a second end point which is drawn in advance is weakened, a two-dimensional coordinate system is constructed by using the upper left corner, the lower left corner, the upper right corner, the lower right corner or other positions of an electronic device interface displaying the straight line connecting line as an origin, it can be understood that after the construction of the two-dimensional coordinate system is completed, coordinates of the first end point and the second end point in the coordinate system can be obtained, and then an included angle between the straight line connecting line and the positive direction of the X axis of the coordinate system can be determined by using the implementation manner, which is not described herein again.
After the angle is determined, step S12 is performed.
S12: and determining a rectangle with the length of the connecting line and the width of the rectangle as a predetermined width along the first direction by taking the X axis as a central line.
Wherein, the predetermined width can be set according to the requirement of a user. Wherein, in the embodiment of the present application, the predetermined width may be 8mm, 1cm, and the like.
When the configuration file includes a width of a line control, the predetermined width is the width of the line control.
When the width of the line control element is not included in the configuration file, the predetermined width may be set according to the user requirement.
As an embodiment, S12 includes: and determining the rectangle with the length of the connecting line and the width of the predetermined width along the first direction by taking the origin of the coordinate system as a starting point and the X axis as a central line.
With the X-axis as the center line of the rectangle, with the origin of the coordinate system as the starting point of the center line, please refer to fig. 2, the first direction is the positive direction of the X-axis, according to the predetermined width, it is determined that the abscissa of the vertex of the lower left corner of the rectangle is zero, the ordinate is a negative value, and the absolute value of the ordinate is one half of the value of the predetermined width, according to the length of the connection line between the first endpoint and the second endpoint, the coordinate of the vertex of the lower right corner of the rectangle is determined along the first direction, the abscissa of the vertex of the lower right corner of the rectangle is a positive number, and the absolute value of the abscissa of the vertex of the lower right corner of the rectangle is the same as the length of the connection line, the ordinate of the vertex of the lower right corner is the same as the ordinate of the vertex of the lower left corner, the abscissa of the vertex of the upper left corner of the rectangle is zero, and the absolute value of the width is one half of the predetermined width, the abscissa of the vertex of the upper right corner of the rectangle is the same as the abscissa of the vertex of the lower right corner, and the ordinate of the vertex of the upper right corner of the rectangle is the same as the ordinate of the upper left corner of the rectangle.
Referring to fig. 3, the first direction is an X-axis negative direction, according to the predetermined width, it is determined that an abscissa of a vertex of a lower right corner of the rectangle is zero, an ordinate is a negative value, and an absolute value of the ordinate is one half of a value of the predetermined width, according to a length of a connection line between the first endpoint and the second endpoint, it is determined that a coordinate of the vertex of the lower left corner of the rectangle is along the first direction, the abscissa of the vertex of the lower left corner of the rectangle is a negative number, the absolute value of the abscissa of the vertex of the lower left corner of the rectangle is the same as the length of the connection line, the ordinate of the vertex of the lower left corner is the same as the ordinate of the lower right corner, the abscissa of the vertex of the upper right corner of the rectangle is zero, the ordinate is a positive number, and the absolute value thereof is one half of the value of the predetermined width, the abscissa of the vertex of the lower left corner of the rectangle is the same as the abscissa of the, and the ordinate of the vertex at the upper left corner of the rectangle is the same as the ordinate of the vertex at the upper right corner of the rectangle.
As an embodiment, S12 includes: and determining the rectangle with the length of the connecting line and the width of the predetermined width along the first direction by taking the projection coordinate of the first end point or the second end point on the X axis as a starting point and the X axis as a central line.
With the X axis as a center line of the rectangle, the first direction as a positive X axis direction, and the included angle as an acute angle or an obtuse angle, please refer to fig. 4, determine an end point with a small absolute value of an abscissa from the first end point and the second end point, determine a projection coordinate of the end point with the small absolute value of the abscissa on the X axis as a start point of the center line according to the predetermined width, determine a projection coordinate of the end point with the small absolute value of the abscissa on the X axis as an abscissa of a lower left corner vertex of the rectangle, determine a negative ordinate of the ordinate, and determine a coordinate of a lower right corner vertex of the rectangle along the first direction according to a length of a connection line between the first end point and the second end point, the abscissa of the lower right corner vertex of the rectangle being greater than the abscissa of the lower left corner vertex, and the absolute value of the difference between the abscissa of the vertex of the lower right corner of the rectangle and the abscissa of the vertex of the lower left corner is the same as the length of the connecting line, the ordinate of the vertex of the lower right corner is the same as the ordinate of the vertex of the lower left corner, the abscissa of the vertex of the upper left corner of the rectangle is the same as the abscissa of the vertex of the lower left corner of the rectangle, the ordinate is a positive number, the absolute value of the ordinate is one half of the value of the predetermined width, the abscissa of the vertex of the upper right corner of the rectangle is the same as the abscissa of the vertex of the lower right corner, and the ordinate of the vertex of the upper right corner of the rectangle is the same as the ordinate of the upper left corner of the rectangle.
With the X axis as a center line of the rectangle, the first direction as a negative X axis, and the included angle as an acute angle or an obtuse angle, please refer to fig. 5, determine an end point with a small absolute value of an abscissa from the first end point and the second end point, determine a projection coordinate of the end point with the small absolute value of the abscissa on the X axis as a start point of the center line, according to the predetermined width, determine a projection coordinate of an end point with a small absolute value of the abscissa on the X axis, a vertical coordinate is a negative value, and an absolute value of the vertical coordinate is one half of a value of the predetermined width, determine a coordinate of a left lower corner vertex of the rectangle along the first direction according to a length of a connection line between the first end point and the second end point, the abscissa of the left lower corner vertex of the rectangle is smaller than the abscissa of the right lower corner vertex, and the absolute value of the difference between the abscissa of the vertex of the lower left corner of the rectangle and the abscissa of the vertex of the lower right corner is the same as the length of the connecting line, the ordinate of the vertex of the lower left corner is the same as the ordinate of the vertex of the lower right corner, the abscissa of the vertex of the upper right corner of the rectangle is the same as the abscissa of the vertex of the lower right corner of the rectangle, the ordinate is a positive number, the absolute value of the ordinate is one half of the value of the predetermined width, the abscissa of the vertex of the upper left corner of the rectangle is the same as the abscissa of the vertex of the lower left corner, and the ordinate of the vertex of the upper left corner of the rectangle is the same as the ordinate of the upper right corner of the rectangle.
S13: and moving the rectangle based on the included angle so as to enable the center line of the moved rectangle to coincide with the connecting line.
And rotating and translating each vertex and each edge of the rectangle based on the included angle and the first direction so as to enable the central line of the rectangle determined by each vertex after movement or the rectangle after movement to coincide with the connecting line.
Or rotating and translating each vertex of the rectangle to enable the central line of the rectangle determined by each vertex after movement or the rectangle after movement to be coincident with the connecting line.
As a value, the translation includes translation in one, two or more directions of up, down, left and right directions. When the path length of the translation is zero, the translation is not used for characterization.
Referring to fig. 6, when the first direction is a positive direction of the X axis and the rotation direction of each vertex of the rectangle is a counterclockwise direction, the rotation angle of the rectangle is the same as the included angle; and when the rotating direction of each vertex of the rectangle is clockwise, the rotating angle of the rectangle is 360 degrees and the difference value of the included angle.
When the first direction is the negative direction of the X axis and the rotating direction of each vertex of the rectangle is the clockwise direction, the rotating angle of the rectangle is the same as the included angle; when the rotating direction of each vertex of the rectangle is the anticlockwise direction, the rotating angle of the rectangle is 360 degrees and the difference value of the included angle.
As an embodiment, S13 includes steps B1 and B2.
B1: and dividing the rectangle by taking the diagonal line of the rectangle as a dividing line to obtain two triangles.
It will be appreciated that the common side of the two triangles is the diagonal.
B2: based on the included angles, the triangles are respectively moved, so that the central line of a rectangle formed by the two moved triangles is superposed with the connecting line; and the rectangle formed by the two moved triangles is the moved rectangle.
The specific implementation of B2 is the same as S13, and therefore, the detailed description thereof is omitted here.
S14: and filling the moved rectangle.
As an embodiment, S14 includes: and filling the moved rectangle by using a predetermined texture picture.
As an embodiment, S14 includes: the moved rectangle may be filled with a predetermined fill color.
Wherein the predetermined fill color may be one or more of black, red, green, etc.
As an embodiment, if the moved rectangle is composed of two triangles, S14 includes: and filling the two moved triangles respectively.
As an embodiment, if the rectangle is drawn in step S12, the rectangle may be filled in before the rectangle is moved.
Referring to fig. 7, fig. 7 is a block diagram illustrating a processing apparatus 700 for processing line segment aliasing according to an embodiment of the present application. The block diagram of the structure shown in fig. 7 will be explained, and the illustrated apparatus includes:
the angle determining unit 710 is configured to determine an angle between a connection line between the first endpoint and the second endpoint and a first direction of an X-axis in the coordinate system.
A rectangle determining unit 720, configured to determine, along the first direction, a rectangle with a length equal to the length of the connection line and a width equal to a predetermined width, with the X axis as a center line.
And a moving unit 730, configured to move the rectangle based on the included angle, so that a center line of the moved rectangle coincides with the connection line.
A filling unit 740, configured to fill the moved rectangle.
In an embodiment, the rectangle determining unit 720 is specifically configured to determine the rectangle with a length equal to the length of the connection line and a width equal to a predetermined width along the first direction, with an origin of the coordinate system as a starting point and the X axis as a central line.
In an embodiment, the rectangle determining unit 720 is further configured to determine the rectangle with a length equal to the length of the connection line and a width equal to a predetermined width along the first direction, with a projection coordinate of the first end point or the second end point on the X axis as a starting point, and the X axis as a central line.
As an embodiment, the moving unit 730 is specifically configured to divide the rectangle by taking a diagonal line of the rectangle as a dividing line to obtain two triangles; based on the included angles, the triangles are respectively moved, so that the central line of a rectangle formed by the two moved triangles is superposed with the connecting line; and the rectangle formed by the two moved triangles is the moved rectangle.
As an embodiment, the filling unit 740 is specifically configured to fill the two moved triangles respectively.
In an embodiment, the filling unit 740 is further configured to fill the moved rectangle with a predetermined texture picture.
As an embodiment, the apparatus further comprises: the system comprises an acquisition unit, a control unit and a control unit, wherein the acquisition unit is used for acquiring a configuration file required by the creation of a UI line control piece; wherein, the configuration file comprises: creating coordinates of the first endpoint and the second endpoint in the coordinate system, wherein the coordinates are required by the UI line control part; and the analysis unit is used for analyzing the configuration file to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.
For the process of implementing each function by each functional unit in this embodiment, please refer to the content described in the embodiments shown in fig. 1 to 6, which is not described herein again.
Referring to fig. 8, an embodiment of the present application provides a schematic structural diagram of an electronic device 800, where the electronic device 800 may be a server in the above embodiments, and the electronic device 800 may be a Personal Computer (PC), a tablet PC, a smart phone, a Personal Digital Assistant (PDA), or the like.
The electronic device 800 may include: memory 802, processes 801, communication interface 803, and a communication bus to enable connection communications of these components.
The Memory 802 is used for storing various data such as a computer program instruction corresponding to the method and the apparatus for processing a line segment aliasing provided in the embodiment of the present application, where the Memory 802 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 801 is configured to read and run computer program instructions corresponding to the processing method and apparatus for aliasing a line segment stored in the memory, so as to determine an included angle between a connection line between the first endpoint and the second endpoint and a first direction of an X axis in a coordinate system; determining a rectangle with a length of the connecting line and a width of a predetermined width along the first direction by taking the X axis as a central line; based on the included angle, moving the rectangle to enable the center line of the moved rectangle to be overlapped with the connecting line; and filling the moved rectangle.
The processor 801 may be an integrated circuit chip having signal processing capabilities. The Processor 801 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
A communication interface 803 for receiving or transmitting data.
In addition, a storage medium is provided in an embodiment of the present application, and a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer is caused to execute the method provided in any embodiment of the present application.
To sum up, the processing method, device, electronic equipment and storage medium of line segment aliasing that this application each embodiment provided after determining the line between first endpoint and the second endpoint and the contained angle of the first direction of the X axle in the coordinate system, with the X axle is the central line, along the simple quick length of confirming of first direction does the length of line, width are four summits of predetermined width rectangle, then based on the contained angle, will the rectangle removes to make the central line of the rectangle after removing with the line coincidence, in order to guarantee the length, position and the shape of the central line of the rectangle after removing with the line keeps unanimous, through right rectangle after removing fills, realizes weakening with lower complexity the line segment aliasing phenomenon between first endpoint and the second endpoint.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based devices that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the 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 (10)

1. A method for processing line segment aliasing, the method comprising:
determining an included angle between a connecting line between the first end point and the second end point and a first direction of an X axis in a coordinate system;
determining a rectangle with a length of the connecting line and a width of a predetermined width along the first direction by taking the X axis as a central line;
based on the included angle, moving the rectangle to enable the center line of the moved rectangle to be overlapped with the connecting line;
and filling the moved rectangle.
2. The method of claim 1, wherein said determining a rectangle having a length of the line and a predetermined width along the first direction with the X-axis as the center line comprises:
and determining the rectangle with the length of the connecting line and the width of the predetermined width along the first direction by taking the origin of the coordinate system as a starting point and the X axis as a central line.
3. The method of claim 1, wherein said determining a rectangle having a length of the line and a predetermined width along the first direction with the X-axis as the center line comprises:
and determining the rectangle with the length of the connecting line and the width of the predetermined width along the first direction by taking the projection coordinate of the first end point or the second end point on the X axis as a starting point and the X axis as a central line.
4. The method of claim 1, wherein the moving the rectangle based on the included angle so that a center line of the moved rectangle coincides with the connection line comprises:
dividing the rectangle by taking a diagonal line of the rectangle as a dividing line to obtain two triangles;
based on the included angles, the triangles are respectively moved, so that the central line of a rectangle formed by the two moved triangles is superposed with the connecting line; and the rectangle formed by the two moved triangles is the moved rectangle.
5. The method of claim 4, wherein the filling the moved rectangle comprises:
and filling the two moved triangles respectively.
6. The method of claim 1, wherein the filling the moved rectangle comprises:
and filling the moved rectangle by using a predetermined texture picture.
7. The method of claim 1, wherein prior to 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, the method further comprises:
acquiring a configuration file required by the creation of a UI drive-by-wire element; wherein, the configuration file comprises: creating coordinates of the first endpoint and the second endpoint in the coordinate system, wherein the coordinates are required by the UI line control part;
and analyzing the configuration file to obtain the coordinates of the first endpoint and the second endpoint in the coordinate system.
8. A device for processing a line segment distortion, the device comprising:
the angle determining unit is used for determining an included angle between a connecting line between the first end point and the second end point and a first direction of an X axis in the coordinate system;
a rectangle determining unit, configured to determine, along the first direction, a rectangle with a length equal to the length of the connection line and a width equal to a predetermined width, with the X axis as a center line;
the moving unit is used for moving the rectangle based on the included angle so as to enable the center line of the moved rectangle to be overlapped with the connecting line;
and filling the moved rectangle.
9. An electronic device comprising a memory and a processor, the memory having stored therein computer program instructions that, when read and executed by the processor, perform the method of any of claims 1-7.
10. A storage medium having stored thereon computer program instructions which, when read and executed by a computer, perform the method of any one of claims 1-7.
CN202010487078.6A 2020-06-01 2020-06-01 Processing method and device for line segment aliasing, electronic equipment and storage medium Pending CN111784795A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010487078.6A CN111784795A (en) 2020-06-01 2020-06-01 Processing method and device for line segment aliasing, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010487078.6A CN111784795A (en) 2020-06-01 2020-06-01 Processing method and device for line segment aliasing, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111784795A true CN111784795A (en) 2020-10-16

Family

ID=72754570

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010487078.6A Pending CN111784795A (en) 2020-06-01 2020-06-01 Processing method and device for line segment aliasing, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111784795A (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101465973A (en) * 2008-11-04 2009-06-24 新奥特(北京)视频技术有限公司 Method for rendering subtitling based on curved profile closed loop domain and pixel mask matrix
CN101764938A (en) * 2008-11-04 2010-06-30 新奥特(北京)视频技术有限公司 Edge anti-aliasing processing method based on contour line distance of adjacent four pixels
CN102117501A (en) * 2009-12-31 2011-07-06 厦门高德软件有限公司 Method and device for rendering three-dimensional lines
CN102270351A (en) * 2011-03-17 2011-12-07 长沙景嘉微电子有限公司 Method for implementing line segment partitioning technology in graphic processing unit (GPU) based on partitioning rendering
CN102999930A (en) * 2011-09-15 2013-03-27 汉王科技股份有限公司 Method and device for drawing electronic writing lines
US20170372154A1 (en) * 2016-06-27 2017-12-28 Texas Instruments Incorporated Method and apparatus for avoiding non-aligned loads using multiple copies of input data
CN108416729A (en) * 2018-03-27 2018-08-17 长沙景嘉微电子股份有限公司 A kind of realization device and method of line segment anti-aliasing in GPU
CN108510565A (en) * 2018-03-27 2018-09-07 长沙景嘉微电子股份有限公司 A kind of apparatus and method realized line segment and turn triangle drafting in GPU
CN108519867A (en) * 2018-04-12 2018-09-11 长沙景美集成电路设计有限公司 A kind of device and method for realizing triangle anti-aliasing in GPU
CN109544702A (en) * 2018-11-21 2019-03-29 北京像素软件科技股份有限公司 Three-dimension varying processing method, device, electronic equipment and storage medium
CN110648386A (en) * 2019-07-23 2020-01-03 完美世界(北京)软件科技发展有限公司 Method and system for anti-aliasing of graphics primitives
CN110751713A (en) * 2019-10-18 2020-02-04 长春理工大学 Self-adaptive anti-aliasing method for rendering picture by ray tracing of three-dimensional scene

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101465973A (en) * 2008-11-04 2009-06-24 新奥特(北京)视频技术有限公司 Method for rendering subtitling based on curved profile closed loop domain and pixel mask matrix
CN101764938A (en) * 2008-11-04 2010-06-30 新奥特(北京)视频技术有限公司 Edge anti-aliasing processing method based on contour line distance of adjacent four pixels
CN102117501A (en) * 2009-12-31 2011-07-06 厦门高德软件有限公司 Method and device for rendering three-dimensional lines
CN102270351A (en) * 2011-03-17 2011-12-07 长沙景嘉微电子有限公司 Method for implementing line segment partitioning technology in graphic processing unit (GPU) based on partitioning rendering
CN102999930A (en) * 2011-09-15 2013-03-27 汉王科技股份有限公司 Method and device for drawing electronic writing lines
US20170372154A1 (en) * 2016-06-27 2017-12-28 Texas Instruments Incorporated Method and apparatus for avoiding non-aligned loads using multiple copies of input data
CN108416729A (en) * 2018-03-27 2018-08-17 长沙景嘉微电子股份有限公司 A kind of realization device and method of line segment anti-aliasing in GPU
CN108510565A (en) * 2018-03-27 2018-09-07 长沙景嘉微电子股份有限公司 A kind of apparatus and method realized line segment and turn triangle drafting in GPU
CN108519867A (en) * 2018-04-12 2018-09-11 长沙景美集成电路设计有限公司 A kind of device and method for realizing triangle anti-aliasing in GPU
CN109544702A (en) * 2018-11-21 2019-03-29 北京像素软件科技股份有限公司 Three-dimension varying processing method, device, electronic equipment and storage medium
CN110648386A (en) * 2019-07-23 2020-01-03 完美世界(北京)软件科技发展有限公司 Method and system for anti-aliasing of graphics primitives
CN110751713A (en) * 2019-10-18 2020-02-04 长春理工大学 Self-adaptive anti-aliasing method for rendering picture by ray tracing of three-dimensional scene

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
PO HU;MINLIE HUANG;XIAOYAN ZHU;: "Finding Nuggets in Patent Portfolios: Core Patent Mining and Its Applications", TSINGHUA SCIENCE AND TECHNOLOGY, no. 04, 15 August 2013 (2013-08-15), pages 13 - 26 *
梅洋等: "基于边界反走样算法的地图可视化研究", 《武汉大学学报(信息科学版)》, no. 7, 5 July 2008 (2008-07-05), pages 759 - 761 *

Similar Documents

Publication Publication Date Title
US11842438B2 (en) Method and terminal device for determining occluded area of virtual object
CN108564082B (en) Image processing method, device, server and medium
US11054969B2 (en) Method and device for displaying page of electronic book, and terminal device
US11321822B2 (en) Determining image defects using image comparisons
US9262848B2 (en) Method for stroking paths
CN112184815B (en) Method and device for determining position and posture of panoramic image in three-dimensional model
CN111583381B (en) Game resource map rendering method and device and electronic equipment
CN113126937A (en) Display terminal adjusting method and display terminal
CN112172149B (en) Method, device and equipment for automatically improving printing effect and storage medium
CN115829929A (en) Method, device and equipment for detecting defects of product surface image and storage medium
CN111784695B (en) Method and device for cutting graph, electronic equipment and storage medium
CN112149383B (en) Text real-time layout method based on GPU, electronic device and storage medium
CN111784795A (en) Processing method and device for line segment aliasing, electronic equipment and storage medium
CN117557777A (en) Sample image determining method and device, electronic equipment and storage medium
CN112348025A (en) Character detection method and device, electronic equipment and storage medium
CN110969042B (en) Two-dimensional code identification method and device and hardware device
CN115661493A (en) Object pose determination method and device, equipment and storage medium
CN116263984A (en) Three-dimensional map visualization method and device, electronic equipment and storage medium
CN115375740A (en) Pose determination method, three-dimensional model generation method, device, equipment and medium
CN113902841A (en) Image drawing method and device, electronic equipment and readable storage medium
CN113870190A (en) Vertical line detection method, device, equipment and storage medium
CN112508831A (en) Ultrasonic wide-scene image generation method, device, equipment and storage medium
CN113496134A (en) Two-dimensional code positioning method, device, equipment and storage medium
EP4343679A1 (en) Image processing method and apparatus, and readable storage medium
CN111506842A (en) Page display method and device, electronic equipment and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination