A method and system for displaying a straight line anti-aliasing process in a raster graphics display

By normalizing the straight line to the first quadrant, calculating the slope and ordinate offset, and calculating the grayscale based on the slope and linewidth interpolation coefficient, the problem of jagged edges on straight lines on raster graphics displays is solved, achieving a smooth display effect without affecting positional accuracy.

CN121810836BActive Publication Date: 2026-05-15XIAN AIRCRAFT DESIGN INST OF AVIATION IND OF CHINA +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XIAN AIRCRAFT DESIGN INST OF AVIATION IND OF CHINA
Filing Date
2026-03-11
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Insufficient sampling causes jagged edges on straight lines in raster graphics displays, which existing algorithms such as the DDA algorithm and the Bresenham algorithm cannot effectively eliminate.

Method used

By normalizing the straight line to the first quadrant, calculating the slope and ordinate offset, and calculating the grayscale based on the slope and line width interpolation coefficient, the smooth display of the straight line is achieved.

Benefits of technology

Without increasing computation, jagged edges in line drawing are eliminated, improving display quality without sacrificing positional accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121810836B_ABST
    Figure CN121810836B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of linear anti-aliasing processing display, and particularly relates to a grating graphic display display linear anti-aliasing processing method and system, wherein the grating graphic display display linear anti-aliasing processing method comprises the following steps: step one, normalizing a straight line to a first quadrant and calculating a slope of the straight line; step two, calculating offset amounts of vertical coordinates at starting and ending points of the straight line, and vertical coordinates corresponding to horizontal coordinates of the straight line and line width coordinates; step three, calculating interpolation coefficients based on the slope of the straight line, the offset amounts of the vertical coordinates at the starting and ending points of the straight line, and the vertical coordinates corresponding to the horizontal coordinates of the straight line and the line width coordinates; step four, calculating gray scales at the vertical coordinates corresponding to the horizontal coordinates of the straight line and the line width coordinates based on the interpolation coefficients; and step five, restoring the straight line and displaying according to the corresponding gray scales.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of line anti-aliasing processing display technology, specifically relating to a method and system for line anti-aliasing processing in a raster graphic display. Background Technology

[0002] On a raster graphics display, straight lines are approximated by discrete pixels. Due to insufficient sampling, straight lines on a raster graphics display often exhibit aliasing, meaning the edges of the lines are jagged. This phenomenon is particularly noticeable for lines with a line width of 5 pixels or more.

[0003] The purpose of anti-aliasing is to reduce and eliminate aliasing in graphics, thereby improving the realism of the displayed graphics. Currently, the most commonly used line drawing algorithms are the DDA algorithm and the Bresenham algorithm. These two algorithms either fill or leave unfilled for each discrete pixel, and cannot effectively eliminate aliasing in line display.

[0004] In view of the aforementioned technical deficiencies, this application is hereby filed. Summary of the Invention

[0005] The purpose of this application is to provide a method and system for anti-aliasing processing of straight lines displayed on a raster graphic display, so as to overcome or mitigate at least one of the known technical defects.

[0006] The technical solution of this application is:

[0007] A method for anti-aliasing processing of straight lines displayed on a raster graphics display includes:

[0008] Step 1: Normalize the line to the first quadrant and calculate the slope of the line;

[0009] Step 2: Calculate the offset of the ordinate at the start and end points of the line, as well as the ordinate and line width coordinates corresponding to the abscissa of the line.

[0010] Step 3: Based on the slope of the line, the offset of the ordinate at the start and end points of the line, and the ordinate and line width coordinates corresponding to the abscissa of the line, calculate the interpolation coefficients.

[0011] Step 4: Based on the interpolation coefficients, calculate the gray level at the ordinate and line width coordinates corresponding to the horizontal coordinate of the line.

[0012] Step 5: Restore the straight line and display it according to the corresponding grayscale.

[0013] Optionally, in the above-mentioned raster graphics display method for anti-aliasing of straight lines, in step one, the straight line is normalized to the first quadrant based on the starting coordinates (x1, y1) and ending coordinates (x2, y2) of the line.

[0014] Optionally, in the above-described raster graphics display method for anti-aliasing of straight lines, step one includes:

