Method and device for generating drawing content, electronic equipment and program product
By converting the text of page elements into protocol data that is compatible with different operating systems, the compatibility problem of page rendering technology between different operating systems and development platforms is solved, and the unified rendering performance and the improvement of multi-field page rendering efficiency is achieved.
Patent Information
- Application Number
- CN202510099125.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-06
AI Technical Summary
The existing page rendering technology has compatibility problems between different operating systems and development platforms, resulting in inconsistent rendering performance and affecting the efficiency of page rendering in multiple fields.
By obtaining the text used to set page elements and converting the attribute values of elements in the text according to the predefined data protocol, protocol data can be supported by development components of different operating systems, so that the drawing content of elements is generated by the development components.
It realizes the unification of development standards between different operating systems and development components, ensures the consistency of rendering performance, thereby improving the efficiency of multi-domain page rendering.
Smart Images

Figure CN119938042A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of computers, and more particularly, to a method, an apparatus, an electronic device, and a program product for generating drawing content. Background Art
[0002] Page rendering technology is one of the core links of software development, including client-side rendering, server-side rendering, static site rendering and hybrid rendering methods. The current page development framework and tool chain continue to integrate various rendering technologies, thus providing developers with flexible and efficient page rendering solutions.
[0003] With the continuous improvement of user experience and rendering performance, rendering performance optimization has become an important direction for page rendering. For example, developers can improve page rendering speed by reducing resource loading time, optimizing rendering process, using hardware acceleration, etc. Due to the complexity of devices and the adaptation of development tools, page rendering technology still has a lot of room for improvement. Summary of the invention
[0004] In an embodiment of the present disclosure, a method, an apparatus, an electronic device, and a program product for generating drawing content are provided.
[0005] In a first aspect of the present disclosure, a method for generating drawing content is provided, comprising: obtaining text of an element for setting a page, the text being organized according to the syntax of a standard interface of the element; converting multiple attribute values of the element contained in the text according to a predefined data protocol to generate protocol data that can be supported by multiple development components for different operating systems; and generating, by the development component for the operating system, the drawing content of the element based on the protocol data.
[0006] In a second aspect of the present disclosure, a device for generating drawing content is provided, comprising: a text acquisition module, configured to acquire text of an element for setting a page, the text being organized according to the syntax of a standard interface of the element; an attribute value conversion module, configured to convert multiple attribute values of the element contained in the text according to a predefined data protocol to generate protocol data that can be supported by multiple development components for different operating systems; and a drawing content generation module, configured to generate the drawing content of the element based on the protocol data by a development component for the operating system.
[0007] In a third aspect of the present disclosure, an electronic device is provided, comprising a processor and a memory coupled to the processor, wherein the memory has instructions stored therein, and when the instructions are executed by the processor, the electronic device executes the method according to the first aspect.
[0008] In a fourth aspect of the present disclosure, a computer program product is provided, comprising computer executable instructions, wherein the computer executable instructions are executed by a processor to implement the method according to the first aspect.
[0009] In a fifth aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are executed by a processor to implement the method according to the first aspect.
[0010] The purpose of this Summary is to introduce a selection of concepts in a simplified form that are further described in the Detailed Description below. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0012] Figure 1 A schematic diagram illustrating an example environment in which some embodiments of the present disclosure may be implemented;
[0013] Figure 2 A flowchart of a method for generating drawing content according to some embodiments of the present disclosure is shown;
[0014] Figure 3 A schematic diagram showing a process for drawing a background according to some embodiments of the present disclosure;
[0015] Figure 4 A schematic diagram showing a process for parsing text according to some embodiments of the present disclosure is shown;
[0016] Figure 5 A schematic diagram showing the relationship of data processing tools of some embodiments of the present disclosure;
[0017] Figure 6 A schematic diagram showing a data processing process of some embodiments of the present disclosure;
[0018] Figure 7 A schematic diagram showing the drawing process of some embodiments of the present disclosure;
[0019] Figure 8 A schematic diagram showing another drawing process of some embodiments of the present disclosure;
[0020] Fig. 9 A block diagram showing an apparatus for generating drawing content according to some embodiments of the present disclosure; and
[0021] Fig.10 A schematic block diagram of an electronic device according to some embodiments of the present disclosure is shown.
[0022] Throughout the drawings, the same or similar reference numbers denote the same or similar elements. DETAILED DESCRIPTION
[0023] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0024] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0025] For example, when receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0026] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0027] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0029] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects, unless explicitly stated. Other explicit and implicit definitions may also be included below.
[0030] In relevant development standards, such as web page standards, developers can define the background and border styles of page elements through background attributes, border attributes, etc. The attribute description capabilities in web page standards are relatively rich, and can provide capabilities such as linear gradients and radial gradients, and support superimposing multiple backgrounds and borders on the same view. Taking the web page standard as an example, it provides a description of the background and the corresponding relationship with the style. According to the web page standard, the functions of various rendering modules can be realized, which is part of the browser Cascading Style Sheets (CSS).
[0031] For different development platforms, their development standards and performance are different. For example, for mobile terminal platforms, the background drawing capabilities in the page framework they provide are limited. They do not have the ability to clearly define the background like in the web page standard. In most cases, developers need to draw the background through a 2D graphics library. In addition, the background drawing capabilities provided by mobile terminals with different operating systems are also different. Therefore, the relevant technologies have inconsistent rendering capabilities for different development platforms, and it is impossible to achieve a unified development standard, resulting in low efficiency in page rendering in multiple fields.
[0032] In an embodiment of the present disclosure, firstly, the text input by the developer for setting the page element is obtained, and the text is described by the standard interface of the element in the relevant standard. Then, according to the predefined data protocol, the multiple attribute values related to the element in the text are converted, so as to obtain the protocol data that can be supported by the development components of different operating systems at the same time. Furthermore, the drawing content of the element is generated by the development component of any operating system based on the protocol data. In this way, a certain development standard can be converted into protocol data supported by the development components of multiple operating systems at the same time, so as to ensure the unification of the development standards of different development components, ensure the consistency of the rendering performance of different development components, and thus improve the efficiency of multi-domain page rendering.
[0033] Figure 1 A schematic diagram of an example environment 100 is shown in which some embodiments of the present disclosure may be implemented. Figure 1, the example environment 100 includes a development platform 102 and a terminal 114, wherein the development platform 102 can be set as a computing system, a single server, a distributed server, or a cloud-based server, etc., and the terminal 114 can be set as a personal computer, a mobile phone, a tablet computer, etc. In some embodiments, the development platform 102 is provided with a multi-system development component 104 and a parser 112, and the multi-system development component 104 is provided with a plurality of development components corresponding to a plurality of operating systems, such as a development component 106 corresponding to a first operating system, a development component 108 corresponding to a second operating system, and a development component 110 corresponding to a third operating system.
[0034] In some embodiments, the development platform 102 obtains the text input by the developer for setting the page element. For example, the development platform 102 may include a developer terminal for interacting with the developer, and the developer transmits the text to the development platform 102 through the developer terminal. The text is organized by the developer according to the syntax of the standard interface of the page element in a certain standard. Then, the parser 112 in the development platform 102 parses the text input by the developer to obtain the attributes and attribute values of the elements set by the developer in the text. Through a predefined data protocol, the parsed attributes and attribute values are converted into protocol data that can be supported simultaneously by multiple development components in the multi-system development component 104.
[0035] Further, after the parser 112 parses the text and obtains the protocol data, any development component in the multi-system development component 104 generates the drawing content of the element according to the protocol data. For example, if the operating system in the terminal 114 is a third operating system, the development component 110 generates the drawing content of the element according to the protocol data. Then, the development component 110 sends the generated drawing content to the terminal 114 so that the terminal 114 performs page rendering according to the drawing content. In this way, a certain development standard can be converted into protocol data supported by development components of multiple operating systems at the same time, thereby ensuring the unification of development standards of different development components, ensuring the consistency of rendering performance of different development components, and thus improving the efficiency of multi-domain page rendering.
[0036] It should be understood that the architecture and functions in the example environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure. Embodiments of the present disclosure may also be applied to other environments with different structures and / or functions.
[0037] The following will combine Figures 2 to 10The process according to the embodiment of the present disclosure is described in detail. For ease of understanding, the specific data mentioned in the following description are exemplary and are not intended to limit the scope of protection of the present disclosure. It should be understood that the embodiments described below may also include additional actions not shown and / or the actions shown may be omitted, and the scope of the present disclosure is not limited in this respect.
[0038] Figure 2 FIG. 2 is a flowchart of a method 200 for generating drawing content in some embodiments of the present disclosure. In some embodiments, the method 200 for generating drawing content may be Figure 1 It should be understood that the development platform 102 can be set as a computing system, a single server, a distributed server, or a cloud-based server, etc.
[0039] At block 202, text for setting an element of a page is obtained, and the text is organized according to the syntax of a standard interface of the element. In some embodiments, the development platform 102 obtains text input by a developer for setting a page element. For example, the development platform 102 may include a developer terminal for interacting with the developer, and the developer transmits the text to the development platform 102 through the developer terminal. The text is organized by the developer according to the syntax of a standard interface of the page element in a certain standard.
[0040] At block 204, multiple attribute values of the elements contained in the text are converted according to a predefined data protocol to generate protocol data that can be supported by multiple development components for different operating systems. In some embodiments, the text input by the developer is then parsed by the parser 112 in the development platform 102 to obtain the attributes and attribute values of the elements set by the developer in the text. The parsed attributes and attribute values are converted into protocol data that can be simultaneously supported by multiple development components in the multi-system development component 104 through the predefined data protocol.
[0041] At block 206, the development component for the operating system generates the drawing content of the element based on the protocol data. In some embodiments, after the parser 112 parses the text and obtains the protocol data, any development component in the multi-system development component 104 generates the drawing content of the element according to the protocol data. For example, if the operating system in the terminal 114 is a third operating system, the development component 110 generates the drawing content of the element according to the protocol data. Then, the development component 110 sends the generated drawing content to the terminal 114 so that the terminal 114 performs page rendering according to the drawing content.
[0042] In an embodiment of the present disclosure, firstly, the text input by the developer for setting the page element is obtained, and the text is described by the standard interface of the element in the relevant standard. Then, according to the predefined data protocol, the multiple attribute values related to the element in the text are converted, so as to obtain the protocol data that can be supported by the development components of different operating systems at the same time. Furthermore, the drawing content of the element is generated by the development component of any operating system based on the protocol data. In this way, a certain development standard can be converted into protocol data supported by the development components of multiple operating systems at the same time, so as to ensure the unification of the development standards of different development components, ensure the consistency of the rendering performance of different development components, and thus improve the efficiency of multi-domain page rendering.
[0043] Figure 3 FIG. 3 is a schematic diagram of a process 300 for drawing a background in some embodiments of the present disclosure. In some embodiments, the process 300 for drawing may be Figure 1 The development platform 102 (including the multi-system development component 104 and the parser 112) and the terminal 114 in the embodiment are executed. It should be understood that the development platform 102 can be set as a computing system, a single server, a distributed server, or a cloud-based server, etc. Among them, box 302 can be executed by the developer terminal of the development platform 102, boxes 304, boxes 314-318, and box 322 are executed by the multi-system development component 104, boxes 306-312 are executed by the parser 112, and boxes 320, boxes 324-326 are executed by the terminal 114.
[0044] At box 302, the developer terminal sets the background style. In some embodiments, the developer enters text corresponding to the background style in the developer terminal, where the text can be organized according to the standard interface corresponding to the background style in the development standard, and the developer can pass in the attribute values of the relevant attributes in the standard interface to set the background style. At box 304, the multi-system development component 104 receives the background style. In some embodiments, after receiving the text of the background style, the developer terminal sends the text of the background style to the development component in the multi-system development component 104. For example, if the operating system of the terminal 114 is the second operating system, the developer terminal sends the text to the development component 108.
[0045] At block 306, the parser 112 receives the background style. In some embodiments, since the multi-system development component 104 cannot directly support the development standard corresponding to the text, the multi-system development component 104 sends the text to the unified parser 112 for parsing. At block 308, the parser 112 parses the style string, that is, parses the text of the background style. In some embodiments, the parser 112 may first determine the attributes and corresponding attribute values in the text of the background style, and convert the attributes and attribute values into data that can be supported by multiple development components at the same time, which will be described below in conjunction with Figure 4 Let’s describe the parsing process in detail.
[0046] At box 310, the parser 112 serializes the data. In some embodiments, the parser 112 serializes the converted data to obtain an instruction sequence for generating the drawing content. At box 312, the parser 112 sends the data to the development component. In some embodiments, after the parser 112 parses the text of the background style and obtains the protocol data, the protocol data can be sent to the development component corresponding to the operating system of the terminal 114 in the multi-system development component 104, such as the development component 106 (hereinafter described by taking the development component 106 as an example). At box 314, the development component 106 receives the serialized data, i.e., the serialized protocol data.
[0047] At box 316, the development component 106 sets data for the background manager. In some embodiments, after receiving the protocol data, the development component 106 passes the protocol data into the background manager, thereby preparing to perform a background drawing operation. At box 318, the development component 106 requests drawing. In some embodiments, the development component 106 sends a request for rendering a page to the terminal 114, thereby asking whether the terminal 114 agrees to render the page. At box 320, the terminal 114 accepts the drawing request. In some embodiments, if the terminal 114 agrees to render, a response agreeing to render the page can be sent to the development component 106. At box 322, the development component 106 draws background content. In some embodiments, after receiving the response agreeing to render the page sent by the terminal 114, the development component 106 generates background content for drawing according to the protocol data. Then, the development component 106 sends the background content to the terminal 114. At box 324, the terminal 114 receives the background content. At box 326, the terminal 114 draws the background content.
[0048] Figure 4 FIG. 4 is a schematic diagram of a process 400 for parsing text in some embodiments of the present disclosure. In some embodiments, the process 400 for parsing text may be Figure 1It should be understood that the parser 112 can be set in a computing system, a single server, a distributed server, or a cloud-based server.
[0049] At box 402, the parser 112 receives text. In some embodiments, the text is a setting statement for a page element set by a developer according to relevant development standards, such as the background interface in the CSS standard. At box 404, the parser 112 parses the text. In some embodiments, the parser 112 segments the text input by the developer to obtain multiple sub-texts. For example, for the CSS standard text "border:1px solid red; background:white", it can be segmented into two sub-texts "border:1px solid red" and "background:white". In this way, the statements in the text can be split to improve the parsing efficiency of the text.
[0050] In some embodiments, the attribute type in the above subtext can be a long-format attribute (which can be called an attribute of the first format, i.e., a specific attribute) or an abbreviated attribute (which can be called an attribute of the second format). Among them, the long-format attribute is an attribute used to set a certain style characteristic individually, and each long-format attribute only controls a specific style aspect. For example, background-image in CSS annotation is specifically used to set the background image of the element, background-color is specifically used to set the background color of the element, and background-size is specifically used to set the size of the element image, etc. The advantage of the long-format attribute is that it can accurately control a specific style, and the disadvantage is that multiple related styles need to be set for a certain element at the same time, and the code appears redundant. Correspondingly, the abbreviated attribute can set multiple related style characteristics at the same time in one attribute declaration, and one abbreviated attribute can be converted into multiple corresponding long-format attributes. For example, the background abbreviated attribute can be converted into long-format attributes such as background-image, background-color, and background-size.
[0051] At block 406, the parser 112 determines whether it is a long-form attribute. In some embodiments, the parser 112 determines whether the parsed subtext is the text of the long-form attribute. If the subtext is the text of the long-form attribute, then at block 408, the parser 112 parses the long-form attribute to obtain the attribute value corresponding to each long-form attribute. At block 410, the parser 112 generates data according to the data protocol. In some embodiments, the parser 112 converts the long-form attribute and the corresponding attribute value into protocol data that can be simultaneously supported by multiple development components in the multi-system development component 104 according to a predefined data protocol.
[0052] If the subtext is not the text of the long-format attribute but the text of the abbreviated attribute, then at box 412, the parser 112 parses the abbreviated attribute into multiple corresponding long-format attributes. In some embodiments, the parser 112 splits the abbreviated attribute into multiple key-value pairs of long-format attributes. For example, for the subtext of the abbreviated attribute "background: linear-gradient (red, blue)", the parser 112 can split it into six long-format attributes "background-image, background-origin, background-size, background-repeat, background-position, background-clip". At box 414, the parser 112 generates data according to the data protocol. In some embodiments, the parser 112 converts the split long-format attributes and the corresponding attribute values into protocol data that can be simultaneously supported by multiple development components in the multi-system development component 104 according to a predefined data protocol.
[0053] At block 416, the parser 112 determines whether there are more attributes. In some embodiments, the parser 112 determines whether there are any unparsed texts. If there are any unparsed texts, the parser 112 repeats the above process to continue parsing. If there are no unparsed texts, at block 418, the parser 112 sends the protocol data to the development component. In some embodiments, after obtaining the protocol data, the parser 112 sends the protocol data to the corresponding development component, and the development component performs subsequent drawing.
[0054] In some embodiments, the element referred to in the present disclosure may be a background or border in a page. According to the characteristics of its long-form attributes, the long-form attributes may be divided into the following four categories: color attributes, enumerated attributes, length or percentage attributes, and image attributes. Taking the CSS standard as an example, color attributes may include border-top-color, border-right-color, border-bottom-color, border-left-color, background-color, enumerated attributes may include background-origin, border-top-style, border-right-style, border-bottom-style, border-left-style, background-clip, background-repeat, length or percentage attributes may include border-top-width, border-right-width, border-bottom-width, border-left-width, background-position, background-size, and image attributes may include background-image.
[0055] For each type of long-format attribute, there is a corresponding data protocol when converting the subtext. According to the different long-format attributes, the corresponding data protocols are also different. Therefore, after obtaining the subtext, the parser 112 can first determine the attribute type of the long-format attribute, and then convert the long-format attribute and its attribute value according to the data protocol corresponding to the attribute type, so as to obtain the converted data, and then serialize the converted data to obtain the protocol data in the form of a sequence. In this way, the conversion efficiency of the subtext can be improved.
[0056] In some embodiments, for subtext of color attributes, the parser 112 may use an unsigned 32-bit integer (which may be referred to as the first type of data) to represent its color value, for example, white may be represented as hexadecimal FFFFFFFF. For subtext of enumeration attributes, the parser 112 may use an unsigned 32-bit integer (which may be referred to as the second type of data) to represent its enumeration value, for example, using 0 to represent solid. For subtext of length or percentage attributes, the parser 112 may use a one-bit Boolean value to indicate whether it is a length or a percentage, and use a 64-bit double-precision floating point number (which may be referred to as the third type of data) to represent its numerical value. For example, for 50%, the parser 112 may use |1|0.5| to represent it. For subtext of image attributes, the parser 112 may use a 64-bit integer, etc. (which may be referred to as the fourth type of data) to represent its attribute value.
[0057] The data protocol conversion process of the subtext of the image attribute will be described in detail below. In some embodiments, the image attribute may include a picture address attribute, a linear gradient attribute, and a radial gradient attribute, which correspond to the url function, the linear-gradient function, and the radial-gradient function, respectively, taking the CSS standard as an example. In some embodiments, the parser 112 may first determine which of the picture address attribute, the linear gradient attribute, and the radial gradient attribute the type of the image attribute is, and use an 8-bit integer (which may be referred to as the fifth type of data) to represent its type.
[0058] Then, for the image address attribute, the parser 112 can use a string (i.e., the fourth type of data) to represent the address of its image. For the linear gradient attribute, the parser 112 can use an 8-bit integer to indicate whether the direction is an enumeration value or an angle. If it is an angle, the parser 112 can use a 64-bit double-precision floating point number to represent the angle, and if it is an enumeration value, the parser 112 can use a 64-bit integer to represent the enumeration value. Then, the parser 112 can use an array of 32-bit unsigned integers to represent the color of the gradient, and use an array of 64-bit double-precision floating point numbers to represent the stop point of the gradient. The above-mentioned data related to the relevant attribute values of the linear gradient attribute can all be called the fourth type of data.
[0059] For the radial gradient attribute, the parser 112 can use a flag bit to identify whether it is a circle or an ellipse, and then use an array to describe its position and size, the array consisting of length or percentage values. After that, the parser 112 can use an array of 32-bit unsigned integers to represent the color of the gradient, and an array of 64-bit double-precision floating point numbers to represent the stop point of the gradient. The above-mentioned data related to the attribute value of the radial gradient attribute can all be called the fourth type of data.
[0060] Figure 5 A schematic diagram of a relationship 500 of a data processing tool of some embodiments of the present disclosure is shown. In some embodiments, the relationship 500 includes a linear gradient background class 502, a radial gradient background class 504, and a picture background class 506, all of which belong to a background class 512. The relationship 500 also involves background layer information 508, a background manager 510, and background information 514, wherein each background layer information 508 holds a background class 512, which is a virtual class, and the real line of sight is realized by the linear gradient background class 502, the radial gradient background class 504, and the picture background class 506.
[0061] In some embodiments, the background manager 510 is used to manage and set background-related data, and the above-parsed protocol data will be set to the background information 514 through the background manager 510. The background information 514 deserializes the protocol data into background layer information 508 according to the protocol data, and each image attribute in the background layer information 508 corresponds to a background layer, for example, "background: linear-gradient (red, blur) url ("xxxx.png")" corresponds to two background layers.
[0062] Figure 6 FIG. 6 is a schematic diagram showing a process 600 for data processing of some embodiments of the present disclosure. In some embodiments, the process 300 for data processing may be Figure 1 The development component 104 of the multi-system development component 104 in the development platform 102 is executed (hereinafter, the development component 106 is used as an example for explanation). It should be understood that the development component can be set in a computing system, a single server, a distributed server, or a cloud-based server.
[0063] At block 602, the development component 106 creates a background manager for performing the processing task of the protocol data, and the background manager is used to manage all background behaviors. At block 604, the development component 106 creates background information for storing the protocol data. At block 606, the development component 106 sets attributes for the background information, thereby setting the attributes in the protocol data to the attributes corresponding to the background information. After all attributes are set, at block 608, the development component 106 confirms whether there is new data. In some embodiments, if there is new protocol data, the development component 106 repeats the process of block 606 above.
[0064] If there is no new protocol data, then at box 610, the development component 106 combines the background layer information. In some embodiments, the development component 106 generates the corresponding background layer information according to the number of background levels defined in the background image attributes, and combines the background layer information. At box 612, the development component 106 generates a background example of the corresponding type. In some embodiments, the development component 106 generates a background instance of the corresponding content type through a linear gradient background class, a radial gradient background class, and a picture background class according to the specific content type of the layer. In box 614, the development component 106 sets the attribute to the background instance. Through the above process, the development component 106 completes the processing of the protocol data.
[0065] Figure 7 FIG. 7 is a schematic diagram showing a drawing process 700 of some embodiments of the present disclosure. In some embodiments, the drawing process 700 may be performed by Figure 1The development component 104 of the multi-system development component 104 in the development platform 102 is executed (hereinafter, the development component 106 is used as an example for explanation). It should be understood that the development component can be set in a computing system, a single server, a distributed server, or a cloud-based server.
[0066] In box 702, the development component 106 begins drawing. In some embodiments, when all properties are set, the development component 106 enters the drawing process. In box 704, the development component 106 creates a background layer. In box 706, the development component 106 determines whether there is only a gradient. In some embodiments, the development component 106 determines whether there are only linear gradient properties and radial gradient properties in the properties. In box 708, the background instance of the development component 106 generates a corresponding gradient layer based on the background size. In box 710, the development component 106 generates a vertical repeat layer, and in box 712, the development component 106 generates a horizontal repeat layer. In some embodiments, the development component 106 needs to handle repeat effects, so it can be repeated in the vertical direction and the horizontal direction.
[0067] At block 714, the exploit component 106 inserts the gradient layer into the vertical repeat. In some embodiments, the vertical repeat effect can be achieved by a vertical repeat layer with the same width as the gradient layer and the same height as the target size. At block 716, the exploit component 106 inserts the vertical repeat layer into the horizontal repeat layer. In some embodiments, the exploit component 106 creates a horizontal repeat layer with the same size as the target, and repeats the horizontal repeat layer to obtain the horizontal repeat effect.
[0068] In box 718, the development component 106 inserts the horizontal repeating layer into the top layer of the background layer. In box 720, the development component 106 determines that each background information layer is processed, and if not, repeats the above process. If so, then in box 722, the development component 106 determines whether there is a color background. If so, then in box 724, the development component 106 creates a shape layer. In box 726, the development component 106 creates a clipping path. In box 728, the development component 106 sets the color and path to the shape layer, thereby completing the background color setting and shape clipping of the shape layer. In box 730, the development component 106 inserts the shape layer into the bottom layer of the background layer. In box 732, the development component 106 uses the graphics library to draw. In box 734, the development component 106 inserts the background layer into the view tree. In some embodiments, the view tree corresponds to multiple views in the page, and the rendering of the page can be achieved through the view tree.
[0069] Figure 8 FIG. 8 is a schematic diagram showing another drawing process 800 of some embodiments of the present disclosure. The drawing process 700 may be performed by Figure 1The drawing process 800 is executed by any development component of the multi-system development component 104 in the development platform 102 (hereinafter, the development component 106 is used as an example for explanation). It should be understood that the development component can be set in a computing system, a single server, a distributed server, or a cloud-based server. It should be understood that the drawing process 800 is mainly for repeated effects.
[0070] In box 802, the development component 106 crops the canvas. In box 804, the development component 106 calculates the size size. In some embodiments, the development component 106 calculates the size size of the repeated target. In box 806, the development component 106 calculates the position pos. In some embodiments, the development component 106 calculates the position pos of the repeated target. In box 808, the development component 106 determines repeat.x, that is, determines whether the target is repeated in the x direction (e.g., horizontal direction). If not repeated, in box 810, the development component 106 calculates end.x = pos.x + size.x, that is, the development component uses the sum of the size and position in the x direction as the position of the end point. If repeated, in box 812, the development component 106 calculates the new starting point pos.x, that is, the development component 106 calculates the position of the starting point after the repetition in the x direction. In box 814, the development component 106 calculates end.x = FRAME.right, that is, the development component 106 uses the rightmost position of the target after the repetition as the position of the end point in the x direction.
[0071] In box 816, the development component 106 determines repeat.y, that is, determines whether the target is repeated in the y direction (e.g., vertical direction). If not, in box 818, the development component 106 calculates end.y = pos.y + size.x, that is, the development component uses the sum of the size and position in the y direction as the position of the end point. If it is repeated, in box 820, the development component 106 calculates the new starting point pos.y, that is, the development component 106 calculates the position of the starting point in the y direction after the repetition. In box 822, the development component 106 calculates end.y = FRAME.bottom, that is, the development component 106 uses the bottommost position of the target after the repetition as the position of the end point in the y direction.
[0072] At block 824, the development component 106 draws (pos.x, pos.y, size), that is, the development component 106 draws repeating objects according to the position and size. At block 826, the development component 106 determines pos.x < end.x, that is, the development component 106 determines whether the position of the next object reaches the position of the end point. If not, at block 828, the development component 106 calculates pos.x += size.x, that is, the development component 106 adds the size to the position of the current object to calculate the position of the next object. Then, the development component 106 repeats the above process until the position of the end point is reached. After reaching the end point, at block 830, the development component draws (pos.x, pos.y, size), that is, the development component 106 draws the last repeating object. For the y direction, the development component 106 performs similar processing. At block 832, the development component 106 determines pos.y < end.y, and at block 834, the development component 106 calculates pos.y += size.y. After all repeating objects are drawn, at block 836, the development component 106 determines whether each background layer is drawn. If not, at block 838, the development component 106 draws the next layer 838 and repeats the above process until all layers are drawn.
[0073] Fig. 9 The block diagram of a device 900 for generating rendering content according to some embodiments of the present disclosure is shown. The device 900 includes: a text acquisition module 902 configured to acquire text for setting elements of a page, the text being organized according to the syntax of the standard interface of the elements; an attribute value conversion module 904 configured to convert multiple attribute values of the elements included in the text according to a predefined data protocol to generate protocol data that can be supported by multiple development components for different operating systems; and a rendering content generation module 906 configured to generate the rendering content of the elements by the development components for the operating systems based on the protocol data.
[0074] It can be understood that the device 900 of the present disclosure can achieve at least one of the many advantages that the method or process described above can achieve. For example, the device 900 first acquires the text input by the developer for setting page elements, and the text is described through the standard interface of the elements in the relevant standard. Then, according to the predefined data protocol, multiple attribute values of the elements involved in the text are converted to obtain protocol data that can be supported by the development components of different operating systems at the same time. Further, the development components of any operating system generate the rendering content of the elements based on the protocol data. In this way, a certain development standard can be converted into protocol data that can be supported by the development components of multiple operating systems at the same time, thereby ensuring the unity of the development standards of different development components, ensuring the consistency of the rendering performance of different development components, and further improving the efficiency of multi-domain page rendering.
[0075] Fig.10 1 is a block diagram of an electronic device 1000 according to some embodiments of the present disclosure. The device 1000 may be a device or apparatus described in the embodiments of the present disclosure. Fig.10 As shown, the device 1000 includes a central processing unit (CPU) and / or a graphics processing unit (GPU) 1002, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 1004 or loaded from a storage unit 1016 to a random access memory (RAM) 1006. In the RAM 1006, various programs and data required for the operation of the device 1000 can also be stored. The CPU / GPU 1002, the ROM 1004, and the RAM 1006 are connected to each other via a bus 1008. An input / output (I / O) interface 1010 is also connected to the bus 1008. Although not shown in FIG. Fig.10 As shown in FIG. 1 , device 1000 may further include a coprocessor.
[0076] A number of components in the device 1000 are connected to the I / O interface 1010, including: an input unit 1012, such as a keyboard, a mouse, etc.; an output unit 1014, such as various types of displays, speakers, etc.; a storage unit 1016, such as a disk, an optical disk, etc.; and a communication unit 1018, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1018 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0077] The various methods or processes described above may be performed by the CPU / GPU 1002. For example, in some embodiments, the methods may be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 1016. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1004 and / or the communication unit 1018. When the computer program is loaded into the RAM 1006 and executed by the CPU / GPU 1002, one or more steps or actions in the methods or processes described above may be performed.
[0078] In some embodiments, the methods and processes described above may be implemented as a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.
[0079] Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer readable storage medium used here is not interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (for example, a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.
[0080] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0081] The computer program instructions for performing the disclosed operation may be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, programming languages including object-oriented programming languages, and conventional procedural programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In certain embodiments, by utilizing the state information of a computer-readable program instruction to customize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit may execute a computer-readable program instruction, thereby realizing various aspects of the present disclosure.
[0082] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0083] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0084] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the equipment, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous frames can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the functions involved. It should also be noted that each frame in the block diagram and / or flow chart, and the combination of frames in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0085] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
[0086] Some example implementations of the present disclosure are listed below.
[0087] Example 1. A method for generating drawing content, comprising:
[0088] Acquire text for setting an element of the page, the text being organized according to the syntax of a standard interface of the element;
[0089] According to a predefined data protocol, converting multiple attribute values of the element contained in the text to generate protocol data that can be supported by multiple development components for different operating systems; and
[0090] The development component for the operating system generates the drawing content of the element based on the protocol data.
[0091] Example 2. The method according to Example 1, wherein converting multiple attribute values of the element contained in the text according to a predefined data protocol comprises:
[0092] Determining a format of the text, the format of the text comprising a first format and a second format, the plurality of attribute values in the first format corresponding to a plurality of specific attributes of the element, and the plurality of attribute values in the second format corresponding to abbreviated attributes of the element; and
[0093] In the case where the format of the text is the first format, the multiple attribute values and the corresponding multiple specific attributes are converted according to the data protocol to generate the protocol data that can be supported by the multiple development components.
[0094] Example 3. The method according to Example 1 or 2, wherein converting the multiple attribute values of the element contained in the text according to a predefined data protocol further comprises:
[0095] In a case where the format of the text is the second format, determining a plurality of specific attributes corresponding to the plurality of attribute values based on the abbreviated attribute; and
[0096] The multiple attribute values and the corresponding multiple specific attributes are converted according to the data protocol to generate the protocol data that can be supported by the multiple development components.
[0097] Example 4. The method according to any one of Examples 1-3, wherein the text is used to set multiple elements of the page, and converting multiple attribute values of the elements contained in the text according to a predefined data protocol comprises:
[0098] dividing the text into a plurality of sub-texts corresponding to the plurality of elements, wherein the format of the sub-texts in the plurality of sub-texts is the first format or the second format; and
[0099] According to the data protocol, multiple attribute values of the elements contained in the subtext are converted to generate the protocol data that can be supported by the multiple development components.
[0100] Example 5. The method according to any one of Examples 1-4, wherein the element is a background or a border of the page, the protocol data is a sequence of multiple data after the multiple attribute values are converted, and converting the multiple attribute values of the element contained in the text according to a predefined data protocol includes:
[0101] Determine an attribute type of a specific attribute among the multiple specific attributes, the attribute type being one of a color attribute, an enumeration attribute, a length or percentage attribute, and an image attribute;
[0102] Determining data after the attribute value corresponding to the specific attribute is converted according to the data protocol corresponding to the attribute type; and
[0103] The plurality of data after the plurality of attribute values are converted are serialized to generate the sequence.
[0104] Example 6. The method according to any one of Examples 1-5, wherein determining data converted from the attribute value corresponding to the specific attribute according to the data protocol corresponding to the attribute type comprises:
[0105] In the case where the attribute type is the color attribute, converting the attribute value corresponding to the color attribute into data of the first type;
[0106] In the case where the attribute type is the enumerated attribute, converting the attribute value corresponding to the enumerated attribute into data of a second type;
[0107] In the case where the attribute type is a length or percentage attribute, converting the attribute value corresponding to the length or percentage attribute into a Boolean value and a third type of data, wherein the Boolean value is used to indicate that the attribute value is a length or a percentage; and
[0108] In the case where the attribute type is an image attribute, the attribute value corresponding to the image attribute is converted into data of the fourth type.
[0109] Example 7. The method according to any one of Examples 1-6, wherein the image attribute includes at least one of a picture address attribute, a linear gradient attribute, and a radial gradient attribute, and when the attribute type is an image attribute, converting the attribute value corresponding to the image attribute into the fourth type of data includes:
[0110] In the case where the attribute type is an image attribute, determining the type of the image attribute; and
[0111] The attribute value corresponding to the image attribute is converted into the fourth type of data and the fifth type of data, wherein the fifth type of data indicates one of a picture address attribute, a linear gradient attribute, and a radial gradient attribute.
[0112] Example 8. The method according to any one of Examples 1-7, wherein generating, by a development component for an operating system, drawing content of the element based on the protocol data comprises:
[0113] The development component sends a request for rendering a page to a terminal of the operating system; and in response to receiving a response from the terminal agreeing to render the page to the request, the development component generates the drawing content of the element based on the protocol data;
[0114] And the method further comprises:
[0115] The development component sends the drawing content to the terminal, so that the terminal renders the element of the page based on the drawing content.
[0116] Example 9. The method according to any one of Examples 1-8, wherein generating, by a development component for an operating system, drawing content of the element based on the protocol data comprises:
[0117] Determining, by the development component for the operating system, whether the drawing operation indicated by the protocol data is a repeated drawing operation; and
[0118] In response to the drawing operation indicated by the protocol data being the repeated drawing operation, the position of the next drawing content in the repeated direction is determined based on the position and size of the current drawing content.
[0119] Example 10. An apparatus for generating drawing content, comprising:
[0120] A text acquisition module, configured to acquire text for setting an element of the page, the text being organized according to the syntax of a standard interface of the element;
[0121] an attribute value conversion module configured to convert a plurality of attribute values of the element contained in the text according to a predefined data protocol to generate protocol data that can be supported by a plurality of development components for different operating systems; and
[0122] The drawing content generating module is configured to generate the drawing content of the element based on the protocol data by a development component for the operating system.
[0123] Example 11. The apparatus according to Example 10, wherein the attribute value conversion module is further configured to:
[0124] Determining a format of the text, the format of the text comprising a first format and a second format, the plurality of attribute values in the first format corresponding to a plurality of specific attributes of the element, and the plurality of attribute values in the second format corresponding to abbreviated attributes of the element; and
[0125] In the case where the format of the text is the first format, the multiple attribute values and the corresponding multiple specific attributes are converted according to the data protocol to generate the protocol data that can be supported by the multiple development components.
[0126] Example 12. The apparatus according to example 10 or 11, wherein the attribute value conversion module is further configured to:
[0127] In a case where the format of the text is the second format, determining a plurality of specific attributes corresponding to the plurality of attribute values based on the abbreviated attribute; and
[0128] The multiple attribute values and the corresponding multiple specific attributes are converted according to the data protocol to generate the protocol data that can be supported by the multiple development components.
[0129] Example 13. The apparatus according to any one of Examples 10-12, wherein the text is used to set multiple elements of the page, and wherein the attribute value conversion module is further configured to:
[0130] dividing the text into a plurality of sub-texts corresponding to the plurality of elements, wherein the format of the sub-texts in the plurality of sub-texts is the first format or the second format; and
[0131] According to the data protocol, multiple attribute values of the elements contained in the subtext are converted to generate the protocol data that can be supported by the multiple development components.
[0132] Example 14. The apparatus according to any one of Examples 10-13, wherein the element is a background or a border of the page, the protocol data is a sequence of multiple data after the multiple attribute values are converted, and the attribute value conversion module is further configured to:
[0133] Determine an attribute type of a specific attribute among the multiple specific attributes, the attribute type being one of a color attribute, an enumeration attribute, a length or percentage attribute, and an image attribute;
[0134] Determining data after the attribute value corresponding to the specific attribute is converted according to the data protocol corresponding to the attribute type; and
[0135] The plurality of data after the plurality of attribute values are converted are serialized to generate the sequence.
[0136] Example 15. The apparatus according to any one of Examples 10-14, wherein the attribute value conversion module is further configured to:
[0137] In the case where the attribute type is the color attribute, converting the attribute value corresponding to the color attribute into data of the first type;
[0138] In the case where the attribute type is the enumerated attribute, converting the attribute value corresponding to the enumerated attribute into data of a second type;
[0139] In the case where the attribute type is a length or percentage attribute, converting the attribute value corresponding to the length or percentage attribute into a Boolean value and a third type of data, wherein the Boolean value is used to indicate that the attribute value is a length or a percentage; and
[0140] In the case where the attribute type is an image attribute, the attribute value corresponding to the image attribute is converted into data of the fourth type.
[0141] Example 16. The apparatus according to any one of Examples 10-15, wherein the image attribute comprises at least one of a picture address attribute, a linear gradient attribute, and a radial gradient attribute, and the attribute value conversion module is further configured to:
[0142] In the case where the attribute type is an image attribute, determining the type of the image attribute; and
[0143] The attribute value corresponding to the image attribute is converted into the fourth type of data and the fifth type of data, wherein the fifth type of data indicates one of a picture address attribute, a linear gradient attribute, and a radial gradient attribute.
[0144] Example 17. The apparatus according to any one of Examples 10-16, wherein the drawing content generation module is further configured to:
[0145] The development component sends a request for rendering a page to a terminal of the operating system; and
[0146] In response to receiving a response from the terminal agreeing to render the page to the request, the development component generates the drawing content of the element based on the protocol data;
[0147] And the device also includes:
[0148] The drawing content sending module is configured to send the drawing content so that the terminal renders the element of the page based on the drawing content.
[0149] Example 18. The apparatus according to any one of Examples 10-17, wherein the drawing content generation module is further configured to:
[0150] Determining, by the development component for the operating system, whether the drawing operation indicated by the protocol data is a repeated drawing operation; and
[0151] In response to the drawing operation indicated by the protocol data being the repeated drawing operation, the position of the next drawing content in the repeated direction is determined based on the position and size of the current drawing content.
[0152] Example 19. An electronic device comprising:
[0153] Processor; and
[0154] A memory coupled to the processor, the memory having instructions stored therein, wherein when the instructions are executed by the processor, the electronic device performs actions, the actions comprising:
[0155] Acquire text for setting an element of the page, the text being organized according to the syntax of a standard interface of the element;
[0156] According to a predefined data protocol, converting multiple attribute values of the element contained in the text to generate protocol data that can be supported by multiple development components for different operating systems; and
[0157] The development component for the operating system generates the drawing content of the element based on the protocol data.
[0158] Example 20. The electronic device according to Example 19, wherein converting the multiple attribute values of the element contained in the text according to a predefined data protocol comprises:
[0159] Determining a format of the text, the format of the text comprising a first format and a second format, the plurality of attribute values in the first format corresponding to a plurality of specific attributes of the element, and the plurality of attribute values in the second format corresponding to abbreviated attributes of the element; and
[0160] In the case where the format of the text is the first format, the multiple attribute values and the corresponding multiple specific attributes are converted according to the data protocol to generate the protocol data that can be supported by the multiple development components.
[0161] Example 21. The electronic device according to Example 19 or 20, wherein converting the multiple attribute values of the element contained in the text according to a predefined data protocol further comprises:
[0162] In a case where the format of the text is the second format, determining a plurality of specific attributes corresponding to the plurality of attribute values based on the abbreviated attribute; and
[0163] The multiple attribute values and the corresponding multiple specific attributes are converted according to the data protocol to generate the protocol data that can be supported by the multiple development components.
[0164] Example 22. An electronic device according to any one of Examples 19-21, wherein the text is used to set multiple elements of the page, and converting multiple attribute values of the elements contained in the text according to a predefined data protocol comprises:
[0165] dividing the text into a plurality of sub-texts corresponding to the plurality of elements, wherein the format of the sub-texts in the plurality of sub-texts is the first format or the second format; and
[0166] According to the data protocol, multiple attribute values of the elements contained in the subtext are converted to generate the protocol data that can be supported by the multiple development components.
[0167] Example 23. An electronic device according to any one of Examples 19-22, wherein the element is a background or a border of the page, the protocol data is a sequence of multiple data after the multiple attribute values are converted, and converting the multiple attribute values of the element contained in the text according to a predefined data protocol includes:
[0168] Determine an attribute type of a specific attribute among the multiple specific attributes, the attribute type being one of a color attribute, an enumeration attribute, a length or percentage attribute, and an image attribute;
[0169] Determining data after the attribute value corresponding to the specific attribute is converted according to the data protocol corresponding to the attribute type; and
[0170] The plurality of data after the plurality of attribute values are converted are serialized to generate the sequence.
[0171] Example 24. The electronic device according to any one of Examples 19-23, wherein determining data converted from the attribute value corresponding to the specific attribute according to the data protocol corresponding to the attribute type comprises:
[0172] In the case where the attribute type is the color attribute, converting the attribute value corresponding to the color attribute into data of the first type;
[0173] In the case where the attribute type is the enumerated attribute, converting the attribute value corresponding to the enumerated attribute into data of a second type;
[0174] In the case where the attribute type is a length or percentage attribute, converting the attribute value corresponding to the length or percentage attribute into a Boolean value and a third type of data, wherein the Boolean value is used to indicate that the attribute value is a length or a percentage; and
[0175] In the case where the attribute type is an image attribute, the attribute value corresponding to the image attribute is converted into data of the fourth type.
[0176] Example 25. An electronic device according to any one of Examples 19-24, wherein the image attribute includes at least one of a picture address attribute, a linear gradient attribute, and a radial gradient attribute, and when the attribute type is an image attribute, converting the attribute value corresponding to the image attribute into a fourth type of data includes:
[0177] In the case where the attribute type is an image attribute, determining the type of the image attribute; and
[0178] The attribute value corresponding to the image attribute is converted into the fourth type of data and the fifth type of data, wherein the fifth type of data indicates one of a picture address attribute, a linear gradient attribute, and a radial gradient attribute.
[0179] Example 26. The electronic device according to any one of Examples 19-25, wherein generating, by a development component for an operating system, the drawing content of the element based on the protocol data comprises:
[0180] The development component sends a request for rendering a page to a terminal of the operating system; and
[0181] In response to receiving a response from the terminal agreeing to render the page to the request, the development component generates the drawing content of the element based on the protocol data;
[0182] And the actions also include:
[0183] The development component sends the drawing content to the terminal, so that the terminal renders the element of the page based on the drawing content.
[0184] Example 27. The electronic device according to any one of Examples 19-26, wherein generating, by a development component for an operating system, drawing content of the element based on the protocol data comprises:
[0185] Determining, by the development component for the operating system, whether the drawing operation indicated by the protocol data is a repeated drawing operation; and
[0186] In response to the drawing operation indicated by the protocol data being the repeated drawing operation, the position of the next drawing content in the repeated direction is determined based on the position and size of the current drawing content.
[0187] Example 28. A computer-readable storage medium having computer-executable instructions stored thereon, wherein the computer-executable instructions are executed by a processor to implement a method according to any one of Examples 1 to 9.
[0188] Example 29. A computer program product tangibly stored on a computer-readable medium and comprising computer-executable instructions that, when executed by a device, cause the device to perform a method according to any one of Examples 1 to 9.
[0189] Although the disclosure has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Instead, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for generating drawing content, comprising: Get the text of an element used to set the page, the text being organized according to the syntax of the standard interface of the element; According to a predefined data protocol, converting multiple attribute values of the element contained in the text to generate protocol data that can be supported by multiple development components for different operating systems; as well as The development component for the operating system generates the drawing content of the element based on the protocol data.
2. The method according to claim 1, wherein converting the multiple attribute values of the element contained in the text according to a predefined data protocol comprises: Determine a format of the text, the format of the text including a first format and a second format, the multiple attribute values in the first format correspond to multiple specific attributes of the element, and the multiple attribute values in the second format correspond to abbreviated attributes of the element; as well as In the case where the format of the text is the first format, the multiple attribute values and the corresponding multiple specific attributes are converted according to the data protocol to generate the protocol data that can be supported by the multiple development components.
3. The method according to claim 2, wherein converting the multiple attribute values of the element contained in the text according to a predefined data protocol further comprises: When the format of the text is the second format, determining a plurality of specific attributes corresponding to the plurality of attribute values based on the abbreviated attribute; as well as The multiple attribute values and the corresponding multiple specific attributes are converted according to the data protocol to generate the protocol data that can be supported by the multiple development components.
4. The method according to claim 2 or 3, wherein the text is used to set a plurality of elements of the page, and converting a plurality of attribute values of the elements contained in the text according to a predefined data protocol comprises: dividing the text into a plurality of sub-texts corresponding to the plurality of elements, wherein the format of the sub-texts in the plurality of sub-texts is the first format or the second format; as well as According to the data protocol, multiple attribute values of the elements contained in the subtext are converted to generate the protocol data that can be supported by the multiple development components.
5. The method according to claim 2 or 3, wherein the element is the background or border of the page, the protocol data is a sequence of multiple data after the multiple attribute values are converted, and converting the multiple attribute values of the element contained in the text according to a predefined data protocol comprises: Determine an attribute type of a specific attribute among the multiple specific attributes, the attribute type being one of a color attribute, an enumeration attribute, a length or percentage attribute, and an image attribute; Determine the data after the attribute value corresponding to the specific attribute is converted according to the data protocol corresponding to the attribute type; as well as The plurality of data after the plurality of attribute values are converted are serialized to generate the sequence.
6. The method according to claim 5, wherein determining the data after the attribute value corresponding to the specific attribute is converted according to the data protocol corresponding to the attribute type comprises: In the case where the attribute type is the color attribute, converting the attribute value corresponding to the color attribute into data of the first type; In the case where the attribute type is the enumerated attribute, converting the attribute value corresponding to the enumerated attribute into data of a second type; In the case where the attribute type is a length or percentage attribute, converting the attribute value corresponding to the length or percentage attribute into a Boolean value and data of a third type, wherein the Boolean value is used to indicate that the attribute value is a length or a percentage; as well as In the case where the attribute type is an image attribute, the attribute value corresponding to the image attribute is converted into data of the fourth type.
7. The method according to claim 6, wherein the image attribute comprises at least one of a picture address attribute, a linear gradient attribute, and a radial gradient attribute, and when the attribute type is an image attribute, converting the attribute value corresponding to the image attribute into the fourth type of data comprises: In the case where the attribute type is an image attribute, determining the type of the image attribute; as well as The attribute value corresponding to the image attribute is converted into the fourth type of data and the fifth type of data, wherein the fifth type of data indicates one of a picture address attribute, a linear gradient attribute, and a radial gradient attribute.
8. The method according to claim 1, wherein generating, by a development component for an operating system, drawing content of the element based on the protocol data comprises: The development component sends a request for rendering a page to a terminal of the operating system; as well as In response to receiving a response from the terminal agreeing to render the page to the request, the development component generates the drawing content of the element based on the protocol data; And the method also includes: The development component sends the drawing content to the terminal, so that the terminal renders the element of the page based on the drawing content.
9. The method according to claim 1, wherein generating, by a development component for an operating system, drawing content of the element based on the protocol data comprises: Determining, by the development component for the operating system, whether the drawing operation indicated by the protocol data is a repeated drawing operation; as well as In response to the drawing operation indicated by the protocol data being the repeated drawing operation, the position of the next drawing content in the repeated direction is determined based on the position and size of the current drawing content.
10. A device for generating drawing content, comprising: A text acquisition module, configured to acquire text of an element used to set a page, wherein the text is organized according to the syntax of a standard interface of the element; an attribute value conversion module configured to convert multiple attribute values of the element contained in the text according to a predefined data protocol to generate protocol data that can be supported by multiple development components for different operating systems; as well as The drawing content generating module is configured to generate the drawing content of the element based on the protocol data by a development component for the operating system.
11. An electronic device, comprising: processor; as well as A memory coupled to the processor, the memory having instructions stored therein, wherein when the instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 9.
12. A computer program product comprising computer executable instructions, wherein the computer executable instructions are executed by a processor to implement the method according to any one of claims 1 to 9.