Image-text content rendering method and device, equipment and storage medium

By constructing a node tree representing the intermediate content of graphics and text, parsing and converting the node tree, the rendering of graphics and text content on the non-web container rendering end is realized, which solves the problem of limited cross-end rendering function of graphics and text content, and realizes the rendering of graphics and text content on various terminals. Universal rendering capabilities.

CN118673230AActive Publication Date: 2024-09-20BEIJING ZITIAO NETWORK TECH CO LTD

Patent Information

Application Number
CN202310250752.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-15
Publication Date
2024-09-20
Estimated Expiration
2043-03-15

AI Technical Summary

Technical Problem

The existing technology is difficult to realize the rendering of graphics and text content on non-web container rendering terminals, especially on terminals such as mobile terminals, resulting in limited cross-terminal rendering functions of graphics and text content.

Method used

By obtaining the node tree of the structured storage document of the target graphic content, traversing the node tree, parsing and converting the nodes, determining their type, and constructing an intermediate representation node tree of the graphic content, so as to render the graphic content on the target rendering end.

Benefits of technology

It realizes the universal cross-end rendering function of graphics and text content on various rendering ends, and solves the problem of rendering graphics and text content that relies on web container rendering on non-web container ends.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673230A
    Figure CN118673230A
Patent Text Reader

Abstract

The invention provides an image-text content rendering method, device and equipment and a storage medium, and the method comprises the steps: firstly obtaining a node tree corresponding to a structured storage document of target image-text content, then determining a current processing node by traversing nodes on the node tree, analyzing the current processing node, and obtaining a target image-text content; a determination is made as to whether a node belongs to a structured type. And if it is determined that the current processing node does not belong to the node of the structured type, converting the current processing node into a first image-text content type node at a corresponding position in the image-text content intermediate representation node tree according to the node label of the current processing node. And through construction and node conversion of the image-text content intermediate representation node tree corresponding to the node tree, the target image-text content can be rendered at the target rendering end based on the image-text content intermediate representation node tree. According to the image-text content rendering method and device, the image-text content rendered depending on the web container can be rendered on various rendering ends, and the general image-text content cross-end rendering function is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular to a method, device, equipment and storage medium for rendering graphic content. Background Art

[0002] Currently, most graphic content relies on web container rendering to present to users. Therefore, the data storage format of graphic content is generally the Hypertext Markup Language HTML document format. However, with the popularity of various terminals such as mobile terminals, more and more functional requirements need to be realized by rendering graphic content using non-web containers.

[0003] Therefore, how to render graphic content that relies on web container rendering on various terminals is a technical problem that needs to be solved urgently. Summary of the invention

[0004] In order to solve the above technical problems, the present disclosure provides a method, device, equipment and storage medium for rendering graphic content, which can render graphic content that relies on web container rendering on various terminals.

[0005] In a first aspect, the present disclosure provides a method for rendering graphic content, the method comprising:

[0006] Obtaining a node tree corresponding to a structured storage document of target graphic content; wherein the node tree includes nodes of a structured type;

[0007] Determine a current processing node by traversing the nodes on the node tree, and parse the current processing node to determine whether the current processing node belongs to a node of the structured type;

[0008] If it is determined that the current processing node does not belong to the structured type node, then according to the node label of the current processing node, convert the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree; wherein the node type of the first graphic content type node is determined based on the node label;

[0009] Continue to execute the step of determining the current processing node by traversing the nodes on the node tree until the intermediate representation node tree of the graphic content corresponding to the node tree is obtained; wherein the graphic content node tree is used to render the target graphic content at the target rendering end.

[0010] In an optional implementation manner, the method further includes:

[0011] If it is determined that the current processing node belongs to the structured type node, the current processing node is converted into a second graphic content type node at the corresponding position in the graphic content intermediate representation node tree; wherein the node type of the second graphic content type node is determined based on the structured type to which the current processing node belongs.

[0012] In an optional implementation, the node label of the current processing node includes a table label, and before converting the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree according to the node label of the current processing node, the method further includes:

