A method, device, computer equipment and storage medium for enhancing display of graphic elements

The complexity and lag rate problems when drawing the outer contour lines of the element are solved by redrawing the element by the camera and using the depth test occlusion principle, achieving improvements in clarity and interaction performance.

CN116266340BActive Publication Date: 2025-08-22GLODON CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111540807.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-16
Publication Date
2025-08-22
Estimated Expiration
2041-12-16

AI Technical Summary

Technical Problem

In the prior art, when using the method of drawing the outer contour lines of the graph element for enhanced display, there are problems with high drawing complexity and high lag rate, especially when scaling, it is easy to cause disconnection of contour lines and lag interactions.

Method used

The element is redrawn by moving the preset distance in the preset direction by the camera, and using the occlusion principle of depth test, it is determined that the parts that need to be blocked and do not need to be blocked, and only the parts that need not be blocked are displayed to achieve enhanced display of the element.

Benefits of technology

While ensuring the clarity of the outer contour lines, it reduces the drawing complexity and lag rate, simplifies the operation process, and improves interactive performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116266340B_ABST
    Figure CN116266340B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for enhancing the display of graphic elements. The method comprises: determining a target graphic element to be enhanced in a two-dimensional drawing and a camera used to draw the target graphic element; adjusting the camera in a preset direction and by a preset distance, redrawing the target graphic element at the camera's currently adjusted position using the camera, and recording the depth value of the redrawn target graphic element; determining, based on the depth value of the redrawn target graphic element, the portion of the redrawn target graphic element that needs to be blocked and the portion that does not need to be blocked; and displaying the portion of the redrawn target graphic element that does not need to be blocked in the two-dimensional drawing. The present invention also discloses a graphic element enhanced display device, a computer device, and a computer-readable storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer-aided design, and in particular to a method and device for enhancing the display of graphic elements, a computer device, and a computer-readable storage medium. Background Art

[0002] Vector drawings can be infinitely enlarged, and the graphics elements in the vector drawings can be selected and measured. By rendering the vector drawings, the graphics elements can be enhanced when the user interacts with the vector drawings. For example, when the mouse selects a point in the vector drawing, it is determined which graphics element the point belongs to, and the graphics element will be enhanced. Among them, enhanced display includes highlighting and selection. The difference between highlighting and selection lies in the way the mouse selects the point. Highlighting only requires moving the mouse to a certain point, while selection requires clicking the mouse on a certain point. The most commonly used enhanced display method is to draw contour lines of different colors on the outer contour of the graphics element, such as Figure 1A is a graphic element in a vector drawing. Figure 1B This is a schematic diagram of the highlighted element. Figure 1C This is a schematic diagram after the element is selected.