[0015] S101. Calculate the difference in the horizontal coordinates of the lines, Δx = |x1 - x2|, and calculate the difference in the vertical coordinates of the lines, Δy = |y1 - y2|.

[0016] S102. If △x≥△y, then define deltx=△x, delty=△y, and the length of the horizontal coordinate of the line is x_ref=|[x1]-[x2]|, where [x1] and [x2] are the integers of x1 and x2.

[0017] If △x < △y, then define deltx = △y, delty = △x, and the length of the horizontal coordinate of the line is x_ref = |[y1] - [y2]|, where [y1] and [y2] are the integers of y1 and y2.

[0018] S103. Calculate the slope of the straight line K = delty / deltx.

[0019] Optionally, in the above-mentioned raster graphics display method for anti-aliasing of straight lines, step two includes:

[0020] S201. If △x≥△y and x1≥x2, then calculate the offset of the ordinate at the starting point of the line, dlt_up=x2-[x2], and the offset of the ordinate at the ending point, dlt_down=x1-[x1].

[0021] If △x≥△y and x1<x2, then calculate the offset of the ordinate at the starting point of the line dlt_up= x1-[x1], and the offset of the ordinate at the ending point dlt_down= x2-[x2];

[0022] If △x < △y and y1 ≥ y2, then calculate the offset of the ordinate at the starting point of the line dlt_up = y2 - [y2] and the offset of the ordinate at the ending point dlt_down = y1 - [y1].

[0023] If △x < △y and y1 < y2, then calculate the offset of the ordinate at the starting point of the line, dlt_up = y1 - [y1], and the offset of the ordinate at the ending point, dlt_down = y2 - [y2].

[0024] S202. Calculate the ordinate corresponding to the x-coordinate of the line:

[0025] ;

[0026] Where x and y are the x-coordinate and y-coordinate of the line;

[0027] S203. Calculate the line width coordinates y+1, y+2, ..., y+m-2 corresponding to the horizontal coordinate of the line, where m is the number of pixels of the line width, and m>5.

[0028] Optionally, in the above-mentioned raster graphics display method for anti-aliasing of straight lines, step three specifically includes:

[0029] ;

[0030] ;

[0031] ;

[0032] ;

[0033] ;

[0034] in,

[0035] f(x,y) is the interpolation coefficient at the ordinate y corresponding to the x-coordinate of the line;

[0036] f(x,y+1), f(x,y+n-4), f(x,y+m-3), and f(x,y+m-2) are the interpolation coefficients at the line width coordinates y+1, y+n-4, y+m-3, and y+m-2 corresponding to the x-coordinate of the line, where n>5 and n≤m.

[0037] Optionally, in the above-mentioned raster graphics display method for anti-aliasing of straight lines, step four specifically includes:

[0038] The grayscale value at the corresponding ordinate and linewidth coordinates of the horizontal axis of the line is obtained by multiplying the interpolation coefficients at the corresponding ordinate and linewidth coordinates of the display by the highest grayscale value of the display.

[0039] Optionally, in the above-mentioned raster graphics display method for anti-aliasing of straight lines, step five includes:

[0040] If △x≥△y, and x2≥x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y;

