Display object rendering method and device, electronic equipment and storage medium
By constructing the first data structure of the display object and updating the corresponding attributes, the problem of excessive logical judgment in the existing rendering technology is solved, the rendering efficiency and animation fluency are improved, and the user experience is enhanced.
Patent Information
- Application Number
- CN202410700698.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2025-09-19
AI Technical Summary
When updating the interface, existing rendering technology needs to generate rendering instructions for each display attribute, resulting in a large number of logical judgments, which reduces rendering efficiency and animation smoothness, especially when there are many display objects or many custom setting items.
By constructing a first data structure of a display object, storing the setting data of each display attribute, and updating only the attributes that need to be changed during an update, a second data structure is generated, reducing unnecessary logical judgments, and rendering the updated display object directly based on the second data structure.
It reduces the rendering operation time, improves rendering efficiency and animation smoothness, and enhances the user experience.
Smart Images

Figure CN120669938A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of display technology, and in particular relates to a method, device, electronic device, and storage medium for rendering a display object. Background Art
[0002] As display technology continues to advance, the clarity and diversity of displayed content are also improving. For example, the icons on the home screen can be customized to suit user needs, including shadow style, border style, and size, to meet user needs in different scenarios.
[0003] Existing rendering technology requires regenerating rendering instructions for all display attributes when updating a rendered display object in an interface. That is, regardless of whether the setting data of the display attribute has changed, a rendering instruction corresponding to the display attribute needs to be generated to determine whether the corresponding display attribute has been set for the display object. If the display attribute has been set, the corresponding rendering action is performed based on the updated setting data of the display attribute corresponding to the display object.
[0004] However, when there are a large number of objects displayed on the screen or a large number of custom setting items, the electronic device needs to perform a large amount of logical judgment, which greatly increases the rendering time required to update the display objects, reduces the smoothness of the animation during the update and the rendering efficiency of the display objects, and affects the user experience. Summary of the Invention
[0005] The embodiments of the present application provide a rendering method, device, electronic device and storage medium for a display object, which can solve the problem of low rendering efficiency in existing rendering technology, which requires a large number of logical judgments to complete re-rendering when updating the display object.
[0006] In a first aspect, the present application provides a method for rendering a display object, the method comprising:
[0007] Rendering the display object based on a first data structure corresponding to the display object; the first data structure is constructed based on object data of the display object when a rendering request corresponding to the display object is received; the first data structure is used to store setting data of various display attributes;
[0008] In response to an object update instruction of a display object, update setting data of at least one display update attribute to obtain a second data structure; the display update attribute is a display attribute indicated to be updated by the object update instruction;
[0009] Based on the second data structure, an updated display object is rendered.
[0010] The implementation of the embodiment of the present application has the following beneficial effects: by generating a corresponding first data structure based on the object data of the display object when rendering the display object, so as to record the setting data of each display attribute through the first data structure, when the display object needs to be updated, the setting data recorded in the corresponding display attribute in the first data structure can be adjusted according to the object update instruction, thereby obtaining a second data structure, without the need to generate a corresponding rendering instruction for each display attribute, and being able to render the display object again according to the second data structure, thereby achieving the purpose of updating the display object in the interface. Compared with existing rendering technologies, the embodiment of the present application does not need to generate a corresponding rendering instruction for each display attribute, that is, there is no need to perform a logical judgment on all display attributes separately, but only needs to update the setting data of the display attributes that need to be updated in the first data structure, thereby reducing unnecessary logical judgment operations and reducing the operation time required for rendering, thereby improving rendering efficiency and improving the smoothness of animation when display objects are updated.
[0011] In a possible implementation of the first aspect, the display attribute includes a first display attribute and a second display attribute; the first display attribute is a display attribute that has been set in the object data; and the second display attribute is a display attribute to be set in the object data.
[0012] In a possible implementation of the first aspect, before rendering the display object based on the first data structure corresponding to the display object, the method further includes:
[0013] In response to a rendering request for a display object, object data of the display object is acquired; the object data records setting data of at least one first display attribute; the first display attribute is a display attribute that has been set in the object data;
[0014] The setting data of the display attribute of the first data structure is set based on the object data.
[0015] In a possible implementation of the first aspect, the display update attribute includes a first display attribute;
[0016] In response to an object update instruction of a display object, setting data of at least one display update attribute is updated to obtain a second data structure, including:
[0017] In response to the object update instruction, the first setting data in the first display attribute is updated to the second setting data.
[0018] In a possible implementation of the first aspect, the display update attribute includes a first display attribute;
[0019] In response to an object update instruction of a display object, setting data of at least one display update attribute is updated to obtain a second data structure, including:
[0020] In response to the object update instruction, first setting data recorded in the first data structure for the first display attribute is deleted to change any first display attribute to a second display attribute.
[0021] In a possible implementation of the first aspect, the display update attribute includes a second display attribute;
[0022] In response to an object update instruction of a display object, setting data of at least one display update attribute is updated to obtain a second data structure, including:
[0023] In response to the object update instruction, the second display attribute in the first data structure is set to the second setting data to change the second display attribute to the first display attribute.
[0024] In a possible implementation of the first aspect, each display attribute in the first data structure corresponds to a rendering order;
[0025] Rendering the display object based on the first data structure corresponding to the display object includes:
[0026] Based on the rendering order, the setting data of each first display attribute in the first data structure is read in sequence, and the display object is rendered.
[0027] In a possible implementation of the first aspect, before sequentially reading the setting data of each first display attribute in the first data structure based on the rendering order and rendering the display object, the method further includes:
[0028] According to the rendering order, the setting data of the first display attribute in the object data of the display object is assigned to the preset data structure template in sequence to obtain a first data structure.
[0029] In a possible implementation manner of the first aspect, the display object includes multiple display sub-objects; the display attribute includes a first node attribute; and the first node attribute is used to store display data determined based on some display sub-objects among all the display sub-objects.
[0030] In a possible implementation manner of the first aspect, the display data is image data generated based on a plurality of display sub-objects.
[0031] In a possible implementation of the first aspect, the display object includes multiple display sub-objects; the display attribute includes a second node attribute; and the second node attribute is used to record a storage address of a third data structure corresponding to each display sub-object.
[0032] In a second aspect, an embodiment of the present application provides a rendering device for a display object, comprising:
[0033] a first rendering unit, configured to render a display object based on a first data structure corresponding to the display object; the first data structure being constructed based on object data of the display object upon receiving a rendering request corresponding to the display object; the first data structure being configured to store setting data for various display attributes;
[0034] an updating unit, configured to update setting data of at least one display update attribute in response to an object update instruction of the display object, to obtain a second data structure; the display update attribute is a display attribute indicated to be updated by the object update instruction;
[0035] The second rendering unit is configured to render the updated display object based on the second data structure.
[0036] In a possible implementation of the second aspect, the display attribute includes a first display attribute and a second display attribute; the first display attribute is a display attribute that has been set in the object data; and the second display attribute is a display attribute to be set in the object data.
[0037] In a possible implementation of the second aspect, the rendering apparatus further includes:
[0038] An object data acquisition unit is configured to acquire object data of a display object in response to a rendering instruction of the display object; the object data records setting data of at least one first display attribute; the first display attribute is a display attribute that has been set in the object data;
[0039] The first data structure generating unit is configured to set the display attribute setting data of the first data structure in the cache area based on the object data.
[0040] In a possible implementation of the second aspect, the display update attribute includes any first display attribute;
[0041] The update unit includes:
[0042] The first updating unit is configured to update the first setting data in any first display attribute to the second setting data in response to the object update instruction.
[0043] In a possible implementation of the second aspect, the display update attribute includes any first display attribute;
[0044] The update unit includes:
[0045] The second updating unit is configured to delete the first setting data recorded in the first data structure for any first display attribute in response to the object update instruction, so as to change the first display attribute to the second display attribute.
[0046] In a possible implementation of the second aspect, the display update attribute includes any second display attribute;
[0047] The update unit includes:
[0048] The third updating unit is configured to set any second display attribute in the first data structure as second setting data in response to the object update instruction, so as to change any second display attribute to the first display attribute.
[0049] In a possible implementation of the second aspect, each display attribute in the first data structure corresponds to a rendering order;
[0050] The first rendering unit includes:
[0051] The ordered rendering unit is used to sequentially read the setting data of each first display attribute in the first data structure based on the rendering order, and render the display object.
[0052] In a possible implementation of the second aspect, the rendering apparatus further includes:
[0053] The parameter assignment unit is used to assign the setting data of the first display attribute in the object data of the display object to the preset data structure template in sequence according to the rendering order to obtain the first data structure.
[0054] In a possible implementation of the second aspect, the display object includes multiple display sub-objects; the display attribute includes a first node attribute; and the first node attribute is used to store display data determined based on some display sub-objects among all the display sub-objects.
[0055] In a possible implementation manner of the second aspect, the display data is image data generated based on a plurality of display sub-objects.
[0056] In a possible implementation of the second aspect, the display object includes multiple display sub-objects; the display attribute includes a second node attribute; and the second node attribute is used to record a storage address of a third data structure corresponding to each display sub-object.
[0057] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a program stored in the memory, wherein when the processor executes the program, the steps of the method for rendering a display object in any one of the above-mentioned first aspects are implemented.
[0058] In a fourth aspect, an embodiment of the present application provides a readable storage medium, which stores a program. When the program is executed by a processor, it implements the steps of the rendering method of any one of the display objects in the first aspect above.
[0059] In a fifth aspect, an embodiment of the present application provides a program product. When the program product is run on a device, the device executes the steps of any one of the display object rendering methods in the first aspect or implements the steps of any one of the display object rendering methods in the third aspect.
[0060] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 is a schematic diagram of a rendering node tree provided by an embodiment of the present application;
[0062] Figure 2 It is a flowchart of the existing rendering process;
[0063] Figure 3 This is a flowchart of a method for rendering a display object provided by an embodiment of the present application;
[0064] Figure 4 is a schematic diagram of a playback interface of a music program provided in one embodiment of the present application;
[0065] Figure 5 This is a schematic diagram of constructing a first data structure provided by an embodiment of the present application;
[0066] Figure 6 is a schematic diagram of setting data provided by an embodiment of the present application;
[0067] Figure 7 This is a schematic diagram of a display object including multiple display sub-objects provided by an embodiment of the present application;
[0068] Figure 8 This is a schematic diagram of determining display attributes of multiple display sub-objects based on an overall display, provided by an embodiment of the present application;
[0069] Figure 9 This is a schematic diagram of a third data structure corresponding to the construction of each display sub-object provided in an embodiment of the present application;
[0070] Figure 10 This is a schematic diagram of rendering based on the first data structure provided by an embodiment of the present application;
[0071] Figure 11 This is a schematic diagram of changing display attributes provided by an embodiment of the present application;
[0072] Figure 12 This is a schematic diagram of a display effect corresponding to removing a certain display attribute provided by an embodiment of the present application;
[0073] Figure 13This is a schematic diagram of a display effect corresponding to adding a certain display attribute provided by an embodiment of the present application;
[0074] Figure 14 This is a structural block diagram of a rendering device for a display object provided in an embodiment of the present application;
[0075] Figure 15 It is a structural diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0076] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0077] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0078] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0079] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0080] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0081] When an electronic device renders a certain interface, it can determine the various display objects contained in the interface. The display object can be a user interface (UI) control in the interface, or a background image in the interface, etc. The electronic device can obtain the display information of each display object through the rendering engine. The display information can be used to record the rendering properties (such as character style, border style, color, etc.) and geometric information (such as size, position, rotation angle, etc.) of the display object. The display information corresponding to each display object can be used as a rendering node. Based on the relative positional relationship between the various display objects in the interface, a rendering node tree corresponding to the interface can be obtained. For example, Figure 1 Schematic diagram of a rendering node tree provided by an embodiment of the present application is shown. Figure 1 As shown in (a) of FIG, it is a schematic diagram of a main interface. The main interface includes icon controls of multiple applications. When rendering the main interface, the electronic device can obtain the display information corresponding to each UI control and generate a corresponding rendering node tree based on the display information, such as Figure 1 The rendering node tree includes a root node, which may include one or more desktop nodes. In this embodiment, the root node includes desktop node 1 and desktop node 2, wherein desktop node 1 corresponds to Figure 1 If the electronic device's application has many UI controls, such as many icon controls or multiple application controls that occupy a large display area, these controls can be displayed through a secondary interface that is different from the primary interface, namely, the aforementioned desktop node 2. The user can switch between the primary and secondary interfaces by swiping left or right.
[0082] Taking the nodes contained under desktop node 1 as an example, the interface corresponding to desktop node 1 is the main interface, and the interface corresponding to desktop node 2 is the secondary interface. The main interface contains icons of multiple applications, such as icon 11 for the music application and icon 12 for the photo album application. Correspondingly, the icon controls of each of the above applications also have corresponding rendering nodes under desktop node 1, such as rendering node 21 for the icon control of the music application and rendering node 22 for the icon control of the photo album application. Each rendering node is used to store the display information of the corresponding control, such as the above-mentioned drawing attributes and geometric information. For example, the rendering node 21 corresponding to the icon of the music application records the color information 211, text content 212, icon image 213 and other sub-nodes of the icon control corresponding to the music application. When the number of display attributes of the UI control increases, the number of nodes in the entire interface will also increase sharply. For example, when the shadow and border of the UI control can be changed according to the scene, the rendering nodes corresponding to the icon controls of the above-mentioned applications will also have corresponding child nodes corresponding to the shadow and the border style. That is, for every additional display attribute, the number of nodes will increase by N, where N is the number of display objects contained in the interface.
[0083] In some examples, the electronic device can call the rendering thread in the rendering engine to render the interface. Among them, when rendering the interface, the rendering thread can traverse each rendering node in the rendering node tree and perform corresponding drawing operations. Specifically, the rendering thread can dynamically generate graphic data based on the display information of the rendering node. For example, the display information includes three display attributes: background, border style, and shadow style. The rendering engine will generate rendering instructions corresponding to the above three display attributes respectively. The rendering thread can execute the above three rendering instructions in sequence to generate corresponding background color blocks, border styles, and shadow styles, and merge the three types of graphic data generated above to render the UI control corresponding to the display object in the interface. Figure 1 The icon control 11 of the music application in (a) is shown.
[0084] Therefore, similar to the sudden increase in the number of nodes in the above-mentioned rendering node tree as the number of display attributes increases, when the rendering thread renders each display object in the interface, since each display attribute needs to generate a corresponding rendering instruction, the number of rendering instructions will also increase as the number of display attributes increases.
[0085] In particular, any changes in the interface, such as a change in the border style of a UI control, require calling the rendering thread in the rendering engine to re-execute the rendering instructions corresponding to all display attributes in the entire rendering node. Even if the display object to be updated does not set a certain display attribute, or a certain display attribute has not changed, the corresponding rendering instruction needs to be generated. The rendering instruction is used to determine whether the display attribute is set in the display information of the display object, as well as the setting data corresponding to the display attribute.
[0086] For example, Figure 2 A schematic diagram of the existing rendering process is shown. Figure 2 As shown, the display object in an interface is a color block 201 containing text content. Among them, the display object corresponds to 10 display attributes, Figure 2 Some of the 10 display attributes are displayed, such as border style 202, background color 203, and shadow style 204. The display attributes may also include text content, pattern texture, etc. It should be noted that each display attribute may include one or more attribute description dimensions. For example, in order to determine the border style 202, it is necessary to determine the border thickness, border transparency, border color, and border line style, etc., that is, the display attribute of the border style corresponds to multiple attribute description dimensions. Different attribute description dimensions may have corresponding parameter values, and the parameter values of each attribute description dimension may be stored in the setting data of the display object. Among them, the setting data of some of the above 10 display attributes are recorded in the display information of the display object, while some display attributes are not set. For example, the display attribute of the pattern texture is not set. The corresponding display information is as follows. Figure 2 At a certain moment, the background color of the display object needs to be updated from white to black. That is, the background color setting data in the display information of the display object needs to be updated from white to black, which results in code segment 206. At this time, the rendering thread in the rendering engine will generate 10 rendering instructions, each corresponding to a display attribute, and execute the following steps in sequence:
[0087] Step 1: The rendering thread executes the rendering instruction corresponding to the border style. When the rendering thread executes the rendering instruction, it determines whether the display information of the display object after the display object is updated contains the setting data corresponding to the border style. If the display information contains the setting data corresponding to the border style, the corresponding graphic data is generated according to the setting data corresponding to the border style. Since the border style has not changed, the resulting graphic data is Figure 2 The border style 207 in the display information is displayed, and the next rendering instruction is executed; otherwise, when the display information does not contain the setting data corresponding to the border style, the next rendering instruction is executed.
[0088] Step 2: The rendering thread executes the rendering instruction corresponding to the pattern texture. Similar to step 1, it first determines whether the updated display information contains the setting data corresponding to the pattern texture. Since the display information originally did not have this display attribute, and this update did not update this display attribute, the rendering engine will not generate graphics data and execute the next rendering instruction.
[0089] Step 3: The rendering engine executes the rendering instruction corresponding to the background color. Since the display attribute in the display information of the display object has been updated to black, when the rendering thread executes the rendering instruction, if it is determined that the display information contains the display attribute of the background color, it can generate the corresponding black background graphic data according to the setting data corresponding to the display attribute (i.e., "black"), such as Figure 2 The background color 208 in the image is set, and the next rendering instruction is executed.
[0090] The process of steps 4 to 10 can refer to the description above, that is, when the rendering thread executes the rendering instruction corresponding to the display attribute, it needs to perform logical judgment to determine whether the display information contains the setting data of the corresponding display attribute. When the setting data of the corresponding display attribute has been set, the graphics data is rendered. Figure 2 Finally, graphics merging is performed based on the graphics data corresponding to all rendering instructions to obtain an updated display object, that is, a color block 210 containing text content.
[0091] It can be seen that the existing rendering technology generates multiple rendering instructions based on the number of display attributes when updating the display objects in the interface. When the rendering thread executes each rendering instruction in sequence, it needs to perform a large number of logical judgments, which greatly increases the logical complexity of the display object update and the time required for rendering, thereby reducing the rendering efficiency and the smoothness of the update animation.
[0092] For example, when a smartphone switches from highlight display mode to night eye protection mode, it needs to update all icons and tool controls in the main interface, as well as other display objects, such as updating the text color from black to white, and updating the background color from high brightness to low brightness. The rendering thread needs to generate a rendering instruction for all display attributes in the rendering node corresponding to each display object, and execute the logical operations corresponding to each rendering instruction in turn. The amount of logical judgment calculation will increase exponentially with the number of display attributes, affecting the user experience.
[0093] In order to solve the problems existing in rendering technology, the embodiments of the present application provide a method for rendering a display object, which can be applied to electronic devices with built-in or external display screens, such as smart TVs, smart phones, laptops, tablet computers, desktop computers, smart watches, and smart projection devices. Specifically, Figure 3 FIG2 shows a flow chart of a method for rendering a display object provided by an embodiment of the present application. Figure 3 As shown, the specific implementation process of the display object rendering method provided in the embodiment of the present application is as follows:
[0094] In S301, a display object is rendered based on a first data structure corresponding to the display object; the first data structure is constructed based on object data of the display object when a rendering request corresponding to the display object is received; the first data structure is used to store setting data of various display attributes.
[0095] In this embodiment, when rendering any display object, the electronic device may generate a corresponding rendering request. Upon receiving the rendering request, the electronic device may obtain object data corresponding to the display object, which is used to define setting data for some or all display attributes of the display object. The rendering request may be generated by an application running within the electronic device, and the rendering request may be sent to a rendering engine within the electronic device. The electronic device may obtain the object data of the display object through the rendering engine to construct a corresponding first data structure.
[0096] Among them, in the case where the display attribute includes multiple attribute description dimensions, the above-mentioned setting data can also include setting values of some or all attribute description dimensions. For example, the above-mentioned display object is an icon of a music application, and the object data corresponding to the icon stores setting parameters of the display attribute of border style. The display attribute of border style includes multiple attribute description dimensions such as border color, border thickness, border line style and border transparency. Then, the above-mentioned setting data can record parameter values corresponding to all attribute description dimensions, or record parameter values corresponding to some attribute description dimensions. Exemplarily, the object data can be generated when the application executes the code of the interface rendering request. When the application needs to render the corresponding interface, it can send the relevant code data to the rendering engine. The rendering engine responds to the rendering request through the rendering thread, determines the display objects contained in the interface, and obtains the object data corresponding to each display object.
[0097] Take the music program as an example, for example, Figure 4 Schematic diagram showing the playing interface of the music program provided by an embodiment of the present application. Figure 4As shown, the playing interface of the music program includes multiple display objects, such as the above-mentioned play control 41, the play progress bar control 42, etc. The object data of each display object in the playing interface can be stored in the program package of the music application. When the electronic device generates the playing interface, if the user clicks on Figure 1 When the icon 11 is displayed, the electronic device can obtain the program package of the music application from the memory, and the music application can generate a request for generating a playback interface and send it to the rendering engine. The rendering engine responds to the request for generating the playback interface by calling the rendering thread, determines the display objects contained in the playback interface, such as the above-mentioned playback control 41 and the playback progress bar 42, and constructs the first data structures corresponding to the above-mentioned two controls respectively through the object data corresponding to the above-mentioned two controls, and according to the various display attributes that have been set in the first data structure, executes the rendering instructions corresponding to each display attribute respectively through the rendering thread, thereby rendering the corresponding controls.
[0098] In some implementations, the storage unit of the electronic device includes a memory unit, and the storage area corresponding to the memory unit is the memory area. When the electronic device renders the display object through the rendering engine, the relevant data during the operation can be stored in the memory area. Among them, the memory area includes a cache area. After the electronic device constructs the first data structure corresponding to the display object, the first data structure can be stored in the cache area of the electronic device, that is, the setting data corresponding to each display attribute (i.e., attribute slot) of the display object is stored in the cache area, so that when the rendering thread in the rendering engine performs the rendering operation, the setting parameters corresponding to each display attribute can be quickly read from the cache area to improve the rendering efficiency.
[0099] In this embodiment, the first data structure includes all configurable display attributes in the interface. The electronic device can read the display attribute setting data recorded in the object data of the display object, assign values to the corresponding display attributes in the data structure template, and use the assigned data structure template as the first data structure corresponding to the display object in the cache area.
[0100] For example, Figure 5 FIG1 shows a schematic diagram of constructing a first data structure provided by an embodiment of the present application. Figure 5As shown, the electronic device can obtain the data structure template 51 corresponding to the interface, and the data structure template 51 contains multiple attribute slots, each attribute slot is used to record a display attribute. In the data structure template 51, each attribute slot is in a waiting state, that is, it is empty. The electronic device can obtain the object data 52 of any display object in the interface and determine the display attributes that have been set in the object data, such as shadow style 521, border style 522 and background color 523. The electronic device can assign the setting data of each display attribute to the attribute slot corresponding to the display attribute corresponding to the data structure template 51 in the cache area according to the setting data of the above display attributes, thereby obtaining the first data structure of the display object, that is, data structure 53. In the data structure 53, the above shadow style 531, border style 522 and background color 523 are all set with corresponding setting data.
[0101] In some implementations, the data structure may be an array, a queue, a tree, a heap, a stack, or the like.
[0102] In some implementations, the setting data recorded in the object data may be any type of data. For example, Figure 6 Schematic diagram of setting data provided by an embodiment of the present application is shown. Figure 6 As shown, a certain object data stores setting data for a display attribute, namely, a border style. The setting data can be a graphic data, i.e., the graphic data corresponding to the specific border style is stored in the above-mentioned object data, such as border style 61. The setting data can also be a parameter value, and the electronic device can store a correspondence between a border style and a parameter value. When the setting data corresponding to the above-mentioned border style is set to 3, the border style corresponding to style 3 can be used as the border style corresponding to the display by querying the above-mentioned correspondence, i.e., style 3 in the correspondence 62. The setting data can also be an address pointer 63, and the electronic device can obtain the corresponding storage area through the address pointer, thereby obtaining the corresponding border style. Specifically, the data type of the above-mentioned setting data can be determined according to actual conditions and is not limited here.
[0103] In some implementations, the number of display attributes contained in the corresponding data structure templates may be different for different interfaces. For example, in interface A, none of its UI controls have shadow effects. In this case, the data structure template corresponding to interface A does not include display attributes related to shadow effects, such as shadow style and shadow color; in interface B, its UI controls have shadow effects. In this case, the data structure template corresponding to interface B may include shadow style and shadow color, which are equal to display attributes related to shadow effects. That is, the data structure template corresponding to the above-mentioned interface A may be different from the data structure template corresponding to interface B. Of course, in some implementations, all interfaces within the same electronic device may use the same data structure template to store the various display attributes of the interface. The specific selection may be made based on actual conditions and is not limited here.
[0104] In some implementations, the attribute slots in the data structure template include attribute slots that have been set in the object data, and attribute slots that have not been set in the object data, that is, the data structure template contains attribute slots corresponding to all adjustable display attributes. In this case, when the electronic device generates a first data structure based on the object data of the display object, the first data structure includes display attributes that have been set (i.e., the first display attribute) and display data that has not been set (i.e., the second display attribute). Figure 5 For example, the object data records the shadow style, border style, and background color. Therefore, in the first data structure generated based on the object data, the attribute slots corresponding to these three display attributes are already assigned values. These three display attributes are the first display attributes. In some scenarios, the object data does not record the pattern texture and transparency display attributes. Accordingly, the attribute slots corresponding to these two display attributes in the first data structure are empty, meaning they are in a pending state. In this case, the pattern texture and transparency display attributes are the second display attributes.
[0105] In an embodiment of the present application, the first structure data includes the display attributes that have been set and the display attributes that have not been set of the object data, that is, it includes all adjustable display attributes, which makes it convenient for subsequent updates to the display object without changing the framework of the first data structure, and only the corresponding display attributes need to be adjusted, thereby improving rendering efficiency and reducing the operational complexity when updating the display data.
[0106] In some implementations, the data structure template is specifically a hierarchical structure with a fixed order, that is, different display attributes correspond to a rendering order, and the display attributes are arranged in sequence based on the rendering order to obtain the corresponding data structure template. For example, the data structure template can be expressed as:
[0107] void Data Structure(){
[0108] background color =;
[0109] shadow type=;
[0110] frame type =;
[0111] text=;text color=;
[0112] …
[0113] }
[0114] Among them, Data Structure() in the code content is the structure identifier of the data structure template. After reading the object data of a display object, the object identifier of the display object can be filled in the above brackets. For example, if a display object is an icon control of a music application, the first data structure corresponding to the icon control of the music application can be expressed as: Data Structure (Music App), wherein "Music App" is the object identifier corresponding to the above music application.
[0115] The above data structure template contains at least four display attributes, each corresponding to a rendering order: background color (first in the rendering order), shadow type (second in the rendering order), frame type (third in the rendering order), and text (fourth in the rendering order). The text display attribute includes two attribute description dimensions: text content and text color, resulting in a hierarchical data structure with a fixed order. Each display attribute corresponds to an "attribute slot," meaning that each of the above display attributes is in an unset state, meaning that the content after the "=" sign can be assigned a value based on the object data's settings.
[0116] In this embodiment, the electronic device can assign the setting data corresponding to each display attribute set in the object data to the attribute slot of the corresponding display data in the data structure template according to the rendering order, thereby obtaining the first data structure corresponding to the display object.
[0117] Taking the assignment of background color as an example, since the above-mentioned background color is the display attribute with the first rendering order, the electronic device can obtain the setting parameters corresponding to the background color from the object data of the display object. Among them, the above-mentioned setting data can be a parameter value. For example, if the background color is black, the "attribute slot" corresponding to the background color can be set to: background color = (0,0,0), or background color = black; the above-mentioned setting data can also be a graphic data, such as background color = 1111; the above-mentioned setting data can also be a storage address, such as background color = c: / img / black.jpg. Through the above operations, the electronic device can assign the setting data corresponding to the background color to the attribute slot of the corresponding display attribute in the data structure template, thereby obtaining the corresponding first structure data.
[0118] For example, taking the icon control of a music application as an example, the first structure data corresponding to the music application after the assignment is completed can be expressed as:
[0119] void Data Structure(Music App){
[0120] background color = (0,0,0);
[0121] shadow type=;
[0122] frame type=type 1;
[0123] text = "Music"; text color = (0,0,0);
[0124] …
[0125] }
[0126] The first data structure of the music application includes set display attributes, such as background color, border style, text, etc., which are the first display attributes; it also includes unset display attributes, such as shadow style. Among them, since the text display attribute contains two attribute description dimensions, the above setting data stores the setting information corresponding to each attribute description dimension. For example, the setting information corresponding to the text content attribute description dimension is "music", and the setting information corresponding to the text color is "(0,0,0)", that is, the text color is black. In some implementations, the above setting data may only store the setting information corresponding to some attribute description dimensions, which can be determined according to actual conditions and is not limited here.
[0127] In an embodiment of the present application, the electronic device obtains the setting data of each display attribute from the object data in sequence according to the rendering order, so that the various setting data can be imported into the data structure template in an orderly manner to obtain the first data structure corresponding to the display object, thereby improving the efficiency of constructing the data structure for rendering in the cache, and then improving the subsequent interface rendering efficiency.
[0128] In some implementations, if the above display object includes multiple display sub-objects. For example, Figure 7 A schematic diagram of a display object including multiple display sub-objects provided by an embodiment of the present application is shown. Figure 7 As shown in , the display interface includes multiple controls, including an icon control 71 for a music application, an icon control 72 for an album application, and a tool control 73 corresponding to a weather application. The tool control 73 displays weather forecast information for multiple days, such as today's weather information 731, May 29th's weather information 732, etc., that is, the tool control 73 includes multiple display sub-objects. Another display object containing multiple display sub-objects can be a control corresponding to an application group consisting of multiple applications, such as Figure 7 The icon control 74 corresponding to the payment application group in the payment application group. The payment application group includes multiple applications with payment functions, and each payment application can be used as a display sub-object in the icon control 74. When constructing the first data structure of the display object including the display sub-object, it can be implemented in the following two ways:
[0129] Method 1: Encapsulate multiple display sub-objects into a whole and record the display properties of the whole
[0130] In this manner, all display sub-objects contained in a display object can be treated as a whole, that is, a corresponding first data structure is no longer constructed for each display sub-object, but the display attributes corresponding to the whole are used as one or more display attributes in the first data structure of the display object. The above-mentioned first data structure contains a first node attribute, and the first node attribute is used to store display data determined based on a number of display sub-objects, that is, the display attributes corresponding to the whole composed of multiple display sub-objects are recorded through the first node attribute in the first data structure. Since a display object contains multiple display sub-objects, its UI control generally has a certain stability, that is, in the UI control, the number, content and relative position relationship of each display sub-object are often not easily changed. In this case, all the display sub-objects in the display object are treated as a whole to record their corresponding display attributes, so that the whole can be rendered once, without rendering each display sub-object separately, and then merging the rendered multiple display sub-objects for rendering, which can reduce the number of renderings and thus improve the rendering efficiency.
[0131] For example, Figure 8 FIG2 shows a schematic diagram of determining the display attributes of multiple display sub-objects based on the whole according to an embodiment of the present application. Figure 8 As shown, the display object is a payment application group 81, which includes at least two payment applications, namely payment application 1 and payment application 2. Among them, the patterns of the icons corresponding to payment application 1 and payment application 2 are different, namely icon 811 and icon 812. In this embodiment, the above two payment applications are regarded as a whole. In the first data structure of the above payment application group, the setting data of the display attribute of the above icon pattern can be image data composed of the combination of the above payment application 1 and payment application 2, that is, the setting data of the attribute slot 82 corresponding to the icon pattern is image 83. The above image 83 not only contains the icons of the two payment applications, but also can determine the relative position relationship between the two icons, that is, the setting data of the first node attribute can be data generated based on the image data corresponding to multiple display sub-objects.
[0132] In some cases, if the display object contains a large number of display sub-objects, when generating the UI control corresponding to the display object, it is impossible to display all the display sub-objects in the UI control at the same time. Continuing to use the above-mentioned payment application group as an example, if the payment application group contains 10 different payment applications, since the UI control corresponding to the payment application group can only display the icon thumbnails of 9 of the payment applications in the interface, that is, the icon of the 10th payment application cannot be displayed in the UI control corresponding to the payment application group. In this case, when generating the icon pattern corresponding to the UI control, the icon patterns of the first 9 payment applications are obtained, and the corresponding image data is generated based on the first 9 icon patterns, and the image data is used as the setting data corresponding to the display attributes of the icon pattern in the first data structure corresponding to the payment application group.
[0133] In some implementations, the number of the first node attributes can be multiple, and different first node attributes can be used to record different display attributes of a whole composed of multiple display sub-objects. For example, the first node attributes include three display attributes: node icon pattern, node border style, and node background color. Among them, the first node attribute of the node icon pattern is used to determine the image data corresponding to the whole composed of multiple display sub-objects; the border style and background color used by each display sub-object in the display object are the same. In this case, the border style and background color corresponding to all display sub-objects can be determined by the first node attribute in the first data structure, that is, the setting data is assigned to the node border style and node background color in the first data structure.
[0134] In an embodiment of the present application, by treating multiple display sub-objects as a whole and recording the display properties corresponding to the whole, it is possible to directly generate overall graphic data constructed based on multiple display sub-objects during rendering, without having to render each display sub-object separately and then merge them, thereby reducing unnecessary rendering operations and improving rendering efficiency.
[0135] Method 2: Build a separate third data structure for each display sub-object
[0136] In this manner, the electronic device can construct a corresponding third data structure for each display sub-object within the display object. This third data structure includes multiple display attributes corresponding to the display sub-objects. Based on the object data corresponding to each display sub-object, the electronic device can assign the setting attributes corresponding to each display attribute in the object data to a data structure template, thereby generating the third data structure corresponding to the display sub-object. The method for constructing the third data structure based on the object data of the display sub-objects can be found in the process of generating the first data structure, and will not be further described here.
[0137] In this embodiment, after constructing corresponding third data structures for different display sub-objects, the electronic device can store the storage addresses corresponding to each third data structure in the second node data of the first data structure corresponding to the display object, thereby enabling nesting between data structures.
[0138] For example, Figure 9 Schematic diagram showing the third data structure corresponding to the construction of each display sub-object provided by an embodiment of the present application. Figure 9 As shown, the display object 1 contains three display sub-objects, namely sub-object 1, sub-object 2 and sub-object 3. The first data structure corresponding to the display object contains three second node attributes, namely attributes 91 to 93, and each attribute points to a third data structure of a display sub-object. For example, attribute 91 points to the third data structure 94 corresponding to sub-object 1, and the third data structure 94 also contains multiple display attributes. Of course, in some scenarios, if the display sub-object also contains multiple sub-objects, the third data structure may also contain node attributes pointing to other data structures, thereby forming a tree-like data structure. Correspondingly, attribute 92 points to the third data structure 95 corresponding to sub-object 2, and attribute 93 points to the third data structure 96 corresponding to sub-object 3.
[0139] In an embodiment of the present application, a corresponding third data structure is constructed for different display sub-objects, so that the display effects between the display sub-objects can be decoupled, that is, different display sub-objects can customize the display effects without using the same display effects as other display sub-objects, thereby improving the diversity of display effects.
[0140] In this embodiment, after the electronic device constructs the first data structure corresponding to the display object in the cache area, it can obtain the setting data corresponding to each display attribute in the first data structure through the rendering thread, thereby generating graphic data corresponding to each display attribute through the rendering thread, and performing graphic merging processing on all graphic data to render the display object.
[0141] In some implementations, each display attribute in the first data structure has a fixed rendering order. In this case, the above rendering process can be specifically: based on the rendering order, read the setting data of each first display attribute in the first data structure in sequence, and render the corresponding display object.
[0142] For example, Figure 10 FIG1 shows a schematic diagram of rendering based on the first data structure provided by an embodiment of the present application. Figure 10 As shown, the first data structure includes at least four set display attributes, namely four first display attributes, namely background color, text, and border style. Among them, the background color is white, and the text includes two attribute description dimensions, namely text content and text color. The setting information corresponding to the above two dimensions is "music application" and gray, and the border style is a solid line border. The rendering engine of the electronic device includes a rendering thread. By calling this rendering thread, the rendering operations corresponding to the above four display attributes can be executed in sequence, thereby rendering the corresponding display object, such as display object 101.
[0143] In an embodiment of the present application, the setting data of each display attribute is read separately according to a fixed rendering order, and the rendering operations corresponding to each display attribute are executed in sequence through the rendering thread, and the rendering is superimposed according to the order of the effects. This solves the problem of the existing rendering process that a large amount of logical judgment is needed to realize the effect priority judgment, thereby causing the program to be complicated. It simplifies the rendering process and reduces performance pressure.
[0144] In S302, in response to an object update instruction of a display object, setting data of at least one display update attribute is updated to obtain a second data structure; the display update attribute is a display attribute indicated to be updated by the object update instruction.
[0145] In this embodiment, when a display object needs to be updated, such as adjusting the border style corresponding to the display object, an object update instruction corresponding to the display object can be generated. The object update instruction includes the object identifier of the display object to be updated and the update content. The update content is used to record the display attributes to be updated (i.e., the display update attributes described above) and the corresponding setting data after the update.
[0146] In some implementations, a rendering request for a display object can be sent to a rendering engine through an application. Therefore, when the application detects that any display object in the interface is updated, a corresponding object update instruction can be generated and sent to the rendering engine. The object update instruction can include the object data of the updated display object. After receiving the above-mentioned object update instruction, the rendering engine can perform an incremental update operation on the first data structure, that is, determine the display attributes that have changed, and update the setting data corresponding to the display attributes that have changed. The above-mentioned display object update can be an update generated by editing the display object in the interface, such as a user editing the text content corresponding to the application icon; it can also be an update generated by the interface when the corresponding animation effect is running. For example, when a user clicks on a control and needs to highlight the control, the display effect of the control in the interface needs to be adjusted.
[0147] In this embodiment, the first data structure corresponding to the above-mentioned display data is stored in a cache area, which has the characteristics of fast reading and writing. Therefore, when it is detected that a display object needs to be updated, the display attributes that need to be updated can be quickly determined from the cache area, and the setting data corresponding to the display attributes can be adjusted. The data structure after the adjustment of all display attributes that need to be updated is used as the second data structure corresponding to the display object.
[0148] In some implementations, the process of updating the first data structure to obtain the second data structure is an incremental update process. That is, when the rendering engine receives a rendering request from the application, it determines whether there are updated display attributes (i.e., display update attributes) and adjusts the setting data corresponding to the display update attributes in the first data structure. For display attributes that have not changed, the setting parameters are not changed. For example, the first data structure contains 40 display attributes. At a certain moment, the rendering engine detects that three display attributes of the display object have been updated. The rendering engine then updates the setting data of the updated display attributes respectively, while the remaining 37 display attributes remain unchanged because they have not been updated.
[0149] In some implementations, if a display attribute contains multiple attribute description dimensions, such as the border style mentioned above, including border thickness, border color, etc., if any attribute description dimension changes, the rendering engine can generate an update instruction corresponding to the display attribute, and in response to the update instruction, adjust the setting information of the corresponding attribute description dimension in the display attribute.
[0150] The above update process specifically includes the following three situations:
[0151] Case 1: Changing the setting data of a display attribute
[0152] In this case, the above S302 specifically includes: in response to the object update instruction, updating the first setting data in any first display attribute to the second setting data.
[0153] In this embodiment, the display attribute that has been set is the first display attribute. In the first data structure, the first display attribute has been set with a setting parameter, namely the first setting parameter. The electronic device can adjust the corresponding numerical value in the first data structure according to the setting parameter recorded in the object update instruction (i.e., the second setting parameter), that is, change the first setting parameter to the second setting parameter, that is, realize the update of the display effect. It should be noted that if the above-mentioned first display attribute includes multiple attribute description dimensions, and different attribute description dimensions correspond to one setting information, then the above-mentioned update may include changing the setting information of at least one attribute description dimension. Of course, in some implementation scenarios, the above-mentioned update process can also change the setting information of all attribute description dimensions of the first display attribute, which can be determined according to actual conditions. For example, Figure 11 Schematic diagram showing how to change display attributes according to an embodiment of the present application. Figure 11 As shown, the first data structure of the display object records the display attribute of background color, and the original setting data of the display attribute is black, as shown in FIG. Figure 11 Attribute 111 in the first data structure. At a certain moment, if the background color of the display object needs to be changed from black to white, the electronic device will determine that the corresponding display update attribute is the background color according to the object update instruction, and update the setting data corresponding to the background color in the first data structure from black (i.e., the first setting data) to white (i.e., the second setting data), thereby obtaining attribute 112. The data structure after updating all display attributes that need to be updated is used as the second data structure.
[0154] In some implementations, if the first display attribute includes multiple attribute description dimensions, then situation 1 can be further divided into the following situations:
[0155] Case 1.1 updates the attribute description dimension already set in the first display attribute. Taking the border style attribute dimension as an example, the border style includes border thickness and border color. In the first data structure, the border thickness of the border style display attribute is set to 0.1 points, and the border color is set to black. During this update, the border thickness in the border style can be set to 0.2 points, while the border color remains black, thus updating the attribute description dimension already set in the display attribute. Of course, the above update can also update all attribute description dimensions.
[0156] Case 1.2 adds an effect to the attribute description dimension that is not set in the first display attribute. Take the attribute dimension of border style as an example for explanation. The border style includes border thickness and border color. In the first data structure, the border thickness of the display attribute of the above-mentioned border style is set to 0.1 pounds, and the border color is empty. When the setting information is empty, the corresponding display effect can be the default effect. In this embodiment, when the border color is not set, the corresponding default color can be black. During this update process, the corresponding border color can be added, that is, the border color in the above-mentioned border style is set to blue.
[0157] Case 1.3: Remove some of the setting information of the attribute description dimension that has been set in the first display attribute. Take the attribute dimension of border style as an example. The border style includes border thickness and border color. In the first data structure, the border thickness of the display attribute of the border style is set to 0.1 pounds, and the border color is set to blue. During this update process, some of the setting information of the attribute description dimension that has been set can be removed. For example, the setting information of the border color can be deleted and set to empty. When the border color is not set, the default color is used for display. For example, if the default color is black, the border color is adjusted to black.
[0158] In an embodiment of the present application, during re-rendering, the setting parameters of the set display attributes can be updated, thereby improving the flexibility of adjusting the display effect.
[0159] Case 2: Remove the setting data of a display attribute
[0160] In this case, the above-mentioned S302 specifically includes: in response to the object update instruction, deleting the first setting data recorded in the first data structure of any first display attribute, so as to change any first display attribute to the second display attribute.
[0161] In this embodiment, the set display attribute is the first display attribute. In the first data structure, the first display attribute has been set with a setting parameter, namely the first setting parameter. The electronic device can remove the display effect corresponding to the first display attribute according to the object update instruction. In this case, the electronic device can delete the first setting data that has been set for the first display attribute, thereby achieving the purpose of removing the corresponding display effect. Since the first display attribute is in an unset state after the first setting data is removed, the first display attribute is changed to the second display data, namely the display attribute to be set.
[0162] For example, Figure 12 A schematic diagram showing the display effect corresponding to removing a certain display attribute provided by an embodiment of the present application is shown. Figure 12As shown, the first data structure of the display object records the display attribute of shadow style, and the original setting data of the display attribute is style 1, such as Figure 12 Attribute 121 in. At a certain moment, if the shadow effect of the display object needs to be removed, the electronic device will determine that the corresponding display update attribute is the shadow style according to the object update instruction, and delete the setting data corresponding to the shadow style in the first data structure from style 1 (i.e., the first setting data), that is, the shadow style is changed to an unset state, so as to achieve the purpose of removing a certain display effect.
[0163] In some implementations, if the first display attribute includes multiple attribute description dimensions, then scenario 2 specifically involves removing the setting information for all previously set attribute description dimensions in the display attribute. For example, the shadow style attribute dimension is used as an example. The shadow style includes a shadow size and a shadow color. In the first data structure, the shadow size of the shadow style display attribute is set to 4 pixels, and the shadow color is set to black. During this update, the shadow effect is removed, and the setting values for all attribute description dimensions in the shadow style are removed, meaning that the shadow size and shadow color are both left blank.
[0164] Case 3: Adding setting data for a display attribute
[0165] In this case, the above S302 specifically includes: in response to the object update instruction, setting any second display attribute in the first data structure as the second setting data, so as to change any second display attribute to the first display attribute.
[0166] In this embodiment, the unset display attribute is the second display attribute. In the first data structure, the object data of the display object does not record the setting parameters corresponding to the second display attribute, meaning that the display object does not have the corresponding display effect added. If a corresponding display effect is required, the electronic device can generate an object update instruction corresponding to the display attribute. In this case, the electronic device can add the corresponding setting data, i.e., the second setting data, for the second display attribute, thereby adding the corresponding display effect. Since the second setting data is set, the second display attribute is in the set state. Therefore, the second display attribute is changed to the first display data, i.e., the set display attribute.
[0167] For example, Figure 13 A schematic diagram showing the display effect corresponding to adding a certain display attribute provided by an embodiment of the present application is shown. Figure 13 As shown, the shadow style display attribute is not recorded in the first data structure of the display object, and the display attribute is in an unset state. Figure 13Attribute 131 in. At a certain moment, if a shadow effect needs to be added to the display object, the electronic device will determine that the corresponding display update attribute is the shadow style according to the object update instruction, and set the setting data corresponding to the shadow style in the first data structure to style 1 (i.e., the second setting data), that is, obtain attribute 132 and generate the corresponding second data structure to achieve the purpose of adding the shadow effect.
[0168] In some implementations, if the second display attribute includes multiple attribute description dimensions, scenario 3 specifically involves adding setting information for some or all of the unset attribute description dimensions of the second display attribute. For example, the shadow style attribute dimension includes shadow size and shadow color. In the first data structure, the shadow size and shadow color of the shadow style display attribute are both empty, indicating that they are unset. During this update, when adding a shadow effect, the shadow size and / or shadow color of the shadow style can be set based on actual display requirements.
[0169] In S303 , the updated display object is re-rendered based on the second data structure.
[0170] In this embodiment, after the electronic device updates a portion of the display data within the first data structure according to the object update instruction, it obtains a second data structure. Subsequently, the electronic device can invoke a rendering thread to sequentially execute rendering operations corresponding to each display attribute, thereby rendering the updated display object and updating the display effect of the display object. The process of rendering the display object based on the second data structure by the electronic device can be found in the description of rendering the display object based on the first data structure, and will not be repeated here.
[0171] As can be seen from the above, in a method for rendering a display object provided by an embodiment of the present application, when rendering a display object, a corresponding first data structure is generated based on the object data of the display object, so that the setting data of each display attribute is recorded through the first data structure. When the display object needs to be updated, the setting data recorded in the corresponding display attribute in the first data structure can be adjusted according to the object update instruction, thereby obtaining a second data structure. There is no need to generate a corresponding rendering instruction for each display attribute, and the display object can be rendered again according to the second data structure, thereby achieving the purpose of updating the display object in the interface. Compared with existing rendering technologies, in the embodiment of the present application, there is no need to generate a corresponding rendering instruction for each display attribute, that is, there is no need to perform a logical judgment on all display attributes separately. Instead, it is only necessary to update the setting data of the display attributes that need to be updated in the first data structure, thereby reducing unnecessary logical judgment operations and reducing the operation time required for rendering, thereby improving rendering efficiency and improving the smoothness of animation when the display object is updated.
[0172] Corresponding to the above Figure 3 A method for rendering a display object in the embodiment shown, Figure 14 A structural block diagram of a rendering device for a display object provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0173] See also Figure 14 As shown, the rendering device of the display object includes:
[0174] A first rendering unit 141 is configured to render a display object based on a first data structure corresponding to the display object; the first data structure is constructed based on object data of the display object upon receiving a rendering request corresponding to the display object; the first data structure is configured to store setting data for various display attributes;
[0175] An updating unit 142 is configured to update setting data of at least one display update attribute in response to an object update instruction of a display object to obtain a second data structure; the display update attribute is a display attribute indicated to be updated by the object update instruction;
[0176] The second rendering unit 143 is configured to render the updated display object based on the second data structure.
[0177] Optionally, the display attribute includes a first display attribute and a second display attribute; the first display attribute is a display attribute that has been set in the object data; and the second display attribute is a display attribute to be set in the object data.
[0178] Optionally, the rendering device further includes:
[0179] An object data acquisition unit is configured to acquire object data of a display object in response to a rendering request of the display object; the object data records setting data of at least one first display attribute; the first display attribute is a display attribute that has been set in the object data;
[0180] The first data structure generating unit is configured to set the setting data of the display attribute of the first data structure based on the object data.
[0181] Optionally, the display update attribute includes a first display attribute;
[0182] The updating unit 142 includes:
[0183] The first updating unit is configured to update the first setting data in the first display attribute to the second setting data in response to the object update instruction.
[0184] Optionally, the display update attribute includes a first display attribute;
[0185] The updating unit 142 includes:
[0186] The second updating unit is configured to delete the first setting data recorded in the first data structure for the first display attribute in response to the object update instruction, so as to change the first display attribute to the second display attribute.
[0187] Optionally, the display update attribute includes a second display attribute;
[0188] The updating unit 142 includes:
[0189] The third updating unit is configured to set the second display attribute in the first data structure to second setting data in response to the object update instruction, so as to change the second display attribute to the first display attribute.
[0190] Optionally, each display attribute in the first data structure corresponds to a rendering order;
[0191] The first rendering unit 141 includes:
[0192] The ordered rendering unit is used to sequentially read the setting data of each first display attribute in the first data structure based on the rendering order, and render the display object.
[0193] Optionally, the rendering device further includes:
[0194] The parameter assignment unit is used to assign the setting data of the first display attribute in the object data of the display object to the preset data structure template in sequence according to the rendering order to obtain the first data structure.
[0195] Optionally, the display object includes multiple display sub-objects; the display attribute includes a first node attribute; and the first node attribute is used to store display data determined based on several display sub-objects among all the display sub-objects.
[0196] Optionally, the display data is image data generated based on several display sub-objects.
[0197] Optionally, the display object includes a plurality of display sub-objects; the display attribute includes a second node attribute; and the second node attribute is used to record a storage address of a third data structure corresponding to each display sub-object.
[0198] Figure 15 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. Figure 15 As shown, the electronic device 15 of this embodiment includes: at least one processor 150 ( Figure 15Only one processor is shown, and the number of processors can match the number of chips actually included in the electronic device in the embodiment), a memory 151 and a program 152 stored in the memory 151 and executable on the at least one processor 150, and when the processor 150 executes the program 152, the steps in the above-mentioned rendering method embodiment of any of the display objects are implemented.
[0199] The electronic device 15 may be a tablet computer, a smart phone, a laptop computer, etc. The electronic device may include, but is not limited to, a processor 150 and a memory 151. It will be understood by those skilled in the art that Figure 15 This is merely an example of the electronic device 15 and does not constitute a limitation on the electronic device 15 . The electronic device 15 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output electronic devices, network access electronic devices, etc.
[0200] The processor 150 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.
[0201] In some embodiments, the memory 151 may be an internal storage unit of the electronic device 15, such as a hard disk or memory of the electronic device 15. In other embodiments, the memory 151 may also be an external storage electronic device of the electronic device 15, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. equipped on the electronic device 15. Furthermore, the memory 151 may also include both an internal storage unit of the electronic device 15 and an external storage electronic device. The memory 151 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the program. The memory 151 may also be used to temporarily store data that has been output or is to be output.
[0202] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of this application. Their specific functions and technical effects can be found in the method embodiment section and will not be repeated here.
[0203] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0204] An embodiment of the present application also provides an electronic device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps of any of the above-mentioned method embodiments when executing the computer program.
[0205] An embodiment of the present application further provides a readable storage medium, wherein the readable storage medium stores a program, and when the program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.
[0206] An embodiment of the present application provides a program product. When the program product is run on an electronic device, the electronic device can implement the steps in the above-mentioned various method embodiments when executing the program product.
[0207] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0208] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0209] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A method for rendering a display object, characterized in that: include: Rendering the display object based on a first data structure corresponding to the display object; The first data structure is constructed based on the object data of the display object when a rendering request corresponding to the display object is received; the first data structure is used to store setting data of various display attributes; In response to the object update instruction of the display object, update the setting data of at least one display update attribute to obtain a second data structure; the display update attribute is the display attribute indicated to be updated by the object update instruction; Based on the second data structure, the updated display object is rendered.
2. The rendering method according to claim 1, wherein: The display attribute includes a first display attribute and a second display attribute; the first display attribute is the display attribute that has been set in the object data; and the second display attribute is the display attribute to be set in the object data.
3. The rendering method according to claim 2, wherein: The display update attribute includes the first display attribute; The updating of setting data of at least one display update attribute in response to the object update instruction of the display object to obtain a second data structure includes: In response to the object update instruction, the first setting data in the first display attribute is updated to second setting data.
4. The rendering method according to claim 2, wherein: The display update attribute includes the first display attribute; The updating of setting data of at least one display update attribute in response to the object update instruction of the display object to obtain a second data structure includes: In response to the object update instruction, the first setting data of the first display attribute recorded in the first data structure is deleted to change the first display attribute to the second display attribute.
5. The rendering method according to claim 2, wherein: The display update attribute includes the second display attribute; The updating of setting data of at least one display update attribute in response to the object update instruction of the display object to obtain a second data structure includes: In response to the object update instruction, the second display attribute in the first data structure is set as second setting data to change the second display attribute to the first display attribute.
6. The rendering method according to claim 2, wherein: Each of the display attributes in the first data structure corresponds to a rendering order; The rendering of the display object based on the first data structure corresponding to the display object includes: Based on the rendering order, the setting data of each of the first display attributes in the first data structure is read in sequence to render the display object.
7. The rendering method according to claim 6, characterized in that: Before sequentially reading the setting data of each of the first display attributes in the first data structure based on the rendering order and rendering the display object, the method further includes: According to the rendering order, the setting data of the first display attribute in the object data of the display object is sequentially assigned to a preset data structure template to obtain the first data structure.
8. The rendering method according to any one of claims 1 to 7, characterized in that: The display object includes a plurality of display sub-objects; the display attribute includes a first node attribute; and the first node attribute is used to store display data determined based on a number of the display sub-objects among all the display sub-objects.
9. The rendering method according to claim 8, characterized in that: The display data is image data generated based on the plurality of display sub-objects.
10. The rendering method according to any one of claims 1 to 7, characterized in that: The display object includes a plurality of display sub-objects; the display attribute includes a second node attribute; the second node attribute is used to record the storage address of the third data structure corresponding to each of the display sub-objects.
11. A rendering device for displaying an object, characterized in that: include: A first rendering unit, configured to render the display object based on a first data structure corresponding to the display object; The first data structure is constructed based on the object data of the display object when a rendering request corresponding to the display object is received; the first data structure is used to store setting data of various display attributes; an updating unit, configured to update setting data of at least one display update attribute in response to an object update instruction of the display object, to obtain a second data structure; the display update attribute is a display attribute indicated to be updated by the object update instruction; The second rendering unit is configured to render the updated display object based on the second data structure.
12. An electronic device, characterized in that: The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the rendering method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the rendering method according to any one of claims 1 to 10 are implemented.
14. A computer product, characterized in that The invention comprises computer-readable instructions, which, when executed by one or more processors, implement the rendering method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Method for generating icon
CN102479025A
3D game rendering engine rendering method
CN105184847A
Rendering method and electronic equipment
CN115686700A
Image rendering method and device, electronic equipment, storage medium and program product
CN116740256A
Rich text processing method and device
CN118069255A