[0003] There are two most commonly used methods for drawing outlines in the prior art: one is a post-processing-based outline drawing method, and the other is a width-adjustable outline drawing method. The inventors have found that the post-processing-based outline drawing method must draw the selected primitives from the frame buffer. If no measures are taken, anti-aliasing will be very serious, especially for fonts composed of triangles. The relatively thin and long triangles will directly cause individual pixels to disappear when the zoom is relatively small, resulting in the final effect of the outline being disconnected in some places (such as Figure 2 The most effective method to solve off-screen rendering anti-aliasing is MultiSampling Anti-Aliasing (MSAA). However, using MAA seriously increases the complexity of the drawing process. The contour drawing method based on adjustable width must generate a new three-pixel contour line, which will lead to increased CPU and GPU memory usage. When the primitives are large, it takes too much time, resulting in the final interaction being stuck, which is unacceptable to users.

[0004] Therefore, when enhancing the display of primitives by drawing their outer contours, how to reduce the drawing complexity and the drawing freeze rate while ensuring the clarity of the drawn outer contours becomes a technical problem that needs to be solved urgently. Summary of the Invention

[0005] The purpose of the present invention is to provide a method, device, computer equipment and computer-readable storage medium for enhancing the display of primitives. When the enhanced display of primitives is achieved by drawing the outer contour lines of the primitives, the drawing complexity and drawing jamming rate can be reduced while ensuring the clarity of the drawn outer contour lines.

[0006] One aspect of the present invention provides a method for enhanced display of graphic elements, the method comprising: determining a target graphic element to be enhanced in a two-dimensional drawing and a camera used to draw the target graphic element; adjusting the camera in a preset direction and a preset distance, redrawing the target graphic element by the camera at the current adjusted position of the camera, and recording the depth value of the redrawn target graphic element; determining a portion of the redrawn target graphic element that needs to be blocked and a portion that does not need to be blocked based on the depth value of the redrawn target graphic element; and displaying the portion of the redrawn target graphic element that does not need to be blocked in the two-dimensional drawing.

[0007] Optionally, adjusting the camera by a preset distance in a preset direction, redrawing the target primitive by the camera at the current adjusted position of the camera, and recording the depth value of the redrawn target primitive includes: determining the position of the camera at a current moment as the initial position of the camera; adjusting the camera by a preset distance in a preset direction with the initial position as a reference point, redrawing the target primitive by the camera at the current adjusted position of the camera, and recording the depth value of the redrawn target primitive; and returning the camera to the initial position.

[0008] Optionally, the method of adjusting the camera by a preset distance in a preset direction based on the initial position as a reference point, redrawing the target primitive by the camera at the currently adjusted position of the camera, and recording the depth value of the redrawn target primitive includes: adjusting the camera by a first preset distance in a first preset direction at the initial position, redrawing the target primitive by the camera at the currently adjusted position of the camera as a first sub-prime, recording the depth value of the first sub-prime, and returning the camera to the initial position; adjusting the camera by a second preset distance in a second preset direction at the initial position, redrawing the target primitive by the camera at the currently adjusted position of the camera as a second sub-prime, recording the depth value of the second sub-prime, and returning the camera to the initial position; and returning the camera to the initial position. The camera adjusts a third preset distance in a third preset direction, redraws the target primitive at the current adjusted position of the camera through the camera as a third sub-prime, records the depth value of the third sub-prime, and returns the camera to the initial position; adjusts the camera at the initial position by a fourth preset distance in a fourth preset direction, redraws the target primitive at the current adjusted position of the camera through the camera as a fourth sub-prime, and records the depth value of the fourth sub-prime; uses the union of all pixels in the first sub-prime, the second sub-prime, the third sub-prime, and the fourth sub-prime as the redrawn target primitive, and uses the union of the depth value of the first sub-prime, the depth value of the second sub-prime, the depth value of the third sub-prime, and the depth value of the fourth sub-prime as the depth value of the redrawn target primitive.

[0009] Optionally, two of the first preset direction, the second preset direction, the third preset direction and the fourth preset direction are opposite to each other and the other two directions are also opposite to each other.

[0010] Optionally, redrawing the target primitive by the camera at the currently adjusted position of the camera includes: identifying a contour color of the target primitive; and redrawing the target primitive by the camera at the currently adjusted position of the camera using the contour color.

[0011] Optionally, the depth value of the redrawn target primitive includes the depth value of each pixel in the redrawn target primitive, and determining the part of the redrawn target primitive that needs to be occluded and the part that does not need to be occluded based on the depth value of the redrawn target primitive includes: determining a target area for inserting the redrawn target primitive in the two-dimensional drawing, and obtaining the depth value of each pixel in the target area; comparing the depth value of each pixel in the redrawn target primitive with the depth value of the corresponding pixel in the target area; when the depth value of the pixel in the redrawn target primitive is equal to the depth value of the corresponding pixel in the target area, taking the pixel in the redrawn target primitive as one of the pixel in the part that needs to be occluded; when the depth value of the pixel in the redrawn target primitive is greater than the depth value of the corresponding pixel in the target area, taking the pixel in the redrawn target primitive as one of the pixel in the part that does not need to be occluded.

[0012] Another aspect of the present invention provides a primitive enhancement display device, the device comprising: a first determination module for determining a target primitive to be enhanced and displayed in a two-dimensional drawing and a camera for drawing the target primitive; a drawing module for adjusting the camera in a preset direction and a preset distance, redrawing the target primitive by the camera at the current adjusted position of the camera, and recording the depth value of the redrawn target primitive; a second determination module for determining, based on the depth value of the redrawn target primitive, a portion of the redrawn target primitive that needs to be blocked and a portion that does not need to be blocked; and a display module for displaying the portion of the redrawn target primitive that does not need to be blocked in the two-dimensional drawing.

[0013] Optionally, the drawing module is specifically used to: determine the position of the camera at the current moment as the initial position of the camera; adjust the camera by a preset distance in a preset direction based on the initial position, redraw the target primitive at the current adjusted position of the camera through the camera, and record the depth value of the redrawn target primitive; and adjust the camera back to the initial position.

[0014] Another aspect of the present invention provides a computer device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the primitive enhanced display method described in any of the above embodiments when executing the computer program.

[0015] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for enhancing the display of graphic elements described in any of the above embodiments is implemented.

[0016] The method for enhancing the display of primitives provided by the present invention, in order to solve the defects existing in the prior art, needs to avoid both post-processing and regeneration of new objects. Therefore, the main idea of ​​the present invention is: when enhancing the display of primitives, the relative position of the camera and the primitive is used to move the camera in a preset direction and a preset distance, and then the camera is made to redraw the primitive at the adjusted position to draw a new primitive with a larger outer contour than the original primitive, and then the occlusion principle of the depth test is used to determine the part of the new primitive that needs to be occluded and the part that does not need to be occluded, and finally the part that does not need to be occluded is displayed in the drawing, so as to achieve the purpose of enhancing the display of the primitives. Through the method for enhancing the display of primitives provided by the present invention, based on the occlusion principle of the depth test, the newly drawn primitive will not occlude the original primitive, but will only display a larger outer contour on the basis of the original primitive. The processing method is simple and easy to implement. When the enhanced display of the primitive is achieved by drawing the outer contour line of the primitive, the drawing complexity and the drawing freeze rate can be reduced while ensuring the clarity of the drawn outer contour line. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:

[0018] Figure 1A A schematic diagram showing a primitive in a vector drawing that is not enhanced;

[0019] Figure 1B A schematic diagram showing enhanced display of graphic elements in a vector drawing is shown;

[0020] Figure 1C Another schematic diagram showing the enhanced display of graphic elements in a vector drawing;

[0021] Figure 2 A schematic diagram showing anti-aliasing of enhanced graphics in a vector drawing;

[0022] Figure 3 A flow chart of the method for enhancing the display of graphic elements in the first embodiment is shown;

[0023] Figure 4 A specific logic diagram of the method for enhancing the display of graphic elements in the first embodiment is shown;

[0024] Figure 5 A block diagram of a graphic element enhancement display device in a second embodiment is shown;

[0025] Figure 6A block diagram of a computer device suitable for implementing the method for enhancing the display of graphic elements provided in the third embodiment is shown. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0027] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0028] Example 1

[0029] In order to solve the defects existing in the prior art, the present invention needs to avoid post-processing and regeneration of new objects. Therefore, the main idea of ​​the present invention is: when enhancing the display of primitives, the relative position of the camera and the primitive is used to move the camera in a preset direction and a preset distance, and then the camera is made to redraw the primitive at the adjusted position to draw a new primitive with a larger outer contour than the original primitive, and then the occlusion principle of the depth test is used to determine the part of the new primitive that needs to be occluded and the part that does not need to be occluded, and finally the part that does not need to be occluded is displayed in the drawing, so as to achieve the purpose of enhancing the display of the primitives. Through the primitive enhanced display method provided by the present invention, based on the occlusion principle of the depth test, the newly drawn primitive will not occlude the original primitive, but will only display a larger outer contour on the basis of the original primitive. The processing method is simple and easy to implement. When the enhanced display of the primitive is achieved by drawing the outer contour line of the primitive, the drawing complexity and the drawing jam rate can be reduced while ensuring the clarity of the drawn outer contour line. Specifically, Figure 3 A flowchart of the method for enhancing the display of graphic elements in the first embodiment is shown. Figure 3 As shown, the method includes steps S1 to S4, wherein:

[0030] Step S1: determining a target graphic element to be enhanced and displayed in a two-dimensional drawing and a camera for drawing the target graphic element.

[0031] When the mouse moves over a certain element in the two-dimensional drawing, the element can be recorded as the target element to be enhanced and displayed. At this time, the element can be highlighted, that is, the outer contour of the element will be enlarged; when the mouse clicks on a certain element in the two-dimensional drawing, the element can be recorded as the target element to be enhanced and displayed. At this time, the element can be selected, that is, in addition to the outer contour being enlarged, the element color will also be changed.

[0032] The camera can be an orthographic camera or a perspective camera. For two-dimensional drawings, the camera is preferably an orthographic camera.

[0033] Step S2: Adjust the camera toward a preset direction by a preset distance, redraw the target primitive at the current adjusted position of the camera through the camera, and record the depth value of the redrawn target primitive.

[0034] The preset direction can be any direction, and the preset distance can also be any distance. However, in order to ensure the clarity of the enhanced display results, the preset distance can be controlled within a certain range, such as [0, x], where x is greater than 0, and the maximum boundary value x of the range must be smaller than the line width of the target primitive. Generally, the preset distance is selected to be a few pixels, such as 1 pixel, 2 pixels, or 3 pixels.

[0035] As an optional embodiment, step S2 may include steps S21 to S23, wherein:

[0036] Step S21, determining the current position of the camera as the initial position of the camera;

[0037] Step S22, adjusting the camera by a preset distance in a preset direction with the initial position as a reference point, redrawing the target primitive at the current adjusted position of the camera by the camera, and recording the depth value of the redrawn target primitive;

[0038] Step S23: returning the camera to the initial position.

