CN105976415B - Mask display processing method and device - Google Patents

Mask display processing method and device Download PDF

Info

Publication number
CN105976415B
CN105976415B CN201610340631.7A CN201610340631A CN105976415B CN 105976415 B CN105976415 B CN 105976415B CN 201610340631 A CN201610340631 A CN 201610340631A CN 105976415 B CN105976415 B CN 105976415B
Authority
CN
China
Prior art keywords
mask
display
outline
masked
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610340631.7A
Other languages
Chinese (zh)
Other versions
CN105976415A (en
Inventor
李中秋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610340631.7A priority Critical patent/CN105976415B/en
Publication of CN105976415A publication Critical patent/CN105976415A/en
Application granted granted Critical
Publication of CN105976415B publication Critical patent/CN105976415B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Controls And Circuits For Display Device (AREA)
  • Image Generation (AREA)

Abstract

The embodiment of the invention discloses a mask display processing method, which comprises the following steps: acquiring a masked identifier of a target display object; searching a corresponding first mask object according to the masked identification of the target display object; acquiring a mask outline of the first mask object; matching the display outline of the target display object with the mask outline of the first mask object, and displaying the display content located in the mask outline of the mask object in the display content of the target display object. The embodiment of the invention also discloses a mask display processing device. By adopting the invention, the video memory resource can be effectively saved.

Description

Mask display processing method and device
Technical Field
The invention relates to the technical field of image display, in particular to a mask display processing method and device.
Background
The mask is a special display effect, and the simplest mask effect has at least two layers, wherein one layer on the upper layer is a mask layer, and the other layer is a masked layer below the mask layer; only the overlapping areas of the two layers are displayed, i.e. the areas of the mask layer where there are objects are "transparent", through which the objects in the corresponding areas of the mask layer can be seen, whereas the areas of the mask layer where there are no objects are not "transparent", and the objects in the corresponding areas of the mask layer are not visible.
Masks are widely used, and can be used in a specific scene or a specific area, so that objects outside the scene or objects outside the specific area are invisible, or used for covering a part of a certain element, thereby realizing special effects, such as photo clipping, for example, being fixed by a mask layer, enabling the mask layer to move forward to form a mask animation and the like.
The prior art usually uses a global mask structure linked list to correspondingly record mask information of each mask object for the mask layer, the mask information mainly includes display content of the mask object, for example, the mask object is a circle, the corresponding mask information will record the position of the circle, and parameter information for rendering and drawing the circular mask object line by line, and the like, in the process of rendering and displaying, the mask object can be additionally subjected to a transparent rendering and drawing step, such mask information can occupy huge display resources according to the height and rendering complexity of the mask object, and the global mask structure linked list can occupy huge display resources.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for processing mask display, which can effectively save video memory resources.
In order to solve the above technical problem, an embodiment of the present invention provides a mask display processing method, including:
acquiring a masked identifier of a target display object;
searching a corresponding first mask object according to the masked identification of the target display object;
acquiring a mask outline of the first mask object;
matching the display outline of the target display object with the mask outline of the first mask object, and displaying the display content located in the mask outline of the mask object in the display content of the target display object.
Accordingly, an embodiment of the present invention further provides a mask display processing apparatus, including:
the mask identification obtaining module is used for obtaining a masked identification of the target display object;
the mask object searching module is used for searching a corresponding first mask object according to the masked identifier of the target display object;
a mask outline acquisition module for acquiring a mask outline of the first mask object;
and the mask display module is used for matching the display outline of the target display object with the mask outline of the first mask object and displaying the display content positioned in the mask outline of the mask object in the display content of the target display object.
The mask display processing device in the embodiment can find the corresponding mask object through the mask identification of the display object in the current picture to be displayed, and then perform mask display processing on the target display object according to the obtained mask outline of the mask object, so that an independent rendering and drawing step is not required to be performed on the mask object, and a global mask structure linked list in the prior art is also not required, thereby effectively saving display and storage resources.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a mask display processing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of matching a display outline of a target display object with a mask outline of the first mask object according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a mask display processing method according to another embodiment of the present invention;
FIG. 4 is a schematic diagram of matching between a display outline of a target display object, a mask outline of a first mask object, and a mask outline of a second mask object in an embodiment of the present invention;
fig. 5 is a schematic diagram of allocating a mask identifier and a masked identifier to each display object of a frame to be displayed according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a mask display processing apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a mask display module according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a mask display module according to another embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The mask display processing method and device in the embodiments of the present invention may be implemented in a computer system such as a personal computer, a notebook computer, a smart phone, a tablet computer, an e-reader, and the like, and the mask display processing device is used as an execution main body of the embodiments of the present invention to be described below.
Fig. 1 is a schematic flow chart of a mask display processing method according to an embodiment of the present invention, where the flow of the mask display processing method according to the embodiment of the present invention includes:
s101, acquiring a masked mark of the target display object.
Specifically, the mask display processing device in the embodiment of the present invention may obtain a display object set of a current to-be-displayed picture, and then traverse each display object in the display object set to perform rendering display. In an alternative embodiment, the display Object set may be organized as a tree structure (e.g., a DOM tree), and the mask display processing device may render and display each display Object on the tree structure from bottom to top in sequence, where the display objects may include a mask Object and a non-mask Object. When traversing to the target display object, the mask display processing device may first determine whether the target display object is masked (or is in a masked layer), and if the target display object is masked, may obtain a masked identifier of the target display object, for example, the masked identifier of the target display object is viewed from the tree structure data. In an alternative embodiment, whether the target display object is masked may be determined according to the masked identifier of the target display object, for example, if the masked identifier of the target display object is 0, it is determined that the target display object is not masked, otherwise, it is determined that the target display object is masked.
S102, searching a corresponding first mask object according to the masked identification of the target display object.
In the embodiment of the present invention, the masked identifier may uniquely correspond to one display object in the display object set of the current to-be-displayed picture, for example, the object identifier of a certain display object is directly identified, so that the display object whose object identifier is the masked identifier of the target display object may be found in the display object set as the first masked object of the target display object; or a certain mask object is labeled with a mask identifier 1 in advance, and if the masked identifier of the target display object is also 1, the display object with the mask identifier 1 is the first mask object of the target display object. In other optional embodiments, the masked identifier may also be a display resource identifier occupied by a masking object, a tree structure index identifier, or the like, and the masking display processing apparatus may uniquely determine a corresponding display object in the display object set of the current to-be-displayed picture through the masked identifier.
S103, acquiring a mask outline of the first mask object.
Specifically, the mask display processing device in the embodiment of the present invention may obtain the mask outline of the first mask object after the first mask object is found, where a circle a shown in fig. 2 is the mask outline of the mask object a. The mask outline may be obtained from a display object set of the current to-be-displayed picture by the mask display processing device, for example, read from the tree structure data, or the mask display processing device may allocate a video memory resource to each display object of the current to-be-displayed picture in advance before displaying the current to-be-displayed picture, and write a corresponding mask outline in the video memory resource of the mask object, so that the mask outline of the first mask object may be obtained from the video memory resource of the first mask object after searching the corresponding first mask object according to the mask identifier of the target display object.
S104, matching the display outline of the target display object with the mask outline of the first mask object, and displaying the display content in the mask outline of the first mask object in the display content of the target display object.
The mask display processing device may obtain display content of the target display object, which is located in the mask outline of the first mask object, according to a result of matching the display outline of the target display object with the mask outline of the first mask object, so as to display the display content of the target display object, which is located in the mask outline of the first mask object, and discard the display content of the target display object, which is outside the mask outline of the first mask object.
Specifically, the mask display processing apparatus in the embodiment of the present invention may obtain an overlapping area between a display outline of the target display object and a mask outline of the first mask object, as shown in fig. 2, an overlapping area C (diagonal line shading) between a display outline (circle) of the first mask object a and a display outline (square) of the target display object B, and the mask display processing apparatus renders and fills display content of the target display object located in the overlapping area to the overlapping area, specifically, renders to a rendering object RT (render target) corresponding to the overlapping area, and further displays the overlapping area where the display content is rendered and filled, specifically, renders a rendering texture on the RT corresponding to the overlapping area to a corresponding position on a display screen. In an alternative embodiment, the mask display processing device may allocate video memory resources to each display object of the current picture to be displayed in advance before the current picture to be displayed is displayed, after rendering and filling the display content of the target display object in the overlapping area into the overlapping area, the mask display processing device can discard other display contents of the target display object outside the overlapping area, release the display memory resource occupied by the target display object, meanwhile, because the display object A is a mask object, the mask display processing device does not need to perform rendering processing on the display object A, after the display contents of all the display objects of its mask are rendered and filled, only the target display object is present in this embodiment, namely, after the display content of the display object of the target display object is rendered and filled in the overlapping area, the display memory resource occupied by the first mask object can be released.
In another embodiment, the mask display processing device may render and draw the picture to be displayed line by line, for example, when scanning to a scanning line where a horizontal straight line is located as shown in fig. 2, the display outline of the target display object and the mask outline of the first mask object are respectively cut into two line segments on the horizontal straight line, where a1-a2 is used as the mask outline line segment of the mask outline of the first mask object on the current scanning line, and b1-b2 is used as the display outline line segment of the display outline of the target display object on the current scanning line, and the overlapped line segment is b1-a2, and the mask display processing device may render and fill the display content of the target display object on the overlapped line segment onto the overlapped line segment, specifically, may be rendered to the rendering object RT corresponding to the overlapped line segment, and then display the overlapped line segment with the display content, specifically, the rendering texture on the RT corresponding to the overlapped line segment may be drawn to a corresponding position on the display screen. Furthermore, in an optional embodiment, before rendering the current scan line, the mask display processing device may allocate display memory resources corresponding to the current scan line to the target display object and the first mask object, respectively, and after rendering and filling the display content of the target display object located in the overlap line segment to the overlap line segment, the mask display processing device may discard other display content of the target display object corresponding to the scan line, and release the display memory resources occupied by the target display object and corresponding to the scan line, and meanwhile, since the display object a is a mask object, the mask display processing device does not need to perform rendering processing on the display object, after rendering and filling the display content of all the display objects masked by the mask object, in this embodiment, only the target display object is present, that is, after completing rendering and filling the display content of the display object of the target display object to the overlap line segment, the video memory resource corresponding to the scanning line occupied by the first mask object can be released.
The mask display processing device in the embodiment can find the corresponding mask object through the mask identification of the display object in the current picture to be displayed, and then perform mask display processing on the target display object according to the obtained mask outline of the mask object, so that an independent rendering and drawing step is not required to be performed on the mask object, and a global mask structure linked list in the prior art is also not required, thereby effectively saving display and storage resources.
Fig. 1 is a schematic flow chart of a mask display processing method according to an embodiment of the present invention, where the flow of the mask display processing method according to the embodiment of the present invention includes:
s201, obtaining a masked mark of the target display object.
Specifically, the mask display processing device in the embodiment of the present invention may obtain a display object set of a current to-be-displayed picture, and then traverse each display object in the display object set to perform rendering display. In this embodiment, the display object set may be organized as a tree structure as shown in fig. 5, where each display object in the to-be-displayed picture is pre-allocated with a mask identifier and a masked identifier, including: for example, if E1 and E3 in fig. 5 are mask objects, then progressively increasing masked identifiers may be allocated according to a front-end traversal order of the tree structure, the id _ masking of E1 is 1, the id _ masking of E3 is 2, none of the other display objects in fig. 5 is a mask object, and both id _ masking thereof are 0, then the masked display object flag of each masked in the to-be-displayed picture is a masked identifier, the masked identifier of the masked object of the display object is a mask identifier that directly masks the display object, if E0 shown in fig. 5 is not masked, its id _ masked is 0, E2 is directly masked by E1, then the id _ masked of E2 is marked as E1 is 1, similarly, E4 is marked as E3 is directly masked, then the id _ masking of the id _ 3 of E4 is marked as 2. To achieve the nested masking effect, the masked identification of each mask object may inherit the masked identification of its parent display object, e.g., the parent object of E3 is E2, and E2 is masked by E1 so id _ masking, labeled E1, of E2 is 1, and E3 may inherit id _ masked of E2 is 1. Preferably, the mask identifier and the masked identifier may be sequentially allocated to each display object according to a previous traversal according to the tree structure of the to-be-displayed frame, and in the tree structure, a traversal order of the mask object is prior to a traversal order of the display object masked by the mask object.
S202, searching a corresponding first mask object according to the masked identification of the target display object.
Assuming that the target display object is E4, the mask object with id _ masking of 2 can be found as E3 as the first mask object of E4 according to id _ masked of E4 being 2, i.e., E4 is directly masked by E3.
S203, obtaining the masked identification of the first masking object, searching a corresponding second masking object according to the masked identification of the first masking object, and obtaining the masking outline of the second masking object.
Specifically, the mask display processing device may determine whether the first mask object is masked according to the masked identifier of the first mask object, for example, if the masked identifier of the first mask object is 0, it is determined that the first mask object is not masked, that is, the target display object is not nested and covered, otherwise, it is determined that the target display object is masked, that is, the target display object is nested and covered.
In this embodiment, the id _ masked of the first mask object E3 is 1, and the mask object with id _ masking of 1 is found as E1 in the tree structure shown in fig. 5 as the corresponding second mask object, i.e., E3 is directly masked by E1.
As shown in fig. 4, the circle a is the mask outline of the second mask object E1, the square B is the mask outline of the first mask object E3, and the rectangle D is the display outline of the target display object E4.
The mask outline can be read from the tree structure data by the mask display processing device, and the mask display processing device can also allocate a video memory resource to each display object of the current to-be-displayed picture in advance before the current to-be-displayed picture is displayed, write a corresponding mask outline in the video memory resource of the mask object, and write a corresponding display outline in the video memory resource of the display object, so that the display outline of each display object and the mask outline of each mask object can be acquired from the video memory resource of each display object subsequently.
S204, matching the mask outline of the first mask object with the mask outline of the second mask object, and acquiring the overlapping mask outline of the first mask object and the second mask object.
For example, as shown in fig. 4, the overlapping mask contour of the mask contour a of the first mask E3 and the mask contour B of the second mask object E1 is a region C (diagonally shaded).
And S205, matching the display contour of the target display object with the overlapping mask contour of the first mask object and the second mask object, and displaying the display content in the overlapping mask contour of the first mask object and the second mask object in the display content of the target display object.
The mask display processing device may obtain display content of the target display object located in the overlap mask outline according to a result of matching the display outline of the target display object with the overlap mask outline of the first mask object and the second mask object, so as to display the display content of the target display object located in the overlap mask outline, and discard the display content of the target display object outside the overlap mask outline.
Specifically, the mask display processing device in the embodiment of the present invention may obtain an overlapping area between a display outline of the target display object and a mask outline of the first mask object, as shown in fig. 4, an overlapping area (a grid shadow area E) between an overlapping mask outline C of the first mask object and the second mask object and a display outline D (a rectangle) of the target display object, and the mask display processing device renders and fills display content of the target display object located in the overlapping area to the overlapping area, specifically, may render to a rendering object RT (render target) corresponding to the overlapping area, and further displays the overlapping area where the display content is rendered and filled, specifically, may render a rendering texture on the RT corresponding to the overlapping area to a corresponding position on a display screen. In an optional embodiment, the mask display processing device may allocate, before displaying the current picture to be displayed, display memory resources to each display object of the current picture to be displayed in advance, and after rendering and filling the display content of the target display object located in the overlapping area into the overlapping area, the mask display processing device may discard other display content of the target display object outside the overlapping area, and release the display memory resources occupied by the target display object, meanwhile, since the display objects E1 and E3 are mask objects, the mask display processing device does not need to perform rendering processing on the mask display objects, and after rendering and filling the display content of all the display objects masked by the mask display processing device, the display memory resources occupied by the mask object may be released, in this embodiment, only the target display object E4 of the E3 mask is that after rendering and filling the display content of the target display object E4 into the overlapping area is completed, that is, the video memory resource occupied by E3 may be released, and after the completion of the rendering and filling of the display content of the target display object E4 to the overlap area and the rendering and filling of the display content located in the mask outline of E1 in the display content of E2, the video memory resource occupied by E1 may be released.
In another embodiment, the mask display processing device may render and draw the picture to be displayed line by line, for example, when scanning to a scanning line where a horizontal straight line is located as shown in fig. 4, the display outline of the target display object, the mask outline of the first mask object, and the mask outline of the second mask object are respectively cut into three line segments on the horizontal straight line, where a1-a2 is used as the mask outline line segment of the mask outline of E1 in the current scanning line, b1-b2 is used as the display outline line segment of the mask outline of E3 in the current scanning line, d1-d2 is used as the display outline line segment of the display outline of E4 in the current scanning line, and the overlapping line segment of the three line segments is d1-a2, an overlapping portion of a1-a2 and b1-b2 may be obtained first and then be overlapped with d1-d2, or an overlapping determination order may be exchanged, the results are not affected. The mask display processing device may render and fill display content of the target display object E4 on the overlapped line segment to the overlapped line segment, specifically, render to a rendering object RT corresponding to the overlapped line segment, and then display the overlapped line segment whose display content is filled in the rendering, specifically, draw a rendering texture on the RT corresponding to the overlapped line segment to a corresponding position on a display screen. Further in an optional embodiment, before rendering the current scan line, the mask display processing device may allocate video memory resources corresponding to the current scan line to the target display object, the first mask object and the second mask object respectively, after rendering fill-in the display content of the target display object in the overlapping line segment to the overlapping line segment, other display contents in the display contents of the target display object and the scanning line can be discarded, the display memory resource occupied by the target display object and corresponding to the scanning line is released, meanwhile, because the first mask object and the second mask object are mask objects, the mask display processing device does not need to perform rendering processing on the first mask object and the second mask object, after the display contents of all the display objects masked by the first mask object are rendered and filled, the video memory resources corresponding to the scanning line occupied by the first mask object and the second mask object can be released. In this embodiment, the display object masked by the first masking object E3 only has the target display object E4, that is, after the display content of the display object of E4 is rendered and filled into the overlap line segment, the video memory resource corresponding to the scan line occupied by E3 may be released, and after the display content of the target display object E4 is rendered and filled into the overlap line segment and the display content located in the mask outline of E1 in the display content of E2 is rendered and filled, the video memory resource corresponding to the scan line occupied by E1 may be released.
It should be noted that, this embodiment only exemplifies a processing example of a two-layer nested mask display, and in practical applications, the processing manner of a 3-layer or more-layer nested mask display can be derived based on the processing principle of the above-described embodiment of the present invention without any doubt.
The mask display processing device in the embodiment can find the corresponding mask object through the mask identification of the display object in the current picture to be displayed, and then find the corresponding nested mask object according to the mask identification of the mask object, so that the mask display processing of the target display object can be realized according to the overlapped mask outline, an independent rendering and drawing step for the mask object is not needed, and meanwhile, a global mask structure linked list in the prior art is also not needed, so that the display and storage resources can be effectively saved.
Fig. 6 is a schematic structural diagram of a mask display processing device according to an embodiment of the present invention, where the mask display processing device of the present invention at least includes the following structures:
the mask identification obtaining module 610 obtains a masked identification of the target display object.
Specifically, the mask display processing device in the embodiment of the present invention may obtain a display object set of a current to-be-displayed picture, and then traverse each display object in the display object set to perform rendering display. In an alternative embodiment, the display Object set may be organized as a tree structure (e.g., a DOM tree), and the mask display processing device may render and display each display Object on the tree structure from bottom to top in sequence. When traversing to the target display object, the mask identifier obtaining module 610 may first determine whether the target display object is masked (or is in a masked layer), and if the target display object is masked, obtain a masked identifier of the target display object, for example, a masked identifier of the target display object is viewed from the tree structure data. In an optional embodiment, the mask identifier obtaining module 610 may determine whether the target display object is masked according to the masked identifier of the target display object, for example, if the masked identifier of the target display object is 0, it is determined that the target display object is not masked, otherwise, it is determined that the target display object is masked.
The mask object searching module 620 searches for a corresponding first mask object according to the masked identifier of the target display object.
In the embodiment of the present invention, the masked identifier may uniquely correspond to one display object in the display object set of the current to-be-displayed picture, for example, the object identifier of a certain display object directly, then the masked object searching module 620 may search, in the display object set, for the display object whose object identifier is the masked identifier of the target display object, as the first masked object of the target display object; or a certain mask object is labeled with a mask identifier 1 in advance, and if the masked identifier of the target display object is also 1, the display object with the mask identifier 1 is the first mask object of the target display object. In other optional embodiments, the masked identifier may also be a display resource identifier occupied by a masking object, a tree structure index identifier, or the like, and the masking object finding module 620 may uniquely determine a corresponding display object in the display object set of the current to-be-displayed picture through the masked identifier.
The mask outline acquisition module 630 acquires a mask outline of the first mask object.
Specifically, after the first mask object is found, the mask outline obtaining module 630 obtains the mask outline of the first mask object, where a circle a shown in fig. 2 is the mask outline of the mask object a. The mask outline may be obtained by the mask outline obtaining module 630 from a display object set of the current to-be-displayed picture, for example, by reading from the tree structure data, and the mask display processing apparatus may also allocate a video memory resource to each display object of the current to-be-displayed picture in advance before displaying the current to-be-displayed picture, and write a corresponding mask outline in the video memory resource of the mask object, so that the mask outline obtaining module 630 may obtain the mask outline of the first mask object from the video memory resource of the first mask object after subsequently searching the corresponding first mask object according to the masked identifier of the target display object.
The mask display module 640 matches the display contour of the target display object with the mask contour of the first mask object, and displays the display content located in the mask contour of the mask object in the display content of the target display object.
Specifically, the mask displaying module 640 may obtain, according to a result that the display contour of the target display object matches the mask contour of the first mask object, display content located in the mask contour of the first mask object in the display content of the target display object, so as to display the display content located in the mask contour of the first mask object in the display content of the target display object, and discard the display content of the target display object outside the mask contour of the first mask object.
In an alternative embodiment, the mask display module 640 may further include as shown in fig. 7:
a mask region acquiring unit 641 is configured to acquire an overlapping region of the display outline of the target display object and the mask outline of the first mask object, as shown in fig. 2, an overlapping region C (hatched by oblique lines) of the display outline (circle) of the first mask object a and the display outline (square) of the target display object B.
The rendering and filling unit 643 is configured to render and fill, in the display content of the target display object, the display content located in the mask outline of the mask object to the overlap area, specifically, to a rendering object rt (render target) corresponding to the overlap area.
A display unit 645, configured to display the overlapped region with the display content filled in the rendering, specifically, draw the rendering texture on the RT corresponding to the overlapped region to a corresponding position on the display screen.
In another alternative embodiment, the mask display module 640 may further include as shown in fig. 8:
the mask line segment obtaining unit 642 is configured to obtain a display outline line segment of the display outline of the target display object in the current scanning line, obtain a mask outline line segment of the mask outline of the first mask object in the current scanning line, and further obtain an overlapping line segment of the display outline line segment and the mask outline line segment.
In this embodiment, the mask display processing device may render and draw the picture to be displayed line by line, for example, when scanning to a scanning line where a horizontal straight line is located as shown in fig. 2, the display outline of the target display object and the mask outline of the first mask object are respectively cut into two line segments on the horizontal straight line, where a1-a2 is used as the mask outline line segment of the mask outline of the first mask object in the current scanning line, b1-b2 is used as the display outline line segment of the display outline of the target display object in the current scanning line, and the overlapped line segment is b1-a 2.
The rendering and filling unit 643 is configured to render and fill display contents of the target display object on the overlap line segment onto the overlap line segment, and specifically, may be rendered onto a rendering object RT corresponding to the overlap line segment.
The display unit 645 is configured to display the overlapped line segments with the display content being filled in the rendering, specifically, rendering textures on the RT corresponding to the overlapped line segments may be drawn to corresponding positions on a display screen.
Further in an optional embodiment, the mask display processing device may further include:
a video memory resource allocation module 650, configured to allocate video memory resources corresponding to the current scan line to the target display object and the first mask object respectively before rendering the current scan line;
the video memory releasing module 660 releases the video memory resources corresponding to the first mask object and the current scanning line after the mask outline of the first mask object is obtained from the mask outline line segment of the current scanning line.
In the embodiment of rendering and drawing the picture to be displayed line by the mask display processing device, after the display content of the target display object in the overlapped line segment is rendered and filled into the overlapped line segment, the video memory releasing module 660 may discard other display contents of the target display object corresponding to the scan line, release the video memory resource occupied by the target display object corresponding to the scan line, meanwhile, since the display object a is a mask object, the mask display module 640 does not need to perform rendering processing on it, after the display contents of all the display objects of its mask are rendered and filled, only the target display object is present in this embodiment, namely, after finishing the rendering and filling of the display content of the display object of the target display object to the overlapped line segment, the video memory releasing module 660 may release the video memory resource corresponding to the scan line occupied by the first mask object.
In another alternative embodiment, the video memory resource allocation module 650 may allocate video memory resources to each display object of the current picture to be displayed in advance before displaying the current picture to be displayed, after rendering and filling the display content of the target display object in the overlapping area into the overlapping area, the video memory releasing module 660 may discard other display contents of the target display object outside the overlap area, release the video memory resource occupied by the target display object, meanwhile, since the display object a is a mask object, the mask display module 640 does not need to perform rendering processing on it, after the display contents of all the display objects of its mask are rendered and filled, only the target display object is present in this embodiment, namely, after finishing rendering and filling the display content of the display object of the target display object into the overlap region, the video memory releasing module 660 may release the video memory resource occupied by the first mask object.
In another alternative embodiment, the mask display processing means may implement a nested mask display processing, in order to implement the nested mask display processing, in the mask display processing means:
the mask identifier obtaining module 610 is further configured to obtain a masked identifier of the first mask object.
Specifically, the mask identifier obtaining module 610 may determine whether the first mask object is masked according to the masked identifier of the first mask object, for example, if the masked identifier of the first mask object is 0, it is determined that the first mask object is not masked, that is, the target display object is not nested and covered, otherwise, it is determined that the target display object is masked, that is, the target display object is nested and covered.
The mask object searching module 620 is further configured to search a corresponding second mask object according to the masked identifier of the first mask object;
for example, if the set of display objects in the to-be-displayed picture is organized into a tree structure as shown in fig. 5, each display object in the to-be-displayed picture is pre-assigned with a mask id and a masked id, id _ masked of the first mask object E3 is 1, and the mask object finding module 620 finds that the mask object with id _ masking of 1 is E1 in the tree structure as the corresponding second mask object, that is, E3 is directly masked by E1.
A mask outline obtaining module 630, configured to obtain a mask outline of the second mask object, match the mask outline of the first mask object with the mask outline of the second mask object, and obtain an overlapping mask outline of the first mask object and the second mask object;
as shown in fig. 4, the circle a is the mask outline of the second mask object E1, the square B is the mask outline of the first mask object E3, and the rectangle D is the display outline of the target display object E4. The mask outline acquisition module 630 obtains an overlapping mask outline of a mask outline a of the first mask E3 and a mask outline B of the second mask object E1 as an area C (diagonally shaded).
The mask outline may be read from the tree structure data by the mask outline acquisition module 630, and the mask display processing device may also allocate a video memory resource to each display object of the current to-be-displayed picture in advance before displaying the current to-be-displayed picture, write a corresponding mask outline in the video memory resource of the mask object, and write a corresponding display outline in the video memory resource of the display object, so that the subsequent mask outline acquisition module 630 may acquire the display outline of each display object and the mask outline of each mask object from the video memory resource of each display object.
The mask displaying module 640 is further configured to match the display contour of the target display object with the overlapping mask contour of the first mask object and the second mask object, and display content of the target display object, which is located in the overlapping mask contour of the first mask object and the second mask object, is displayed.
Specifically, the mask displaying module 640 may obtain, according to a result that the display contour of the target display object matches the overlapping mask contour of the first mask object and the second mask object, the display content located in the overlapping mask contour in the display content of the target display object, so as to display the display content located in the overlapping mask contour in the display content of the target display object, and discard the display content of the target display object outside the overlapping mask contour.
To implement the nested mask display process, the mask display module 640 may further include, as shown in fig. 7:
the mask region obtaining unit 641 is configured to obtain an overlapping region between the display outline of the target display object and the mask outline of the first mask object, as shown in fig. 4, an overlapping region between the overlapping mask outline C of the first mask object and the second mask object and the display outline D (rectangle) of the target display object (a grid shadow region E).
The rendering and filling unit 643 is configured to render and fill, in the display content of the target display object, the display content located in the mask outline of the mask object to the overlap area, specifically, to a rendering object rt (render target) corresponding to the overlap area.
A display unit 645, configured to display the overlapped region with the display content filled in the rendering, specifically, draw the rendering texture on the RT corresponding to the overlapped region to a corresponding position on the display screen.
Further in this embodiment implementing nested mask display processing,
the video memory resource allocation module 650 may allocate video memory resources to each display object of the current picture to be displayed in advance before the current picture to be displayed is displayed, after the display content of the target display object located in the overlapping region is rendered and filled in the overlapping region, the video memory release module 660 may discard other display content of the target display object outside the overlapping region, and release the video memory resource occupied by the target display object, meanwhile, since the display objects E1 and E3 are mask objects, the mask display module 640 does not need to render the same, after the display content of all the display objects masked by the mask is rendered and filled, the video memory release module 660 may release the video memory resource occupied by the mask objects, in this embodiment, only the target display object E4 of the E3 mask is, that is, after the display content of the target display object E4 is rendered and filled in the overlapping region, the video memory releasing module 660 may release the video memory resource occupied by E3, and after completing rendering and filling the display content of the target display object E4 to the overlapping area and rendering and filling the display content located in the mask outline of E1 in the display content of E2, the video memory releasing module 660 may release the video memory resource occupied by E1.
To implement the nested mask display process, the mask display module 640 may further include as shown in fig. 8:
the mask line segment obtaining unit 642 is configured to obtain a display outline line segment of the display outline of the target display object in the current scanning line, obtain a mask outline line segment of the mask outline of the first mask object in the current scanning line, and further obtain an overlapping line segment of the display outline line segment and the mask outline line segment.
In this embodiment, the mask display processing device may render and draw the picture to be displayed line by line, for example, when scanning to the scanning line where the horizontal straight line is located as shown in fig. 4, the display outline of the target display object, the mask outline of the first mask object and the mask outline of the second mask object are respectively cut into three line segments on the transverse straight line, wherein a1-a2 is used as a mask outline line segment of the mask outline of E1 in the current scanning line, b1-b2 is used as a display outline line segment of the mask outline of E3 in the current scanning line, d1-d2 is used as a display outline line segment of the display outline of E4 in the current scanning line, the overlapped line segment of the three line segments is d1-a2, the overlapped part of a1-a2 and b1-b2 can be obtained firstly, and then the overlapped part and d1-d2 are subjected to overlapping judgment, or the overlapping judgment sequence is exchanged, so that the result is not influenced.
The rendering and filling unit 643 is configured to render and fill display contents of the target display object on the overlap line segment onto the overlap line segment, and specifically, may be rendered onto a rendering object RT corresponding to the overlap line segment.
The display unit 645 is configured to display the overlapped line segments with the display content being filled in the rendering, specifically, rendering textures on the RT corresponding to the overlapped line segments may be drawn to corresponding positions on a display screen.
Further in this embodiment implementing nested mask display processing:
the video memory resource allocation module 650 is configured to allocate video memory resources corresponding to the current scanning line to the target display object, the first mask object, and the second mask object, respectively, before rendering the current scanning line.
The video memory releasing module 660 releases the video memory resources corresponding to the first mask object and the current scanning line after the mask outline of the first mask object is obtained from the mask outline line segment of the current scanning line.
After rendering and filling the display content of the target display object located in the overlapped line segment to the overlapped line segment, the video memory releasing module 660 may discard other display content of the display content corresponding to the target display object and the scanning line, and release the video memory resource corresponding to the scanning line occupied by the target display object, and meanwhile, since the first mask object and the second mask object are mask objects, the mask displaying module 640 does not need to perform rendering processing on the mask objects, and after rendering and filling the display content of all the display objects masked by the mask objects, the video memory releasing module 660 may release the video memory resource corresponding to the scanning line occupied by the first mask object and the second mask object. In this embodiment, the display object masked by the first masking object E3 only has the target display object E4, that is, after the display content of the display object of E4 is rendered and filled into the overlap line segment, the memory releasing module 660 may release the memory resource corresponding to the scan line occupied by E3, and after the display content of the target display object E4 is rendered and filled into the overlap line segment and the display content located in the mask outline of E1 in the display content of E2 is rendered and filled, the memory releasing module 660 may release the memory resource corresponding to the scan line occupied by E1.
It should be noted that, this embodiment only exemplifies a processing example of a two-layer nested mask display, and in practical applications, the processing manner of a 3-layer or more-layer nested mask display can be derived based on the processing principle of the above-described embodiment of the present invention without any doubt.
Further in an optional embodiment, the mask display processing device may further include:
the mask marking module 600 is configured to allocate a mask identifier to each mask object in the to-be-displayed picture, and mark a masked display object identifier to each masked display object in the to-be-displayed picture, where the masked display object identifier of the display object is a mask identifier of a mask object that directly masks the display object.
The mask marking module 600 allocates mask identifications to each mask object in the picture to be displayed, for example, if E1 and E3 in fig. 5 are mask objects, then increasing masked identifications may be allocated according to a front-end traversal order of a tree structure, id _ masking of E1 is 1, id _ masking of E3 is 2, none of the other display objects in fig. 5 are mask objects, id _ masking thereof is 0, then each masked display object in the picture to be displayed is marked with a masked identification, the masked identification of the display object is a mask identification that directly masks the mask object of the display object, if E0 shown in fig. 5 is not masked, id _ masked thereof is 0, E2 is directly masked by E1, id _ masked of E2 is marked as id _ masking of E1 as 1, similarly, E4 is directly masked by E3, and id _ masked _ masking of id _ masking of E3 of E4 is marked as mask object. To achieve the nested masking effect, the mask marking module 600 may inherit the masked identification of each mask object from the masked identification of its parent display object, e.g., the parent object of E3 is E2, while E2 is covered by E1 so the id _ masked flag of E2 is E1 is 1, and E3 may inherit the id _ masked of E2 is 1. Preferably, the mask marking module 600 may allocate the mask identifier and the masked identifier to each display object according to the tree structure of the to-be-displayed picture in a forward traversal order, and in the tree structure, the traversal order of the mask object is prior to the traversal order of the display object masked by the mask object.
The mask display processing device in the embodiment can find the corresponding mask object through the mask identification of the display object in the current picture to be displayed, and then perform mask display processing on the target display object according to the obtained mask outline of the mask object, and further can realize nested mask display processing by finding the mask outline of the nested mask object, so that an independent rendering and drawing step on the mask object is not needed any more, and a global mask structure linked list in the prior art is also not needed, thereby effectively saving display and storage resources.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.

Claims (17)

1. A method of mask display processing, the method comprising:
acquiring a masked identifier of a target display object;
searching a corresponding first mask object according to the masked identification of the target display object;
acquiring a mask outline of the first mask object;
acquiring an overlapping area of a display outline of the target display object and a mask outline of the first mask object, rendering and filling display content of the target display object in the overlapping area to the overlapping area, displaying the overlapping area with the display content rendered and filled, discarding display content of the target display object outside the mask outline of the first mask object, and releasing display memory resources occupied by the first mask object after displaying the display content of the target display object in the mask outline of the first mask object.
2. The method of matte display processing according to claim 1, wherein said finding a corresponding first mask object according to the masked identification of the target display object comprises:
and searching for the display object with the mask identifier as the target display object, and taking the searched display object as a first mask object of the target display object.
3. The mask display processing method according to claim 1, wherein the obtaining of the masked identification of the target display object further comprises:
and respectively distributing video memory resources for the target display object and the first mask object.
4. The matte display processing method according to claim 1, wherein the obtaining of an overlapping area of a display outline of the target display object and a mask outline of the first mask object, rendering and filling display content of the target display object located in the overlapping area into the overlapping area, the rendering and filling display content into the overlapping area comprises:
acquiring a display contour line segment of the display contour of the target display object in the current scanning line;
acquiring a mask outline line segment of the mask outline of the first mask object in a current scanning line;
acquiring an overlapped line segment of the display outline line segment and the mask outline line segment;
rendering and filling the display content of the target display object on the overlapped line segment onto the overlapped line segment;
display rendering the overlapping line segments filled with display content.
5. The mask display processing method according to claim 4, further comprising:
before rendering a current scanning line, respectively allocating video memory resources corresponding to the current scanning line to the target display object and the first mask object;
and after the mask outline of the first mask object is obtained on the mask outline line segment of the current scanning line, releasing the video memory resource corresponding to the first mask object and the current scanning line.
6. The method for processing mask display according to claim 1, wherein the step of displaying the display content of the target display object located in the mask outline of the first mask object to release the video memory resource occupied by the first mask object further comprises:
acquiring a masked identifier of the first masking object;
searching a corresponding second mask object according to the masked identification of the first mask object, and acquiring a mask outline of the second mask object;
matching the mask outline of the first mask object with the mask outline of the second mask object to obtain an overlapped mask outline of the first mask object and the second mask object;
matching the display outline of the target display object with the overlapping mask outline of the first mask object and the second mask object, acquiring the display outline of the target display object and a first overlapping area of the overlapping mask outline, rendering and filling the display content of the target display object in the first overlapping area to the first overlapping area, displaying the first overlapping area with the display content being rendered and filled, and discarding the display content of the target display object outside the overlapping mask outline;
and releasing the video memory resources occupied by the first mask object and the second mask object.
7. The mask display processing method according to any one of claims 1 to 6, wherein the obtaining of the masked identification of the target display object further comprises:
allocating a mask mark for each mask object in the picture to be displayed;
and marking a masked display object mark of each masked display object in the picture to be displayed, wherein the masked display object mark of the display object is a mask mark of a mask object which directly masks the display object.
8. The matte display processing method according to claim 7, wherein the masked identification of each mask object inherits the masked identification of its parent display object.
9. A mask display processing apparatus, comprising:
the mask identification obtaining module is used for obtaining a masked identification of the target display object;
the mask object searching module is used for searching a corresponding first mask object according to the masked identifier of the target display object;
a mask outline acquisition module for acquiring a mask outline of the first mask object;
the mask display module is used for matching the display outline of the target display object with the mask outline of the first mask object, displaying the display content of the target display object, which is positioned in the mask outline of the first mask object, in the display content of the target display object, and discarding the display content of the target display object, which is positioned outside the mask outline of the first mask object;
the video memory releasing module is used for releasing video memory resources occupied by the first mask object after the mask display module displays the display content in the mask outline of the first mask object in the display content of the target display object;
wherein the mask display module comprises:
a mask region acquisition unit configured to acquire an overlapping region of a display contour of the target display object and a mask contour of the first mask object;
a rendering and filling unit, configured to render and fill display content located in the mask outline of the first mask object in the display content of the target display object to the overlap area;
a display unit for displaying the overlapped area filled with the display content.
10. The mask display processing apparatus according to claim 9, wherein the mask object finding module is configured to:
and searching for the display object with the mask identifier as the target display object, and taking the searched display object as a first mask object of the target display object.
11. The mask display processing device according to claim 9, further comprising:
and the video memory resource allocation module is used for allocating video memory resources for the target display object and the first mask object respectively.
12. The mask display processing device according to claim 9, wherein the mask display module further comprises:
a mask line segment obtaining unit, configured to obtain a display outline line segment of the display outline of the target display object in a current scanning line, obtain a mask outline line segment of the mask outline of the first mask object in the current scanning line, and further obtain an overlapping line segment of the display outline line segment and the mask outline line segment;
the rendering and filling unit is used for rendering and filling the display content of the target display object on the overlapped line segment onto the overlapped line segment;
the display unit is used for displaying and rendering the overlapped line segments filled with the display content.
13. The mask display processing device according to claim 12, further comprising:
a video memory resource allocation module, configured to allocate video memory resources corresponding to the current scan line to the target display object and the first mask object respectively before rendering the current scan line;
and the video memory releasing module is used for releasing the video memory resources corresponding to the first mask object and the current scanning line after the mask outline of the first mask object is obtained on the mask outline line segment of the current scanning line.
14. The mask display processing device according to claim 9,
the mask identification acquisition module is further configured to: acquiring a masked identifier of the first masking object;
the mask object finding module is further configured to: searching a corresponding second mask object according to the masked identifier of the first mask object;
the mask contour acquisition module is further configured to: acquiring a mask outline of the second mask object, matching the mask outline of the first mask object with the mask outline of the second mask object, and acquiring an overlapped mask outline of the first mask object and the second mask object;
the mask display module is used for:
matching the display outline of the target display object with the overlapping mask outline of the first mask object and the second mask object, and displaying the display content in the overlapping mask outline of the first mask object and the second mask object in the display content of the target display object.
15. Mask display processing apparatus according to any one of claims 9 to 14, the apparatus further comprising:
the display device comprises a mask marking module and a display object marking module, wherein the mask marking module is used for distributing mask marks for all mask objects in a picture to be displayed and marking masked display object marks for all masked display objects in the picture to be displayed, and the masked display object marks are mask marks of mask objects which directly mask the display objects.
16. The mask display processing device according to claim 15, wherein the masked identification of each mask object inherits the masked identification of its parent display object.
17. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions which, when executed by a processor, perform the method according to any one of claims 1-8.
CN201610340631.7A 2016-05-20 2016-05-20 Mask display processing method and device Active CN105976415B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610340631.7A CN105976415B (en) 2016-05-20 2016-05-20 Mask display processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610340631.7A CN105976415B (en) 2016-05-20 2016-05-20 Mask display processing method and device

Publications (2)

Publication Number Publication Date
CN105976415A CN105976415A (en) 2016-09-28
CN105976415B true CN105976415B (en) 2020-05-26

Family

ID=56956242

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610340631.7A Active CN105976415B (en) 2016-05-20 2016-05-20 Mask display processing method and device

Country Status (1)

Country Link
CN (1) CN105976415B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6742963B2 (en) * 2017-07-25 2020-08-19 株式会社日立ハイテク Automatic analyzer and image processing method
CN112419456B (en) * 2019-08-23 2024-04-16 腾讯科技(深圳)有限公司 Special effect picture generation method and device
CN110766774B (en) * 2019-11-06 2022-11-25 武汉艺画开天文化传播有限公司 Label adding method and system for Maya
CN114445521A (en) * 2022-02-09 2022-05-06 北京字跳网络技术有限公司 Image processing method, image processing device, electronic equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103391424A (en) * 2012-05-08 2013-11-13 安讯士有限公司 Method for analyzing object in image captured by monitoring camera and object analyzer
CN103679793A (en) * 2013-12-31 2014-03-26 广州博冠信息科技有限公司 Rendering method and equipment
CN103679777A (en) * 2012-09-07 2014-03-26 腾讯科技(深圳)有限公司 Method and device for realizing page mask
CN104899856A (en) * 2014-03-07 2015-09-09 腾讯科技(深圳)有限公司 Image processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103391424A (en) * 2012-05-08 2013-11-13 安讯士有限公司 Method for analyzing object in image captured by monitoring camera and object analyzer
CN103679777A (en) * 2012-09-07 2014-03-26 腾讯科技(深圳)有限公司 Method and device for realizing page mask
CN103679793A (en) * 2013-12-31 2014-03-26 广州博冠信息科技有限公司 Rendering method and equipment
CN104899856A (en) * 2014-03-07 2015-09-09 腾讯科技(深圳)有限公司 Image processing method and device

Also Published As

Publication number Publication date
CN105976415A (en) 2016-09-28

Similar Documents

Publication Publication Date Title
CN105976415B (en) Mask display processing method and device
CN103500066B (en) Screenshot device and method suitable for touch screen equipment
CN110008808B (en) Panorama segmentation method, device and system and storage medium
CN110381369B (en) Method, device and equipment for determining recommended information implantation position and storage medium
CN111291584B (en) Method and system for identifying two-dimensional code position
CN109710362B (en) Screenshot processing method, computing device and computer storage medium
CN110781859A (en) Image annotation method and device, computer equipment and storage medium
CN104536990B (en) A kind of image display method and terminal
US20150187126A1 (en) Using indirection maps for rendering texture space effects
CN110060201B (en) Hot spot interaction method for panoramic video
JP2015504220A5 (en)
TW201915952A (en) Method and apparatus for generating visualization object, and device
CN106500684B (en) Method and device for processing navigation path information
CN110851050B (en) Method and device for testing clicking of page elements
CN111429548B (en) Digital map generation method and system
CN101388979B (en) Method for overlapping user interface on video image
CN106569805B (en) Canvas storage method, picture drawing method and equipment
CN113379865B (en) Drawing method and system of target object
CN104156694A (en) Method and device for identifying target object of image
CN112906532B (en) Image processing method and device, electronic equipment and storage medium
CN110018812B (en) Graph drawing method and device
US20180336243A1 (en) Image Search Method, Apparatus and Storage Medium
US9031281B2 (en) Identifying an area of interest in imagery
CN106934845B (en) Object picking method and device
CN115063497B (en) Point cloud data processing method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant