Page rendering method and device
By finding and using target position information from the element information library for rendering, the problem of high time consumption during real-time rendering of game page elements is solved, and the rendering efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411351738.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2024-12-20
AI Technical Summary
In the prior art, real-time rendering of game page elements requires the calculation of element position information, resulting in high time consumption and lack of efficient page rendering schemes.
By obtaining the page elements to be rendered on the target page, searching for its initial position information from the element information library, and determining the target position information based on the page position information and initial position information of the target page, using the target position information for rendering, saving calculation time and improving Rendering efficiency.
By directly searching the initial position information in the element information database, the calculation time overhead is reduced, and the accuracy of target position information is improved by integrating the page position information, which significantly improves the efficiency of page rendering.
Smart Images

Figure CN119166265A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of computer technology, and more particularly to a page rendering method and device. Background Art
[0002] With the development of computer technology, software applications are updated and iterated faster and faster. Taking game applications as an example, with the development and update of game applications, the frequency of rendering operations such as adding and modifying elements in the game page is getting higher and higher. Therefore, how to render elements in the game page has gradually become a research focus.
[0003] Currently, the element position information of the elements to be rendered in the game page can be calculated in real time, and the game page is rendered according to the calculated element position information. However, in the above solution, the real-time calculation of element position information will bring a high time consumption to page rendering, so an efficient page rendering solution is urgently needed. Summary of the invention
[0004] In view of this, an embodiment of the present specification provides a page rendering method. One or more embodiments of the present specification also relate to a page rendering device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of this specification, a page rendering method is provided, including: Get the page element to be rendered of the target page; Searching for initial position information of a to-be-rendered page element from an element information library, wherein the element information library includes a plurality of page elements and position information corresponding to the plurality of page elements; Determine the target position information of the page element to be rendered according to the page position information and the initial position information of the target page; Using the target location information, the page elements to be rendered are rendered to obtain the page rendering result.
[0006] According to a second aspect of an embodiment of this specification, a page rendering device is provided, including: A first acquisition module is configured to acquire a page element to be rendered of a target page; A search module is configured to search for initial position information of a to-be-rendered page element from an element information library, wherein the element information library includes a plurality of page elements and position information corresponding to the plurality of page elements; A determination module is configured to determine target position information of the page element to be rendered according to the page position information and the initial position information of the target page; The rendering module is configured to render the page elements to be rendered using the target location information to obtain a page rendering result.
[0007] According to a third aspect of an embodiment of this specification, a computing device is provided, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned page rendering method are implemented.
[0008] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the above-mentioned page rendering method are implemented.
[0009] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which implements the steps of the above-mentioned page rendering method when executed by a processor.
[0010] A page rendering method provided by an embodiment of the present specification obtains a page element to be rendered of a target page; searches for initial position information of the page element to be rendered from an element information library, wherein the element information library includes multiple page elements and position information corresponding to the multiple page elements; determines target position information of the page element to be rendered based on the page position information and initial position information of the target page; renders the page element to be rendered using the target position information to obtain a page rendering result. Since the element information library includes position information corresponding to multiple page elements, it is ensured that the initial position information can be directly searched from the element information library, saving the calculation time overhead of the initial position information, and the page position information is integrated into the process of determining the target position information, thereby improving the accuracy of the target position information and further improving the efficiency of page rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a flow chart of a page rendering method; Figure 2 is a flow chart of a page rendering method provided by an embodiment of this specification; Figure 3 is a process flow chart of a page rendering method provided by an embodiment of this specification; Figure 4 It is a structural schematic diagram of a page rendering device provided by an embodiment of this specification; Figure 5 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0012] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0013] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0014] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0015] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0016] First, the terms involved in one or more embodiments of this specification are explained.
[0017] A 3D (Three-Dimensional) scene is a virtual environment built in a three-dimensional space. This environment consists of multiple three-dimensional models and can be created, rendered, and interacted with through computer graphics technology. 3D scenes are widely used in game development, film production, architectural design, engineering design, medical simulation, virtual reality, augmented reality, and other fields.
[0018] User Interface (UI): User interface refers to the way software or applications interact with users. It includes everything that users can see, such as visual elements such as buttons, icons, menus, dialog boxes, and all the ways users can interact with them, such as clicking, sliding, entering text, and other operations.
[0019] Game UI text: refers to all text content used to convey information to players in the game. These texts usually appear in the game interface to help players understand the game's operating methods, storyline, mission objectives, status information, etc.
[0020] Graphics Processing Unit (GPU): A graphics processor can also be called a display core, visual processor, or display chip. It is a microprocessor that specializes in performing image and graphics-related calculations on personal computers, workstations, game consoles, and some mobile devices (such as tablets, smartphones, etc.).
[0021] Texture position coordinates (UV coordinates): refers to the two-dimensional coordinate system used in 3D computer graphics to map textures to 3D models. In 3D modeling, "U" and "V" represent two axes on a two-dimensional plane, which correspond to "X" and "Y" in the common two-dimensional coordinate system. UV coordinates are mainly used to apply image maps to the surface of 3D objects so that the image can be displayed correctly on the object, just like applying a world map to a sphere. Figure 1 The importance of UV coordinates is that they enable complex textures to be correctly mapped onto 3D objects, thus enhancing the realism of rendered scenes. UV coordinates are an indispensable part of game development, movie special effects, and other applications that require high-quality graphics.
[0022] Shader: A special program or script that is used to control the color calculation and other effects in the computer graphics rendering process. In computer graphics, shaders are mainly run on the GPU to achieve efficient graphics processing.
[0023] Vertex shader stage: Vertex shader is an important component in the shader pipeline, which processes each vertex in the three-dimensional model. The input of the vertex shader is usually data from the 3D model, such as vertex position, color, normal, etc. The main responsibilities of the vertex shader include but are not limited to: Position transformation: convert the position of the vertex from model space to view space or screen space, involving matrix operations to change the position of the vertex. Lighting calculation: In some cases, the vertex shader can also perform preliminary lighting calculations to provide lighting information for subsequent fragment shaders. Normal transformation: Calculate the value of the vertex normal in the transformed space, which is very important for lighting calculations. Other attribute calculations: In addition to position, other vertex attributes such as color, texture coordinates, and tangent space can also be calculated.
[0024] Fragment shader stage: Fragment shader is an important part of the shader pipeline. Its role in the rendering process is to shade each fragment on the screen. In the rasterization process, a fragment usually corresponds to a pixel or a part of a pixel. It contains all the information of the pixel, such as position, color, texture coordinates, etc. The main responsibilities of the vertex shader include but are not limited to: Color calculation: Calculate the color of each pixel, involving multiple operations such as lighting calculation, texture sampling, and blending. Texture mapping: Apply texture images to 3D models to make the model surface detailed and realistic. Depth test: Determine whether the current fragment should be drawn on the screen or is blocked by the fragment behind it. Blending: Handle the blending between transparent objects so that transparent objects can be correctly superimposed on each other. Post-processing effects: Implement post-processing effects such as blurring, sharpening, and color correction.
[0025] See also Figure 1 , Figure 1A flow chart of a page rendering method is shown. Taking the text rendering of the game user interface as an example, after obtaining the user's input text, the text rendering component processing flow is entered. In the text rendering component processing flow, the existing character atlas is parsed, and the character information is searched according to the input text in the character atlas to determine whether the character corresponding to the input text can be found. If not, the font of the input text is obtained, and a new character atlas is created according to the font, and the step of finding the character information is returned; if it can be found, a new grid is created and the character position, texture position, color and other information are calculated and filled in, and the user interface bottom processing flow is entered. In the user interface bottom processing flow, first, it can be determined which characters are invisible characters in the user interface, and the invisible characters are cut out. Then, it is checked whether the characters intersect, and they are sorted according to the front and back relationship according to the judgment result. Then, it is determined whether the characters of the user interface can be batched. If not, the shader rendering process is directly entered; if they can be batched, the grid data of the characters is obtained, the grid data is merged, and the shader rendering stage is entered. In the shader rendering stage, the rendering of the game user interface text is realized through the vertex shader stage and the fragment shader stage.
[0026] It should be noted that, since the existing character atlas is usually universal, it is often the case that the character atlas does not include the characters corresponding to the input text, which requires the creation of a new character atlas in real time and the repeated judgment steps, resulting in high consumption. The consumption of modifying text in each frame of ten text rendering components was tested, and the test showed that each frame has an overhead of about 0.8ms. In the game, it is common to modify dozens or hundreds of components at the same time. Such high consumption is unacceptable in the game.
[0027] In order to solve the above problems, the embodiment of this specification proposes a page rendering method, which obtains the to-be-rendered page element of the target page; searches for the initial position information of the to-be-rendered page element from the element information library, wherein the element information library includes multiple page elements and position information corresponding to the multiple page elements; determines the target position information of the to-be-rendered page element according to the page position information and the initial position information of the target page; renders the to-be-rendered page element using the target position information to obtain a page rendering result. Since the element information library includes the position information corresponding to the multiple page elements, it is ensured that the initial position information can be directly searched from the element information library, which saves the time overhead of calculating the initial position information, and the page position information is integrated into the process of determining the target position information, which improves the accuracy of the target position information and further improves the efficiency of page rendering.
[0028] It is worth noting that the page rendering method proposed in the embodiments of this specification can be independent of Figure 1 The page rendering process shown can also be compared with Figure 1 The page rendering process shown is integrated to optimize Figure 1The page rendering process shown in the figure, the application mode of the page rendering method proposed in the embodiment of this specification is selected according to the actual situation, and the embodiment of this specification does not make any limitation to this.
[0029] In this specification, a page rendering method is provided. This specification also relates to a page rendering device, a computing device, a computer-readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.
[0030] See also Figure 2 , Figure 2 A flow chart of a page rendering method provided by an embodiment of the present specification is shown, which specifically includes the following steps: Step 202: Obtain the page elements to be rendered of the target page.
[0031] It should be noted that the target page refers to the specific web page visited by the user when browsing the website, or the specific page that needs to be loaded or rendered in the application. The target page can be a page in different scenarios, such as a live broadcast page in a live broadcast scenario, a game interface in a game scenario, and so on. The page elements to be rendered refer to the page elements that need to be rendered to the target page. The page elements to be rendered can be elements existing in the target page, such as characters in the target page that need to adjust the font color, or elements that do not exist in the target page, such as characters that need to be added to the target page. The page elements to be rendered can be different types of page elements, and the page elements to be rendered include but are not limited to text, pictures, links, buttons, and form controls. The number of page elements to be rendered can be one or more, and the specific selection is based on the actual situation. The embodiments of this specification do not impose any restrictions on this.
[0032] In actual applications, there are many ways to obtain the page elements to be rendered of the target page, which are selected according to the actual situation, and the embodiments of this specification do not limit this. In one possible implementation of this specification, the page elements to be rendered of the target page sent by the user can be received. In another possible implementation of this specification, the page elements to be rendered of the target page can be read from other data acquisition devices or databases.
[0033] Step 204: searching for initial position information of the to-be-rendered page element from an element information library, wherein the element information library includes a plurality of page elements and position information corresponding to the plurality of page elements.
[0034] It should be noted that the element information library refers to a collection that stores page elements and related information. The page elements included in the element information library include all the page elements to be rendered, so the initial position information of any page element to be rendered can be found in the element information library. The relevant information of the page element includes but is not limited to the style, size, and position of the page element, which is selected according to the actual situation, and the embodiments of this specification do not impose any restrictions on this. The page elements in the element information library include but are not limited to text, pictures, links, buttons, and form controls. The position information of the page element refers to the most original position information of the page element itself, and the position information includes at least one of the element position information, position offset information, and texture position information of the page element. The initial position information refers to the most original position information of the page element itself to be rendered, and the initial position information includes at least one of the element position information, position offset information, and texture position information of the page element to be rendered.
[0035] In practical applications, there are many ways to find the initial position information of the page element to be rendered from the element information library, which can be selected according to the actual situation, and the embodiments of this specification do not limit this. In one possible implementation of this specification, the element search engine can be directly called to find the initial position information of the page element to be rendered from the element information library.
[0036] In another possible implementation of the present specification, the initial position information of the page element to be rendered can be searched from the element information library according to the element identifier of the page element to be rendered. That is, the above-mentioned searching the initial position information of the page element to be rendered from the element information library can include the following steps: Get the element ID of the page element to be rendered; From the element information library, search for the target page element corresponding to the element identifier; The position information corresponding to the target page element is determined as the initial position information of the page element to be rendered.
[0037] It should be noted that the element identifier is used to uniquely identify the page element to be rendered. The element identifier can be the serial number of the page element to be rendered in the element information library, or it can be the unique code of the page element to be rendered. The element identifier is selected according to the actual situation, and the embodiments of this specification do not impose any restrictions on this. Each page element included in the element information library carries an element matching identifier that uniquely identifies the page element.
[0038] In practical applications, there are many ways to obtain the element identification of the page element to be rendered, which are selected according to the actual situation, and the embodiments of this specification do not limit this. In one possible implementation of this specification, the element identification of the page element to be rendered sent by the user can be received. In another possible implementation of this specification, the element identification of the page element to be rendered can be read from other databases or data acquisition devices.
[0039] Furthermore, when searching for the target page element corresponding to the element identifier in the element information library, the element identifier of the page element to be rendered can be matched with the element matching identifier carried by each page element in the element information library, and the target element matching identifier that is the same as the element identifier can be determined, and the page element corresponding to the target element matching identifier can be determined as the target page element. Finally, the position information corresponding to the target page element can be determined as the initial position information of the page element to be rendered.
[0040] By applying the solution of the embodiment of this specification, the target page element is determined according to the element identifier of the page element to be rendered, and the position information of the target page element is determined as the initial position information of the page element to be rendered, thereby achieving efficient and accurate determination of the initial position information.
[0041] In an optional embodiment of the present specification, before searching for the initial position information of the page element to be rendered from the element information library, the element information library may be obtained first. There are many ways to obtain the element information library. In one possible implementation, the element information library may be read from a database or other data acquisition device. In another possible implementation, the element information library may be constructed.
[0042] In a possible implementation of the present specification, taking the position information including the position offset information as an example, before searching the initial position information of the to-be-rendered page element from the element information library, the following steps may also be included: Obtain a page element atlas, wherein the page element atlas includes multiple page elements, and the page elements carry element position information; Calculate position offset information corresponding to the plurality of page elements respectively according to the element position information and the reference position information of the reference page element; An element information library is constructed based on multiple page elements and position offset information.
[0043] It should be noted that the page element atlas refers to a large image file obtained by merging multiple page element images. In other words, the page element atlas is an image file, and the page element atlas includes page element images of each page element and element position information of each page element image. In order to save memory, the page element can be a character in ASCII code, such as damage numbers, distance prompts, time, combat power attributes, etc. in game applications. Element position information refers to the position information of the page element in the page layout, such as the element position coordinates. The reference page element can be understood as a standard page element, such as a standard character. In the page layout, each page element has a predetermined or default position, and the element at this position can be understood as a reference page element of the page element, and the position is also the reference position information. Position offset information refers to the position offset of a page element relative to its reference page element. When the actual position of the page element is different from the reference position, the difference between the actual position and the reference position constitutes the position offset information.
[0044] In actual applications, there are many ways to obtain a page element atlas, which can be selected based on actual conditions, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, an element rendering component can be called to generate a page element atlas based on multiple page elements and atlas attribute information. In another possible implementation of this specification, multiple page elements and element position information of each page element sent by a user can be received, and a page element atlas can be constructed based on multiple page elements and element position information of each page element.
[0045] Exemplarily, assuming that the reference position information of the reference page element is (0, 0) and the element position information of the page element is (100, 50), then the position offset information of the page element is (100, 50).
[0046] The scheme of the embodiment of this specification is applied to calculate the position offset information corresponding to multiple page elements respectively according to the element position information and the reference position information of the reference page elements; and to construct an element information library based on the multiple page elements and the position offset information, thereby improving the accuracy of the position offset information and making the content in the element information library richer.
[0047] In a possible implementation of the present specification, the position information also includes texture position information as an example; before constructing the element information library according to the plurality of page elements and position offset information, the following steps may also be included: Parse the page element atlas to obtain texture position information corresponding to multiple page elements; Building an element information library according to multiple page elements and position offset information may include the following steps: An element information library is constructed according to multiple page elements, position offset information and texture position information.
[0048] It should be noted that the texture position information refers to the texture position coordinates of the page element in the page element atlas.
[0049] In actual applications, when parsing the page element atlas and obtaining the texture position information corresponding to multiple page elements, the size information of the page element atlas can be obtained, and the position and size of each page element in the atlas can be determined according to the design document or metadata file. The position and size of each page element can be converted into UV coordinates to obtain the texture position information of each page element.
[0050] By applying the solution of the embodiment of this specification, the texture position information of the page elements is integrated into the element information library, so that the position information of each page element in the element information library is more accurate.
[0051] In an optional embodiment of the present specification, the obtaining of the page element atlas may include the following steps: Get multiple page elements and atlas attribute information; Call the element rendering component to generate a page element atlas based on multiple page elements and atlas attribute information.
[0052] It should be noted that the multiple page elements obtained include at least all the page elements to be rendered, that is, the multiple page elements may be all the page elements to be rendered, or may include all the page elements to be rendered and other page elements other than the page elements to be rendered. Atlas attribute information refers to metadata related to the page element atlas, which provides key information about each page element in the page element atlas. The atlas attribute information includes but is not limited to the total width and height of the page element atlas, and the resolution of the page element atlas, which is selected according to the actual situation, and the embodiments of this specification do not impose any restrictions on this. The element rendering component is a software module or library that is responsible for converting one or more page elements into a visual form, and packaging or integrating multiple page elements into a page element atlas.
[0053] In practical applications, there are many ways to obtain multiple page elements and atlas attribute information, which can be selected according to actual conditions, and the embodiments of this specification do not limit this. In one possible implementation of this specification, page elements and atlas attribute information sent by a user can be received. In another possible implementation of this specification, multiple page elements and atlas attribute information can be read from other data acquisition devices or databases.
[0054] By applying the solution of the embodiment of this specification, the element rendering component is called to generate a page element atlas according to multiple page elements and atlas attribute information, thereby improving the generation efficiency and accuracy of the page element atlas.
[0055] Step 206: Determine the target position information of the page element to be rendered according to the page position information and the initial position information of the target page.
[0056] It should be noted that the page position information of the target page refers to the overall layout information of the target page, and the page position information may include grid layout information in the page, such as the position and size information of the grid container and its sub-items.
[0057] In actual applications, when determining the target position information of the page element to be rendered based on the page position information and initial position information of the target page, if the initial position information includes position offset information, the target position information of the page element to be rendered is calculated based on the page position information and position offset information of the page element to be rendered in the target page. If the initial position information includes texture position information in addition to position offset information, the target position information of the page element to be rendered is calculated based on the page position information and position offset information of the page element to be rendered in the target page, and the texture position information is also used as the target position information.
[0058] Step 208: Render the page elements to be rendered using the target position information to obtain a page rendering result.
[0059] It should be noted that when rendering the page element to be rendered using the target position information, if the page element to be rendered is a page element that does not exist in the target page, the rendering position of the page element to be rendered can be determined based on the target position information, and the page element to be rendered can be added to the rendering position, or the existing element at the rendering position can be replaced. If the page element to be rendered is a page element that already exists in the target page, the rendering position of the page element to be rendered in the target page can be determined based on the target position information, and further rendering operations such as color modification and font adjustment can be performed on the page element to be rendered at the rendering position to obtain the page rendering result.
[0060] By applying the solution of the embodiments of this specification, since the element information library includes the position information corresponding to multiple page elements, it is ensured that the initial position information can be directly found from the element information library, saving the calculation time overhead of the initial position information. In addition, the page position information is integrated into the process of determining the target position information, thereby improving the accuracy of the target position information and further improving the efficiency of page rendering.
[0061] In an optional embodiment of the present specification, when rendering the page element to be rendered, personalized rendering can also be achieved in combination with the element rendering information. That is, before rendering the page element to be rendered using the target position information and obtaining the page rendering result, the following steps can also be included: Get the element rendering information of the page element to be rendered; Using the target location information, render the page elements to be rendered and obtain the page rendering results, including: The target position information and the element rendering information are used to render the page elements to be rendered, and the page rendering result is obtained.
[0062] It should be noted that element rendering information refers to a series of attributes and configuration information used to render the elements of the page to be rendered. Element rendering information includes but is not limited to color, size, position, transparency, border, background, font style, and is selected according to actual conditions. This specification embodiment does not impose any limitation on this.
[0063] In actual applications, there are many ways to obtain element rendering information of the page element to be rendered, which are selected according to the actual situation, and the embodiments of this specification do not limit this. In one possible implementation of this specification, the element rendering information of the page element to be rendered sent by the user can be received. In another possible implementation of this specification, the element rendering information of the page element to be rendered can be read from other data acquisition devices or databases.
[0064] For example, taking the game user interface text as the page element to be rendered, the font color of the game user interface text is green, and the element rendering information of the page element to be rendered is obtained as "the target rendering color is blue". The rendering position of the page element to be rendered is determined using the target position information, and the game user interface text at the rendering position is modified to blue to obtain the page rendering result.
[0065] By applying the solution of the embodiment of this specification, the target position information and element rendering information are used to render the page elements to be rendered, and the page rendering result is obtained, thereby realizing personalized page element rendering and improving the flexibility of page element rendering.
[0066] The following combination Figure 3 , taking the application of the page rendering method provided in this specification in the user interface text modification scenario as an example, the page rendering method is further described. Figure 3 A flow chart of the processing process of a page rendering method provided by an embodiment of the present specification is shown. The processing process of the page rendering method can be divided into a page character atlas configuration stage, an initialization stage, a text rendering component processing stage, and a shader rendering stage. These four stages are described in detail below.
[0067] Page character atlas configuration stage: obtain multiple page characters and atlas attribute information; call the text rendering component to configure the page character atlas according to the multiple page characters and atlas attribute information; Initialization phase: Get the page character atlas; parse the page character atlas to obtain the texture position information corresponding to multiple page characters; search for character position information in the page character atlas; calculate the position offset information based on the character position information and the position information of the standard character; build a character information library based on multiple page characters, position offset information and texture position information; pass the character information library to the GPU through the compute buffer; Text rendering component processing stage: through the text rendering component in the GPU, obtain the page characters to be rendered of the target page input by the user and the modified colors of the page characters to be rendered from the character information library; find the character identifier of the page characters to be rendered; determine the renderer parameters corresponding to the modified colors; pass the character identifier and renderer parameters to the shader in the GPU; Shader rendering stage: find the initial position information (including position offset information and texture position information) of the page characters to be rendered from the character information library; determine the target position information of the page characters to be rendered based on the page position information and initial position information of the target page; use the target position information and modified color to modify the color of the page characters to be rendered, and obtain the page characters after color modification.
[0068] Optionally, in the shader rendering stage, further rendering of page characters can also be achieved through the vertex shader stage and the fragment shader stage. After the page character atlas configuration stage and the initialization stage are performed once, the processing of different page rendering tasks can be repeated.
[0069] It is worth noting that the user only needs to input the page characters to be rendered of the target page and the modified color of the page characters to be rendered to achieve page rendering, which improves the efficiency of page rendering. After testing the consumption of ten text rendering components when modifying text per frame, the page rendering consumption can be ignored when the page rendering scheme proposed in the embodiment of this specification is applied.
[0070] Corresponding to the above method embodiment, this specification also provides a page rendering device embodiment, Figure 4 FIG. 1 shows a schematic diagram of a page rendering device provided by an embodiment of the present specification. Figure 4 As shown, the device comprises: A first acquisition module 402 is configured to acquire a page element to be rendered of a target page; The search module 404 is configured to search for initial position information of the to-be-rendered page element from an element information library, wherein the element information library includes a plurality of page elements and position information corresponding to the plurality of page elements; The determination module 406 is configured to determine the target position information of the page element to be rendered according to the page position information and the initial position information of the target page; The rendering module 408 is configured to render the page elements to be rendered using the target location information to obtain a page rendering result.
[0071] Optionally, the device also includes: a second acquisition module, configured to obtain element rendering information of the page element to be rendered; and a rendering module 408, further configured to render the page element to be rendered using the target position information and the element rendering information to obtain a page rendering result.
[0072] Optionally, the position information includes position offset information; the device also includes: a construction module, configured to obtain a page element atlas, wherein the page element atlas includes multiple page elements, and the page elements carry element position information; based on the element position information and the reference position information of the reference page elements, calculate the position offset information corresponding to the multiple page elements respectively; based on the multiple page elements and the position offset information, construct an element information library.
[0073] Optionally, the position information also includes texture position information; the device also includes: a parsing module, configured to parse the page element atlas to obtain texture position information corresponding to multiple page elements respectively; a construction module, further configured to construct an element information library based on multiple page elements, position offset information and texture position information.
[0074] Optionally, the construction module is further configured to obtain multiple page elements and atlas attribute information; call the element rendering component to generate a page element atlas according to the multiple page elements and atlas attribute information.
[0075] Optionally, the search module 404 is further configured to obtain an element identifier of the page element to be rendered; search for a target page element corresponding to the element identifier from the element information library; and determine the position information corresponding to the target page element as the initial position information of the page element to be rendered.
[0076] By applying the scheme of the embodiments of this specification, since the element information library includes the position information corresponding to multiple page elements, it is ensured that the page rendering device can directly search for the initial position information from the element information library, saving the calculation time overhead of the initial position information. In addition, the page position information is integrated into the process of determining the target position information, thereby improving the accuracy of the target position information and further improving the efficiency of page rendering.
[0077] The above is a schematic scheme of a page rendering device of this embodiment. It should be noted that the technical scheme of the page rendering device and the technical scheme of the above-mentioned page rendering method belong to the same concept, and the details not described in detail in the technical scheme of the page rendering device can be referred to the description of the technical scheme of the above-mentioned page rendering method.
[0078] Figure 5 The block diagram of a computing device provided by one embodiment of the present specification is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0079] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world microwave interconnection access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0080] In one embodiment of the present specification, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0081] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 500 may also be a mobile or stationary server.
[0082] The processor 520 is used to execute a computer program / instruction, which implements the steps of the above-mentioned page rendering method when executed by the processor.
[0083] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned page rendering method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned page rendering method.
[0084] An embodiment of the present specification further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned page rendering method when executed by a processor.
[0085] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned page rendering method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned page rendering method.
[0086] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned page rendering method when executed by a processor.
[0087] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned page rendering method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned page rendering method.
[0088] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0089] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0090] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0091] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0092] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A page rendering method, characterized in that: include: Get the page element to be rendered of the target page; Searching for initial position information of the to-be-rendered page element from an element information library, wherein the element information library includes a plurality of page elements and position information corresponding to the plurality of page elements respectively; Determining target position information of the to-be-rendered page element according to the page position information of the target page and the initial position information; The target position information is used to render the page element to be rendered, and a page rendering result is obtained.
2. The method according to claim 1, characterized in that Before rendering the to-be-rendered page element by using the target position information and obtaining the page rendering result, the method further includes: Obtaining element rendering information of the page element to be rendered; The step of rendering the to-be-rendered page element by using the target position information to obtain a page rendering result includes: The target position information and the element rendering information are used to render the page element to be rendered, and a page rendering result is obtained.
3. The method according to claim 1, characterized in that The position information includes position offset information; Before searching the element information library for the initial position information of the to-be-rendered page element, the method further includes: Obtaining a page element atlas, wherein the page element atlas includes a plurality of page elements, and the page elements carry element position information; Calculating position offset information corresponding to each of the plurality of page elements according to the element position information and reference position information of the reference page element; The element information library is constructed according to the multiple page elements and the position offset information.
4. The method according to claim 3, characterized in that The position information also includes texture position information; Before constructing the element information library according to the plurality of page elements and the position offset information, the method further includes: Parsing the page element atlas to obtain texture position information corresponding to the plurality of page elements respectively; The step of constructing the element information library according to the plurality of page elements and the position offset information includes: The element information library is constructed according to the multiple page elements, the position offset information and the texture position information.
5. The method according to claim 3, characterized in that: The obtaining of the page element atlas comprises: Get multiple page elements and atlas attribute information; An element rendering component is called to generate the page element atlas according to the plurality of page elements and the atlas attribute information.
6. The method according to claim 1, characterized in that The step of searching the element information library for the initial position information of the element to be rendered on the page includes: Obtaining the element identifier of the page element to be rendered; Searching the target page element corresponding to the element identifier from the element information library; The position information corresponding to the target page element is determined as the initial position information of the page element to be rendered.
7. A page rendering device, characterized in that: include: A first acquisition module is configured to acquire a page element to be rendered of a target page; A search module is configured to search for initial position information of the to-be-rendered page element from an element information library, wherein the element information library includes a plurality of page elements and position information corresponding to the plurality of page elements respectively; A determination module, configured to determine the target position information of the to-be-rendered page element according to the page position information of the target page and the initial position information; The rendering module is configured to render the to-be-rendered page elements using the target location information to obtain a page rendering result.
8. A computing device, characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which implements the steps of the method described in any one of claims 1 to 6 when executed by a processor.
10. A computer program product, characterized in that The method comprises a computer program / instruction which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 6.