[0013] Traversing downward the nodes on the node tree based on the current processing node until a child node of the current processing node belonging to the structured type is found;

[0014] Correspondingly, converting the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree according to the node label of the current processing node includes:

[0015] Converting the subtree structure determined based on the current processing node and the child node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree.

[0016] In an optional implementation, some or all of the first graphic content type nodes in the graphic content intermediate representation node tree are provided with a predefined view component, and the predefined view component is used to support rendering of the corresponding first graphic content type nodes at the target rendering end.

[0017] In an optional implementation manner, the method further includes:

[0018] The nodes in the graphic content IR node tree corresponding to the node tree are traversed to determine at least two nodes that meet the preset node merging rule, and the at least two nodes are merged based on the preset node merging rule.

[0019] In an optional implementation manner, parsing the current processing node to determine whether the current processing node belongs to the structured type node includes:

[0020] Determine the layout context type of the current processing node based on the layout context types of the child nodes of the current processing node in the node tree;

[0021] According to the layout context type of the current processing node, it is determined whether the current processing node belongs to the structured type node.

[0022] In an optional implementation, the structured type node includes at least one of a text type node, a picture type node and a block type node.

[0023] In a second aspect, the present disclosure provides a graphic content processing device, the device comprising:

[0024] A first acquisition module is used to acquire a node tree corresponding to a structured storage document of target graphic content; wherein the node tree includes structured type nodes;

[0025] A first determination module, configured to determine a current processing node by traversing the nodes on the node tree, and to parse the current processing node to determine whether the current processing node belongs to a node of the structured type;

[0026] A first conversion module is used for converting the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree according to the node label of the current processing node when it is determined that the current processing node does not belong to the structured type node; wherein the node type of the first graphic content type node is determined based on the node label;

[0027] The second acquisition module is used to continue executing the step of determining the current processing node by traversing the nodes on the node tree until the intermediate representation node tree of the graphic content corresponding to the node tree is obtained; wherein the intermediate representation node tree of the graphic content is used to render the target graphic content at the target rendering end.

[0028] In a third aspect, the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the above method.

[0029] In a fourth aspect, the present disclosure provides a graphic content rendering device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the computer program.

[0030] In a fifth aspect, the present disclosure provides a computer program product, wherein the computer program product comprises a computer program / instructions, and the computer program / instructions implement the above method when executed by a processor.

[0031] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has at least the following advantages:

[0032] The disclosed embodiment provides a method for rendering graphic content, first obtaining a node tree corresponding to a structured storage document of a target graphic content, then determining the current processing node by traversing the nodes on the node tree, and parsing the current processing node to determine whether it is a structured type node; wherein the structured type node has a corresponding relationship with the basic view component of the target rendering end. If it is determined that the current processing node does not belong to a structured type node, then according to the node label of the current processing node, the current processing node is converted into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree, wherein the node type of the first graphic content type node is determined based on the node label. The construction and node conversion of the graphic content intermediate representation node tree corresponding to the node tree are completed in the above manner, so that the target graphic content can be rendered on the target rendering end based on the graphic content intermediate representation node tree. It can be seen that the disclosed embodiment can render graphic content that relies on web container rendering on various rendering ends, realizing a more general cross-end rendering function of graphic content. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0035] Figure 1 A flowchart of a method for rendering graphic content provided by an embodiment of the present disclosure;

[0036] Figure 2 A schematic diagram of a node tree conversion provided by an embodiment of the present disclosure;

[0037] Figure 3 A schematic diagram of an optimized IR node tree of graphic content provided by an embodiment of the present disclosure;

[0038] Figure 4 A schematic diagram of the structure of a graphic content rendering device provided in an embodiment of the present disclosure;

[0039] Figure 5 A schematic diagram of the structure of a graphic content rendering device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0040] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0041] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0042] Since most graphic content such as articles rely on web containers for rendering, the storage data format of articles is generally HTML document format. However, with the rapid development of mobile terminal technology and the increasing demand of users for performance experience, various mobile terminals have become the mainstream terminals at present. Therefore, how to render graphic content such as articles that rely on web container rendering in non-web containers to meet the needs of cross-terminal rendering of graphic content on various rendering terminals is a technical problem that needs to be solved urgently.