[0041] If △x < △y, and x2 ≥ x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] - [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y;

[0042] If △x≥△y, and x2<x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y;

[0043] If △x < △y, and x2 < x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y;

[0044] If △x < △y, and x2 ≥ x1, y2 < y1, then the x-coordinate of the line is restored to [x1] - [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y;

[0045] If △x≥△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y;

[0046] If △x≥△y, and x2<x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y;

[0047] If △x < △y, and x2 < x1, y2 < y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y.

[0048] A raster graphics display line anti-aliasing processing system is provided to implement the above-mentioned raster graphics display line anti-aliasing processing method, comprising:

[0049] Line normalization and slope calculation module: used to normalize lines to the first quadrant and calculate the slope of lines;

[0050] Line offset and longitudinal calculation module: used to calculate the offset of the ordinate at the start and end points of a line, as well as the ordinate and line width coordinates corresponding to the abscissa of the line;

[0051] Linear interpolation coefficient calculation module: used to calculate interpolation coefficients based on the slope of a line, the offset of the ordinate at the start and end points of the line, and the ordinate and line width coordinates corresponding to the abscissa of the line.

[0052] Linear grayscale calculation module: used to calculate the grayscale at the ordinate and line width coordinates corresponding to the horizontal coordinate of a straight line based on interpolation coefficients;

[0053] Line restoration and display module: used to restore the line and display it according to the corresponding grayscale.

[0054] Optionally, in the above-mentioned raster graphics display line anti-aliasing processing system, the line normalization and slope calculation module normalizes the line to the first quadrant based on the starting coordinates (x1, y1) and ending coordinates (x2, y2) of the line drawing.

[0055] Optionally, in the above-mentioned raster graphics display line anti-aliasing processing system, the line normalization and slope calculation module includes:

[0056] S101. Calculate the difference in the horizontal coordinates of the lines, Δx = |x1 - x2|, and calculate the difference in the vertical coordinates of the lines, Δy = |y1 - y2|.

[0057] S102. If △x≥△y, then define deltx=△x, delty=△y, and the length of the horizontal coordinate of the line is x_ref=|[x1]-[x2]|, where [x1] and [x2] are the integers of x1 and x2.

[0058] If △x < △y, then define deltx = △y, delty = △x, and the length of the horizontal coordinate of the line is x_ref = |[y1] - [y2]|, where [y1] and [y2] are the integers of y1 and y2.

[0059] S103. Calculate the slope of the straight line K = delty / deltx.

[0060] Optionally, in the above-mentioned raster graphics display system for line anti-aliasing processing, the line offset and longitudinal calculation module includes:

[0061] S201. If △x≥△y and x1≥x2, then calculate the offset of the ordinate at the starting point of the line, dlt_up=x2-[x2], and the offset of the ordinate at the ending point, dlt_down=x1-[x1].

[0062] If △x≥△y and x1<x2, then calculate the offset of the ordinate at the starting point of the line dlt_up= x1-[x1], and the offset of the ordinate at the ending point dlt_down= x2-[x2];

[0063] If △x < △y and y1 ≥ y2, then calculate the offset of the ordinate at the starting point of the line dlt_up = y2 - [y2] and the offset of the ordinate at the ending point dlt_down = y1 - [y1].

[0064] If △x < △y and y1 < y2, then calculate the offset of the ordinate at the starting point of the line, dlt_up = y1 - [y1], and the offset of the ordinate at the ending point, dlt_down = y2 - [y2].

[0065] S202. Calculate the ordinate corresponding to the x-coordinate of the line:

[0066] ;

[0067] Where x and y are the x-coordinate and y-coordinate of the line;

[0068] S203. Calculate the line width coordinates y+1, y+2, ..., y+m-2 corresponding to the horizontal coordinate of the line, where m is the number of pixels of the line width, and m>5.

[0069] Optionally, in the above-mentioned raster graphics display system for linear anti-aliasing processing, the linear interpolation coefficient calculation module includes:

[0070] ;

[0071] ;

[0072] ;

[0073] ;

[0074] ;

[0075] in,

[0076] f(x,y) is the interpolation coefficient at the ordinate y corresponding to the x-coordinate of the line;

[0077] f(x,y+1), f(x,y+n-4), f(x,y+m-3), and f(x,y+m-2) are the interpolation coefficients at the line width coordinates y+1, y+n-4, y+m-3, and y+m-2 corresponding to the x-coordinate of the line, where n>5 and n≤m.

[0078] Optionally, in the above-mentioned raster graphic display line anti-aliasing processing system, the line grayscale calculation module multiplies the interpolation coefficients at the vertical and line width coordinates corresponding to the horizontal coordinate of the line by the highest grayscale of the display to obtain the grayscale at the vertical and line width coordinates corresponding to the horizontal coordinate of the line.

[0079] Optionally, in the above-mentioned raster graphic display line anti-aliasing processing system, the line restoration and display module includes:

[0080] If △x≥△y, and x2≥x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y;

[0081] If △x < △y, and x2 ≥ x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] - [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y;

[0082] If △x≥△y, and x2<x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y;

[0083] If △x < △y, and x2 < x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y;

[0084] If △x<△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]-[(m-4) / 2]+x, and the y-coordinate is restored to [y1]+y;

[0085] If △x≥△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y;

[0086] If △x≥△y, and x2<x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y;

[0087] If △x < △y, and x2 < x1, y2 < y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y.

[0088] This application has at least the following beneficial technical effects:

[0089] This paper provides a method and system for anti-aliasing processing of straight lines displayed on a raster graphics display. Through a series of steps such as coordinate normalization, calculation of interpolation coefficients based on slope and line width, grayscale calculation, and coordinate restoration, the method eliminates the jagged edges of the drawn straight lines without increasing the amount of computation. This can improve the display effect of straight lines without sacrificing positional accuracy. Attached Figure Description

[0090] Figure 1 This is a schematic diagram of the raster graphics display line anti-aliasing processing method provided in the embodiments of this application;

[0091] Figure 2 This is a schematic diagram of a raster graphic display system for displaying line anti-aliasing processing, provided in an embodiment of this application.

[0092] To better illustrate this embodiment, some content in the accompanying drawings may be omitted, enlarged, or reduced. They are for illustrative purposes only and should not be construed as limiting the scope of this application. Detailed Implementation

[0093] To make the technical solution and advantages of this application clearer, the technical solution of this application will be described in a clearer and more complete manner below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only some embodiments of this application, and are only used to explain this application, not to limit this application. It should be noted that, for ease of description, only the parts related to this application are shown in the accompanying drawings, and other related parts can be referred to the general design.

[0094] Furthermore, unless otherwise defined, the technical or scientific terms used in this application description shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The word "comprising" as used in this application description indicates that the concept preceding the word encompasses the concepts listed following the word and their equivalents, without excluding other related concepts.

[0095] A method for anti-aliasing processing of straight lines displayed on a raster graphics display, such as... Figure 1 As shown.

[0096] Step 1: Normalize the line to the first quadrant and calculate the slope of the line to simplify the subsequent calculation logic.

[0097] Based on the starting coordinates (x1, y1) and ending coordinates (x2, y2) of the line, normalize the line to the first quadrant.

[0098] S101. Calculate the difference in the horizontal coordinates of the lines, Δx = |x1 - x2|, and calculate the difference in the vertical coordinates of the lines, Δy = |y1 - y2|.

[0099] S102. If △x≥△y, then define deltx=△x, delty=△y, and the length of the horizontal coordinate of the line is x_ref=|[x1]-[x2]|, where [x1] and [x2] are the integers of x1 and x2.

[0100] If △x < △y, then define deltx = △y and delty = △x. The length of the horizontal coordinate of the line is x_ref = |[y1] - [y2]|, where [y1] and [y2] are the integers of y1 and y2.

[0101] S103. Calculate the slope of the straight line K = delty / deltx.

[0102] Step 2: Calculate the offset of the ordinate at the start and end points of the line, as well as the ordinate and line width coordinates corresponding to the abscissa of the line, to ensure the accuracy of the line drawing.

[0103] S201. If △x≥△y and x1≥x2, then calculate the offset of the ordinate at the starting point of the line dlt_up=x2-[x2] and the offset of the ordinate at the ending point dlt_down=x1-[x1];

[0104] If △x≥△y and x1<x2, then calculate the offset of the ordinate at the starting point of the line dlt_up= x1-[x1], and the offset of the ordinate at the ending point dlt_down= x2-[x2];

[0105] If △x < △y and y1 ≥ y2, then calculate the offset of the ordinate at the starting point of the line, dlt_up = y2 - [y2], and the offset of the ordinate at the ending point, dlt_down = y1 - [y1].

[0106] If △x < △y and y1 < y2, then calculate the offset of the ordinate at the starting point of the line, dlt_up = y1 - [y1], and the offset of the ordinate at the ending point, dlt_down = y2 - [y2].

[0107] S202. Calculate the ordinate corresponding to the x-coordinate of the line:

[0108] ;

[0109] Where x and y are the x-coordinate and y-coordinate of the line.

[0110] S203. Calculate the line width coordinates y+1, y+2, ..., y+m-2 corresponding to the horizontal coordinate of the line, where m is the number of pixels of the line width, and m>5.

[0111] Step 3: Calculate the interpolation coefficients based on the slope of the line, the offset of the ordinates at the start and end points of the line, and the ordinates and line width coordinates corresponding to the abscissa of the line.

[0112] ;

[0113] ;

[0114] ;

[0115] ;

[0116] ;

[0117] in,

[0118] f(x,y) is the interpolation coefficient at the ordinate y corresponding to the x-coordinate of the line;

[0119] f(x,y+1), f(x,y+n-4), f(x,y+m-3), and f(x,y+m-2) are the interpolation coefficients at the line width coordinates y+1, y+n-4, y+m-3, and y+m-2 corresponding to the x-coordinate of the line, where n>5 and n≤m.

[0120] Step 4: Based on the interpolation coefficients, calculate the grayscale at the ordinate and line width coordinates corresponding to the horizontal coordinate of the line. Assign weight coefficients to the multiple columns of pixels of the line, which gradually change from near to far, laying the foundation for generating a smooth transition grayscale effect.

[0121] The grayscale value at the corresponding ordinate and linewidth coordinates of the horizontal axis of the line is obtained by multiplying the interpolation coefficients at the corresponding ordinate and linewidth coordinates of the display by the highest grayscale value of the display.

[0122] Step 5: Restore the straight line to obtain the pixel position in the actual display coordinates, and display it according to the corresponding gray level to make the pixels at the edge of the straight line present a smooth gray level transition and eliminate the jaggedness.

[0123] If △x≥△y, and x2≥x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y;

[0124] If △x < △y, and x2 ≥ x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] - [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y;

[0125] If △x≥△y, and x2<x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y;

[0126] If △x < △y, and x2 < x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y;

[0127] If △x<△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]-[(m-4) / 2]+x, and the y-coordinate is restored to [y1]+y;

