CN112950757B - Image rendering method and device - Google Patents

Image rendering method and device Download PDF

Info

Publication number
CN112950757B
CN112950757B CN202110339048.5A CN202110339048A CN112950757B CN 112950757 B CN112950757 B CN 112950757B CN 202110339048 A CN202110339048 A CN 202110339048A CN 112950757 B CN112950757 B CN 112950757B
Authority
CN
China
Prior art keywords
rendering
image
sub
area
subtask
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110339048.5A
Other languages
Chinese (zh)
Other versions
CN112950757A (en
Inventor
方鹏程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN202110339048.5A priority Critical patent/CN112950757B/en
Publication of CN112950757A publication Critical patent/CN112950757A/en
Application granted granted Critical
Publication of CN112950757B publication Critical patent/CN112950757B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Abstract

The application provides an image rendering method and an image rendering device, wherein the image rendering method comprises the following steps: receiving an image rendering request, wherein the image rendering request comprises an image rendering rule and at least one rendering subtask; distributing a corresponding rendering area for each rendering subtask application; generating a sub-view corresponding to each rendering subtask in each rendering area; merging the sub-views of each rendering area according to the image rendering rule to generate a merged image; the combined image is rendered to a preset canvas to generate a rendered image, the image rendering method provided by the application achieves flexible combination and rendering of a plurality of sub-views, different sub-views are combined according to requirements, the rendering mode is simplified, third-party resources are prevented from being introduced, and the volume and the calling of system resources are reduced.

Description

Image rendering method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to an image rendering method. The application also relates to an image rendering apparatus, a computing device, and a computer-readable storage medium.
Background
With the development of the technology, the mobile phone operating system is more and more exquisite, and in the rendering process of the android system, a third-party graphic library is generally used for enriching the image quality of the android system.
The method comprises the steps that a third-party graphic library is required to be introduced, all resources of the third-party graphic library are required to be introduced into a system, the volume of an android package is increased due to the introduction, meanwhile, the third-party graphic library has large invasion to an android system, the third-party graphic library cannot be directly compatible with the original interface design (UI), a large amount of business logic needs to be added, the system complexity of the android system is increased, the third-party graphic library applied to the android system cannot render videos generally, only UI controls can be rendered, and the third-party graphic library applied to rendering videos cannot be applied to the android system generally.
Disclosure of Invention
In view of this, an embodiment of the present application provides an image rendering method. The application also relates to an image rendering device, a computing device and a computer readable storage medium, so as to solve the problems that in the prior art, the android system needs the environment dependence of a third party in the image rendering process, and the system installation package is increased and the service logic is complex.
According to a first aspect of embodiments of the present application, there is provided an image rendering method, including:
receiving an image rendering request, wherein the image rendering request comprises an image rendering rule and at least one rendering subtask;
distributing a corresponding rendering area for each rendering subtask application;
generating a sub-view corresponding to each rendering subtask in each rendering area;
combining the sub-views of each rendering area according to the image rendering rule to generate a combined image;
and rendering the merged image to a preset canvas to generate a rendered image.
According to a second aspect of embodiments of the present application, there is provided an image rendering apparatus including:
a receiving module configured to receive an image rendering request, wherein the image rendering request includes an image rendering rule and at least one rendering subtask;
the distribution module is configured to apply for distributing a corresponding rendering area for each rendering subtask;
a generating module configured to generate a sub-view corresponding to each of the rendering sub-tasks in each of the rendering regions;
a merging module configured to merge the sub-views of each rendering region according to the image rendering rule to generate a merged image;
and the rendering module is configured to render the merged image to a preset canvas to generate a rendered image.
According to a third aspect of embodiments herein, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the image rendering method when executing the computer instructions.
According to a fourth aspect of embodiments herein, there is provided a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the image rendering method.
The image rendering method comprises the steps of receiving an image rendering request, wherein the image rendering request comprises an image rendering rule and at least one rendering subtask; distributing a corresponding rendering area for each rendering subtask application; generating a sub-view corresponding to each rendering subtask in each rendering area; merging the sub-views of each rendering area according to the image rendering rule to generate a merged image; and rendering the merged image to a preset canvas to generate a rendered image. According to the embodiment of the application, the multiple sub-views can be flexibly combined and rendered, different sub-views can be combined according to requirements, views can be rendered, videos, controls and the like can be rendered, the rendering mode is simplified, third-party resources are prevented from being introduced, and the inclusion volume and system resource calling of system resources are reduced.
Drawings
Fig. 1 is a flowchart of an image rendering method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an image rendering method according to an embodiment of the present application;
FIG. 3 is a flowchart of an image rendering method applied to generate an image Zhuo Shitu by rendering according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an image rendering apparatus according to an embodiment of the present application;
fig. 5 is a block diagram of a computing device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The terminology used in the one or more embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present application. As used in one or more embodiments of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments of the present application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first aspect may be termed a second aspect, and, similarly, a second aspect may be termed a first aspect, without departing from the scope of one or more embodiments of the present application. The word "if," as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination," depending on the context.
First, the noun terms to which one or more embodiments of the present application relate are explained.
Drawing surface: surface, drawing Surface of android system.
Drawing surface texture: surface texture, surface image buffering entity of android system, is used to create Surface.
OpenGL: the OpenGL three-dimensional graphics API is a subset of OpenGL three-dimensional graphics APIs and is designed for embedded devices such as mobile phones, tablets and game hosts.
OpenGLES: for the OpenGL subset optimized for the mobile terminal, taking the bullet screen as an example, the bullet screen may be displayed by using a view or OpenGLES in An Zhuoduan.
FBO: the FrameBuffer is called an image buffer area for short.
And (4) UI control: view component of android system.
A Canvas: canvas of a control in the android system.
Off-screen rendering: and not rendered on the screen.
In the present application, an image rendering method is provided, and the present application relates to an image rendering apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
Fig. 1 shows a flowchart of an image rendering method according to an embodiment of the present application, which specifically includes the following steps:
step 102: an image rendering request is received, wherein the image rendering request includes an image rendering rule and at least one rendering subtask.
The image rendering method provided by the application is applied to a mobile terminal of an android system, an image rendering request is a requirement for rendering a generated image according to the requirement, for example, a control view of the android system, a control view group of the android system, a video player or content rendered by some OpenGLES is generated, the OpenGLES aims at an OpenGL subset optimized by a mobile terminal, the OpenGL is a subset of an OpenGL three-dimensional graphics API, and the image rendering method is designed aiming at embedded devices such as a mobile phone, a tablet and a game host.
The image rendering request comprises an image rendering rule and at least one rendering subtask, wherein the image rendering rule specifically refers to whether the rendering subtask is displayed, the position of the rendering subtask, the style of the rendering subtask and the like.
In a specific embodiment provided by the application, the image rendering request is to render a view interface of the android system, the view interface includes 5 icon controls, which are F1, F2, F3, F4, and F5, respectively, the 5 icon controls are 5 rendering subtasks, the image rendering rule may be that F1 to F5 are all displayed, and F1 to F5 are displayed on the view interface in sequence.
In another specific embodiment provided by the present application, for example, the video is generated by using an image rendering request as a rendering, the video player, the bullet screen control corresponding to the video, and the subtitle control corresponding to the video are generated by using a rendering subtask as a rendering, and the rendering rule is that the bullet screen control is stacked on the upper portion of the video player and the subtitle control is stacked on the lower portion of the video player.
Step 104: and distributing a corresponding rendering area for each rendering subtask application.
In practical application, the LocalSurface encapsulates a drawing Surface texture (Surface texture) and a drawing Surface (Surface), and the Surface is a drawing Surface of an android system. LocalSurface is an area that can be internally generated or externally injected to directly render images or create rendering environments. In practical application, each rendering subtask corresponds to a LocalSurface.
Specifically, allocating a corresponding rendering area for each rendering subtask application includes:
starting a rendering thread in response to the image rendering request;
applying a rendering area corresponding to each rendering subtask to the rendering thread according to each rendering subtask;
and the rendering thread allocates a corresponding rendering area for each rendering subtask.
The rendering thread is specifically a computer thread used for rendering and generating an image, the thread is a minimum unit which can be operated and scheduled by an operating system, and the rendering thread is used for generating a rendering image corresponding to the image rendering request.
After each rendering subtask is determined, a LocalSurface corresponding to each rendering subtask is applied to a rendering thread according to each rendering subtask, and the rendering thread allocates the LocalSurface to each rendering subtask according to the application, that is, a corresponding memory area is allocated to each rendering subtask in a memory.
Optionally, the step of allocating, by the rendering thread, a corresponding rendering area to each rendering subtask includes:
distributing corresponding drawing surface textures for each rendering subtask;
creating a drawing surface corresponding to each rendering subtask on each drawing surface texture;
and allocating a drawing surface corresponding to each rendering subtask.
In practical applications, when a rendering thread receives a request for allocating a rendering area, a corresponding drawing Surface texture (Surface texture) is allocated in a memory according to attribute information, such as size, of each subtask, where the Surface texture is a Surface image buffer entity of the android system and can be used to create a drawing Surface (Surface), and the Surface is specifically a drawing Surface of the android system, and the Surface texture (Surface) and the drawing Surface texture (Surface texture) inevitably exist in the presence of the Surface, and the drawing Surface (Surface) and the drawing Surface texture (Surface texture) jointly form the rendering area (LocalSurface).
In a specific embodiment provided by the present application, taking rendering subtasks as an example of rendering five icon controls F1, F2, F3, F4, and F5, respectively, a corresponding rendering area Q1, Q2, Q3, Q4, and Q5 is allocated for each rendering subtask.
In another specific embodiment provided by the present application, taking video generation by rendering as an example, the rendering subtasks generate a video player, a bullet screen control corresponding to the video, and a subtitle control corresponding to the video for rendering, and allocate corresponding rendering areas P1, P2, and P3 to each rendering subtask respectively.
Step 106: and generating a sub-view corresponding to each rendering subtask in each rendering area.
Each rendering area (LocalSurface) is used for generating a sub-view of each corresponding rendering sub-task, for example, when the rendering sub-task is an icon control, a control sub-view is generated in the corresponding rendering area; when the rendering subtask is a video player, a video player sub-view is generated in the corresponding rendering region, and so on.
Optionally, the rendering area comprises a drawing surface;
generating a sub-view corresponding to each rendering sub-task in each rendering area, including:
and generating a sub-view corresponding to each rendering sub-task on the drawing surface of each rendering area.
Each rendering area (LocalSurface) includes a drawing Surface (Surface), and the rendering subtask needs to display its own content, so that the rendering is performed on the Surface corresponding to the rendering subtask to generate a child view.
In a specific embodiment provided by the present application, taking five icon controls, i.e., rendering subtasks to respectively render F1, F2, F3, F4, and F5 as an example, a rendering area Q1, Q2, Q3, Q4, and Q5 corresponding to each rendering subtask is allocated to each rendering subtask, a sub-view 1 corresponding to F1 is generated in a Surface of the rendering area Q1, a sub-view 2 corresponding to F2 is generated in a Surface of the rendering area Q2, a sub-view 3 corresponding to F3 is generated in a Surface of the rendering area Q3, a sub-view 4 corresponding to F4 is generated in a Surface of the rendering area Q4, and a sub-view 5 corresponding to F5 is generated in a Surface of the rendering area Q5.
In another specific embodiment provided by the present application, for example, a video is generated by rendering, the rendering subtasks generate a video player, a bullet screen control corresponding to the video, and a subtitle control corresponding to the video for rendering, each rendering subtask is respectively allocated to a corresponding rendering area P1, P2, and P3, the video player is generated in the Surface of the rendering area P1, the bullet screen control is generated in the Surface of the rendering area P2, and the subtitle control is generated in the Surface of the rendering area P3.
Step 108: and combining the sub-views of each rendering area according to the image rendering rule to generate a combined image.
The image rendering rule comprises information such as whether each sub-view is displayed, position, style and the like, each sub-view is merged according to the image rendering rule, and the merged image is the merged image.
Specifically, merging the sub-views of each rendering area according to the image rendering rule to generate a merged image includes:
determining a sub-view merging rule according to the image rendering rule;
and merging the sub-views of each rendering area according to the rendering thread and the sub-view merging rule to generate a merged image.
The method includes determining a sub-view merging rule in an image rendering rule, merging each rendering area according to the sub-view merging rule by a rendering thread, in practical application, the rendering thread is used to merge and render the sub-views to generate a merged image, the rendering thread includes a rendering cycle for periodically merging each LocalSurface, and each LocalSurface is traversed by the rendering cycle during each rendering, so that an original android canvas (canvas) is replaced by a locancave of the LocalSurface, and the rendering cycle is performed continuously, for example, all the rendering cycles are performed every second to generate the merged image.
Step 110: and rendering the merged image to a preset canvas to generate a rendered image.
An android canvas (canvas) is a canvas of an android control, and can be understood as a drawing tool of an android, a graph is drawn on the canvas through various drawing methods, and an expected graph can be drawn on the canvas through an API (application programming interface) provided by the canvas.
In a specific embodiment provided by the application, taking rendering subtasks as an example of rendering five icon controls of F1, F2, F3, F4, and F5, after the rendering areas Q1, Q2, Q3, Q4, and Q5 are merged according to a subtask merging rule, a merged image is generated, meanwhile, a view interface of the android system can also be used as a rendering subtask to apply for a rendering area Q0 from a rendering thread, the rendering area Q0 is inserted into a linked list of the rendering thread, and finally, an original canvas is replaced, the merged image is drawn on the canvas corresponding to the rendering area Q0, and a final view interface of the android system is generated by rendering, wherein the view interface includes five icon controls of F1, F2, F3, F4, and F5.
In another specific embodiment provided by the present application, taking generation of a video by rendering as an example, merging rendering regions P1, P2, and P3 according to a child view merging rule to generate a merged image, rendering the merged image onto a preset canvas to generate a video player, generating a video in the Surface of the rendering region P1, generating a bullet screen in the Surface of the rendering region P2, and generating a subtitle in the Surface of the rendering region P3.
In yet another embodiment provided herein, the image rendering rule includes an image output location; after the merged image is rendered to a preset canvas and a rendered image is generated, the method comprises the following steps:
and outputting the rendered image to the image output position.
Wherein outputting the rendered image to the image output location comprises:
outputting the rendered image to a screen; or
And outputting the rendered image to a preset image buffer area.
In practical application, according to different actual rendering requirements, positions of rendered images to be output are different, for example, if a user wants to generate a recorded video, the rendered images can be stored locally in the device as a video stream; for example, if the user wishes to display in real time, the rendered image may be displayed on the terminal screen, so that the image rendering rule further includes an image output position to which the rendered image is output according to the image output position after the rendered image is generated.
Specifically, when the image output position is a screen, the rendered image is output to the screen, and a user can visually see the rendered image from the screen; and under the condition that the image output position is not a screen, outputting the rendering image to a preset image buffer area (FBO), and performing operation processing such as coding, saving, stream pushing, screen projecting and the like on the rendering image buffered on the FBO, so that the rendering image can be saved in a storage device of the terminal or displayed through other terminals.
The image rendering method comprises the steps of receiving an image rendering request, wherein the image rendering request comprises an image rendering rule and at least one rendering subtask; distributing a corresponding rendering area for each rendering subtask application; generating a sub-view corresponding to each rendering subtask in each rendering area; merging the sub-views of each rendering area according to the image rendering rule to generate a merged image; and rendering the merged image to a preset canvas to generate a rendered image. According to the embodiment of the application, the multiple sub-views can be flexibly combined and rendered, different sub-views can be combined according to requirements, views can be rendered, videos, controls and the like can be rendered, the rendering mode is simplified, third-party resources are prevented from being introduced, and the inclusion volume and system resource calling of system resources are reduced.
The image rendering method provided by the present application is further explained with reference to fig. 2, and fig. 2 shows a schematic structural diagram of the image rendering method provided by the present application.
As shown in fig. 2, in the image rendering method of the present application, in response to an image rendering request, a rendering thread is started, and a rendering loop is provided in the rendering thread, which is responsible for periodically merging each rendering region, and finally outputting the merged rendering region to a screen or a designated image buffer.
Specifically, each rendering area is traversed through a rendering cycle during each rendering, the original canvas is replaced by the canvas corresponding to the rendering area, the rendered image generated by rendering is executed with an off-screen or on-screen operation according to the image rendering rule, information such as whether certain specific rendering areas are displayed, styles, positions and the like can be realized according to the image rendering rule, and the rendering mode is flexibly controlled and simplified.
The image rendering method can render views and view groups of the android system, the android views want to render thread application rendering areas, namely one rendering area can be obtained, a plurality of rendering areas can also be applied according to different requirements in the android views, flexibility and changeability are achieved, canvas of the rendering areas applied by the android views can finally replace canvas of the android system, and the android views are displayed through the canvas corresponding to the rendering areas.
The image rendering method provided by the application can also be used for rendering a video player, and the video player can also apply for a rendering area from the rendering thread and perform video rendering through a drawing surface in the rendering area to generate a final video animation.
The image rendering method is also suitable for OpenGLES rendering, and OpenGLES rendering can apply for rendering areas from rendering threads, inject rendering images generated by rendering into the rendering threads, and combine the rendering areas with other rendering areas through circular rendering.
The image rendering method comprises the steps of receiving an image rendering request, wherein the image rendering request comprises an image rendering rule and at least one rendering subtask; distributing a corresponding rendering area for each rendering subtask application; generating a sub-view corresponding to each rendering subtask in each rendering area; merging the sub-views of each rendering area according to the image rendering rule to generate a merged image; and rendering the merged image to a preset canvas to generate a rendered image. According to the embodiment of the application, the multiple sub-views can be flexibly combined and rendered, different sub-views can be combined according to requirements, views can be rendered, videos, controls and the like can be rendered, the rendering mode is simplified, third-party resources are prevented from being introduced, and the inclusion volume and system resource calling of system resources are reduced.
The following description will further describe the image rendering method with reference to fig. 3 by taking an application of the image rendering method provided in the present application in rendering and generating an image Zhuo Shitu as an example. Fig. 2 shows a processing flow chart of an image rendering method applied to render and generate an image Zhuo Shitu according to an embodiment of the present application, which specifically includes the following steps:
step 302: receiving an android view rendering request, wherein the android view rendering request comprises rendering rules and 4 rendering subtasks.
In the embodiment provided by the application, explanation is given by taking Zhuo Shitu as an example for rendering generation, an android view rendering request is received, the android view rendering request carries a rendering rule and 4 rendering subtasks, and the 4 rendering subtasks are an android view main interface, a clock control, a weather control and a calendar control respectively.
Step 304: and starting a rendering thread in response to the android view rendering request.
In the embodiment provided by the application, following the above example, the rendering thread is started in response to the android view rendering request, and the rendering loop is included in the rendering thread.
Step 306: and applying for 4 rendering areas from the rendering thread according to the 4 rendering subtasks.
In the embodiment provided by the application, the previous example is adopted, and 4 rendering areas are applied to the rendering thread according to 4 rendering subtasks, namely Q1, Q2, Q3 and Q4, wherein the rendering area Q1 corresponds to an android view main interface, the rendering area Q2 corresponds to a clock control, the rendering area Q3 corresponds to a weather control, and the rendering area Q4 corresponds to a calendar control.
Step 308: and respectively allocating corresponding rendering areas for the 4 rendering subtasks.
In the embodiment provided by the application, following the above example, the rendering thread allocates corresponding rendering areas to the 4 rendering subtasks respectively, and the size of each rendering area corresponds to the rendering subtask.
Step 310: and generating a sub-view corresponding to each rendering subtask in each rendering area.
In the embodiment provided by the application, following the above example, the sub-view 1 corresponding to the android system main interface is generated in the rendering area Q1, the sub-view 2 corresponding to the clock control is generated in the rendering area Q2, the sub-view 3 corresponding to the weather control is generated in the rendering area Q3, and the sub-view 4 corresponding to the calendar control is generated in the rendering area Q4.
Step 312: and combining the sub-views of each rendering area according to the image rendering rule to generate a combined image.
In the embodiment provided by the application, following the above example, the image rendering rules include a child view merging rule, that is, an Zhuozhu interface is on the bottom layer, and the clock control, the weather control and the calendar control are on the upper layer of An Zhuozhu interface, and are arranged in sequence from top to bottom. And merging the sub-view 1, the sub-view 2, the sub-view 3 and the sub-view 4 according to a sub-view merging rule to generate a merged image.
Step 314: and rendering the merged image to a preset canvas to generate a rendered image.
In the embodiment provided by the application, the above example is continued, the merged image is rendered to the canvas corresponding to the An Zhuozhu interface, and the rendered image of the android view is generated.
Step 316: and outputting the rendering image to a screen for display.
In the embodiment provided by the application, following the above example, if the image output position is also included in the image rendering rule as a screen, the generated rendered image of the android view is output to the screen for display.
The image rendering method comprises the steps of receiving an image rendering request, wherein the image rendering request comprises an image rendering rule and at least one rendering subtask; distributing a corresponding rendering area for each rendering subtask application; generating a sub-view corresponding to each rendering sub-task in each rendering area; merging the sub-views of each rendering area according to the image rendering rule to generate a merged image; and rendering the merged image to a preset canvas to generate a rendered image. According to the embodiment of the application, the multiple sub-views can be flexibly combined and rendered, different sub-views can be combined according to requirements, views can be rendered, videos, controls and the like can be rendered, the rendering mode is simplified, third-party resources are prevented from being introduced, and the inclusion volume and system resource calling of system resources are reduced.
Corresponding to the above embodiment of the image rendering method, the present application further provides an embodiment of an image rendering device, and fig. 4 shows a schematic structural diagram of an image rendering device provided in an embodiment of the present application. As shown in fig. 4, the apparatus includes:
a receiving module 402 configured to receive an image rendering request, wherein the image rendering request comprises an image rendering rule and at least one rendering subtask;
an allocation module 404 configured to allocate a corresponding rendering area for each rendering subtask application;
a generating module 406 configured to generate a sub-view corresponding to each of the rendering sub-tasks in each of the rendering regions;
a merging module 408 configured to merge the sub-views of each rendering region according to the image rendering rule, generating a merged image;
and a rendering module 410 configured to render the merged image to a preset canvas, generating a rendered image.
Optionally, the allocating module 404 is further configured to:
starting a rendering thread in response to the image rendering request;
applying a rendering area corresponding to each rendering subtask to the rendering thread according to each rendering subtask;
and the rendering thread allocates a corresponding rendering area for each rendering subtask.
Optionally, the allocating module 404 is further configured to:
distributing corresponding drawing surface textures for each rendering subtask;
creating a drawing surface corresponding to each rendering subtask on each drawing surface texture;
and allocating a drawing surface corresponding to each rendering subtask.
Optionally, the rendering area comprises a drawing surface;
the generating module 406 is further configured to:
and generating a sub-view corresponding to each rendering sub-task on the drawing surface of each rendering area.
Optionally, the merging module 408 is further configured to:
determining a sub-view merging rule according to the image rendering rule;
and merging the sub-views of each rendering area according to the rendering thread and the sub-view merging rule to generate a merged image.
Optionally, the image rendering rule includes an image output position;
the device further comprises:
an output module configured to output the rendered image to the image output location.
Optionally, the output module is further configured to:
outputting the rendered image to a screen; or
And outputting the rendered image to a preset image buffer area.
The image rendering device comprises a receiving module, a processing module and a display module, wherein the receiving module is used for receiving an image rendering request, and the image rendering request comprises an image rendering rule and at least one rendering subtask; distributing a corresponding rendering area for each rendering subtask application; generating a sub-view corresponding to each rendering subtask in each rendering area; merging the sub-views of each rendering area according to the image rendering rule to generate a merged image; and rendering the merged image to a preset canvas to generate a rendered image. According to the embodiment of the application, the multiple sub-views can be flexibly combined and rendered, different sub-views can be combined according to requirements, views can be rendered, videos, controls and the like can be rendered, the rendering mode is simplified, third-party resources are prevented from being introduced, and the inclusion volume and system resource calling of system resources are reduced.
The above is a schematic scheme of an image rendering apparatus of the present embodiment. It should be noted that the technical solution of the image rendering apparatus and the technical solution of the image rendering method belong to the same concept, and details that are not described in detail in the technical solution of the image rendering apparatus can be referred to the description of the technical solution of the image rendering method.
Fig. 5 illustrates a block diagram of a computing device 500 provided according to an embodiment of the present application. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. Processor 520 is coupled to memory 510 via bus 530, and database 550 is used to store data.
Computing device 500 also includes access device 540, access device 540 enabling computing device 500 to communicate via one or more networks 560. Examples of such networks include the 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), wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave 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 so forth.
In one embodiment of the application, the above components of the computing device 500 and other components not shown in fig. 5 may also be connected to each other, for example, by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 5 is for purposes of example only and is not limiting as to the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smartphone), wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 500 may also be a mobile or stationary server.
Wherein processor 520, when executing said computer instructions, performs the steps of said image rendering method.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the image rendering method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the image rendering method.
An embodiment of the present application also provides a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the image rendering method as described above.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the image rendering method, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the image rendering method.
The foregoing description has been directed to specific embodiments of this application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and its practical applications, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.