[0039] Before determining the target graphics to be enhanced, if the two-dimensional drawing has not been enlarged, reduced or redisplayed, the target graphics to be enhanced can be directly determined, and then the initial position of the camera at the current moment can be determined, such as taking the position of the camera relative to the center of each graphics element as the initial position, or taking the position of the camera relative to the upper left corner of each graphics element as the initial position; before determining the target graphics to be enhanced, if the two-dimensional drawing has been enlarged, reduced or redisplayed, it is necessary to first use the camera to redraw all graphics elements in the two-dimensional drawing. At this time, the position of the camera relative to the graphics elements just drawn can be used as the initial position of the camera. Further, after determining the target graphics to be enhanced, the initial position of the camera can be obtained.

[0040] It should be noted that after the target primitive is redrawn using the camera, the camera can be adjusted back to its initial position so that when other primitives are subsequently enhanced, the accuracy of the camera's initial position can be ensured, thereby ensuring the clarity of the subsequent enhanced display.

[0041] Optionally, since graphic elements are generally displayed horizontally and vertically in a two-dimensional drawing, in order to ensure the clarity of the enhanced display result, the preset direction can be one or more of a first preset direction, a second preset direction, a third preset direction, and a fourth preset direction, wherein the first preset direction, the second preset direction, the third preset direction, and the fourth preset direction are different directions and respectively represent one of directly above, directly below, directly to the left, and directly to the right. The first preset direction corresponds to a first preset distance, the second preset direction corresponds to a second preset distance, the third preset direction corresponds to a third preset distance, and the fourth preset direction corresponds to a fourth preset distance, wherein the first preset distance, the second preset distance, the third preset distance, and the fourth preset distance may be equal or unequal.

[0042] After the camera is adjusted in a first preset direction by a first preset distance, the target primitive that is redrawn may be referred to as a first sub-primitive; after the camera is adjusted in a second preset direction by a second preset distance, the target primitive that is redrawn may be referred to as a second sub-primitive; after the camera is adjusted in a third preset direction by a third preset distance, the target primitive that is redrawn may be referred to as a third sub-primitive; and after the camera is adjusted in a fourth preset direction by a fourth preset distance, the target primitive that is redrawn may be referred to as a fourth sub-primitive. When the preset directions include one or more of the first preset direction, the second preset direction, the third preset direction, and the fourth preset direction, the target primitive that is redrawn in step S2 may be the union of all pixels in the corresponding sub-primitives, and the depth value of the target primitive that is redrawn in step S2 may be the union of the depth values ​​of the corresponding sub-primitives.

[0043] Preferably, when the preset directions include the first preset direction, the second preset direction, the third preset direction, and the fourth preset direction, the enhanced display effect of the target primitive is the best. Specifically, as an optional embodiment, step S22 includes steps S221 to S225, wherein:

[0044] Step S221, adjusting the camera at the initial position toward a first preset direction by a first preset distance, redrawing the target primitive at the currently adjusted position of the camera as a first sub-primitive using the camera, recording the depth value of the first sub-primitive, and returning the camera to the initial position;

[0045] Step S222, adjusting the camera at the initial position toward a second preset direction by a second preset distance, redrawing the target primitive at the camera's current adjusted position as a second sub-primitive using the camera, recording the depth value of the second sub-primitive, and returning the camera to the initial position;

[0046] Step S223, adjusting the camera at the initial position toward a third preset direction by a third preset distance, redrawing the target primitive at the camera's current adjusted position as a third sub-primitive using the camera, recording the depth value of the third sub-primitive, and returning the camera to the initial position;

[0047] Step S224, adjusting the camera at the initial position toward a fourth preset direction by a fourth preset distance, redrawing the target primitive at the camera's current adjusted position as a fourth sub-primitive using the camera, and recording a depth value of the fourth sub-primitive;

[0048] Step S225: Use the union of all pixels in the first sub-element, the second sub-element, the third sub-element and the fourth sub-element as the target element for redrawing, and use the union of the depth value of the first sub-element, the depth value of the second sub-element, the depth value of the third sub-element and the depth value of the fourth sub-element as the depth value of the target element for redrawing.

[0049] In this embodiment, the primitives obtained after four renderings are first merged into one primitive (i.e., the redrawn target primitive), and then occlusion of the depth test is performed based on the merged primitive and the original target primitive, thereby achieving the purpose of enhanced display of the original target primitive.

[0050] As an optional embodiment, two of the first preset direction, the second preset direction, the third preset direction and the fourth preset direction are opposite to each other and the other two directions are also opposite to each other.

[0051] For example, the first preset direction and the second preset direction are opposite directions, and the third preset direction and the fourth preset direction are opposite directions. When the first preset direction is directly above, the second preset direction must be directly below; when the third preset direction is directly to the left, the fourth preset direction must be directly to the right.

[0052] As an optional embodiment, the step of “redrawing the target primitive by the camera at the currently adjusted position of the camera” in steps S2, S22, and S221 to S224 includes:

[0053] Identifying the outline color of the target graphic element;

[0054] The target primitive is redrawn by the camera at the camera's currently adjusted position using the outline color.

[0055] In order to make the color of the unobstructed part of the redrawn target primitive more prominent when combined with the original primitive, and to avoid the problem of blurring of the primitive after enhanced display, the new primitive can be drawn using the color of the original primitive's outer contour line.

[0056] Step S3: determining the portion of the redrawn target primitive that needs to be blocked and the portion that does not need to be blocked according to the depth value of the redrawn target primitive.

[0057] Step S4: displaying the portion of the redrawn target graphic element that does not need to be blocked on the two-dimensional drawing.

[0058] The principle of depth test occlusion is to store the depth values ​​of the pixels of all primitives in the two-dimensional drawing in advance, such as in a Z-buffer, also known as a depth buffer. After drawing a certain primitive, if you want to present it on a two-dimensional drawing, you can first compare the depth value of the currently drawn primitive with the depth value of the corresponding position in the pre-stored two-dimensional drawing. If the depth value of the drawn primitive is greater than the depth value of the corresponding position, it means that the drawn primitive is deeper than the primitive at the corresponding position. At this time, the drawn primitive is discarded (that is, the drawn primitive or pixel is hidden); if the depth value of the drawn primitive is equal to the depth value of the corresponding position, it means that the drawn primitive is at the same depth as the primitive at the corresponding position. At this time, even if the drawn primitive is displayed on the two-dimensional drawing, it will be obscured by the original primitive at the corresponding position on the two-dimensional drawing; if the depth value of the drawn primitive is less than the depth value of the corresponding position, it means that the drawn primitive is closer to the primitive at the corresponding position. At this time, the drawn primitive is directly displayed on the two-dimensional drawing, and the drawn primitive will obscure the original primitive at the corresponding position in the two-dimensional drawing.

[0059] Based on the above-mentioned depth test occlusion principle, the parts of the redrawn target primitive that need to be occluded and the parts that do not need to be occluded can be determined. It should be noted that for the overlapping parts of the redrawn target primitive with the original target primitive, the depth value is the same. At this time, the original target primitive will cover these overlapping parts of the redrawn target primitive, so these overlapping parts can be called the parts that need to be occluded; for the non-overlapping parts of the redrawn target primitive with the original target primitive, since the preset distance of the camera movement is very short, the position of the two-dimensional drawing corresponding to the non-overlapping part is generally a blank part, and the depth value of the blank part is generally the minimum depth value, such as 0. Therefore, the depth value of the non-overlapping part must be greater than the depth value of the blank part. At this time, the non-overlapping part can be displayed in the two-dimensional drawing, thereby achieving the effect of generating a contour line, wherein these non-overlapping parts can become parts that do not need to be occluded. Specifically, as an optional embodiment, the depth value of the redrawn target primitive includes the depth value of each pixel point in the redrawn target primitive, and step S3 includes steps S31 to S34, wherein:

[0060] Step S31, determining a target area for inserting the redrawn target primitive in the two-dimensional drawing, and obtaining a depth value of each pixel in the target area;

[0061] Step S32, comparing the depth value of each pixel in the redrawn target primitive with the depth value of the corresponding pixel in the target area;

[0062] Step S33: when the depth value of the pixel in the redrawn target primitive is equal to the depth value of the corresponding pixel in the target area, use the pixel in the redrawn target primitive as one of the pixels in the portion to be blocked;

[0063] Step S34 : when the depth value of the pixel in the redrawn target primitive is greater than the depth value of the corresponding pixel in the target area, the pixel in the redrawn target primitive is used as one of the pixels in the portion that does not need to be blocked.

[0064] Figure 4 A specific logic diagram of the method for enhancing the display of graphic elements in the first embodiment is shown.

[0065] like Figure 4 As shown, the specific logic of the optimal effect of the primitive enhanced display method in this embodiment is:

[0066] 1. Use the camera to draw all primitives. The camera's position is the initial position.

[0067] 2. Move the camera one pixel upwards, draw the target primitive using the color of its outer contour, and obtain the first sub-primitive.

[0068] 3. Move the camera two pixels downward and draw the target primitive using the color of its outer contour to obtain the second sub-primitive.

[0069] 4. Move the camera one pixel to the left, draw the target primitive using the color of its outer contour, and obtain the third sub-primitive;

[0070] 5. Move the camera two pixels to the right, draw the target primitive using the color of its outer contour, and obtain the fourth sub-primitive.

[0071] 6. The overlapping parts of the first, second, third, and fourth sub-element with the original target element are regarded as the parts that need to be blocked, and the non-overlapping parts of the first, second, third, and fourth sub-element with the original target element are regarded as the parts that do not need to be blocked. The parts that do not need to be blocked are displayed in the two-dimensional drawing;

[0072] 7. Move the camera one pixel to the left to return it to its initial position.