[0128] If △x≥△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y;

[0129] If △x≥△y, and x2<x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y;

[0130] If △x < △y, and x2 < x1, y2 < y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y.

[0131] The raster graphics display anti-aliasing method for lines disclosed in the above embodiments establishes a recursive formula based on the starting and ending coordinates of the line drawing. Through a series of steps such as coordinate normalization, calculation of interpolation coefficients based on slope and line width, grayscale calculation, and coordinate restoration, the edge jaggedness of the line drawing is eliminated without increasing a large amount of computation. It is an efficient anti-aliasing method for lines that does not lose positional accuracy. It can improve the display effect of lines without losing positional accuracy and is applicable to programmable logic devices such as FPGAs.

[0132] A raster graphic display shows a linear anti-aliasing processing system, such as Figure 2 As shown, a method for implementing anti-aliasing processing of straight lines in a raster graphics display includes:

[0133] Line normalization and slope calculation module: used to normalize lines to the first quadrant and calculate the slope of lines;

[0134] Line offset and longitudinal calculation module: used to calculate the offset of the ordinate at the start and end points of a line, as well as the ordinate and line width coordinates corresponding to the abscissa of the line;

[0135] Linear interpolation coefficient calculation module: used to calculate interpolation coefficients based on the slope of a line, the offset of the ordinate at the start and end points of the line, and the ordinate and line width coordinates corresponding to the abscissa of the line.

