A rendering method and device of a display object, electronic equipment and storage medium
Patent Information
- Application Number
- CN202410700698.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2044-05-30
AI Technical Summary
[0005]本申请实施例提供了一种显示对象的渲染方法、装置、电子设备以及存储介质,可以解决现有的渲染技术,在对显示对象进行更新时,需要执行大量逻辑判断才能够完成重新渲染,渲染效率低的问题
[0060]可以理解的是,上述第二方面至第五方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。
Smart Images

Figure CN120669938B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of display technology, and in particular relates to a rendering method, apparatus, electronic device and storage medium for display objects. Background Technology
[0002] With the continuous development of display technology, the clarity and diversity of displayed content have also improved. Taking icons on the main screen as an example, the shadow style, border style, and size of the icons can be customized according to the user's display needs to meet the user's display requirements in different scenarios.
[0003] Existing rendering technologies require regenerating rendering instructions for all display attributes when updating rendered display objects in the interface. That is, regardless of whether the setting data of the display attribute has changed, the rendering instruction corresponding to the display attribute needs to be generated to determine whether the display object has set the corresponding display attribute. If the display attribute has been set, the corresponding rendering action is performed based on the updated setting data of the corresponding display attribute of the display object.
[0004] However, when there are many objects displayed on the screen or many custom settings, electronic devices need to perform a lot of logical judgments, which greatly increases the rendering time required to update the displayed objects, reduces the smoothness of the animation during the update and the rendering efficiency of the displayed objects, and affects the user experience. Summary of the Invention
[0005] This application provides a rendering method, apparatus, electronic device, and storage medium for display objects, which can solve the problem of low rendering efficiency in existing rendering technologies, where a large number of logical judgments need to be performed to complete the re-rendering when updating display objects.
[0006] Firstly, this application provides a method for rendering a display object, the method comprising:
[0007] The display object is rendered based on the 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 the setting data of each display attribute.
[0008] In response to an object update command of a 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 that the object update command indicates to be updated.
[0009] Based on the second data structure, render the updated display object.
[0010] Implementing the embodiments of this application has the following beneficial effects: By generating a corresponding first data structure based on the object data of the display object during rendering, and recording 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 to obtain a second data structure. This eliminates the need to generate corresponding rendering instructions for each display attribute, and allows for re-rendering of the display object based on the second data structure, thereby achieving the purpose of updating the display object in the interface. Compared with existing rendering technologies, the embodiments of this application do not require generating corresponding rendering instructions for each display attribute, i.e., they do not require performing a logical judgment for each display attribute separately. Instead, only the setting data of the display attributes that need to be updated in the first data structure needs to be updated. This reduces unnecessary logical judgment operations, reduces the operation time required for rendering, and thus improves rendering efficiency and the smoothness of animation when the display object is updated.
[0011] In one 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 one 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 from a display object, the object data of the display object is obtained; the object data records setting data for at least one first display property; the first display property is a display property that has been set in the object data;
[0014] Based on object data, set the display properties of the first data structure.
[0015] In one possible implementation of the first aspect, the display update attribute includes a first display attribute;
[0016] In response to an object update instruction of the displayed object, update the setting data of at least one display update property to obtain a second data structure, including:
[0017] In response to an object update instruction, update the first setting data in the first display property to the second setting data.
[0018] In one possible implementation of the first aspect, the display update attribute includes a first display attribute;
[0019] In response to an object update instruction of the displayed object, update the setting data of at least one display update property to obtain a second data structure, including:
[0020] In response to an object update instruction, delete the first setting data of the first display attribute recorded in the first data structure to change any of the first display attributes to the second display attribute.
[0021] In one possible implementation of the first aspect, the display update attribute includes a second display attribute;
[0022] In response to an object update instruction of the displayed object, update the setting data of at least one display update property to obtain a second data structure, including:
[0023] In response to an object update instruction, the second display property in the first data structure is set to the second setting data to change the second display property to the first display property.
[0024] In one possible implementation of the first aspect, each display attribute in the first data structure corresponds to a rendering order;
[0025] Based on the first data structure corresponding to the display object, render the display object, including:
[0026] Based on the rendering order, the setting data of each first display attribute in the first data structure is read sequentially, and the display object is rendered.
[0027] In one possible implementation of the first aspect, before rendering the display object by sequentially reading the setting data of each first display attribute in the first data structure based on the rendering order, the method further includes:
[0028] According to the rendering order, the setting data of the first display attribute in the object data of the displayed object is assigned to the preset data structure template to obtain the first data structure.
[0029] In one possible implementation of the first aspect, the display object includes multiple display sub-objects; the display attributes include a first node attribute; the first node attribute is used to store display data determined based on several display sub-objects among all the display sub-objects.
[0030] In one possible implementation of the first aspect, the display data is image data generated based on several display sub-objects.
[0031] In one possible implementation of the first aspect, the display object includes multiple display sub-objects; the display attributes include second node attributes; the second node attributes are used to record the storage address of the third data structure corresponding to each display sub-object.
[0032] Secondly, embodiments of this application provide a rendering apparatus for displaying objects, comprising:
[0033] The first rendering unit is used to render the display object based on the 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 the setting data of each display attribute.
[0034] The update unit is used to update the setting data of at least one display update attribute in response to the object update instruction of the display object, and obtain a second data structure; the display update attribute is the display attribute that the object update instruction indicates to be updated.
[0035] The second rendering unit is used to render the updated display object based on the second data structure.
[0036] In one possible implementation of the second aspect, the display attributes include 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 one possible implementation of the second aspect, the rendering apparatus further includes:
[0038] The object data acquisition unit is used to acquire the object data of the display object in response to the 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 generation unit is used to set the display attributes of the first data structure in the cache area based on object data.
[0040] In one possible implementation of the second aspect, the display update attribute includes any of the first display attributes;
[0041] The update unit includes:
[0042] The first update unit is used to update the first setting data in any first display attribute to the second setting data in response to an object update instruction.
[0043] In one possible implementation of the second aspect, the display update attribute includes any of the first display attributes;
[0044] The update unit includes:
[0045] The second update unit is used to respond to an object update instruction by deleting the first setting data recorded in the first data structure for any first display attribute, so as to change any first display attribute to a second display attribute.
[0046] In one possible implementation of the second aspect, the display update attribute includes any of the second display attributes;
[0047] The update unit includes:
[0048] The third update unit is used to respond to an object update instruction by setting any second display attribute in the first data structure to second setting data, so as to change any second display attribute to the first display attribute.
[0049] In one 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 then render the display object.
[0052] In one 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 according to the rendering order, so as to obtain the first data structure.
[0054] In one possible implementation of the second aspect, the display object includes multiple display sub-objects; the display attributes include a first node attribute; the first node attribute is used to store display data determined based on several display sub-objects among all the display sub-objects.
[0055] In one possible implementation of the second aspect, the display data is image data generated based on several display sub-objects.
[0056] In one possible implementation of the second aspect, the display object includes multiple display sub-objects; the display attributes include second node attributes; the second node attributes are used to record the storage address of the third data structure corresponding to each display sub-object.
[0057] Thirdly, embodiments of this application provide an electronic device, including: a memory, a processor, and a program stored in the memory, wherein the processor executes the program to implement the steps of the rendering method for any of the display objects described in the first aspect above.
[0058] Fourthly, embodiments of this application provide a readable storage medium storing a program that, when executed by a processor, implements the steps of the rendering method for any of the display objects described in the first aspect.
[0059] Fifthly, embodiments of this application provide a program product that, when run on a device, causes the device to execute the steps of any of the rendering methods for display objects in the first aspect or to implement the steps of any of the rendering methods for display objects in the third aspect.
[0060] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0061] Figure 1 This is a schematic diagram of a rendering node tree provided in an embodiment of this application;
[0062] Figure 2 This is a flowchart illustrating the existing rendering process;
[0063] Figure 3 This is a flowchart illustrating a rendering method for a display object provided in an embodiment of this application;
[0064] Figure 4 This is a schematic diagram of the playback interface of a music program provided in an embodiment of this application;
[0065] Figure 5 This is a schematic diagram illustrating the construction of the first data structure provided in an embodiment of this application;
[0066] Figure 6 This is a schematic diagram of the setting data provided in an embodiment of this application;
[0067] Figure 7 This is a schematic diagram of a display object including multiple display sub-objects provided in an embodiment of this application;
[0068] Figure 8 This is a schematic diagram illustrating the determination of display attributes of multiple display sub-objects based on a holistic approach, according to an embodiment of this 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 this application;
[0070] Figure 10 This is a rendering diagram based on a first data structure provided in an embodiment of this application;
[0071] Figure 11 This is a schematic diagram illustrating the modification of display attributes according to an embodiment of this application;
[0072] Figure 12 This is a schematic diagram illustrating the display effect of removing a certain display attribute according to an embodiment of this application;
[0073] Figure 13This is a schematic diagram illustrating the display effect of adding a certain display attribute according to an embodiment of this application;
[0074] Figure 14 This is a structural block diagram of a rendering device for displaying objects provided in an embodiment of this application;
[0075] Figure 15 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0076] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0077] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0078] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0079] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0080] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of 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 "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0081] When an electronic device renders an interface, it can determine the various display objects contained within that interface. These display objects can be user interface (UI) controls or background images, etc. The electronic device can obtain the display information of each display object through a rendering engine. This display information can be used to record the rendering attributes (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 considered as a rendering node. Based on the relative positions of the display objects within the interface, a rendering node tree for that interface can be obtained. For example, Figure 1 A schematic diagram of a rendered node tree provided in one embodiment of this application is shown. See also Figure 1 As shown in (a) above, this is a schematic diagram of a main interface. This main interface includes icon controls for multiple applications. When rendering this main interface, the electronic device can obtain the display information corresponding to each UI control and generate a corresponding rendering node tree based on this display information, such as... Figure 1 As shown in (b) above. This rendering node tree contains one root node, which can contain one or more desktop nodes. In this embodiment, the root node contains desktop node 1 and desktop node 2, wherein desktop node 1 corresponds to... Figure 1 The interface shown in (a) is an example. If the application of the electronic device has many UI controls, such as many icon controls or multiple application controls that occupy a large display area, they can be displayed through a sub-interface different from the main interface, namely the desktop node 2 mentioned above. Users can switch between the main interface and the sub-interface 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, while the interface corresponding to desktop node 2 is the secondary interface. This main interface contains icons for multiple applications, such as icon 11 for a music application and icon 12 for a photo album application. Correspondingly, each of these application icon controls also has a corresponding rendering node under desktop node 1, such as rendering node 21 for the music application icon control and rendering node 22 for the photo album application icon control. Each rendering node stores the display information of the corresponding control, such as the drawing attributes and geometric information mentioned above. For example, rendering node 21 corresponding to the music application icon records child nodes such as color information 211, text content 212, and icon image 213 for the music application's corresponding icon control. As the number of display attributes of UI controls increases, the number of nodes in the entire interface also increases dramatically. For example, when the shadows and borders of UI controls can be changed according to the scene, the rendering nodes corresponding to the icon controls of the above applications will also have corresponding child nodes for the shadow and child nodes for the border style added. That is, for each 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, electronic devices can invoke a rendering thread within the rendering engine to render the interface. When rendering the interface, the rendering thread can traverse each rendering node in the rendering node tree and execute corresponding drawing operations. Specifically, the rendering thread can dynamically generate graphic data based on the display information of the rendering nodes. For example, if the display information includes three display attributes—background, border style, and shadow style—the rendering engine will generate rendering instructions corresponding to these three display attributes. The rendering thread can then execute these three rendering instructions sequentially, generating the corresponding background color block, border style, and shadow style. The generated three types of graphic data are then combined and rendered on the interface to obtain the UI control corresponding to the displayed object, such as... Figure 1 The icon control 11 for the music application in (a) of the example.
[0084] Therefore, similar to how the number of nodes in the rendering node tree increases dramatically with the number of display attributes, when the rendering thread renders each display object in the interface, the number of rendering instructions also increases with the number of display attributes because each display attribute needs to generate a corresponding rendering instruction.
[0085] In particular, any change in the interface, such as a change in the border style of a UI control, requires the rendering thread in the rendering engine to re-execute the rendering instructions corresponding to all display attributes within the entire rendering node. Even if the display object to be updated has not set a certain display attribute, or a certain display attribute has not changed, the corresponding rendering instruction needs to be generated, and 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 flowchart illustrating the existing rendering process is shown. See also... Figure 2 As shown, the display object in one interface is a color block 201 containing text content. This display object has 10 display attributes. Figure 2 The image displays some of the 10 display attributes, such as border style 202, background color 203, and shadow style 204. These display attributes can also include text content, pattern texture, etc. It should be noted that each display attribute can include one or more attribute description dimensions. For example, to determine border style 202, it is necessary to determine border thickness, border transparency, border color, and border line style, etc. That is, the border style display attribute has multiple attribute description dimensions, and different attribute description dimensions can have corresponding parameter values. The parameter values of each attribute description dimension can be stored in the display object's setting data. The setting data for some of the aforementioned 10 display attributes is recorded in the display information of the display object, while some display attributes are not set, such as the pattern texture display attribute, which is not set. The corresponding display information is as follows: Figure 2 Code segment 205. At a certain point, it is necessary to update the background color of the display object from white to black, that is, to update the background color setting data in the display information of the display object from white to black, resulting 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 executing this instruction, the rendering thread checks whether the updated display information of the display object 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 based on that setting data. Since the border style has not changed, the resulting graphic data is... Figure 2 If the border style is set to 207, the next rendering instruction will be executed; otherwise, if the display information does not contain the setting data corresponding to the border style, the next rendering instruction will be executed.
[0088] Step 2: The rendering thread executes the rendering instructions corresponding to the pattern texture. Similar to Step 1, it first checks whether the updated display information contains the setting data corresponding to the pattern texture. Since the display information did not originally have this display attribute set, and this update did not update this display attribute, the rendering engine will not generate graphics data and will execute the next rendering instruction.
[0089] Step 3: The rendering engine executes the rendering instruction corresponding to the background color. Since the display attribute of this display object has been updated to black in the display information, when the rendering thread executes the rendering instruction, if it determines that the display information contains the background color display attribute, it can generate the corresponding black background graphic data according to the setting data (i.e., "black") corresponding to the display attribute, such as... Figure 2 Set the background color to 208 and execute the next rendering instruction.
[0090] Steps 4 through 10 can be referred to the description above. That is, when the rendering thread executes the rendering instruction for the corresponding display attribute, it needs to perform a logical judgment to determine whether the display information contains the setting data for the corresponding display attribute. If the setting data for the corresponding display attribute has been set, the graphics data is rendered, such as obtaining... Figure 2 The shadow style 209 is used in the image. Finally, the graphics are merged based on the graphics data corresponding to all rendering instructions to obtain the updated display object, which is the color block 210 containing the text content.
[0091] As can be seen, existing rendering technologies generate multiple rendering instructions based on the number of display attributes when updating displayed objects on 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 updating displayed objects and the rendering time required, thereby reducing rendering efficiency and the smoothness of update animations.
[0092] For example, when a smartphone switches from a high-brightness display mode to a night-time eye protection mode, it needs to update various display objects such as all icons and tool controls on the main interface, such as changing the text color from black to white and 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 sequence. The amount of computation for logical judgment will increase exponentially with the number of display attributes, affecting the user experience.
[0093] To address the problems existing in rendering technology, embodiments of this application provide a method for rendering display objects. This method can be applied to electronic devices with built-in or external displays, such as smart TVs, smartphones, laptops, tablets, desktop computers, smartwatches, and smart projectors. Specifically, Figure 3 A schematic flowchart illustrating a rendering method for a display object according to an embodiment of this application is shown. See also... Figure 3 As shown, the specific implementation process of the rendering method for the display object provided in this application embodiment is as follows:
[0094] In S301, the display object is rendered based on the first data structure corresponding to the display object; the first data structure is constructed based on the object data of the display object when the rendering request corresponding to the display object is received; the first data structure is used to store the setting data of each display attribute.
[0095] In this embodiment, when rendering any display object, the electronic device can generate a corresponding rendering request. Upon receiving the rendering request, the electronic device can obtain the object data corresponding to the display object. This object data is used to limit the setting data of some or all display attributes of the display object. The rendering request may be generated by an application running within the electronic device and sent to the rendering engine within the electronic device. The electronic device can obtain the object data of the display object through the rendering engine to construct a corresponding first data structure.
[0096] In cases where the display attribute includes multiple attribute description dimensions, the aforementioned setting data can also include setting values for some or all of these attribute description dimensions. For example, if the display object is an icon for a music application, the object data corresponding to that icon stores setting parameters for the display attribute "border style." This border style display attribute includes multiple attribute description dimensions such as border color, border thickness, border line style, and border transparency. Therefore, the aforementioned setting data can record parameter values corresponding to all attribute description dimensions, or it can record parameter values corresponding to some of these attribute description dimensions. For instance, this object data can be generated when the application executes the code requesting the interface rendering. 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] Let's take a music program as an example. Figure 4 A schematic diagram of the playback interface of a music program according to an embodiment of this application is shown. See also Figure 4As shown, the music program's playback interface includes multiple display objects, such as the playback control 41 and the playback progress bar control 42 mentioned above. The object data of each display object in the playback interface can be stored within the music application's package. When the electronic device generates this playback interface, if the user clicks on... Figure 1 When icon 11 is displayed, the electronic device can retrieve the music application package from the memory. The music application can generate a request to create a playback interface and send it to the rendering engine. The rendering engine responds to the request by calling the rendering thread, determines the display objects contained in the playback interface, such as the playback control 41 and the playback progress bar 42 mentioned above, and constructs the first data structure corresponding to the two controls based on the object data corresponding to the two controls. According to the various display attributes already set in the first data structure, the rendering thread executes the rendering instructions corresponding to each display attribute, thereby rendering the corresponding controls.
[0098] In some implementations, the storage units of an electronic device include memory units, and the storage area corresponding to the memory units is called the memory area. When the electronic device renders a display object through a rendering engine, it can store relevant data generated during the process in the memory area. This memory area includes a cache area. After constructing the first data structure corresponding to the display object, the electronic device can store this first data structure in the cache area. That is, the cache area stores the setting data corresponding to each display attribute (i.e., attribute slot) of the display object. Therefore, when the rendering thread in the rendering engine performs rendering operations, it can quickly read the setting parameters corresponding to each display attribute from the cache area, thereby improving rendering efficiency.
[0099] In this embodiment, the first data structure contains all configurable display attributes in the interface. The electronic device can assign values to the corresponding display attributes in the data structure template by reading the display attribute setting data recorded in the object data of the display object, 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 A schematic diagram illustrating the construction of a first data structure provided in an embodiment of this application is shown. See also... Figure 5As shown, the electronic device can obtain the data structure template 51 corresponding to the interface. The data structure template 51 contains multiple attribute slots, each of which records a display attribute. In the data structure template 51, each attribute slot is in a pending state, i.e., 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 set data of each of the above display attributes to the attribute slots corresponding to the display attributes in the data structure template 51 in the cache area, thereby obtaining the first data structure of the display object, i.e., data structure 53. In the data structure 53, the shadow style 531, border style 522, and background color 523 have all been set with corresponding set data.
[0101] In some implementations, this data structure can be an array, queue, tree, heap, or stack, etc.
[0102] In some implementations, the settings data recorded in the aforementioned object data can be of any type. For example, Figure 6 A schematic diagram of the setting data provided in one embodiment of this application is shown. See also Figure 6 As shown, a certain object data stores setting data for the display attribute of border style. This setting data can be graphic data, that is, 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. The electronic device can store a correspondence between border styles and parameter values. 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 this display by querying the above-mentioned correspondence, that is, style 3 in correspondence 62; the setting data can also be an address pointer 63. 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 the actual situation, and is not limited here.
[0103] In some implementations, the number of display attributes included in the data structure template can differ depending on the interface. For example, in interface A, none of its UI controls have shadow effects. In this case, the data structure template for interface A will not include shadow style and shadow color, or other display attributes related to shadow effects. In interface B, however, its UI controls do have shadow effects. In this case, the data structure template for interface B can include shadow style and shadow color, which are display attributes related to shadow effects. That is, the data structure templates for interface A and interface B can be different. Of course, in some implementations, all interfaces within the same electronic device can use the same data structure template to store the various display attributes of the interface. The specific choice can be made based on the actual situation and is not limited here.
[0104] In some implementations, the attribute slots within the aforementioned data structure template include both attribute slots already set in the object data and attribute slots not yet 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 the first data structure based on the object data of the display object, the aforementioned first data structure includes set display attributes (i.e., first display attributes) and unset display data (i.e., second display attributes). Continuing... Figure 5 Taking an 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 the above three display attributes have also been assigned values; that is, the above three display attributes are the first display attributes. In some scenarios, the above object data does not record the pattern texture and transparency display attributes. Correspondingly, the attribute slots corresponding to the above two display attributes in the first data structure are empty, that is, in a pending state. In this case, the pattern texture and transparency display attributes are the second display attributes.
[0105] In this embodiment, the first structure data includes both the set and unset display attributes of the object data, that is, it includes all adjustable display attributes. This makes it easier to update the display object in the future without changing the framework of the first data structure. Only the corresponding display attributes need to be adjusted, thereby improving rendering efficiency and reducing the operational complexity of updating 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 sequentially based on this rendering order to obtain the corresponding data structure template. For example, this data structure template can be represented as:
[0107] void Data Structure(){
[0108] background color =;
[0109] shadow type =;
[0110] frame type =;
[0111] text =; text color =;
[0112] …
[0113] }
[0114] In the code, Data Structure() is the structure identifier of the data structure template. After reading the object data of a certain display object, the object identifier of the display object can be filled into the parentheses above. For example, if a certain display object is the icon control of a music application, then the first data structure corresponding to the icon control of the music application can be represented as: Data Structure(Music App), where "Music App" is the object identifier corresponding to the music application.
[0115] The aforementioned data structure template contains at least four display attributes, each corresponding to a rendering order: background color (first), shadow type (second), frame type (third), and text (fourth). The text attribute has two descriptive 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 all display attributes are initially unset; the content after the "=" sign can be assigned values based on the object's settings.
[0116] In this embodiment, the electronic device can sequentially 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 background color is the first display attribute in the rendering order, the electronic device can obtain the setting parameters corresponding to the background color from the object data of the display object. This setting data can be a parameter value; for example, if the background color is black, the corresponding "attribute slot" can be set to: background color = (0,0,0), or background color = black. The setting data can also be graphic data, such as background color = 1111; or it can be a storage address, such as background color = c: / img / black.jpg. Through these 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 assignment can be represented 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 this music application includes pre-set display attributes, such as background color, border style, and text, i.e., the first display attributes; it also includes unset display attributes, such as shadow style. The text display attribute has two attribute description dimensions, and the aforementioned 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," while the setting information corresponding to the text color is "(0,0,0)", meaning the text color is black. In some implementations, the aforementioned setting data may only store the setting information corresponding to some attribute description dimensions; this can be determined based on the actual situation and is not limited here.
[0127] In this embodiment, the electronic device sequentially obtains the setting data of each display attribute from the object data according to the rendering order, thereby enabling the orderly import of each setting data into the data structure template to obtain the first data structure corresponding to the display object, which improves the efficiency of building the data structure for rendering in the cache, and thus improves the efficiency of subsequent interface rendering.
[0128] In some implementations, the aforementioned display object may include multiple display sub-objects. For example, Figure 7 A schematic diagram of a display object comprising multiple display sub-objects is shown according to an embodiment of this application. See also Figure 7 As shown, the display interface contains multiple controls, including an icon control 71 for a music application, an icon control 72 for a photo album application, and a tool control 73 for a weather application. This tool control 73 displays multi-day weather forecast information, such as today's weather information 731 and May 29th's weather information 732, meaning that the tool control 73 contains multiple display sub-objects. Another type of 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 corresponds to the payment application group. This payment application group contains multiple applications with payment functionality, and each payment application can be a display sub-object within this icon control 74. The first data structure containing the display sub-objects can be constructed in the following two ways:
[0129] Method 1: Encapsulate multiple display sub-objects into a whole and record the display properties of this whole.
[0130] In this approach, all display sub-objects within a display object can be treated as a whole. Instead of constructing a separate first data structure for each sub-object, the display attributes of this whole are used as one or more display attributes within the first data structure of the display object. This first data structure includes a first node attribute, which stores display data determined by several sub-objects. Specifically, the first node attribute records the display attributes corresponding to the whole composed of multiple sub-objects. Since a display object containing multiple sub-objects generally exhibits a certain degree of stability in its UI controls—meaning the number, content, and relative positions of each sub-object within the UI control are unlikely to change easily—recording the display attributes of all sub-objects as a whole allows for a single rendering of the entire object. This eliminates the need to render each sub-object separately and then merge the rendered sub-objects, reducing the number of rendering iterations and improving rendering efficiency.
[0131] For example, Figure 8 This illustration shows a schematic diagram of determining the display attributes of multiple display sub-objects based on a holistic approach, according to an embodiment of this application. See also... Figure 8 As shown, the display object is a payment application group 81, which contains at least two payment applications, namely payment application 1 and payment application 2. The icons for payment application 1 and payment application 2 have different patterns, namely icon 811 and icon 812, respectively. In this embodiment, the two payment applications are treated as a whole. In the first data structure of the payment application group, the setting data for the display attribute of the icon pattern can be image data composed of the combination of payment application 1 and payment application 2. That is, the setting data for the attribute slot 82 corresponding to the icon pattern is image 83. Image 83 not only contains the icons of the two payment applications but also determines the relative positional relationship between the two icons. Therefore, the setting data for the first node attribute can be data generated based on the image data corresponding to multiple display sub-objects.
[0132] In some cases, if a display object contains a large number of sub-display objects, the UI control corresponding to the display object may not be able to display all sub-display objects simultaneously. Continuing with the example of the payment application group, if the payment application group contains 10 different payment applications, the UI control corresponding to the payment application group can only display the icon thumbnails of a maximum of 9 of them. That is, the icon of the 10th payment application cannot be displayed within 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 corresponding image data is generated based on these 9 icon patterns. This image data is then used as the setting data for the display attributes of the icon pattern in the first data structure corresponding to the payment application group.
[0133] In some implementations, there can be multiple first node attributes, which can be used to record different display attributes of the whole composed of multiple display sub-objects. For example, the first node attributes may include three display attributes: node icon pattern, node border style, and node background color. The node icon pattern attribute is used to determine the image data corresponding to the whole composed of multiple display sub-objects. If all display sub-objects in the display object use the same border style and background color, then the border style and background color of all display sub-objects can be determined through the first node attributes in the first data structure, i.e., their settings are assigned to the node border style and node background color in the first data structure.
[0134] In this embodiment of the application, by treating multiple display sub-objects as a whole and recording the display attributes corresponding to the whole, it is possible to directly generate the overall graphic data 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: Construct a separate third data structure for each display sub-object
[0136] In this approach, the electronic device can construct a corresponding third data structure for each display sub-object within the display object. This third data structure contains multiple display attributes corresponding to the display sub-object. The electronic device can assign the setting attributes corresponding to each display attribute in the object data to the data structure template based on the object data corresponding to each display sub-object, thereby obtaining the third data structure corresponding to the display sub-object. The method of constructing the third data structure based on the object data of the display sub-object can be found in the generation process of the first data structure and will not be elaborated here.
[0137] In this embodiment, after the electronic device constructs corresponding third data structures for different display sub-objects, it 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 This illustration shows a schematic diagram of a third data structure corresponding to the construction of each display sub-object, provided in an embodiment of this application. See also... Figure 9 As shown, the display object 1 contains three display sub-objects: sub-object 1, sub-object 2, and sub-object 3. The first data structure corresponding to this display object contains three second node attributes, namely attributes 91 to 93, each pointing 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, which also contains multiple display attributes. Of course, in some scenarios, if the display sub-object contains multiple sub-objects, the third data structure can also contain node attributes pointing to other data structures, thus 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 this embodiment, a corresponding third data structure is constructed for different display sub-objects, thereby decoupling the display effects between display sub-objects. That is, different display sub-objects can customize the display effects without having to use 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 the 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, the display attributes in the first data structure have a fixed rendering order. In this case, the above rendering process can specifically be as follows: 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 This illustration shows a rendering diagram based on a first data structure according to an embodiment of this application. See also... Figure 10 As shown, the first data structure contains at least four set display attributes, namely four first display attributes: background color, text, and border style. The background color is white, the text includes two attribute description dimensions: text content and text color, with the corresponding settings being "music application" and gray. The border style is a solid line border. The electronic device's rendering engine contains a rendering thread. By calling this rendering thread, the rendering operations corresponding to the four display attributes can be executed sequentially, thereby rendering the corresponding display object, such as display object 101.
[0143] In this embodiment, the setting data of each display attribute is read according to a fixed rendering order, and the rendering operation corresponding to each display attribute is executed sequentially by the rendering thread. The rendering is superimposed according to the order of the effects, which solves the problem that the existing rendering process requires a lot of logical judgment to realize the priority of the effect, resulting in a cumbersome program. This simplifies the rendering process and reduces performance pressure.
[0144] In S302, in response to the object update instruction of the display object, the setting data of at least one display update attribute is updated to obtain a second data structure; the display update attribute is the display attribute that the object update instruction indicates to be updated.
[0145] In this embodiment, when an update is needed for a display object, such as adjusting the border style of the display object, an object update instruction for that display object can be generated. This object update instruction includes the object identifier of the display object to be updated, and the update content. The update content records the display attributes to be updated (i.e., the aforementioned display update attributes), and the corresponding settings data after the update.
[0146] In some implementations, rendering requests for displayed objects can be sent from the application to the rendering engine. Therefore, when the application detects an update to any displayed object in the interface, it can generate a corresponding object update instruction and send it to the rendering engine. This object update instruction can contain the updated object data. Upon receiving the object update instruction, the rendering engine can perform an incremental update operation on the first data structure, that is, identify the changed display attributes and update the settings data corresponding to those changed attributes. The aforementioned display object update can be due to editing of displayed objects in the interface, such as a user editing the text content corresponding to an application icon; or it can be due to updates generated when the interface is running corresponding animation effects, such as when a user clicks on a control and needs to highlight it, requiring adjustments to the control's display effect within the interface.
[0147] In this embodiment, the first data structure corresponding to the above-mentioned display data is stored in a cache area. The cache area has the characteristics of fast read and write. Therefore, when it is detected that the display object needs to be updated, the display attribute that needs to be updated can be quickly determined from the cache area, the setting data corresponding to the display attribute can be adjusted, and the data structure after adjusting all the display attributes that need to be updated can be 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 that there are updated display attributes (i.e., updated display attributes) and adjusts the settings data corresponding to the updated display attributes in the first data structure. For display attributes that have not changed, the settings parameters are not modified. For example, the first data structure contains 40 display attributes. At a certain moment, if the rendering engine detects that three display attributes of the display object have been updated, it updates the settings data for those updated attributes respectively, while the remaining 37 display attributes, since they have not been updated, remain unchanged.
[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 scenarios:
[0151] Scenario 1: Changing the settings of a certain display attribute
[0152] In this case, S302 specifically refers to: 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 set display attribute is the first display attribute. In the first data structure, this first display attribute has a set parameter, namely the first setting parameter. The electronic device can adjust the corresponding value in the first data structure according to the setting parameter (i.e., the second setting parameter) recorded in the object update instruction, that is, change the first setting parameter to the second setting parameter, thereby updating the display effect. It should be noted that if the aforementioned first display attribute includes multiple attribute description dimensions, and different attribute description dimensions correspond to a setting information, then the above update may include changing the setting information of at least one attribute description dimension. Of course, in some implementation scenarios, the above update process can also change the setting information of all attribute description dimensions of the first display attribute, which can be determined according to the actual situation. For example, Figure 11 This diagram illustrates a modification of display attributes according to an embodiment of this application. See also... Figure 11 As shown, the first data structure of this display object records the background color as a display attribute. The original setting for this display attribute is black, as shown below. Figure 11 In the context of attribute 111, if at a certain moment the background color of the displayed object needs to be changed from black to white, the electronic device will determine the corresponding display update attribute as 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), thus obtaining attribute 112. Therefore, the data structure after updating all the 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 case 1 can be further subdivided into the following cases:
[0155] Case 1.1 Updates the attribute description dimensions 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 above border style display attribute is set to 0.1 points, and the border color is set to black. In this update process, the border thickness in the above border style can be set to 0.2 points, while the border color remains black, thus updating the attribute description dimensions already set in the display attribute. Of course, the above update can also be applied to all attribute description dimensions.
[0156] Case 1.2 Adds effects to the attribute description dimensions that are not 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 above-mentioned border style display attribute is set to 0.1 points, while 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. In this update process, the corresponding border color can be added, that is, the border color in the above-mentioned border style can be set to blue.
[0157] Case 1.3 Remove some of the set attribute description dimensions 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 above-mentioned border style display attribute is set to 0.1 points, and the border color is set to blue. During this update, some of the set attribute description dimensions can be removed. For example, the border color setting can be deleted and set to empty. When no border color is set, the default color will be used for display, such as black, meaning the border color will be adjusted to black.
[0158] In this embodiment of the application, during re-rendering, the settings parameters of the already set display attributes can be updated, thereby improving the flexibility of adjusting the display effect.
[0159] Scenario 2: Remove the setting data for a display attribute
[0160] In this case, S302 specifically refers to: in response to the object update instruction, deleting the first setting data recorded in the first data structure for any first display attribute, so as to change any first display attribute to a 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 a set 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 will be changed to the second display data, namely the display attribute to be set.
[0162] For example, Figure 12 This diagram illustrates the display effect of removing a certain display attribute according to an embodiment of this application. See also... Figure 12As shown, the first data structure of this display object records the display attribute "shadow style". The original setting of this display attribute was style 1, as shown below. Figure 12 In attribute 121. At a certain moment, if it is necessary to remove the shadow effect of the display object, the electronic device will determine the corresponding display update attribute as 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 Case 2 specifically involves removing the settings of all set attribute description dimensions in the display attribute. Taking the shadow style attribute dimension as an example, the shadow style includes shadow size and shadow color. In the first data structure, the shadow size of the aforementioned shadow style display attribute is set to 4 pixels, and the shadow color is set to black. During this update process, removing the shadow effect means removing the settings of all attribute description dimensions in the shadow style; that is, the shadow size is empty, and the shadow color is empty.
[0164] Scenario 3: Adding setting data for a specific display attribute
[0165] In this case, S302 specifically refers to: in response to an object update instruction, setting any second display attribute in the first data structure to 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 this second display attribute; that is, the display object has not added the corresponding display effect. If it is necessary to add the corresponding display effect, the electronic device can generate an object update instruction for the display attribute. In this case, the electronic device can add the corresponding setting data, i.e., the second setting data, to the second display attribute, thereby achieving the purpose of adding the corresponding display effect. Since the second display attribute is in a set state after the second setting data is set, the second display attribute will change to the first display data, i.e., the set display attribute.
[0167] For example, Figure 13 This diagram illustrates the display effect of adding a certain display attribute according to an embodiment of this application. See also... Figure 13 As shown, the first data structure of this display object does not record the shadow style display attribute; this display attribute is in an unset state, as... Figure 13In the context of attribute 131, if a shadow effect needs to be added to the displayed object at a certain moment, the electronic device will determine its corresponding display update attribute as 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), thus obtaining attribute 132, and generating the corresponding second data structure to achieve the purpose of adding a shadow effect.
[0168] In some implementations, if the second display attribute includes multiple attribute description dimensions, then case 3 specifically involves adding setting information for some or all of the unset attribute description dimensions in the second display attribute. Taking the shadow style attribute dimension as an example, the shadow style includes shadow size and shadow color. In the first data structure, the shadow size and shadow color of the aforementioned shadow style display attribute are both empty, meaning they are not set. During this update process, when adding shadow effects, the shadow size and / or shadow color in the shadow style can be set according to actual display requirements.
[0169] In S303, the updated display object is re-rendered based on the second data structure.
[0170] In this embodiment, after updating some display data within the first data structure according to the object update instruction, the electronic device obtains the second data structure. Then, by calling the rendering thread, it sequentially executes the rendering operations corresponding to each display attribute, thereby rendering the updated display object and updating the display effect of the object. The process of the electronic device rendering the display object based on the second data structure can be found in the relevant 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 the rendering method for a display object provided in this application embodiment, a first data structure is generated based on the object data of the display object during rendering. This first data structure records the setting data of each display attribute. When the display object needs to be updated, the setting data of the corresponding display attribute recorded in the first data structure can be adjusted according to the object update instruction, thereby obtaining a second data structure. This eliminates the need to generate corresponding rendering instructions for each display attribute and allows for re-rendering of the display object based on the second data structure, thus achieving the purpose of updating the display object in the interface. Compared with existing rendering technologies, this application embodiment does not require generating corresponding rendering instructions for each display attribute, i.e., it does not require performing a logical judgment for each display attribute separately. Instead, it only needs to update the setting data of the display attributes that need to be updated in the first data structure. This reduces unnecessary logical judgment operations, reduces the operation time required for rendering, and consequently improves rendering efficiency and the smoothness of animation when the display object is updated.
[0172] Corresponding to the above text Figure 3 The illustrated embodiment provides a method for rendering a display object. Figure 14 This diagram illustrates a structural block diagram of a rendering apparatus for displaying objects according to an embodiment of this application. For ease of explanation, only the parts related to the embodiments of this application are shown.
[0173] See Figure 14 As shown, the rendering device for the above-mentioned display object includes:
[0174] The first rendering unit 141 is used to render the display object based on the 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 the setting data of each display attribute.
[0175] Update unit 142 is used to update the 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; the display update attribute is the display attribute to be updated by the object update instruction.
[0176] The second rendering unit 143 is used to render the updated display object based on the second data structure.
[0177] Optionally, the display attributes include 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; the second display attribute is a display attribute to be set in the object data.
[0178] Optionally, the rendering apparatus also includes:
[0179] The object data acquisition unit is used to acquire the object data of the display object in response to the rendering request of the display object; the object data records setting data of at least one first display attribute; the first display attribute is the display attribute that has been set in the object data;
[0180] The first data structure generation unit is used to set the display attributes of the first data structure based on object data.
[0181] Optionally, the display update attribute includes the first display attribute;
[0182] Update unit 142 includes:
[0183] The first update unit is used 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 the first display attribute;
[0185] Update unit 142 includes:
[0186] The second update unit is used to respond to an object update instruction by deleting the first setting data recorded in the first data structure for the first display attribute, 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] Update unit 142 includes:
[0189] The third update unit is used to respond to the object update instruction by setting the second display attribute in the first data structure to the second setting data, 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 then render the display object.
[0193] Optionally, the rendering apparatus also 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 according to the rendering order, so as to obtain the first data structure.
[0195] Optionally, the display object includes multiple display sub-objects; the display attributes include a first node attribute; 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 displayed data is image data generated based on several display sub-objects.
[0197] Optionally, the display object includes multiple display sub-objects; the display attributes include second node attributes; the second node attributes are used to record the storage address of the 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 an embodiment of this application. Figure 15 As shown, the electronic device 15 of this embodiment includes: at least one processor 150 ( Figure 15Only one processor is shown in the diagram, and the number of processors may match the actual number of chips included in the electronic device in the embodiment. Memory 151 and program 152 stored in the memory 151 and executable on the at least one processor 150, wherein the processor 150 executes the program 152 to implement the steps in the rendering method embodiments of any of the above-described display objects.
[0199] The electronic device 15 may be a tablet computer, smartphone, laptop computer, etc. This electronic device may include, but is not limited to, a processor 150 and a memory 151. Those skilled in the art will understand that... Figure 15 This is merely an example of electronic device 15 and does not constitute a limitation on electronic device 15. It may include more or fewer components than shown, or combine certain components, or different components. For example, it may also include input / output electronic devices, network access electronic devices, etc.
[0200] The processor 150 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. 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 be an external storage device of the electronic device 15, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 15. Furthermore, the memory 151 may include both internal and external storage devices of the electronic device 15. The memory 151 is used to store the operating system, applications, bootloader, data, and other programs, such as program code. The memory 151 can also be used to temporarily store data that has been output or will be output.
[0202] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0203] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to 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 embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0204] This 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 executes the computer program to implement the steps in any of the above method embodiments.
[0205] This application also provides a readable storage medium storing a program that, when executed by a processor, implements the steps described in the various method embodiments above.
[0206] This application provides a program product that, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.
[0207] If the integrated unit is implemented as 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, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographic device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0208] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0209] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for rendering a display object, characterized in that, include: Rendering the display object based on the first data structure corresponding to the display object includes: reading the setting data of display attributes in the first data structure according to the rendering order, and rendering 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 the setting data of each display attribute; the display object includes multiple display sub-objects; when constructing the first data structure of the display object containing multiple display sub-objects, there are two specific implementation methods: Method 1, the multiple display sub-objects are encapsulated into a whole, and a corresponding first data structure is no longer constructed for each display sub-object, and the display attributes corresponding to the multiple display sub-objects are used as one or more display attributes in the first data structure of the display object, the display attributes of the display object containing multiple display sub-objects include first node attributes; the first node attributes are used to store display data determined based on several of the display sub-objects; different first node attributes are used to record different display attributes based on the whole composed of multiple display sub-objects; Method 2, the display attributes include second node attributes; the second node attributes are used to record the storage address of the third data structure corresponding to each display sub-object; the third data structure contains multiple display attributes corresponding to the display sub-objects. In response to the object update instruction of the display object, the setting data of at least one display update attribute is updated to obtain a second data structure; the display update attribute is the display attribute to be updated by the object update instruction. Rendering the updated display object based on the second data structure includes: reading the display attribute setting data in the second data structure according to the rendering order, and rendering the updated display object.
2. The rendering method according to claim 1, characterized in that, The display attributes include 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; the second display attribute is the display attribute to be set in the object data.
3. The rendering method according to claim 2, characterized in that, The display update attribute includes the first display attribute; The method of updating the 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 the second setting data.
4. The rendering method according to claim 2, characterized in that, The display update attribute includes the first display attribute; The method of updating the 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, so as to change the first display attribute to the second display attribute.
5. The rendering method according to claim 2, characterized in that, The display update attribute includes the second display attribute; The method of updating the 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 to the second setting data to change the second display attribute to the first display attribute.
6. The rendering method according to claim 2, characterized in that, Each of the display attributes in the first data structure corresponds to a rendering order; The step of rendering 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 are read sequentially, and the display object is rendered.
7. The rendering method according to claim 6, characterized in that, Before rendering the display object by sequentially reading the setting data of each of the first display attributes in the first data structure based on the rendering order, 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 assigned to the preset data structure template in sequence to obtain the first data structure.
8. The rendering method according to claim 1, characterized in that, The display data is image data generated based on several display sub-objects.
9. A rendering apparatus for displaying objects, characterized in that, include: A first rendering unit is used to render the display object based on a first data structure corresponding to the display object, including: reading the setting data of display attributes in the first data structure according to the rendering order, and rendering 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 the setting data of each display attribute; the display object includes multiple display sub-objects; when constructing the first data structure of the display object containing display sub-objects, there are two specific implementation methods: Method 1, the multiple display sub-objects are encapsulated into a whole, and a corresponding first data structure is not constructed for each display sub-object, and the display attributes corresponding to the multiple display sub-objects are used as one or more display attributes in the first data structure of the display object, the display attributes of the display object containing multiple display sub-objects include first node attributes; the first node attributes are used to store display data determined based on several of the display sub-objects; different first node attributes are used to record different display attributes based on the whole composed of multiple display sub-objects; Method 2, the display attributes include second node attributes; the second node attributes are used to record the storage address of the third data structure corresponding to each display sub-object; the third data structure contains multiple display attributes corresponding to the display sub-objects. An update unit is configured to update the setting data of at least one display update attribute in response to an object update instruction of the display object, thereby obtaining a second data structure; the display update attribute is a display attribute that the object update instruction indicates to be updated. The second rendering unit is used to render the updated display object based on the second data structure, including: reading the setting data of display attributes in the second data structure according to the rendering order, and rendering the updated display object.
10. 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, wherein the processor executes the computer program to implement the steps of the rendering method as described in any one of claims 1-8.
11. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the rendering method as described in any one of claims 1-8.
12. A computer program product, characterized in that, It includes computer-readable instructions that, when executed by one or more processors, implement the rendering method as described in any one of claims 1-8.
Citation Information
Patent Citations
Rendering method and electronic equipment
CN115686700A
Rich text processing method and device
CN118069255A
Efficient caching and drawing of objects whose rendering properties change frequently
US8766986B1