[0073] It should be noted that when the mouse clicks on the target primitive, the enhanced display effect of the target primitive is selected. When the mouse clicks on the target primitive, you can first change the color and draw the target primitive, and then execute steps 2 to 7. Among them, when changing the color and drawing the target primitive, you can directly use the uniform to pass the primitive state to the shader, and then select the corresponding state color in the shader according to the primitive state, so that the target primitive can be drawn quickly. In addition, the execution order of steps 2 to 4 can be adjusted freely, as long as the final result is that the camera moves one pixel up, down, left, and right relative to the initial camera position, and finally returns to the initial camera position.

[0074] The present invention moves the camera one pixel in each direction relative to the initial camera position, and can draw a new graphic element with an outer contour larger than the original graphic element. Then, the occlusion principle of the depth test is used to display the part that does not need to be occluded in the two-dimensional drawing, thereby achieving the effect of drawing the contour line.

[0075] The present invention has the following advantages: by moving the camera position one pixel up, down, left, and right, and directly superimposing and drawing the primitives four times, the enhanced display effect of the contour line can be achieved; by utilizing the principle of depth test occlusion, the original primitive is drawn first, and then the primitive is superimposed and drawn four times, and the new primitive finally drawn will not cover the fragments of the original primitive; by utilizing the particularity of the orthogonal camera and the two-dimensional drawing, there is no need to consider the stereoscopic effect in the three-dimensional problem; in addition, compared with the post-processing method based on the prior art, the present invention is simpler and more convenient to operate, and compared with the drawing method based on adjustable width lines in the prior art, the speed is faster and the memory will not change, the interactive performance is no longer a problem, and the code implementation is also simpler.

[0076] Example 2

[0077] The second embodiment of the present invention provides a primitive enhancement display device, which corresponds to the method provided in the first embodiment above. The corresponding technical features and technical effects are not described in detail in this embodiment. For relevant details, please refer to the first embodiment above. Specifically, Figure 5 FIG. 1 shows a block diagram of a graphic element enhancement display device in the second embodiment. Figure 5 As shown, the primitive enhanced display device 500 may include a first determination module 501, a drawing module 502, a second determination module 503 and a display module 504, wherein:

[0078] A first determining module 501 is configured to determine a target graphic element to be enhanced and displayed in a two-dimensional drawing and a camera for drawing the target graphic element;

[0079] A drawing module 502 is configured to adjust the camera in a preset direction by a preset distance, redraw the target primitive at the camera's current adjusted position using the camera, and record a depth value of the redrawn target primitive;

[0080] A second determining module 503 is configured to determine, according to the depth value of the redrawn target primitive, a portion that needs to be blocked and a portion that does not need to be blocked in the redrawn target primitive;

[0081] The display module 504 is configured to display the portion of the redrawn target graphic element that does not need to be blocked on the two-dimensional drawing.

[0082] Optionally, the drawing module is specifically used to: determine the position of the camera at the current moment as the initial position of the camera; adjust the camera by a preset distance in a preset direction based on the initial position, redraw the target primitive at the current adjusted position of the camera through the camera, and record the depth value of the redrawn target primitive; and adjust the camera back to the initial position.

[0083] Optionally, when the drawing module executes the steps of adjusting the camera toward a preset direction and a preset distance based on the initial position as a reference point, redrawing the target primitive by the camera at the currently adjusted position of the camera, and recording the depth value of the redrawn target primitive, the drawing module is specifically used to: adjust the camera toward a first preset direction at the initial position by a first preset distance, redraw the target primitive by the camera at the currently adjusted position of the camera as a first sub-primitive, record the depth value of the first sub-primitive, and return the camera to the initial position; adjust the camera toward a second preset direction at the initial position by a second preset distance, redraw the target primitive by the camera at the currently adjusted position of the camera as a second sub-primitive, record the depth value of the second sub-primitive, and return the camera to the initial position; and at the initial position At the initial position, the camera is adjusted toward a third preset direction by a third preset distance, the target primitive is redrawn by the camera at the current adjusted position of the camera as a third sub-prime, the depth value of the third sub-prime is recorded, and the camera is returned to the initial position; at the initial position, the camera is adjusted toward a fourth preset direction by a fourth preset distance, the target primitive is redrawn by the camera at the current adjusted position of the camera as a fourth sub-prime, and the depth value of the fourth sub-prime is recorded; the union of all pixels in the first sub-prime, the second sub-prime, the third sub-prime and the fourth sub-prime is used as the redrawn target primitive, and the union of the depth value of the first sub-prime, the depth value of the second sub-prime, the depth value of the third sub-prime and the depth value of the fourth sub-prime is used as the depth value of the redrawn target primitive.