[0136] Linear grayscale calculation module: used to calculate the grayscale at the ordinate and line width coordinates corresponding to the horizontal coordinate of a straight line based on interpolation coefficients;

[0137] Line restoration and display module: used to restore the line and display it according to the corresponding grayscale.

[0138] In the line normalization and slope calculation module, the line is normalized to the first quadrant based on the starting coordinates (x1, y1) and ending coordinates (x2, y2) of the line.

[0139] The module for normalizing lines and calculating slope includes:

[0140] S101. Calculate the difference in the horizontal coordinates of the lines, Δx = |x1 - x2|, and calculate the difference in the vertical coordinates of the lines, Δy = |y1 - y2|.

[0141] S102. If △x≥△y, then define deltx=△x, delty=△y, and the length of the horizontal coordinate of the line is x_ref=|[x1]-[x2]|, where [x1] and [x2] are the integers of x1 and x2.

[0142] If △x < △y, then define deltx = △y, delty = △x, and the length of the horizontal coordinate of the line is x_ref = |[y1] - [y2]|, where [y1] and [y2] are the integers of y1 and y2.

[0143] S103. Calculate the slope of the straight line K = delty / deltx.

[0144] The linear offset and longitudinal calculation module includes:

[0145] S201. If △x≥△y and x1≥x2, then calculate the offset of the ordinate at the starting point of the line dlt_up=x2-[x2] and the offset of the ordinate at the ending point dlt_down=x1-[x1];