[0043] To this end, the embodiment of the present disclosure provides a method for rendering graphic content, first obtaining a node tree corresponding to a structured storage document of the target graphic content, then determining the current processing node by traversing the nodes on the node tree, and parsing the current processing node to determine whether it belongs to a structured type node. If it is determined that the current processing node does not belong to a structured type node, then according to the node label of the current processing node, the current processing node is converted into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree, wherein the node type of the first graphic content type node is determined based on the node label. The construction and node conversion of the graphic content intermediate representation node tree corresponding to the node tree are completed in the above manner, so that the target graphic content can be rendered on the target rendering end based on the graphic content intermediate representation node tree. It can be seen that the embodiment of the present disclosure can render graphic content that relies on web container rendering on various rendering ends, realizing a more general cross-end rendering function of graphic content.

[0044] Based on this, the present disclosure provides a method for rendering graphic content. Figure 1 A flowchart of a method for rendering graphic content provided by an embodiment of the present disclosure, the method comprising:

[0045] S101: Obtain a node tree corresponding to a structured storage document of target graphic content.

[0046] The structured storage document may include a Hypertext Markup Language HTML document, an Extensible Markup Language XML document, etc. The node tree of the structured storage document includes nodes of a structured type.

[0047] In the disclosed embodiment, the target graphic content may include media content such as article genre content, and the storage data format of the target graphic content may be a structured document format such as HTML document format, XML document format, etc.

[0048] The target rendering end in the embodiment of the present disclosure may be a terminal deployed with a container of the client native, React Native (a JavaScript framework), Flutter, etc. Specifically, the target rendering end may be any rendering end that supports a non-web container, such as an iOS end, an Android end, etc.

[0049] In addition, the basic view component of the target rendering end refers to a component that is pre-deployed on the target rendering end and can be used on the target rendering end to render a corresponding basic view (such as text, image).

[0050] In practical applications, after obtaining the structured storage document of the target graphic content, the structured storage document is parsed to obtain a node tree corresponding to the structured storage document. The node tree may include at least one of a text type node, a picture type node, and a block type node. Since the text type node, the picture type node, and the block type node have a corresponding relationship with the basic view component of the target rendering end, that is, they support rendering on the target rendering end using the corresponding basic view component, the embodiment of the present disclosure defines the text type node, the picture type node, and the block type node as structured type nodes.

[0051] S102: Determine the current processing node by traversing the nodes on the node tree, and parse the current processing node to determine whether the current processing node belongs to the structured type node. If not, execute S103.

[0052] In the embodiment of the present disclosure, in order to realize the function of rendering the target graphic content stored in the structured document format on different types of rendering terminals, the node tree corresponding to the structured storage document of the target graphic content can be parsed and converted into a node tree that can be recognized and rendered by the rendering containers corresponding to different types of terminals, that is, the graphic content intermediate representation (IR) node tree in the embodiment of the present disclosure. Among them, each node in the graphic content IR node tree supports the rendering of the target graphic content using the basic view component and the predefined view component of the target rendering terminal.

[0053] In practical applications, the node tree is traversed in depth first, and each node in the node tree is determined as the current processing node in turn. The current processing node determined in each round is parsed to determine whether it belongs to a structured type node. The method of traversing the node tree in depth first is not described in detail here.

[0054] In an optional implementation, by parsing and identifying the node label, class name, style and other information of the current processing node in the node tree, it is determined whether the current processing node is a structured type node, that is, whether it is a text type node, an image type node or a block type node.

[0055] S103: If it is determined that the current processing node does not belong to the structured type node, convert the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree according to the node label of the current processing node.

[0056] The node type of the first graphic content type node is determined based on the node label.