[0084] Optionally, two of the first preset direction, the second preset direction, the third preset direction and the fourth preset direction are opposite to each other and the other two directions are also opposite to each other.

[0085] Optionally, when the drawing module executes the redrawing of the target primitive through the camera at the currently adjusted position of the camera, it is specifically used to: identify the contour color of the target primitive; and redraw the target primitive using the contour color through the camera at the currently adjusted position of the camera.

[0086] Optionally, the depth value of the redrawn target primitive includes the depth value of each pixel in the redrawn target primitive, and the second determination module is specifically used to: determine a target area for inserting the redrawn target primitive in the two-dimensional drawing, and obtain the depth value of each pixel in the target area; compare the depth value of each pixel in the redrawn target primitive with the depth value of the corresponding pixel in the target area; when the depth value of the pixel in the redrawn target primitive is equal to the depth value of the corresponding pixel in the target area, use the pixel in the redrawn target primitive as one of the pixel points in the part that needs to be occluded; when the depth value of the pixel in the redrawn target primitive is greater than the depth value of the corresponding pixel in the target area, use the pixel in the redrawn target primitive as one of the pixel points in the part that does not need to be occluded.

[0087] Example 3

[0088] Figure 6 A block diagram of a computer device suitable for implementing the method for enhancing the display of graphic elements provided in the third embodiment is shown. In this embodiment, the computer device 600 may be a smartphone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that executes a program. Figure 6 As shown, the computer device 600 of this embodiment includes at least but not limited to: a memory 601, a processor 602, and a network interface 603 that can be interconnected via a system bus. It should be noted that Figure 6 Computer device 600 is shown having only components 601 - 603 , but it is understood that implementing all of the illustrated components is not a requirement, and greater or fewer components may alternatively be implemented.

[0089] In this embodiment, the memory 603 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 601 can be an internal storage unit of the computer device 600, such as the hard disk or memory of the computer device 600. In other embodiments, the memory 601 can also be an external storage device of the computer device 600, such as a plug-in hard disk equipped on the computer device 600, a smart memory card (SMC), a secure digital (SD) card, a flash card, etc. Of course, the memory 601 can also include both the internal storage unit of the computer device 600 and its external storage device. In this embodiment, the memory 601 is generally used to store the operating system and various application software installed on the computer device 600, such as the program code of the primitive enhancement display method.

[0090] In some embodiments, the processor 602 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 602 is generally used to control the overall operation of the computer device 600. For example, it performs control and processing related to data exchange or communication with the computer device 600. In this embodiment, the processor 602 is used to execute the program code of the primitive enhanced display method stored in the memory 601.

[0091] In this embodiment, the primitive enhanced display method stored in the memory 601 may also be divided into one or more program modules and executed by one or more processors (processor 602 in this embodiment) to complete the present invention.

[0092] The network interface 603 may include a wireless network interface or a wired network interface. The network interface 603 is generally used to establish a communication link between the computer device 600 and other computer devices. For example, the network interface 603 is used to connect the computer device 600 to an external terminal via a network, and to establish a data transmission channel and a communication link between the computer device 600 and the external terminal. The network can be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile Communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth, or Wi-Fi.

[0093] Example 4

[0094] This fourth embodiment also provides a computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, server, App application store, etc., on which a computer program is stored, and when the computer program is executed by a processor, the steps of the graphic element enhanced display method are implemented.

[0095] Obviously, those skilled in the art should understand that the various modules or steps of the above-mentioned embodiments of the present invention can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices. Alternatively, they can be implemented using program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than herein, or they can be made into separate integrated circuit modules, or multiple modules or steps can be made into a single integrated circuit module for implementation. Thus, the embodiments of the present invention are not limited to any specific combination of hardware and software.

[0096] It should be noted that the serial numbers of the embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0097] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method.

[0098] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for enhancing the display of graphic elements, characterized in that: The method comprises: Determining a target graphic element to be enhanced in the two-dimensional drawing and a camera for drawing the target graphic element; Adjust the camera in a preset direction by a preset distance, redraw the target primitive at the current adjusted position of the camera using the camera, and record the depth value of the redrawn target primitive; Determining, according to the depth value of the redrawn target primitive, a portion of the redrawn target primitive that needs to be blocked and a portion that does not need to be blocked; Displaying the portion of the redrawn target graphic element that does not need to be blocked on the two-dimensional drawing; The depth value of the redrawn target primitive includes a depth value of each pixel in the redrawn target primitive, and determining the portion to be blocked and the portion not to be blocked in the redrawn target primitive according to the depth value of the redrawn target primitive includes: Determining a target area for inserting the redrawn target primitive in the two-dimensional drawing, and obtaining a depth value of each pixel in the target area; Comparing the depth value of each pixel in the redrawn target primitive with the depth value of the corresponding pixel in the target area; When the depth value of the pixel in the redrawn target primitive is equal to the depth value of the corresponding pixel in the target area, the pixel in the redrawn target primitive is used as one of the pixels in the portion to be blocked; When the depth value of the pixel in the redrawn target primitive is greater than the depth value of the corresponding pixel in the target area, the pixel in the redrawn target primitive is used as one of the pixels in the portion that does not need to be blocked.

2. The method according to claim 1, characterized in that The step of adjusting the camera toward a preset direction and a preset distance, redrawing the target primitive at the currently adjusted position of the camera by the camera, and recording the depth value of the redrawn target primitive includes: Determine the current position of the camera as the initial position of the camera; Adjusting the camera by a preset distance in a preset direction with the initial position as a reference point, redrawing the target primitive at the current adjusted position of the camera by the camera, and recording the depth value of the redrawn target primitive; Return the camera to the initial position.

3. The method according to claim 2, characterized in that The step of adjusting the camera by a preset distance in a preset direction based on the initial position as a reference point, redrawing the target primitive at the current adjusted position of the camera by the camera, and recording the depth value of the redrawn target primitive includes: Adjusting the camera at the initial position by a first preset distance in a first preset direction, redrawing the target primitive at the camera's current adjusted position as a first sub-primitive using the camera, recording a depth value of the first sub-primitive, and returning the camera to the initial position; Adjusting the camera at the initial position toward a second preset direction by a second preset distance, redrawing the target primitive at the currently adjusted position of the camera as a second sub-primitive using the camera, recording the depth value of the second sub-primitive, and returning the camera to the initial position; Adjusting the camera at the initial position toward a third preset direction by a third preset distance, redrawing the target primitive at the camera's current adjusted position as a third sub-primitive using the camera, recording a depth value of the third sub-primitive, and returning the camera to the initial position; Adjusting the camera at the initial position toward a fourth preset direction by a fourth preset distance, redrawing the target primitive at the current adjusted position of the camera by the camera as a fourth sub-primitive, and recording a depth value of the fourth sub-primitive; The union of all pixels in the first sub-primitive, the second sub-primitive, the third sub-primitive and the fourth sub-primitive is used as the target primitive for redrawing, and the union of the depth value of the first sub-primitive, the depth value of the second sub-primitive, the depth value of the third sub-primitive and the depth value of the fourth sub-primitive is used as the depth value of the target primitive for redrawing.

4. The method according to claim 3, characterized in that Two of the first preset direction, the second preset direction, the third preset direction and the fourth preset direction are opposite to each other and the other two directions are also opposite to each other.

5. The method according to any one of claims 1 to 3, characterized in that The redrawing of the target primitive by the camera at the currently adjusted position of the camera includes: Identifying the outline color of the target primitive; The target primitive is redrawn by the camera at the camera's currently adjusted position using the outline color.

6. A graphic element enhancement display device, characterized in that: The device comprises: A first determining module is used to determine a target graphic element to be enhanced and displayed in a two-dimensional drawing and a camera used to draw the target graphic element; a drawing module, configured to adjust the camera in a preset direction by a preset distance, redraw the target primitive at the camera's currently adjusted position using the camera, and record a depth value of the redrawn target primitive; A second determining module is configured to determine, according to the depth value of the redrawn target primitive, a portion that needs to be blocked and a portion that does not need to be blocked in the redrawn target primitive; A display module, configured to display the portion of the redrawn target graphic element that does not need to be blocked on the two-dimensional drawing; The depth value of the redrawn target primitive includes the depth value of each pixel in the redrawn target primitive, and the second determination module is specifically used to: determine a target area for inserting the redrawn target primitive in the two-dimensional drawing, and obtain the depth value of each pixel in the target area; compare the depth value of each pixel in the redrawn target primitive with the depth value of the corresponding pixel in the target area; when the depth value of the pixel in the redrawn target primitive is equal to the depth value of the corresponding pixel in the target area, use the pixel in the redrawn target primitive as one of the pixel points in the part that needs to be occluded; when the depth value of the pixel in the redrawn target primitive is greater than the depth value of the corresponding pixel in the target area, use the pixel in the redrawn target primitive as one of the pixel points in the part that does not need to be occluded.

7. The device according to claim 6, characterized in that The drawing module is specifically used for: Determine the current position of the camera as the initial position of the camera; Adjusting the camera by a preset distance in a preset direction with the initial position as a reference point, redrawing the target primitive at the current adjusted position of the camera by the camera, and recording the depth value of the redrawn target primitive; Return the camera to the initial position.

8. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 5 when executing the computer program.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Three-dimensional enhancing realizing method for multi-viewpoint free stereo display

    CN102568026A

  • Augmented reality display device, method and augmented reality glasses

    CN108398787A