[0146] If △x≥△y and x1<x2, then calculate the offset of the ordinate at the starting point of the line dlt_up= x1-[x1], and the offset of the ordinate at the ending point dlt_down= x2-[x2];

[0147] If △x < △y and y1 ≥ y2, then calculate the offset of the ordinate at the starting point of the line, dlt_up = y2 - [y2], and the offset of the ordinate at the ending point, dlt_down = y1 - [y1].

[0148] If △x < △y and y1 < y2, then calculate the offset of the ordinate at the starting point of the line, dlt_up = y1 - [y1], and the offset of the ordinate at the ending point, dlt_down = y2 - [y2].

[0149] S202. Calculate the ordinate corresponding to the x-coordinate of the line:

[0150] ;

[0151] Where x and y are the x-coordinate and y-coordinate of the line;

[0152] S203. Calculate the line width coordinates y+1, y+2, ..., y+m-2 corresponding to the horizontal coordinate of the line, where m is the number of pixels of the line width, and m>5.

[0153] The linear interpolation coefficient calculation module includes:

[0154] ;

[0155] ;

[0156] ;

[0157] ;

[0158] ;

[0159] in,

[0160] f(x,y) is the interpolation coefficient at the ordinate y corresponding to the x-coordinate of the line;

[0161] f(x,y+1), f(x,y+n-4), f(x,y+m-3), and f(x,y+m-2) are the interpolation coefficients at the line width coordinates y+1, y+n-4, y+m-3, and y+m-2 corresponding to the x-coordinate of the line, where n>5 and n≤m.

[0162] In the linear grayscale calculation module, the interpolation coefficients at the ordinate and line width coordinates corresponding to the horizontal coordinate of the line are multiplied by the highest grayscale of the display to obtain the grayscale at the ordinate and line width coordinates corresponding to the horizontal coordinate of the line.

[0163] The line restoration and display module includes:

[0164] If △x≥△y, and x2≥x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y;

[0165] If △x < △y, and x2 ≥ x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] - [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y;

[0166] If △x≥△y, and x2<x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y;

[0167] If △x < △y, and x2 < x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y;

[0168] If △x<△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]-[(m-4) / 2]+x, and the y-coordinate is restored to [y1]+y;

[0169] If △x≥△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y;

[0170] If △x≥△y, and x2<x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y;

[0171] If △x < △y, and x2 < x1, y2 < y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y.

[0172] The raster graphic display line anti-aliasing processing system disclosed in the above embodiments is described in a relatively simple manner since it corresponds to the raster graphic display line anti-aliasing processing method disclosed in the above embodiments. For specific details, please refer to the relevant description of the raster graphic display line anti-aliasing processing method section. Its technical effects can also be referred to the technical effects of the relevant parts of the raster graphic display line anti-aliasing processing method section, and will not be repeated here.

[0173] Furthermore, those skilled in the art should recognize that the various modules of the raster graphic display line anti-aliasing processing system disclosed in the embodiments of this application can be implemented by electronic hardware, computer software, or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, they are generally described in terms of function in this application. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can choose different methods to implement the described functions for each specific application and its actual constraints, but such implementation should not be considered to be beyond the scope of this application.

[0174] The technical solution of this application has been described in conjunction with the preferred embodiments shown in the accompanying drawings. Those skilled in the art should understand that the scope of protection of this application is obviously not limited to these specific embodiments. Without departing from the principles of this application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of this application.

Claims

1. A method for anti-aliasing processing of straight lines displayed on a raster graphic display, characterized in that, include: Step 1: Normalize the line to the first quadrant and calculate the slope of the line; Step 2: Calculate the offset of the ordinate at the start and end points of the line, as well as the ordinate and line width coordinates corresponding to the abscissa of the line. Step 3: Based on the slope of the line, the offset of the ordinate at the start and end points of the line, and the ordinate and line width coordinates corresponding to the abscissa of the line, calculate the interpolation coefficients. Step 4: Based on the interpolation coefficients, calculate the gray level at the ordinate and line width coordinates corresponding to the horizontal coordinate of the line. Step 5: Restore the straight line and display it according to the corresponding grayscale. Step three specifically involves: ; ; ; ; ; in, f(x,y) is the interpolation coefficient at the ordinate y corresponding to the x-coordinate of the line; f(x,y+1), f(x,y+n-4), f(x,y+m-3), and f(x,y+m-2) are the interpolation coefficients at the line width coordinates y+1, y+n-4, y+m-3, and y+m-2 corresponding to the x-coordinate of the line, where n>5 and n≤m, and m is the number of pixels of the line width, m>5. k is the slope of the line; dlt_up is the offset of the y-coordinate at the starting point of the line; dlt_down is the offset of the y-coordinate at the end of the line; x_ref is the length of the horizontal coordinate of the line being drawn.