[0057] In the disclosed embodiment, after parsing and identifying the node label, class name, style and other information of the current processing node in the node tree and determining that the current processing node does not belong to a structured type node, the current processing node can be converted into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree according to the node label of the current processing node. The node type of the first graphic content type node is determined based on the node label of the current processing node.

[0058] In an optional implementation, assuming that the node label of the current processing node is a video label, that is, the current processing node is a video node, then by parsing the current processing node, it can be determined that the node does not belong to a structured type node. Specifically, the video label does not belong to the label set of the preset graphic structured content. Therefore, the current processing node can be converted into a first graphic content type node in the graphic content intermediate representation node tree based on the video label. Specifically, the node type of the first graphic content type node is determined based on the node label. For example, the node type of the first graphic content type node is a node type with a video identifier.

[0059] In another optional implementation, assuming that the node label of the current processing node includes a table label, that is, the current processing node is a table node, then before converting the current processing node into the first graphic content type node at the corresponding position in the graphic content intermediate representation node tree, the nodes on the node tree can also be traversed downward based on the current processing node until a child node of the current processing node belonging to a structured type is found, and then the subtree structure determined based on the current processing node and the child node is converted into the first graphic content type node at the corresponding position in the graphic content intermediate representation node tree.

[0060] Since the difference between a table node and a video node is that there is no child node under the video node in the node tree, while the cells of a table store contents such as text and pictures, there are still child nodes under the table node, and they are structured child nodes. Based on this, in the embodiment of the present disclosure, for the current processing node whose node label is a table label, the current processing node can be converted into the first graphic content type node at the corresponding position in the graphic content intermediate representation node tree, and the downward traversal of the node tree is stopped at the same time.

[0061] In another optional implementation, for the current processing node whose node label is a table label, not only can the current processing node be marked based on the node label, but the nodes on the node tree can also be traversed downward based on the current processing node until a child node of the current processing node of a structured type is found, and then the subtree structure determined based on the current processing node and the child node is converted into the first graphic content type node at the corresponding position in the graphic content intermediate representation node tree. The node type of the first graphic content type node is determined by the node label table of the current processing node.

[0062] like Figure 2 As shown, it is a schematic diagram of a node tree conversion provided by an embodiment of the present disclosure, wherein it is assumed that the current processing node is node 201 (table node) on the node tree, and node 201 is not a structured type node. Therefore, based on node 201, the node tree is traversed downward to determine in turn whether the child nodes of node 201 are structured type nodes, such as Figure 2 As shown, when traversing to the child nodes 202-205, it is determined that the child nodes 202-205 are all structured type nodes (carrying the content in the table cell). At this time, the subtree structure 206 can be determined based on the current processing node and the child nodes 202-205, and the subtree structure 206 is converted into the first type node in the graphic content IR node tree, such as Figure 2 Node 207 in the graphic content IR node tree is shown.

[0063] Among them, part or all of the first graphic content type nodes in the intermediate representation node tree of the graphic content are provided with a predefined view component, and the predefined view component supports the rendering of the corresponding first graphic content type node on the target rendering end, that is, the predefined view component can be used to render the graphic content based on the first graphic content type node on the target rendering end.

[0064] In an optional implementation, a subtree structure consisting of a current processing node and each child node between the current processing node and the child node of the structured type found is determined as a target subtree structure, such as Figure 2 The subtree structure 206 is shown; then, the target subtree structure is converted into the first graphic content type node in the graphic content IR node tree.

[0065] In the disclosed embodiment, the intermediate representation IR node tree of the graphic content is defined from the perspective of the characteristics of the graphic content (such as an article), and the nodes in the graphic content IR node tree may have the following node attributes. Specifically, the node attributes include a node type identifier, which is used to distinguish whether the node belongs to a first graphic content type node or a second graphic content type node. Among them, since the unstructured type node is scalable, the first graphic content type node converted from the unstructured type node is also scalable. The specific expansion method is not limited, and it can be expanded based on the built-in plug-in method.

