CN114816629B - Method and device for drawing display object, storage medium and electronic device - Google Patents

Method and device for drawing display object, storage medium and electronic device Download PDF

Info

Publication number
CN114816629B
CN114816629B CN202210396743.XA CN202210396743A CN114816629B CN 114816629 B CN114816629 B CN 114816629B CN 202210396743 A CN202210396743 A CN 202210396743A CN 114816629 B CN114816629 B CN 114816629B
Authority
CN
China
Prior art keywords
display
type
display objects
display object
objects
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
CN202210396743.XA
Other languages
Chinese (zh)
Other versions
CN114816629A (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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202210396743.XA priority Critical patent/CN114816629B/en
Publication of CN114816629A publication Critical patent/CN114816629A/en
Application granted granted Critical
Publication of CN114816629B publication Critical patent/CN114816629B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/25Output arrangements for video game devices
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The invention discloses a method and a device for drawing a display object, a storage medium and an electronic device. The method comprises the following steps: dividing a plurality of display objects contained in a display object container into a first type of display object and a second type of display object; acquiring display objects to be batched from the first type of display objects based on the target attribute of each display object in the first type of display objects; determining the drawing sequence of the display objects to be batched, the display objects except the display objects to be batched in the first type of display objects and the second type of display objects; and drawing the plurality of display objects according to the drawing sequence. The invention solves the technical problems of high cost and poor flexibility of the processing method for carrying out batch drawing on the display objects by manual adjustment or global command in the related technology.

Description

Method and device for drawing display object, storage medium and electronic device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for drawing a display object, a storage medium, and an electronic apparatus.
Background
The process by which the game client prepares data and notifies the graphics processor (Graphics processing unit, GPU for short) to draw is called a draw call (draw call). The drawcall value is one of the important performance indicators of the game client, lower drawcall value means better performance of the game client. Typically, the game engine reduces the drawcall value by a pooling operation, however, only consecutive identical texture objects may be pooled, and thus those skilled in the art are continually seeking ways to make objects meet the game engine pooling criteria described above.
In the related scheme, the method for adjusting the text object to meet the text batch principle of the game engine mainly comprises the following two steps:
(1) In a User Interface (UI) editor, text objects are arranged as continuously as possible by manually adjusting them. However, often different text objects are distributed in different object containers, which has the disadvantage of being difficult and costly.
(2) And starting a global automatic batch combination command in the game engine, namely searching and extracting non-adjacent batch-capable objects through global traversal to carry out batch combination. The method for judging the batch-applicable objects comprises the following steps: if two text objects with the same texture do not collide with the boundary of other objects interspersed between the two text objects, the two text objects are combinable objects. However, this method has drawbacks in that: the performance consumption of traversal search is large, the flexibility of the global command is poor, and granularity control is difficult.
Therefore, how to complete automatic batch of a plurality of objects at a low cost becomes one of the important problems in game production. In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a storage medium and an electronic device for drawing display objects, which at least solve the technical problems of high cost and poor flexibility of a processing method for carrying out batch drawing on the display objects through manual adjustment or global commands in the related technology.
According to an aspect of an embodiment of the present invention, there is provided a method of drawing a display object, including:
dividing a plurality of display objects contained in a display object container into a first type of display object and a second type of display object, wherein the first type of display object is a text type display object, and the second type of display object is a display object of other types except the text type; acquiring display objects to be batched from the first type of display objects based on target attributes of each display object in the first type of display objects, wherein the target attributes represent whether to batched texts in the display objects to be batched by taking a display object container as a unit; determining the drawing sequence of the display objects to be batched, the display objects except the display objects to be batched in the first type of display objects and the second type of display objects; and drawing the plurality of display objects according to the drawing sequence.
Optionally, dividing the plurality of display objects contained in the display object container into the first type of display object and the second type of display object includes: acquiring an object type of each display object in a plurality of display objects; the plurality of display objects are divided into a first type of display object and a second type of display object based on the object type.
Optionally, the method for drawing a display object further includes: setting state information of a target attribute in response to a control operation performed on the target attribute, wherein the target attribute is a last rendered text attribute, and the state information includes one of the following: the method comprises an open state and an unopened state, wherein the open state represents that texts in display objects to be batched are batched by taking a display object container as a unit.
Optionally, based on the target attribute of each display object in the first type of display objects, obtaining the display objects to be batched from the first type of display objects includes: acquiring state information of a target attribute; and in the first type of display objects, determining the display object with the state information of which is in an on state as a display object to be batched.
Optionally, determining the drawing order of the display objects to be batched, the display objects except for the display objects to be batched in the first type of display objects, and the second type of display objects includes: traversing the plurality of display objects, adding drawing instructions of the display objects to be batched into a first queue, and adding drawing instructions of the display objects except the display objects to be batched in the first type of display objects and drawing instructions of the display objects of the second type into a second queue, wherein the first queue is a buffer queue, and the second queue is a drawing queue; a drawing order is determined based on the first queue and the second queue.
Optionally, determining the drawing order based on the first queue and the second queue includes: after the first queue is added to the second queue, the drawing order is determined.
Optionally, drawing the plurality of display objects in the drawing order includes: the method comprises the steps of sequentially drawing display objects except for the display objects to be batched in the first type of display objects and the second type of display objects according to the addition sequence of each drawing instruction contained in the second queue, and sequentially drawing the display objects to be batched according to the addition sequence of each drawing instruction contained in the first queue.
According to another aspect of the embodiment of the present invention, there is also provided an apparatus for drawing a display object, including:
the dividing module is used for dividing a plurality of display objects contained in the display object container into a first type of display objects and a second type of display objects, wherein the first type of display objects are text type display objects, and the second type of display objects are display objects of other types except the text type; the display device comprises an acquisition module, a display object storage module and a display object storage module, wherein the acquisition module is used for acquiring to-be-batched display objects from the first type of display objects based on target attributes of each display object in the first type of display objects, wherein the target attributes represent whether to perform to-be-batched processing on texts in the to-be-batched display objects by taking a display object container as a unit; the determining module is used for determining the drawing sequence of the display objects to be batched, the display objects except the display objects to be batched in the first type of display objects and the second type of display objects; and the drawing module is used for drawing the plurality of display objects according to the drawing sequence.
Optionally, the above-mentioned dividing module is further configured to: acquiring an object type of each display object in a plurality of display objects; the plurality of display objects are divided into a first type of display object and a second type of display object based on the object type.
Optionally, the apparatus for drawing a display object further includes: the setting module is used for responding to the control operation executed on the target attribute and setting state information of the target attribute, wherein the target attribute is the last rendered text attribute, and the state information comprises one of the following components: the method comprises an open state and an unopened state, wherein the open state represents that texts in display objects to be batched are batched by taking a display object container as a unit.
Optionally, the above-mentioned acquisition module is further configured to: acquiring state information of a target attribute; and in the first type of display objects, determining the display object with the state information of which is in an on state as a display object to be batched.
Optionally, the determining module is further configured to: traversing the plurality of display objects, adding drawing instructions of the display objects to be batched into a first queue, and adding drawing instructions of the display objects except the display objects to be batched in the first type of display objects and drawing instructions of the display objects of the second type into a second queue, wherein the first queue is a buffer queue, and the second queue is a drawing queue; a drawing order is determined based on the first queue and the second queue.
Optionally, the determining module is further configured to: after the first queue is added to the second queue, the drawing order is determined.
Optionally, the drawing module is further configured to: the method comprises the steps of sequentially drawing display objects except for the display objects to be batched in the first type of display objects and the second type of display objects according to the addition sequence of each drawing instruction contained in the second queue, and sequentially drawing the display objects to be batched according to the addition sequence of each drawing instruction contained in the first queue.
According to another aspect of the embodiments of the present invention, there is also provided a non-volatile storage medium in which a computer program is stored, wherein the computer program is arranged to perform the method of drawing a display object in any one of the above-mentioned aspects when run.
According to another aspect of the embodiment of the present invention, there is also provided an electronic apparatus including: comprising a memory in which a computer program is stored and a processor arranged to run the computer program to perform the method of rendering a display object of any of the above.
In at least some embodiments of the present invention, first, a plurality of display objects included in a display object container are divided into a first type display object and a second type display object, where the first type display object is a text type display object, and the second type display object is a display object of a type other than the text type, and a method for obtaining a display object to be batched from the first type display object based on a target attribute of each display object in the first type display object is adopted, where the target attribute indicates whether to batched text in the display object to be batched in units of the display object container, and by determining a drawing order of the display object to be batched, the display object other than the display object to be batched in the first type display object, and the second type display object, and drawing the plurality of display objects according to the drawing order, a technical effect of batched drawing of the display objects by an automatic batched method in units of the container is achieved, thereby realizing a technical effect of reducing an automatic batched drawing cost of the display objects and further improving performance of a game client, and further solving a technical problem of high and poor processing cost and flexibility of the display object batched by a manual adjustment or global command in related technologies.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
fig. 1 is a block diagram of a hardware structure of a mobile terminal of a method of drawing a display object according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of rendering a display object according to one embodiment of the invention;
FIG. 3 is a schematic diagram of an alternative process of drawing a display object according to an embodiment of the invention;
FIG. 4 is a schematic diagram of an alternative rendering of the results of a display object according to an embodiment of the invention;
FIG. 5 is a schematic diagram of the result of another alternative rendering of a display object according to an embodiment of the invention;
FIG. 6 is a block diagram of an apparatus for rendering a display object according to one embodiment of the present invention;
fig. 7 is a schematic structural view of another apparatus for drawing a display object according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to one embodiment of the present invention, there is provided an embodiment of a method of rendering a display object, it being noted that the steps illustrated in the flowchart of the figures may be performed in a computer system, such as a set of computer executable instructions, and that although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
The method of drawing a display object in one embodiment of the present invention may be run on a terminal device or a server. The terminal device may be a local terminal device. When the method for drawing the display object runs on the server, the method can be realized and executed based on a cloud interaction system, wherein the cloud interaction system comprises the server and the client device.
In an alternative embodiment, various cloud applications may be run under the cloud interaction system, for example: and (5) cloud game. Taking cloud game as an example, cloud game refers to a game mode based on cloud computing. In the running mode of the cloud game, a running main body of the game program and a game picture presentation main body are separated, the storage and running of a method for drawing a display object are completed on a cloud game server, and the function of a client device is used for receiving and sending data and presenting a game picture, for example, the client device can be a display device which is close to a user side and has a data transmission function, such as a mobile terminal, a television, a computer, a palm computer and the like; but the terminal device for information processing is cloud game server of cloud. When playing the game, the player operates the client device to send an operation instruction to the cloud game server, the cloud game server runs the game according to the operation instruction, codes and compresses data such as game pictures and the like, returns the data to the client device through a network, and finally decodes the data through the client device and outputs the game pictures.
In an alternative embodiment, the terminal device may be a local terminal device. Taking a game as an example, the local terminal device stores a game program and is used to present a game screen. The local terminal device is used for interacting with the player through the graphical user interface, namely, conventionally downloading and installing the game program through the electronic device and running. The manner in which the local terminal device provides the graphical user interface to the player may include a variety of ways, for example, it may be rendered for display on a display screen of the terminal, or provided to the player by holographic projection. For example, the local terminal device may include a display screen for presenting a graphical user interface including game visuals, and a processor for running the game, generating the graphical user interface, and controlling the display of the graphical user interface on the display screen.
In a possible implementation manner, the embodiment of the invention provides a method for drawing a display object, and a graphical user interface is provided through a terminal device, wherein the terminal device can be the aforementioned local terminal device or the aforementioned client device in the cloud interaction system.
Taking a mobile terminal running in a local terminal device as an example, the mobile terminal can be a terminal device such as a smart phone (e.g. an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a palm computer, a mobile internet device (Mobile Internet Devices, abbreviated as MID), a PAD, a game console, etc. Fig. 1 is a block diagram of a hardware structure of a mobile terminal of a method of drawing a display object according to an embodiment of the present invention. As shown in fig. 1, a mobile terminal may include one or more (only one is shown in fig. 1) processors 102 (the processors 102 may include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processor (GPU), a Digital Signal Processing (DSP) chip, a Microprocessor (MCU), a programmable logic device (FPGA), a neural Network Processor (NPU), a Tensor Processor (TPU), an Artificial Intelligence (AI) type processor, etc.) and a memory 104 for storing data. Optionally, the mobile terminal may further include a transmission device 106, an input-output device 108, and a display device 110 for communication functions. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a method for drawing a display object in an embodiment of the present invention, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, that is, implement the method for drawing a display object described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
The input in the input output device 108 may come from a plurality of human interface devices (Human Interface Device, abbreviated as HIDs). For example: keyboard and mouse, gamepad, other special game controllers (e.g., steering wheel, fishing pole, dance mat, remote control, etc.). Part of the ergonomic interface device may provide output functions in addition to input functions, such as: force feedback and vibration of the gamepad, audio output of the controller, etc.
The display device 110 may be, for example, a head-up display (HUD), a touch screen type Liquid Crystal Display (LCD), and a touch display (also referred to as a "touch screen" or "touch display"). The liquid crystal display may enable a user to interact with a user interface of the mobile terminal. In some embodiments, the mobile terminal has a Graphical User Interface (GUI), and the user may interact with the GUI by touching finger contacts and/or gestures on the touch-sensitive surface, where the man-machine interaction functions optionally include the following interactions: executable instructions for performing the above-described human-machine interaction functions, such as creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving electronic mail, talking interfaces, playing digital video, playing digital music, and/or web browsing, are configured/stored in a computer program product or readable storage medium executable by one or more processors.
In this embodiment, a method for drawing a display object running on the mobile terminal is provided, and fig. 2 is a flowchart of a method for drawing a display object according to one embodiment of the present invention, as shown in fig. 2, the method includes the following steps:
step S21, dividing a plurality of display objects contained in a display object container into a first type of display object and a second type of display object, wherein the first type of display object is a text type display object, and the second type of display object is a display object of other types except the text type;
alternatively, the method of drawing display objects described above may run on an H5 client gaming engine egset in which the visual graphic consists of display objects and display object containers. The display object may include visible graphics, text, video, pictures, etc. The display object container is not visible and can be used to store a plurality of the display objects.
According to the types of the display objects, a plurality of display objects contained in the display object container may be divided into the first type of display object and the second type of display object. The first type of display object may be a text type of display object and the second type of display object may be other types of display objects than text type.
Step S22, acquiring display objects to be batched from the first type of display objects based on target attributes of each display object in the first type of display objects, wherein the target attributes represent whether to batched texts in the display objects to be batched by taking a display object container as a unit;
the target attribute may be used to indicate whether to batch the text in the display object to be batched with the display object container as a unit. The first type of display object may be a text type display object, and may include a plurality of display objects. Based on the target attribute of each display object in the first type of display object, the display objects to be batched can be obtained from a plurality of display objects included in the first type of display object.
Step S23, determining drawing sequences of the display objects to be batched, the display objects except the display objects to be batched in the first type of display objects and the second type of display objects;
the first type of display object may include a plurality of display objects, and the display objects to be batched may be a plurality of display objects obtained from the first type of display object according to the target attribute. The second display object may be a display object of a type other than the text type.
Alternatively, the drawing order may be an order in which the egr game engine draws a plurality of display objects. By the method provided by the embodiment, the drawing sequence of the display objects to be batched, the display objects except for the display objects to be batched in the first type of display objects and the second type of display objects can be determined.
And step S24, drawing the plurality of display objects according to the drawing sequence.
Alternatively, the game engine egset may draw the plurality of display objects in the drawing order. The plurality of display objects may include: the display objects to be batched, the display objects except for the display objects to be batched in the first type of display objects, and the second type of display objects.
In at least some embodiments of the present invention, first, a plurality of display objects included in a display object container are divided into a first type display object and a second type display object, where the first type display object is a text type display object, and the second type display object is a display object of a type other than the text type, and a method for obtaining a display object to be batched from the first type display object based on a target attribute of each display object in the first type display object is adopted, where the target attribute indicates whether to batched text in the display object to be batched in units of the display object container, and by determining a drawing order of the display object to be batched, the display object other than the display object to be batched in the first type display object, and the second type display object, and drawing the plurality of display objects according to the drawing order, a technical effect of batched drawing of the display objects by an automatic batched method in units of the container is achieved, thereby realizing a technical effect of reducing an automatic batched drawing cost of the display objects and further improving performance of a game client, and further solving a technical problem of high and poor processing cost and flexibility of the display object batched by a manual adjustment or global command in related technologies.
Optionally, in step S21, dividing the plurality of display objects contained in the display object container into the first type of display object and the second type of display object may include the following steps:
step S211, obtaining an object type of each display object in a plurality of display objects;
in step S212, the plurality of display objects are divided into a first type of display object and a second type of display object based on the object type.
Alternatively, the display object container may be a virtual container for storing a plurality of display objects in the game engine egset. The display object may be a graphic, text, video, picture, etc. that is visible in the game engine egset. And taking the display object container as a unit, acquiring an object type of each display object in a plurality of display objects contained in the display object container, wherein the object type can be text, graphics, pictures, videos and the like.
The plurality of display objects may be divided into the first type display object and the second type display object based on an object type of each of the plurality of display objects contained in the display object container. The first type of display object may be a text type of display object and the second type of display object may be other types of display objects than text type.
For example, the method provided by the present embodiment may be used when making a game graphical interface in a game engine egset. The display object container a contains N display objects, among which there are N1 text objects, N2 graphics objects, and 1 picture object, i.e., n=n1+n2+1. Based on the object types of the N display objects, a first type display object and a second type display object can be obtained. The first type of display object includes the n1 text objects; the second type of display object comprises the graphical object and the picture object, i.e. a total of n2+1 display objects.
Specifically, the process of dividing the N display objects into the first type display object and the second type display object based on the object types is as follows: traversing N display objects in a display object container A; judging whether the display object is of a text type or not each time; if the display object is of a text type, the display object is added to the first type of display object, and if the display object is not of a text type, the display object is added to the second type of display object.
Optionally, the method for drawing a display object may further include the following steps:
step S25, responding to the control operation executed on the target attribute, setting state information of the target attribute, wherein the target attribute is the last rendered text attribute, and the state information comprises one of the following: the method comprises an open state and an unopened state, wherein the open state represents that texts in display objects to be batched are batched by taking a display object container as a unit.
The target attribute may be a last rendered text attribute of the display object. The user may perform a control operation on the target attribute, which may be used to set state information of the target attribute to one of an on state and an off state. The on state indicates that all texts in the display object can be automatically batched, and the off state indicates that all texts in the display object cannot be automatically batched.
For example, the method provided by the present embodiment may be used when making a game graphical interface in a game engine egset. The display object container a contains N display objects, and the user can set (corresponding to the control operation described above) whether each of the N display objects is turned on or not, and finally render text attribute (lastrendertexts). The LastRenderText open for a display object indicates that all text in the display object can be automatically batched. Thus, the user can control the automatic batching of N display objects in the display object container by setting the LastRenderText on state of the display objects.
Optionally, in step S22, based on the target attribute of each display object in the first type of display objects, the method for obtaining the display objects to be batched from the first type of display objects may include the following steps:
Step S221, obtaining state information of a target attribute;
in step S222, among the first type of display objects, the display object whose status information is in the on state is determined as the display object to be batched.
The state information of the target attribute may include an on state and an off state, where the on state indicates that all texts in the corresponding display object may be automatically batched. The first type of display object may be a text type display object, and may include a plurality of display objects. And acquiring the state information of the target attribute of each object in the plurality of display objects, wherein the display object with the state information in the on state can be determined as the display object to be batched in the first type of display object.
For example, the method provided by the present embodiment may be used when making a game graphical interface in a game engine egset. Fig. 3 is a schematic diagram of an alternative process of drawing a display object according to an embodiment of the present invention, in which, in the process of traversing the display objects in the display object container a, as shown in fig. 3, for each display object (corresponding to the first type of display object) determined to be of a text type, it is determined whether lastrendertexts of the display objects are turned on, and then the display objects turned on by lastrendertexts are used as display objects to be batched.
Optionally, in step S23, determining the drawing order of the display objects to be batched, the display objects other than the display objects to be batched in the first type display object, and the display objects of the second type may include the following execution steps:
step S231, traversing a plurality of display objects, adding drawing instructions of the display objects to be batched to a first queue, and adding drawing instructions of display objects except the display objects to be batched in a first type of display objects and drawing instructions of display objects of a second type to a second queue, wherein the first queue is a buffer queue, and the second queue is a drawing queue;
step S232, determining the drawing order based on the first queue and the second queue.
Optionally, the display object container in the game engine egset may include a plurality of display objects, and traversing the plurality of display objects may obtain the first queue and the second queue, where the first queue is a buffer queue and the second queue is a drawing queue. Based on the first queue and the second queue, a drawing order may be determined, which may be a sequential order in which the Egret game engine draws the plurality of display objects.
Specifically, the first type of display object is a text type display object among the plurality of display objects, and the second type of display object may be other types of display objects except the text type. The process of obtaining the first queue and the second queue may include: for the display objects to be batched in the first type of display objects, adding corresponding drawing instructions to a buffer queue (corresponding to the first queue); for the display objects except for the display objects to be batched in the first type of display objects, adding corresponding drawing instructions to a drawing queue (corresponding to the second queue); for the second type of display object, a corresponding drawing instruction is added to a drawing queue (corresponding to the second queue).
Optionally, in step S232, determining the drawing order based on the first queue and the second queue may include: after the first queue is added to the second queue, the drawing order is determined.
The drawing order may be an order in which the egset game engine draws a plurality of display objects. The first queue is a buffer queue and may include a plurality of drawing instructions; the second queue is a drawing queue, and may include a plurality of drawing instructions. The drawing order may be determined after the first queue is added to the second queue.
Still as shown in fig. 3, for a display object that is opened by lastrendertexts in a display object of a text type (corresponding to the display object of the first type), the drawing instruction of the display object to be batched is buffered, and the drawing instruction of the display object to be batched is added to the buffer queue Qb (corresponding to the first queue). For a display object whose lastrendertextis not opened in the display object of the text type, a drawing instruction of the display object is added to the drawing queue Qd (corresponding to the second queue described above), and a drawing instruction of a display object of a non-text type in the display object container a is added to the drawing queue Qd.
After the traversing of the N display objects in the display object container a is completed, the buffer queue Qb is added to the drawing queue, so as to obtain the drawing order OrderDraw of the N display objects in the display object container a. The drawing order OrderDraw may be the order in which the N display objects are drawn by the egset game engine.
Optionally, in step S24, drawing the plurality of display objects in the drawing order may include the following execution steps:
step S241, sequentially drawing the display objects except the display objects to be batched and the display objects of the second class in the first class according to the addition sequence of each drawing instruction contained in the second queue, and sequentially drawing the display objects to be batched according to the addition sequence of each drawing instruction contained in the first queue.
The first queue is a buffer queue and may include a plurality of drawing instructions; the second queue is a drawing queue, and may include a plurality of drawing instructions. In the drawing order, the first queue is subsequent to the second queue, and therefore, the drawing order of the plurality of display objects in the display object container is as follows: firstly, according to the addition sequence of each drawing instruction contained in the second queue, sequentially drawing display objects except for the display objects to be batched in the first type of display objects and the second type of display objects; and then, sequentially painting the display objects to be batched according to the adding sequence of each drawing instruction contained in the first queue.
For example, the method provided by the present embodiment may be used when making a game graphical interface in a game engine egset. Fig. 4 is a schematic diagram of the result of an alternative drawing display object according to an embodiment of the present invention, and fig. 5 is a schematic diagram of the result of another alternative drawing display object according to an embodiment of the present invention. When drawing N display objects in the display object container a, firstly drawing display objects which cannot be automatically combined and batched and display objects which are not of a text type in the display objects of a text type according to a drawing queue Qd (corresponding to the second queue) based on the drawing sequence OrderDraw, wherein the drawing result is shown in fig. 4; then, display objects which can be automatically assembled among the display objects of the text type are drawn in accordance with the buffer queue Qb (corresponding to the first queue described above), and the drawing result is shown in fig. 5.
According to the method provided by the embodiment, under the condition that the original UI file and codes in the game engine are not changed, the LastRenderText on state of the display object in the display object container is controlled, so that automatic batch drawing of the text objects in the display object container is realized, namely, all graphic objects, picture objects and non-automatic batch objects in the text objects are firstly rendered, then the automatic batch text objects are uniformly rendered, further, the drawcall value of the game client is reduced, and the performance of the game client is improved.
It is easy to note that, unlike the method provided by the related art, by the method provided by the embodiment, the sequence of the text objects does not need to be manually adjusted, and the global automatic batch combining command does not need to be started, so that the developer can set the lastrenderterstext on state for a certain display object container according to actual conditions, and can automatically batch draw the text objects in units of the container, so that the drawcall value of the game client can be reduced at lower cost, and the performance of the game client is further improved.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiment also provides a device for drawing a display object, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 6 is a block diagram illustrating a structure of an apparatus for drawing a display object according to one embodiment of the present invention, as shown in fig. 6, the apparatus including: a dividing module 601, configured to divide a plurality of display objects included in a display object container into a first type of display object and a second type of display object, where the first type of display object is a text type display object, and the second type of display object is a display object of other types except the text type; the obtaining module 602 is configured to obtain, from the first type of display objects, display objects to be batched based on a target attribute of each display object in the first type of display objects, where the target attribute indicates whether to perform batched processing on text in the display objects to be batched in units of display object containers; a determining module 603, configured to determine a drawing order of the display objects to be batched, display objects other than the display objects to be batched in the first type display objects, and display objects of the second type; and a drawing module 604, configured to draw the plurality of display objects according to a drawing order.
Optionally, the above-mentioned dividing module 601 is further configured to: acquiring an object type of each display object in a plurality of display objects; the plurality of display objects are divided into a first type of display object and a second type of display object based on the object type.
Alternatively, fig. 7 is a schematic structural view of another apparatus for drawing a display object according to an embodiment of the present invention, as shown in fig. 7, the apparatus includes, in addition to all the modules shown in fig. 6: a setting module 605, configured to set state information of a target attribute in response to a control operation performed on the target attribute, where the target attribute is a last rendered text attribute, and the state information includes one of: the method comprises an open state and an unopened state, wherein the open state represents that texts in display objects to be batched are batched by taking a display object container as a unit.
Optionally, the acquiring module 602 is further configured to: acquiring state information of a target attribute; and in the first type of display objects, determining the display object with the state information of which is in an on state as a display object to be batched.
Optionally, the determining module 603 is further configured to: traversing the plurality of display objects, adding drawing instructions of the display objects to be batched into a first queue, and adding drawing instructions of the display objects except the display objects to be batched in the first type of display objects and drawing instructions of the display objects of the second type into a second queue, wherein the first queue is a buffer queue, and the second queue is a drawing queue; a drawing order is determined based on the first queue and the second queue.
Optionally, the determining module 603 is further configured to: after the first queue is added to the second queue, the drawing order is determined.
Optionally, the drawing module 604 is further configured to: the method comprises the steps of sequentially drawing display objects except for the display objects to be batched in the first type of display objects and the second type of display objects according to the addition sequence of each drawing instruction contained in the second queue, and sequentially drawing the display objects to be batched according to the addition sequence of each drawing instruction contained in the first queue.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
Embodiments of the present invention also provide a non-volatile storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
Alternatively, in the present embodiment, the above-described nonvolatile storage medium may be configured to store a computer program for performing the steps of:
S1, dividing a plurality of display objects contained in a display object container into a first type of display object and a second type of display object, wherein the first type of display object is a text type display object, and the second type of display object is other types of display objects except the text type;
s2, acquiring display objects to be batched from the first type of display objects based on target attributes of each display object in the first type of display objects, wherein the target attributes represent whether to batched texts in the display objects to be batched by taking a display object container as a unit;
s3, determining drawing sequences of the display objects to be batched, display objects except the display objects to be batched in the first type of display objects and the second type of display objects;
and S4, drawing the plurality of display objects according to the drawing sequence.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
An embodiment of the invention also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, dividing a plurality of display objects contained in a display object container into a first type of display object and a second type of display object, wherein the first type of display object is a text type display object, and the second type of display object is other types of display objects except the text type;
s2, acquiring display objects to be batched from the first type of display objects based on target attributes of each display object in the first type of display objects, wherein the target attributes represent whether to batched texts in the display objects to be batched by taking a display object container as a unit;
s3, determining drawing sequences of the display objects to be batched, display objects except the display objects to be batched in the first type of display objects and the second type of display objects;
and S4, drawing the plurality of display objects according to the drawing sequence.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments and optional implementations, and this embodiment is not described herein.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present invention, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, for example, may be a logic function division, and may be implemented in another manner, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (10)

1. A method of rendering a display object, comprising:
dividing a plurality of display objects contained in a display object container into a first type of display object and a second type of display object, wherein the first type of display object is a text type display object, and the second type of display object is a display object of other types except the text type;
acquiring a display object to be batched from the first type of display objects based on a target attribute of each display object in the first type of display objects, wherein the target attribute represents whether to batched texts in the display object to be batched by taking a display object container as a unit, and the target attribute is a final rendering text attribute;
determining the drawing sequence of the display objects to be batched, the display objects except the display objects to be batched in the first type of display objects and the second type of display objects;
And drawing the plurality of display objects according to the drawing sequence.
2. The method of claim 1, wherein dividing the plurality of display objects contained in the display object container into the first type of display object and the second type of display object comprises:
acquiring an object type of each display object in the plurality of display objects;
the plurality of display objects are divided into the first type of display object and the second type of display object based on the object type.
3. The method according to claim 1, wherein the method further comprises:
setting state information of the target attribute in response to a control operation performed on the target attribute, wherein the state information includes one of: and the starting state represents that the texts in the display objects to be batched are batched by taking the display object container as a unit.
4. The method of claim 3, wherein obtaining display objects to be batched from the first type of display objects based on the target attribute of each display object in the first type of display objects comprises:
Acquiring the state information of the target attribute;
and in the first type of display objects, determining the display object with the state information being the on state as the display object to be batched.
5. The method of claim 1, wherein determining the drawing order of the display objects to be batched, display objects of the first type other than the display objects to be batched, and display objects of the second type comprises:
traversing the plurality of display objects, adding the drawing instructions of the display objects to be batched to a first queue, and adding the drawing instructions of the display objects except the display objects to be batched in the first type of display objects and the drawing instructions of the display objects of the second type to a second queue, wherein the first queue is a buffer queue, and the second queue is a drawing queue;
the drawing order is determined based on the first queue and the second queue.
6. The method of claim 5, wherein determining the drawing order based on the first queue and the second queue comprises:
the first queue is added after the second queue, and the drawing order is determined.
7. The method of claim 6, wherein rendering the plurality of display objects in the rendering order comprises:
and sequentially drawing the display objects except the display objects to be batched and the second type display objects in the first type display objects according to the addition sequence of each drawing instruction contained in the second queue, and sequentially drawing the display objects to be batched according to the addition sequence of each drawing instruction contained in the first queue.
8. An apparatus for rendering a display object, comprising:
the dividing module is used for dividing a plurality of display objects contained in the display object container into a first type of display objects and a second type of display objects, wherein the first type of display objects are text type display objects, and the second type of display objects are display objects of other types except the text type;
the display device comprises an acquisition module, a display object storage module and a display object storage module, wherein the acquisition module is used for acquiring a display object to be batched from the first type of display objects based on a target attribute of each display object in the first type of display objects, the target attribute represents whether to batched texts in the display object to be batched by taking a display object container as a unit, and the target attribute is a final rendering text attribute;
The determining module is used for determining the drawing sequence of the display objects to be batched, the display objects except the display objects to be batched in the first type of display objects and the second type of display objects;
and the drawing module is used for drawing the plurality of display objects according to the drawing sequence.
9. A non-volatile storage medium, characterized in that a computer program is stored in the storage medium, wherein the computer program is arranged to perform the method of rendering a display object as claimed in any one of claims 1 to 7 at run-time.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of rendering a display object as claimed in any one of claims 1 to 5.
CN202210396743.XA 2022-04-15 2022-04-15 Method and device for drawing display object, storage medium and electronic device Active CN114816629B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210396743.XA CN114816629B (en) 2022-04-15 2022-04-15 Method and device for drawing display object, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210396743.XA CN114816629B (en) 2022-04-15 2022-04-15 Method and device for drawing display object, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN114816629A CN114816629A (en) 2022-07-29
CN114816629B true CN114816629B (en) 2024-03-22

Family

ID=82537213

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210396743.XA Active CN114816629B (en) 2022-04-15 2022-04-15 Method and device for drawing display object, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN114816629B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105556574A (en) * 2013-09-11 2016-05-04 史克威尔·艾尼克斯控股公司 Rendering apparatus, rendering method thereof, program and recording medium
CN105745608A (en) * 2013-11-19 2016-07-06 株式会社和冠 Method and system for ink data generation, ink data rendering, ink data manipulation and ink data communication
CN106730827A (en) * 2016-12-06 2017-05-31 腾讯科技(深圳)有限公司 Method and terminal device that a kind of object shows
CN110209444A (en) * 2019-03-20 2019-09-06 华为技术有限公司 A kind of method for rendering graph and electronic equipment
CN111784812A (en) * 2020-06-09 2020-10-16 当家移动绿色互联网技术集团有限公司 Rendering method, rendering device, storage medium and electronic equipment
CN113419806A (en) * 2021-06-30 2021-09-21 腾讯科技(上海)有限公司 Image processing method, image processing device, computer equipment and storage medium
CN113426130A (en) * 2021-07-01 2021-09-24 网易(杭州)网络有限公司 Batch processing method and device for models
WO2021256800A1 (en) * 2020-06-16 2021-12-23 삼성전자 주식회사 Electronic apparatus and method for generating image in electronic apparatus
CN114066714A (en) * 2021-01-14 2022-02-18 腾讯科技(深圳)有限公司 Batch rendering method, device, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4848001B2 (en) * 2008-12-18 2011-12-28 株式会社ソニー・コンピュータエンタテインメント Image processing apparatus and image processing method
US10424084B2 (en) * 2017-04-28 2019-09-24 Adobe Inc. Digital content rendering that supports alpha is shape (AIS) as part of knockout groups

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105556574A (en) * 2013-09-11 2016-05-04 史克威尔·艾尼克斯控股公司 Rendering apparatus, rendering method thereof, program and recording medium
CN105745608A (en) * 2013-11-19 2016-07-06 株式会社和冠 Method and system for ink data generation, ink data rendering, ink data manipulation and ink data communication
CN106730827A (en) * 2016-12-06 2017-05-31 腾讯科技(深圳)有限公司 Method and terminal device that a kind of object shows
CN110209444A (en) * 2019-03-20 2019-09-06 华为技术有限公司 A kind of method for rendering graph and electronic equipment
CN111784812A (en) * 2020-06-09 2020-10-16 当家移动绿色互联网技术集团有限公司 Rendering method, rendering device, storage medium and electronic equipment
WO2021256800A1 (en) * 2020-06-16 2021-12-23 삼성전자 주식회사 Electronic apparatus and method for generating image in electronic apparatus
CN114066714A (en) * 2021-01-14 2022-02-18 腾讯科技(深圳)有限公司 Batch rendering method, device, equipment and storage medium
CN113419806A (en) * 2021-06-30 2021-09-21 腾讯科技(上海)有限公司 Image processing method, image processing device, computer equipment and storage medium
CN113426130A (en) * 2021-07-01 2021-09-24 网易(杭州)网络有限公司 Batch processing method and device for models

Also Published As

Publication number Publication date
CN114816629A (en) 2022-07-29

Similar Documents

Publication Publication Date Title
US10792566B1 (en) System for streaming content within a game application environment
KR20170045257A (en) Quick navigation of message conversation history
CN111464430B (en) Dynamic expression display method, dynamic expression creation method and device
US20170278291A1 (en) Multi-Mode Animation System
CA2955822C (en) Phonepad
US20230405452A1 (en) Method for controlling game display, non-transitory computer-readable storage medium and electronic device
CN113908550A (en) Virtual character control method, nonvolatile storage medium, and electronic apparatus
CN111773704B (en) Game data processing method and device, storage medium, processor and electronic device
CN111124668A (en) Memory release method and device, storage medium and terminal
CN112799801B (en) Method, device, equipment and medium for drawing simulated mouse pointer
CN113797534A (en) Self-adaptive method and device for maintaining fluency of picture
US20230401772A1 (en) Animation frame display method and apparatus, device, and storage medium
CN114816629B (en) Method and device for drawing display object, storage medium and electronic device
CN113436604B (en) Method and device for broadcasting content, electronic equipment and storage medium
CN108351888B (en) Generating deferrable data streams
CN113706675B (en) Mirror image processing method, mirror image processing device, storage medium and electronic device
CN116843802A (en) Virtual image processing method and related product
WO2021084101A1 (en) Systems and methods for replacing a theme of a virtual environment
CN113850891A (en) Animation playing processing method, device, equipment and system
CN113144606A (en) Skill triggering method of virtual object and related equipment
CN113590013A (en) Virtual resource processing method, nonvolatile storage medium, and electronic device
CN112807688A (en) Method and device for setting expression in game, processor and electronic device
US9384013B2 (en) Launch surface control
CN116271830B (en) Behavior control method, device, equipment and storage medium for virtual game object
CN111107425B (en) Method, system, and storage medium for acquiring computing resources based on rendering component elements

Legal Events

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