2. The method for anti-aliasing of straight lines displayed on a raster graphic display according to claim 1, characterized in that, In step one, the line is normalized to the first quadrant based on the starting coordinates (x1, y1) and ending coordinates (x2, y2) of the line.

3. The method for anti-aliasing of straight lines displayed on a raster graphic display according to claim 2, characterized in that, Step one includes: S101. Calculate the difference in the horizontal coordinates of the lines, Δx = |x1 - x2|, and calculate the difference in the vertical coordinates of the lines, Δy = |y1 - y2|. S102. If △x≥△y, then define deltx=△x, delty=△y, and the length of the horizontal coordinate of the line is x_ref=|[x1]-[x2]|, where [x1] and [x2] are the integers of x1 and x2. If △x < △y, then define deltx = △y, delty = △x, and the length of the horizontal coordinate of the line is x_ref = |[y1] - [y2]|, where [y1] and [y2] are the integers of y1 and y2. S103. Calculate the slope of the straight line k = delty / deltx.

4. The method for anti-aliasing of straight lines displayed on a raster graphic display according to claim 3, characterized in that, Step two includes: S201. If △x≥△y and x1≥x2, then calculate the offset of the ordinate at the starting point of the line, dlt_up=x2-[x2], and the offset of the ordinate at the ending point, dlt_down=x1-[x1]. If △x≥△y and x1<x2, then calculate the offset of the ordinate at the starting point of the line dlt_up= x1-[x1], and the offset of the ordinate at the ending point dlt_down= x2-[x2]; If △x < △y and y1 ≥ y2, then calculate the offset of the ordinate at the starting point of the line dlt_up = y2 - [y2] and the offset of the ordinate at the ending point dlt_down = y1 - [y1]. If △x < △y and y1 < y2, then calculate the offset of the ordinate at the starting point of the line, dlt_up = y1 - [y1], and the offset of the ordinate at the ending point, dlt_down = y2 - [y2]. S202. Calculate the ordinate corresponding to the x-coordinate of the line: ; Where x and y are the x-coordinate and y-coordinate of the line; S203. Calculate the line width coordinates y+1, y+2, ..., y+m-2 corresponding to the x-coordinate of the line.

5. The method for anti-aliasing of straight lines displayed on a raster graphic display according to claim 4, characterized in that, Step four is as follows: The grayscale value at the corresponding ordinate and linewidth coordinates of the horizontal axis of the line is obtained by multiplying the interpolation coefficients at the corresponding ordinate and linewidth coordinates of the display by the highest grayscale value of the display.

6. The method for anti-aliasing of straight lines displayed on a raster graphic display according to claim 5, characterized in that, In step five: If △x≥△y, and x2≥x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y; If △x < △y, and x2 ≥ x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] - [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y; If △x≥△y, and x2<x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y; If △x < △y, and x2 < x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y; If △x<△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]-[(m-4) / 2]+x, and the y-coordinate is restored to [y1]+y; If △x≥△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y; If △x≥△y, and x2<x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y; If △x < △y, and x2 < x1, y2 < y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y.

7. A raster graphic display line anti-aliasing processing system, used to implement the raster graphic display line anti-aliasing processing method of claim 1, comprising: Line normalization and slope calculation module: used to normalize lines to the first quadrant and calculate the slope of lines; Line offset and longitudinal calculation module: used to calculate the offset of the ordinate at the start and end points of a line, as well as the ordinate and line width coordinates corresponding to the abscissa of the line; Linear interpolation coefficient calculation module: used to calculate interpolation coefficients based on the slope of a line, the offset of the ordinate at the start and end points of the line, and the ordinate and line width coordinates corresponding to the abscissa of the line. Linear grayscale calculation module: used to calculate the grayscale at the ordinate and line width coordinates corresponding to the horizontal coordinate of a straight line based on interpolation coefficients; Line restoration and display module: used to restore the line and display it according to the corresponding grayscale; The linear interpolation coefficient calculation module includes: ; ; ; ; ; in, f(x,y) is the interpolation coefficient at the ordinate y corresponding to the x-coordinate of the line; f(x,y+1), f(x,y+n-4), f(x,y+m-3), and f(x,y+m-2) are the interpolation coefficients at the line width coordinates y+1, y+n-4, y+m-3, and y+m-2 corresponding to the x-coordinate of the line, where n>5 and n≤m, and m is the number of pixels of the line width, m>5. k is the slope of the line; dlt_up is the offset of the y-coordinate at the starting point of the line; dlt_down is the offset of the y-coordinate at the end of the line; x_ref is the length of the horizontal coordinate of the line being drawn.

8. The raster graphic display line anti-aliasing processing system according to claim 7, characterized in that, In the line normalization and slope calculation module, the line is normalized to the first quadrant based on the starting coordinates (x1, y1) and ending coordinates (x2, y2) of the line.

9. The raster graphic display line anti-aliasing processing system according to claim 8, characterized in that, The module for normalizing lines and calculating slope includes: S101. Calculate the difference in the horizontal coordinates of the lines, Δx = |x1 - x2|, and calculate the difference in the vertical coordinates of the lines, Δy = |y1 - y2|. S102. If △x≥△y, then define deltx=△x, delty=△y, and the length of the horizontal coordinate of the line is x_ref=|[x1]-[x2]|, where [x1] and [x2] are the integers of x1 and x2. If △x < △y, then define deltx = △y, delty = △x, and the length of the horizontal coordinate of the line is x_ref = |[y1] - [y2]|, where [y1] and [y2] are the integers of y1 and y2. S103. Calculate the slope of the straight line k = delty / deltx.

10. The raster graphic display line anti-aliasing processing system according to claim 9, characterized in that, The linear offset and longitudinal calculation module includes: S201. If △x≥△y and x1≥x2, then calculate the offset of the ordinate at the starting point of the line, dlt_up=x2-[x2], and the offset of the ordinate at the ending point, dlt_down=x1-[x1]. If △x≥△y and x1<x2, then calculate the offset of the ordinate at the starting point of the line dlt_up= x1-[x1], and the offset of the ordinate at the ending point dlt_down= x2-[x2]; If △x < △y and y1 ≥ y2, then calculate the offset of the ordinate at the starting point of the line dlt_up = y2 - [y2] and the offset of the ordinate at the ending point dlt_down = y1 - [y1]. If △x < △y and y1 < y2, then calculate the offset of the ordinate at the starting point of the line, dlt_up = y1 - [y1], and the offset of the ordinate at the ending point, dlt_down = y2 - [y2]. S202. Calculate the ordinate corresponding to the x-coordinate of the line: ; Where x and y are the x-coordinate and y-coordinate of the line; S203. Calculate the line width coordinates y+1, y+2, ..., y+m-2 corresponding to the x-coordinate of the line.

11. The raster graphic display line anti-aliasing processing system according to claim 10, characterized in that, In the linear grayscale calculation module, the interpolation coefficients at the ordinate and line width coordinates corresponding to the horizontal coordinate of the line are multiplied by the highest grayscale of the display to obtain the grayscale at the ordinate and line width coordinates corresponding to the horizontal coordinate of the line.

12. The raster graphic display line anti-aliasing processing system according to claim 11, characterized in that, The line restoration and display module includes: If △x≥△y, and x2≥x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y; If △x < △y, and x2 ≥ x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] - [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y; If △x≥△y, and x2<x1, y2≥y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]-[(m-4) / 2]+y; If △x < △y, and x2 < x1, y2 ≥ y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y; If △x<△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]-[(m-4) / 2]+x, and the y-coordinate is restored to [y1]+y; If △x≥△y, and x2≥x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y; If △x≥△y, and x2<x1, y2<y1, then the x-coordinate of the line is restored to [x1]+x, and the y-coordinate is restored to [y1]+[(m-4) / 2]+y; If △x < △y, and x2 < x1, y2 < y1, then the x-coordinate of the line is restored to [x1] + [(m-4) / 2] + x, and the y-coordinate is restored to [y1] + y.