[0066] In addition, the node attributes of the nodes in the graphic content IR node tree may also include a rendering style type, which is used to identify the rendering style corresponding to the node converted from the block type node; the node attributes may also include content parameters, which are used to store the attribute parameter information of the node, such as the image size information of the image content, the link information of the audio and video source, etc.; the node attributes may also include an array of child nodes, which is used to represent the child nodes of the node in the graphic content IR node tree.

[0067] In the disclosed embodiment, the unstructured type of node can be a node corresponding to a special layout content in the target text content, or a node corresponding to a content with more complex logic (such as a table type node), etc. Therefore, when converting the above-mentioned type of node into a first graphic content type node in the graphic content IR node tree, the subtree structure corresponding to this type of node can be converted as a whole into a node in the graphic content IR node tree, namely, the first graphic content type node. For the first graphic content type node, a corresponding predefined view component can be generated for rendering the text content corresponding to this type of node.

[0068] In the disclosed embodiment, after parsing the current processing node and determining that the current processing node does not belong to a structured type node, the current processing node is converted into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree based on the node label of the current processing node.

[0069] The predefined view components in the embodiments of the present disclosure may be view components that are pre-generated based on demand and deployed on the target rendering end. For example, the predefined view components may include more complex view components such as table view components and interactive card view components.

[0070] In an optional implementation, when it is determined that the current processing node belongs to a structured type node, the current processing node can be converted into a second graphic content type node at a corresponding position in the graphic content intermediate representation node tree, wherein the second graphic content type node supports rendering based on a basic view component of the target rendering end.

[0071] like Figure 2 As shown, assuming that the current processing node is node 210 on the node tree, and node 210 is a structured type node, node 210 is converted into a second graphic content type node at a corresponding position in the graphic content intermediate representation node tree, such as Figure 2 The middle of the graphic content shown represents node 211 in the node tree.

[0072] S104: Continue to execute the above S102 until the graphic content IR node tree corresponding to the node tree is obtained; wherein the graphic content IR node tree is used to render the target graphic content at the target rendering end.

[0073] In the disclosed embodiment, based on the above method, the nodes on the node tree are parsed, converted and processed in sequence to obtain the graphic content IR node tree corresponding to the node tree, thereby completing the parsing conversion from the node tree to the graphic content IR node tree.

[0074] In actual applications, after obtaining the IR node tree of the graphic content corresponding to the node tree, the basic view components and predefined view components deployed on the target rendering end can be used to render the target graphic content on the target rendering end, thereby realizing the cross-end rendering function of the graphic content.

[0075] In an optional implementation, during the process of rendering the target graphic content in the graphic content IR node tree, corresponding basic view components or predefined view components can be called for different types of nodes in the graphic content IR node tree to achieve rendering of the corresponding graphic content.

[0076] In the graphic content rendering method provided by the embodiment of the present disclosure, the node tree corresponding to the structured storage document of the target graphic content is first obtained, and then the nodes on the node tree are traversed to determine the current processing node, and the current processing node is parsed to determine whether it belongs to a structured type node; wherein the structured type node has a corresponding relationship with the basic view component of the target rendering end. If it is determined that the current processing node does not belong to a structured type node, then according to the node label of the current processing node, the current processing node is converted into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree, wherein the node type of the first graphic content type node is determined based on the node label. The construction and node conversion of the graphic content intermediate representation node tree corresponding to the node tree are completed in the above manner, so that the target graphic content can be rendered on the target rendering end based on the graphic content intermediate representation node tree. It can be seen that the embodiment of the present disclosure can render graphic content that relies on web container rendering on various rendering ends, realizing a more general cross-end rendering function of graphic content.

[0077] On the basis of the above embodiment, in order to more accurately identify the node type to which the current processing node belongs, the layout context type of the child nodes of the current processing node in the node tree can be combined to determine the layout context type of the current processing node, thereby determining the node type to which the current processing node belongs.

[0078] In actual applications, the node type in the IR node tree of graphic content is determined by the label information of the node in the node tree, etc., and relies on the semantic standard specifications of structured storage documents (such as HTML). Then, for example, a div type node does not have clear semantics, so it is impossible to directly determine its node type based on the label information, that is, whether it belongs to a text type node or a view type node, because the rendering effect of the node depends on the attributes of its child nodes. Therefore, it is necessary to further confirm the parsed node type based on the layout context type of the node's child nodes to improve the accuracy of node type recognition.

[0079] For example, in the node tree of the target text content, there may be a situation where a node with a p tag nests another node with a p tag, where the parent node corresponds to the view node in the target graphic content, and the child node corresponds to the text node. Therefore, different nodes with the same node label in the node tree may correspond to different types of graphic type nodes in the graphic content IR node tree. If the above parent node and child node both correspond to the same type of graphic type node in the graphic content IR node tree, it may cause rendering anomalies when rendering graphic content based on the graphic content IR node tree. For this reason, the embodiment of the present disclosure can more accurately identify the node type of each node in the node tree based on the context algorithm, so as to more accurately convert each node into a graphic type node in the graphic content IR node tree.

[0080] The layout context types in the embodiments of the present disclosure may include block level and inline level. Each node in the node tree of the structured storage document usually generates a layout context type for its child elements and participates in the layout context type generated by its parent node. The layout context generated by the parent node in which adjacent nodes of the same level participate should be unique. The layout context type of the parent node can be determined based on this uniqueness.

[0081] In actual applications, since the image type node in the node tree does not have child nodes, the layout context type of the current processing node is used to determine whether it belongs to a structured type node, which is mainly implemented for text type nodes and block type nodes. When the current processing node is parsed and identified as a text type node or a block type node, the node type of the current processing node obtained by parsing can be further confirmed based on the layout context type of the child nodes of the current processing node, thereby improving the accuracy of identifying the node type to which the current processing node belongs.

[0082] Based on the characteristics of depth-first traversal, since the child nodes of the current processing node have undergone node parsing, conversion and other processes, the graphic content node types they belong to and the layout context types they participate in are all determined. Based on the above information, the layout context type corresponding to the current processing node can be inferred, thereby determining the graphic content node type it belongs to in the node tree representing the middle of the graphic content, which can improve the accuracy of determining the graphic content node type corresponding to the current processing node.

[0083] Based on the above embodiment, after obtaining the graphic content IR node tree corresponding to the node tree, the graphic content IR node tree can also be optimized to compress the graphic content IR node tree or adapt to the view component of the target rendering end.

[0084] In an optional implementation, the nodes in the graphic content IR node tree corresponding to the node tree are traversed to determine at least two nodes that meet the preset node merging rule, and the at least two nodes are merged based on the preset node merging rule. Specifically, the preset node merging rule can be set based on demand and is not limited here.

[0085] like Figure 3 As shown, it is a schematic diagram of an optimization of a graphic content IR node tree provided by an embodiment of the present disclosure, wherein, for the subtree structure 301 in the graphic content IR node tree, the node 302 can be merged into its parent node 303 to obtain a merged node 304, so as to obtain the merged node 304 that can adapt to the view component of the target rendering end, so as to facilitate the rendering of the graphic content on the target rendering end.

[0086] In addition, in order to adapt to the view component of the target rendering end, new nodes may be added to the nodes in the graphic content IR node tree, so that the graphic content can be rendered on the target rendering end. The embodiments of the present disclosure do not limit other optimization methods for the graphic content IR node tree.

[0087] Based on the above method embodiment, the present disclosure also provides a graphic content rendering device, referring to Figure 4 , is a schematic diagram of the structure of a graphic content rendering device provided by an embodiment of the present disclosure, the device comprising:

[0088] The first acquisition module 401 is used to acquire a node tree corresponding to a structured storage document of target graphic content; wherein the node tree includes structured type nodes;

[0089] A first determination module 402 is used to determine a current processing node by traversing the nodes on the node tree, and to parse the current processing node to determine whether the current processing node belongs to a node of the structured type;

[0090] The first conversion module 403 is used to convert the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree according to the node label of the current processing node when it is determined that the current processing node does not belong to the structured type node; wherein the node type of the first graphic content type node is determined based on the node label;

[0091] The second acquisition module 404 is used to continue executing the step of determining the current processing node by traversing the nodes on the node tree until the intermediate representation node tree of the graphic content corresponding to the node tree is obtained; wherein the intermediate representation node tree of the graphic content is used to render the target graphic content at the target rendering end.

[0092] In an optional implementation, the device further includes:

[0093] A second conversion module is used to convert the current processing node into a second graphic content type node at a corresponding position in the graphic content intermediate representation node tree when it is determined that the current processing node belongs to the structured type; wherein the node type of the second graphic content type node is determined based on the structured type to which the current processing node belongs.

[0094] In an optional implementation manner, the node label of the currently processed node includes a table label, and the device further includes:

[0095] A search module, configured to traverse downward the nodes on the node tree based on the current processing node until a child node of the current processing node belonging to the structured type is found;

[0096] Accordingly, the first conversion module is specifically used for:

[0097] Converting the subtree structure determined based on the current processing node and the child node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree.

[0098] In an optional implementation, some or all of the first graphic content type nodes in the graphic content intermediate representation node tree are provided with a predefined view component, and the predefined view component is used to support rendering of the corresponding first graphic content type nodes at the target rendering end.

[0099] In an optional implementation, the device further includes:

[0100] The merging module is used to traverse the nodes in the graphic content IR node tree corresponding to the node tree, determine at least two nodes that meet the preset node merging rules, and merge the at least two nodes based on the preset node merging rules.

[0101] In an optional implementation, the device further includes:

[0102] A first determination submodule, configured to determine the layout context type of the current processing node based on the layout context types of the child nodes of the current processing node in the node tree if it is determined that the current processing node belongs to the structured type node;

[0103] The second determination submodule is used to determine the structured type to which the current processing node belongs based on the layout context type of the current processing node; wherein the structured type includes a text type, a picture type or a block type.

[0104] In an optional implementation, the structured type node includes at least one of a text type node, a picture type node and a block type node.

[0105] In the graphic content rendering device provided by the embodiment of the present disclosure, the node tree corresponding to the structured storage document of the target graphic content is first obtained, and then the nodes on the node tree are traversed to determine the current processing node, and the current processing node is parsed to determine whether it belongs to a structured type node. If it is determined that the current processing node does not belong to a structured type node, then according to the node label of the current processing node, the current processing node is converted into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree, wherein the node type of the first graphic content type node is determined based on the node label. The construction and node conversion of the graphic content intermediate representation node tree corresponding to the node tree are completed in the above manner, so that the target graphic content can be rendered on the target rendering end based on the graphic content intermediate representation node tree. It can be seen that the embodiment of the present disclosure can render the graphic content that relies on the rendering of the web container on various rendering ends, realizing a more general cross-end rendering function of graphic content.

[0106] In addition to the above-mentioned method and apparatus, the embodiments of the present disclosure further provide a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device implements the graphic content rendering method described in the embodiments of the present disclosure.

[0107] The embodiment of the present disclosure further provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the method for rendering graphic content described in the embodiment of the present disclosure is implemented.

[0108] In addition, the present disclosure also provides a graphic content rendering device, see Figure 5 As shown, it may include:

[0109] Processor 501, memory 502, input device 503 and output device 504. The number of processors 501 in the graphic content rendering device can be one or more. Figure 5 In some embodiments of the present disclosure, the processor 501, the memory 502, the input device 503 and the output device 504 may be connected via a bus or other means, wherein: Figure 5 The example of connecting through bus is taken in the following.

[0110] The memory 502 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing of the graphic content rendering device by running the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application required for a function, etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The input device 503 may be used to receive input digital or character information, and to generate signal input related to user settings and function control of the graphic content rendering device.

[0111] Specifically in this embodiment, the processor 501 will load the executable files corresponding to the processes of one or more applications into the memory 502 according to the following instructions, and the processor 501 will run the applications stored in the memory 502, thereby realizing various functions of the above-mentioned graphic content rendering device.