Claims (10)

1. An image rendering method, comprising:
receiving an image rendering request, wherein the image rendering request comprises an image rendering rule and at least one rendering subtask;
a corresponding rendering area is applied to be distributed for each rendering subtask, wherein the rendering area is a corresponding memory area distributed for each rendering subtask in a memory;
generating a sub-view corresponding to each rendering sub-task in each rendering area;
merging the sub-views of each rendering area according to the image rendering rule to generate a merged image, wherein the merging of the sub-views of each rendering area according to the image rendering rule comprises merging each rendering area according to the image rendering rule through a rendering thread, and the merged image is a merged storage area in a memory;
and rendering the combined image to a preset canvas and replacing the original canvas to generate a rendered image.
2. The image rendering method of claim 1, wherein allocating a corresponding rendering region for each of the rendering subtask applications comprises:
starting a rendering thread in response to the image rendering request;
applying a rendering area corresponding to each rendering subtask to the rendering thread according to each rendering subtask;
and the rendering thread allocates a corresponding rendering area for each rendering subtask.
3. The image rendering method of claim 2, wherein the rendering thread allocates a corresponding rendering region for each rendering subtask, comprising:
distributing corresponding drawing surface textures for each rendering subtask;
creating a drawing surface corresponding to each rendering subtask on each drawing surface texture;
and allocating a drawing surface corresponding to each rendering subtask.
4. The image rendering method of claim 1, wherein the rendering area comprises a drawing surface;
generating a sub-view corresponding to each rendering sub-task in each rendering area, including:
and generating a sub-view corresponding to each rendering sub-task on the drawing surface of each rendering area.
5. The image rendering method of claim 2, wherein merging the sub-views of each of the rendering regions according to the image rendering rule to generate a merged image comprises:
determining a sub-view merging rule according to the image rendering rule;
and merging the sub-views of each rendering area according to the rendering thread and the sub-view merging rule to generate a merged image.
6. The image rendering method of any of claims 1-5, wherein the image rendering rule includes an image output position;
after the merged image is rendered to a preset canvas and a rendered image is generated, the method comprises the following steps:
and outputting the rendered image to the image output position.
7. The image rendering method of claim 6, wherein outputting the rendered image to the image output location comprises:
outputting the rendered image to a screen; or
And outputting the rendered image to a preset image buffer area.
8. An image rendering apparatus, comprising:
a receiving module configured to receive an image rendering request, wherein the image rendering request includes an image rendering rule and at least one rendering subtask;
the distribution module is configured to distribute a corresponding rendering area for each rendering subtask application, wherein the rendering area is a memory area corresponding to each rendering subtask in a memory;
a generating module configured to generate a sub-view corresponding to each of the rendering sub-tasks in each of the rendering regions;
a merging module configured to merge the sub-views of each rendering region according to the image rendering rule to generate a merged image, where the merging the sub-views of each rendering region according to the image rendering rule includes merging each rendering region according to the image rendering rule by a rendering thread, and the merged image is a merged storage region in a memory;
and the rendering module is configured to render the merged image to a preset canvas and replace the original canvas to generate a rendered image.
9. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1-7 when executing the computer instructions.
10. A computer-readable storage medium storing computer instructions, which when executed by a processor, perform the steps of the method of any one of claims 1 to 7.
CN202110339048.5A 2021-03-30 2021-03-30 Image rendering method and device Active CN112950757B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110339048.5A CN112950757B (en) 2021-03-30 2021-03-30 Image rendering method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110339048.5A CN112950757B (en) 2021-03-30 2021-03-30 Image rendering method and device

Publications (2)

Publication Number Publication Date
CN112950757A CN112950757A (en) 2021-06-11
CN112950757B true CN112950757B (en) 2023-03-14

Family

ID=76227462

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110339048.5A Active CN112950757B (en) 2021-03-30 2021-03-30 Image rendering method and device

Country Status (1)

Country Link
CN (1) CN112950757B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113822978B (en) * 2021-08-31 2022-12-27 北京三快在线科技有限公司 Electronic map rendering method and device
CN114286115B (en) * 2021-11-24 2024-04-16 杭州星犀科技有限公司 Control method and system for picture display of multi-channel video
CN114449334A (en) * 2022-01-29 2022-05-06 上海哔哩哔哩科技有限公司 Video recording method, video recording device, electronic equipment and computer storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282686A (en) * 2017-01-18 2018-07-13 广州市动景计算机科技有限公司 Video pictures processing method, device and electronic equipment
CN109218802A (en) * 2018-08-23 2019-01-15 Oppo广东移动通信有限公司 Method for processing video frequency, device, electronic equipment and computer-readable medium
CN110147512A (en) * 2019-05-16 2019-08-20 腾讯科技(深圳)有限公司 Player preloading, operation method, device, equipment and medium
CN112235626A (en) * 2020-10-15 2021-01-15 Oppo广东移动通信有限公司 Video rendering method and device, electronic equipment and storage medium
CN112492401A (en) * 2019-09-11 2021-03-12 腾讯科技(深圳)有限公司 Video-based interaction method and device, computer-readable medium and electronic equipment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090184972A1 (en) * 2008-01-18 2009-07-23 Qualcomm Incorporated Multi-buffer support for off-screen surfaces in a graphics processing system
US8941673B2 (en) * 2011-11-08 2015-01-27 Red Hat, Inc. Rendering images in a remote web browser
CN103247068B (en) * 2013-04-03 2016-03-30 上海晨思电子科技有限公司 A kind of rendering intent and device
KR20180041984A (en) * 2016-10-17 2018-04-25 삼성전자주식회사 Apparatus and Method for Rendering Image
CN109767466B (en) * 2019-01-10 2021-07-13 深圳看到科技有限公司 Picture rendering method and device, terminal and corresponding storage medium
CN111340918B (en) * 2020-03-06 2024-02-23 北京奇艺世纪科技有限公司 Dynamic diagram generation method, dynamic diagram generation device, electronic equipment and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282686A (en) * 2017-01-18 2018-07-13 广州市动景计算机科技有限公司 Video pictures processing method, device and electronic equipment
CN109218802A (en) * 2018-08-23 2019-01-15 Oppo广东移动通信有限公司 Method for processing video frequency, device, electronic equipment and computer-readable medium
CN110147512A (en) * 2019-05-16 2019-08-20 腾讯科技(深圳)有限公司 Player preloading, operation method, device, equipment and medium
CN112492401A (en) * 2019-09-11 2021-03-12 腾讯科技(深圳)有限公司 Video-based interaction method and device, computer-readable medium and electronic equipment
CN112235626A (en) * 2020-10-15 2021-01-15 Oppo广东移动通信有限公司 Video rendering method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112950757A (en) 2021-06-11