[0112] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0113] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for rendering graphic content, It is characterized in that The method comprises: Obtaining a node tree corresponding to a structured storage document of target graphic content; wherein the node tree includes nodes of a structured type; Determine a current processing node by traversing the nodes on the node tree, and parse the current processing node to determine whether the current processing node belongs to a node of the structured type; If it is determined that the current processing node does not belong to the structured type node, then according to the node label of the current processing node, convert the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree; wherein the node type of the first graphic content type node is determined based on the node label; Continue to execute the step of determining the current processing node by traversing the nodes on the node tree until the intermediate representation node tree of the graphic content corresponding to the node tree is obtained; wherein the graphic content node tree is used to render the target graphic content at the target rendering end.

2. The method according to claim 1, It is characterized in that The method further comprises: If it is determined that the current processing node belongs to the structured type node, the current processing node is converted into a second graphic content type node at the corresponding position in the graphic content intermediate representation node tree; wherein the node type of the second graphic content type node is determined based on the structured type to which the current processing node belongs.

3. The method according to claim 1, It is characterized in that The node label of the current processing node includes a table label, and before converting the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree according to the node label of the current processing node, the method further includes: Traversing downward the nodes on the node tree based on the current processing node until a child node of the current processing node belonging to the structured type is found; Correspondingly, converting the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree according to the node label of the current processing node includes: Converting the subtree structure determined based on the current processing node and the child node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree.

4. The method according to claim 1, It is characterized in that Some or all of the first graphic content type nodes in the graphic content intermediate representation node tree are provided with a predefined view component, and the predefined view component is used to support the rendering of the corresponding first graphic content type node at the target rendering end.

5. The method according to claim 1, It is characterized in that The method further comprises: The nodes in the intermediate representation node tree of the graphic content corresponding to the node tree are traversed to determine at least two nodes that meet a preset node merging rule, and the at least two nodes are merged based on the preset node merging rule.

6. The method according to claim 2, It is characterized in that Before converting the current processing node into a second graphic content type node at a corresponding position in the graphic content intermediate representation node tree, the method further includes: If it is determined that the current processing node belongs to the structured type of node, determining the layout context type of the current processing node based on the layout context types of the child nodes of the current processing node in the node tree; According to the layout context type of the current processing node, the structured type to which the current processing node belongs is determined; wherein the structured type includes a text type, a picture type or a block type.

7. The method according to claim 1, It is characterized in that The structured type node includes at least one of a text type node, a picture type node and a block type node.

8. A graphic content processing device, It is characterized in that The device comprises: A first acquisition module is used to acquire a node tree corresponding to a structured storage document of target graphic content; wherein the node tree includes structured type nodes; A first determination module, configured to determine a current processing node by traversing the nodes on the node tree, and to parse the current processing node to determine whether the current processing node belongs to a node of the structured type; A first conversion module is used for converting the current processing node into a first graphic content type node at a corresponding position in the graphic content intermediate representation node tree according to the node label of the current processing node when it is determined that the current processing node does not belong to the structured type node; wherein the node type of the first graphic content type node is determined based on the node label; The second acquisition module is used to continue executing the step of determining the current processing node by traversing the nodes on the node tree until the intermediate representation node tree of the graphic content corresponding to the node tree is obtained; wherein the intermediate representation node tree of the graphic content is used to render the target graphic content at the target rendering end.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the method according to any one of claims 1 to 7.

10. A graphic content processing device, It is characterized in that include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and apparatus for rendering web page by DOM, terminal and storage medium

    CN109542417A

  • Structured query language statement visualization method and device

    CN110874367A

  • Configuration method of application interface of mobile terminal, mobile terminal and storage medium

    CN112882772A

  • Systems and methods for traversing implied subdivision hierarchical level of detail content

    US20220028161A1

Cited By

  • Test question rendering processing method, test question editing rendering system and electronic equipment

    CN122221815A

  • Test question rendering processing method, test question editing rendering system and electronic device

    CN122221815B