Similar Documents

Publication Publication Date Title
CN112950757B (en) Image rendering method and device
US11409547B2 (en) Method for rendering user interface and terminal
US20220139353A1 (en) Display method, electronic device, and non-transitory computer-readable storage medium
CN110955499B (en) Processor core configuration method, device, terminal and storage medium
CN111158866A (en) Engine system and rendering method thereof
CN111737019B (en) Method and device for scheduling video memory resources and computer storage medium
CN113141537A (en) Video frame insertion method, device, storage medium and terminal
CN111311716A (en) Animation playing method and device, terminal equipment and storage medium
CN111124668A (en) Memory release method and device, storage medium and terminal
CN105190701A (en) Primitive-based composition
CN110750664A (en) Picture display method and device
CN110362375A (en) Display methods, device, equipment and the storage medium of desktop data
CN110865863A (en) Interface display method and device for fast application and storage medium
CN113099309A (en) Video processing method and device
CN110782387A (en) Image processing method and device, image processor and electronic equipment
CN112991143A (en) Method and device for assembling graphics primitives and computer storage medium
CN112135056A (en) Shooting method, shooting device, electronic equipment and storage medium
US20130069981A1 (en) System and Methods for Managing Composition of Surfaces
CN102934071A (en) Updating graphical display content
CN110784739A (en) Video synthesis method and device based on AE
US20100085367A1 (en) Graphics processing method and apparatus implementing window system
CN115809106A (en) Cloud desktop system, cloud desktop display method, terminal device and storage medium
CN117065357A (en) Media data processing method, device, computer equipment and storage medium
CN112004049B (en) Double-screen different display method and device and electronic equipment
CN113419650A (en) Data moving method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant