CN116503535A - Image rendering method, device, electronic equipment and storage medium - Google Patents

Image rendering method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116503535A
CN116503535A CN202310693085.5A CN202310693085A CN116503535A CN 116503535 A CN116503535 A CN 116503535A CN 202310693085 A CN202310693085 A CN 202310693085A CN 116503535 A CN116503535 A CN 116503535A
Authority
CN
China
Prior art keywords
target
image
rendering
configuration
rendered
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.)
Pending
Application number
CN202310693085.5A
Other languages
Chinese (zh)
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.)
Beijing Siming Qichuang Technology Co ltd
Original Assignee
Beijing Siming Qichuang 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 Beijing Siming Qichuang Technology Co ltd filed Critical Beijing Siming Qichuang Technology Co ltd
Priority to CN202310693085.5A priority Critical patent/CN116503535A/en
Publication of CN116503535A publication Critical patent/CN116503535A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The embodiment of the application discloses an image rendering method, an image rendering device, electronic equipment and a storage medium. Determining a target rendering environment where the image rendering is currently performed; determining target configuration in candidate configuration information of an alpha channel of an image to be rendered according to a target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode; determining target pixel values of pixels in an image to be rendered according to target configuration; and rendering the image to be rendered according to each target pixel value. According to the embodiment of the application, the rendering efficiency is improved.

Description

Image rendering method, device, electronic equipment and storage medium
Technical Field
Embodiments of the present application relate to communication technologies, and in particular, to an image rendering method, an image rendering device, an electronic device, and a storage medium.
Background
Rendering engines are essentially image-based location transformations and pixel processing. For real-time rendering, after each frame is rendered, the position and pixel color value of the next frame need to be recalculated.
In the implementation of the cos engine (a term of art, a name of engine), a Bitmap (Bitmap) is used as the primary image rendering format. The rendering format is convenient and flexible to operate, and the color depth can be controlled at will. Because of the real-time operability of Bitmap, the browser will recalculate the pixel color values before each frame of rendering, and during rendering, the main thread occupies a lot of resources, and the rendering efficiency is low.
Disclosure of Invention
The application provides an image rendering method, an image rendering device, electronic equipment and a storage medium, so that rendering efficiency is improved.
In a first aspect, an embodiment of the present application provides an image rendering method, including:
determining a target rendering environment where the image rendering is currently performed;
determining target configuration in candidate configuration of alpha channel of the image to be rendered according to the target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode;
determining target pixel values of pixels in an image to be rendered according to target configuration;
and rendering the image to be rendered according to each target pixel value.
In a second aspect, embodiments of the present application further provide an image rendering apparatus, including:
the target rendering environment determining module is used for determining a target rendering environment where the image rendering is currently performed;
the target configuration determining module is used for determining target configuration in candidate configuration of an alpha channel of an image to be rendered according to the target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode;
the target pixel value determining module is used for determining target pixel values of all pixels in the image to be rendered according to target configuration;
and the target pixel value rendering module is used for rendering the image to be rendered according to each target pixel value.
In a third aspect, embodiments of the present application further provide an electronic device, including:
one or more processors;
a storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement any one of the image rendering methods as provided by the embodiments of the present application.
In a fourth aspect, embodiments of the present application also provide a storage medium comprising computer-executable instructions, which when executed by a computer processor, are for performing any one of the image rendering methods as provided by the embodiments of the present application.
The method comprises the steps of determining a target rendering environment where image rendering is currently performed; determining target configuration in candidate configuration information of an alpha channel of an image to be rendered according to a target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode; corresponding target configuration can be determined according to the target rendering environment, the pre-multiplication processing mode in the ImageBitmap in the original cos engine source code is changed into the use according to the need, and for the target rendering environment which does not use the technology, the pre-multiplication processing mode can be closed, and the default processing mode is used; determining target pixel values of pixels in an image to be rendered according to target configuration; and rendering the image to be rendered according to each target pixel value, and reducing the pressure of the main thread. Therefore, through the technical scheme, the problems that a main thread occupies a large amount of resources and the rendering efficiency is low during the rendering period are solved, and the effect of improving the rendering efficiency is achieved.
Drawings
Fig. 1 is a flowchart of an image rendering method in a first embodiment of the present application;
FIG. 2 is a flow chart of an image rendering method in a second embodiment of the present application;
fig. 3 is a schematic structural view of an image rendering apparatus in a third embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device in a fourth embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first" and "second" and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of an image rendering method according to an embodiment of the present application, where the method may be performed by an image rendering device according to a rendering environment of a rendering engine, and the device may be implemented by software and/or hardware and specifically configured in the rendering engine, for example, a cocos engine.
Referring to the image rendering method shown in fig. 1, the image rendering method is applied to a cocos engine, and specifically comprises the following steps:
s110, determining a target rendering environment where the image rendering is currently performed.
The target rendering environment may be a hardware environment that the rendering engine renders for determining a target configuration. By way of example, the target rendering environment may include hardware environments of different configuration versions. Specifically, a system configuration is acquired in an operating environment of a rendering engine, and a target rendering environment is determined through the system configuration. For example, the target rendering environment may include GPU (graphics processing unit, graphics processor) rendering and CPU (Central Processing Unit, central processor) rendering.
S120, determining target configuration in candidate configuration of an alpha channel of an image to be rendered according to the target rendering environment; the candidate configuration includes a pre-multiplication processing mode and a default processing mode.
The alpha channel (Premultiply Alpha) may be an image rendering attribute for determining a target configuration. Premultiply Alpha is one of the technical features used in the cocos engine version 2.4.5. The method is an option attribute of a web interface createImageBitmap (technical term, an interface) method, in the cocos engine implementation, an ImageBitmap format created by the createImageBitmap method is used for all images, and a pre-multiplexing alpha attribute is used in the option attribute.
The candidate configuration information may be an alternative configuration of Premultiply Alpha for determining the target configuration. Illustratively, the candidate configuration includes a pre-multiplication processing mode and a default processing mode. The pre-multiplication processing mode may also include a pre-multiplication processing mode and a pre-division processing mode.
S130, determining target pixel values of pixels in the image to be rendered according to the target configuration.
The target pixel value may be a pixel value obtained by processing a color depth of each pixel in the image to be rendered according to a processing manner corresponding to the target configuration. Illustratively, when the target is configured as a pre-multiply, the pixel value of each pixel in the image to be rendered needs to be multiplied by the pre-multiply value of Premultiply Alpha to obtain the target pixel value of each pixel.
And S140, rendering the image to be rendered according to each target pixel value.
And displaying pixels at corresponding positions according to the target pixel values, so as to realize the rendering of the image to be rendered.
In the implementation of the cos engine, a Bitmap (Bitmap) is used as the primary image rendering format. The format is convenient and flexible to operate, can control the color depth at will, particularly to each pixel, and eliminates the compression of the original graph, thereby facilitating the operation of color values, which is the advantage of the BMP (Bitmap) format. Some other formats, such as jpg (Joint Photographic Experts Group, joint picture expert group, an image file format) or png (Portable Network Graphics, a lossless compressed image file format), are more suitable for offline storage because compression is advantageous and generally not preferred for online rendering. Especially in the context of GPU (graphics processing unit, graphics processor) rendering, bitmaps may be stored directly in the GPU, with the use of raw pictures increasing the read and transfer flow. The real-time operability of Bitmap, the browser will recalculate the pixel color values before each frame of rendering, including pre-multiplication, which will result in reduced image rendering efficiency and the occurrence of a stuck image.
Many reconstructions have been made in the version of rendering phase chrome (technical term, the base version of chrome browser) for many years, including the latest rendering ng (technical term, a version of browser) aimed at relieving the main thread pressure and assigning more rendering tasks to other threads. In the present application, the computing operation of the pixel value is distributed to other threads by using the browser mechanism, so that the pressure of the main thread is released, because the main thread is a real portal for creating the Frame image, if the main thread Cheng Fanmang, the FPS (Frame Per Second) is caused to be too low.
According to the technical scheme, the target rendering environment where the image rendering is currently performed is determined; determining target configuration in candidate configuration information of an alpha channel of an image to be rendered according to a target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode; corresponding target configuration can be determined according to the target rendering environment, the pre-multiplication processing mode in the ImageBitmap in the original cos engine source code is changed into the use according to the need, and for the target rendering environment which does not use the technology, the pre-multiplication processing mode can be closed, and the default processing mode is used; determining target pixel values of pixels in an image to be rendered according to target configuration; in the Bigmap picture format with the pre-multiplication function, even if some pictures do not need to use the pre-multiplication function in the rendering mode of the CPU, each frame is rendered to be pre-imaged, but the default processing mode can be used as required, and for the pictures which do not need to use the pre-multiplication function, the running efficiency of the CPU is improved, namely the pressure of a main thread is reduced. Therefore, through the technical scheme, the problems that a main thread occupies a large amount of resources and the rendering efficiency is low during the rendering period are solved, and the effect of improving the rendering efficiency is achieved.
Example two
Fig. 2 is a flowchart of a flowchart method of an image rendering method according to a second embodiment of the present application, where the technical solution of the present embodiment is further refined based on the technical solution described above.
Further, "determining a target configuration among candidate configurations of alpha channels of an image to be rendered according to a target rendering environment", refines: "if the target rendering environment is a rendering environment based on a central processing unit CPU, determining that the target configuration of the alpha channel of the image to be rendered is a default configuration; if the target rendering environment is a rendering environment based on a CPU graphics processor GPU, determining that the target configuration of the alpha channel of the image to be rendered is a pre-multiplication configuration "to determine the target configuration.
Referring to fig. 2, an image rendering method includes:
s210, determining a target rendering environment where image rendering is currently performed.
S220, if the target rendering environment is a rendering environment based on a CPU, determining that the target configuration of the alpha channel of the image to be rendered is a default configuration.
The rendering environment based on the CPU may be that the hardware environment of the rendering engine is the CPU, and is used for determining the target configuration. For example, the target rendering environment based on the CPU is canvas rendering context (a kind of rendering environment), when the configuration version of the device is low, the GPU cannot be used, and rendering is required based on the rendering environment of the CPU. The default configuration may be a configuration when Premultiply Alpha is not open. Specifically, the cocos engine source code is modified, and the corresponding engineering source code is opened. In a CPU-based rendering environment, premultiply Alpha uses default values to allocate computing power into a composite thread.
There is a premultiplexing alpha option in the cos engine editor, which determines whether to turn on the pre-multiplication process based on this value. The premultiplexing alpha attribute is derived from a visual option in a cos creator (term, an editor) code editor, and if the option of the pre-multiplication method is selected in the editor, it is True, otherwise it is False. Therefore, if the target rendering environment is a CPU-based rendering environment, the pre-multiplexing alpha attribute is determined to be False, and the default value is used.
The asstsmanager is a resource management mode in the engine, any used picture resource is added to the asstsmanager, and the alpha channel attribute of the picture is identified by modifying the implementation of the parteimage method. Thereby reducing the pressure of the main thread in the browser environment. The specific method comprises the following steps: when calling the parseImage method, if there is no pre-multiplication configuration, the default value is used at the pre-multiplex alpha option at createImagebitmap.
S230, if the target rendering environment is a rendering environment based on the CPU GPU, determining that the target configuration of the alpha channel of the image to be rendered is a pre-multiplication configuration.
The GPU-based rendering environment may be a hardware environment of the rendering engine that is a GPU for determining the target configuration. Illustratively, the GPU-based target rendering environment is webglrendering context (a kind of rendering environment). The pre-multiplication configuration may be the configuration at the time of opening Premultiply Alpha, and specifically, the pre-multiplication configuration Premultiply Alpha may be a pre-multiple or none configuration value. Wherein, the pre-multiple corresponds to a pre-multiplication processing mode, and the none corresponds to a pre-division processing mode.
If the pre-multiple alpha is not set at creatediagebitmap, the alpha channel is targeted for default configuration, the corresponding value is default, and the default value is explicitly indicated in HMLT5 Spec (term, a player), which should be implemented by an optimal built-in implementation, specifically determined by the browser vendor itself, so most of the rendering time is allocated to the rendering stage, while the other two options pre-multiple and none, the former use the three primary pre-multiply alpha channel in addition to the remaining original data, the latter use the three primary pre-multiply alpha channel in addition to the remaining original data, none is meaningful, and the default is not the same (since the pre-multiply/divide process renders the original data before a copy of the original data cannot be restored).
S240, determining target pixel values of pixels in the image to be rendered according to the target configuration.
In an alternative embodiment, if the target configuration is a default configuration, determining, according to the target configuration, a target pixel value of each pixel in the image to be rendered includes: and replacing the resource type of the image to be rendered with a webpage element type, and determining the target pixel value of each pixel in the image to be rendered through the webpage element type.
The resource type of the image to be rendered is replaced by the webpage element type, namely the resource type of the image to be rendered is replaced by ImageHTMLElement (term, an interface). Specifically, format conversion is realized by modifying a parser (term, a parser), and the main function of the parser is to parse pictures, parse audio, parse scenes and parse other resources.
In Canvas (Canvas) rendering mode, the image htmlelement interface built in the browser is used to render the target pixel value of each pixel in the image to be rendered. The interface can replace an ImageBitmap interface, is a native browser interface, supports universal picture formats such as PNG (term, an image format), JPEG (term, an image format) and GIF (term, an image format), and can retain original picture information. Since transparency is achieved through the alpha channel of the picture itself without performing operation corresponding to the pre-multiplication processing mode at runtime like ImageBitmap, there is no problem that the CPU occupies too much at runtime.
The method comprises the steps of replacing a resource type of an image to be rendered with a webpage element type, and determining target pixel values of pixels in the image to be rendered through the webpage element type; when the image HTMLelement is used for drawing, the display effect of the picture can be controlled more flexibly, and meanwhile, the picture can be better displayed in different devices and environments. In addition, by using the ImageHTMLElement, the picture can be modified and processed more easily, and the flexibility and the expandability of Canvas drawing are further improved.
In an alternative embodiment, determining the target pixel value of each pixel in the image to be rendered by the webpage element type includes: acquiring a target rendering mode adopted by current image rendering; and determining target pixel values of pixels in the image to be rendered based on the target rendering mode through the webpage element type interface.
The target rendering mode is a rendering mode based on different rendering protocols. By way of example, target rendering modes may include canvas rendering and webgl rendering (Web Graphics Library ). And determining the target pixel value of each pixel in the image to be rendered in the corresponding image format by modifying the image type.
Specifically, through the web page element type interface, a target pixel value of each pixel in the image to be rendered is determined based on a target rendering mode, wherein the method comprises the following types 3:
if the rendering is canvas rendering, directly creating an Image object, then converting file into blob url through a URL (Uniform resource locator) interface, assigning the blob url to the img. Src, and triggering a resource loading completion event after the onload event of the Image object is triggered;
otherwise, if webgl rendering is performed, and the browser supports ImageBitmap, and the file is of the Blob type, creating an ImageBitmap object by using the createdimagebitmap;
if webgl rendering is performed and the browser does not support ImageBitmap, or the file is not of the Blob type, then the file is returned directly.
The method comprises the steps of obtaining a target rendering mode adopted by current image rendering; the target pixel value of each pixel in the image to be rendered is determined based on a target rendering mode through a webpage element type interface, and the use of a pre-multiplication/division function is not supported through the replacement of the image type, so that the method is a scheme of degrading rendering.
In an alternative embodiment, if the target configuration is a pre-multiplication configuration, determining, according to the target configuration, a target pixel value of each pixel in the image to be rendered includes: and determining the target pixel value of each current pixel value according to the target configuration and the current pixel value of each pixel in the image to be rendered.
The current pixel value may be a pixel value in the image to be rendered. And calculating the current pixel of each pixel in the image to be rendered according to the target configuration to obtain a target pixel value of each current pixel value.
The target pixel value of each current pixel value is determined according to the target configuration and the current pixel value of each pixel in the image to be rendered, and the target pixel value under the default configuration is accurately determined.
In an alternative embodiment, determining the target pixel value of each current pixel value according to the target configuration and the current pixel value of each pixel in the image to be rendered includes: and multiplying the current pixel value of each pixel in the image to be rendered by the value of the alpha channel to obtain the target pixel value of each current pixel value.
The value of the alpha channel may be a pre-multiplication value of a pre-multiplication configuration, which may be further divided into pre-multiplication and pre-division according to the pre-multiplier value. And multiplying the current pixel value of each pixel in the image to be rendered by the value of the alpha channel, wherein the multiplied value is the target pixel value of each current pixel value.
And multiplying the current pixel value of each pixel in the image to be rendered by the value of the alpha channel to obtain a target pixel value of each current pixel value, and determining the target pixel value under the pre-multiplication configuration.
S250, rendering the image to be rendered according to each target pixel value.
According to the technical scheme, if the target rendering environment is the rendering environment based on the CPU, the target configuration of the alpha channel of the image to be rendered is determined to be the default configuration; if the target rendering environment is based on the GPU, determining that the target configuration of the alpha channel of the image to be rendered is the pre-multiplication configuration, configuring the target configuration of the alpha channel according to the requirement, and using the default configuration to improve the rendering efficiency when the pre-multiplication processing mode is not needed.
Example III
Fig. 3 is a schematic structural diagram of an image rendering device according to a third embodiment of the present application, where the embodiment is applicable to a situation where an image is rendered according to a rendering environment of a rendering engine, and the image rendering device is configured in a cocos engine, and the specific structure of the image rendering device is as follows:
a target rendering environment determining module 310, configured to determine a target rendering environment in which image rendering is currently performed;
a target configuration determining module 320, configured to determine a target configuration among candidate configurations of alpha channels of an image to be rendered according to a target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode;
a target pixel value determining module 330, configured to determine a target pixel value of each pixel in the image to be rendered according to the target configuration;
the target pixel value rendering module 340 is configured to render the image to be rendered according to each target pixel value.
According to the technical scheme, the target rendering environment where the image rendering is currently performed is determined; determining target configuration in candidate configuration information of an alpha channel of an image to be rendered according to a target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode; corresponding target configuration can be determined according to the target rendering environment, the pre-multiplication processing mode in the ImageBitmap in the original cos engine source code is changed into the use according to the need, and for the target rendering environment which does not use the technology, the pre-multiplication processing mode can be closed, and the default processing mode is used; determining target pixel values of pixels in an image to be rendered according to target configuration; and rendering the image to be rendered according to each target pixel value, and reducing the pressure of the main thread. Therefore, through the technical scheme, the problems that a main thread occupies a large amount of resources and the rendering efficiency is low during the rendering period are solved, and the effect of improving the rendering efficiency is achieved.
Optionally, the target configuration determining module 320 includes:
a default configuration determining unit, configured to determine that a target configuration of an alpha channel of an image to be rendered is a default configuration if the target rendering environment is a rendering environment based on a central processing unit CPU;
and the pre-multiplication configuration determining unit is used for determining that the target configuration of the alpha channel of the image to be rendered is the pre-multiplication configuration if the target rendering environment is the rendering environment based on the GPU.
Alternatively, if the target configuration is a default configuration, the target pixel value determining module 330 includes:
the resource type replacing unit is used for replacing the resource type of the image to be rendered with the webpage element type, and determining the target pixel value of each pixel in the image to be rendered through the webpage element type.
Optionally, the resource type replacing unit includes:
a target rendering mode obtaining subunit, configured to obtain a target rendering mode used for rendering the current image;
the target pixel value determining subunit is configured to determine, through the web page element type interface, a target pixel value of each pixel in the image to be rendered based on a target rendering mode.
Alternatively, if the target is configured as a pre-multiply, the target pixel value determination module 330 includes:
and the target pixel value determining unit is used for determining the target pixel value of each current pixel value according to the target configuration and the current pixel value of each pixel in the image to be rendered.
Optionally, the target pixel value determining unit includes:
and the current pixel value multiplication subunit is used for multiplying the current pixel value of each pixel in the image to be rendered by the value of the alpha channel to obtain a target pixel value of each current pixel value.
The image rendering device provided by the embodiment of the application can execute the image rendering method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of executing the image rendering method.
Example IV
Fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present application, and as shown in fig. 4, the electronic device includes a processor 410, a memory 420, an input device 430 and an output device 440; the number of processors 410 in the electronic device may be one or more, one processor 410 being taken as an example in fig. 4; the processor 410, memory 420, input device 430, and output device 440 in the electronic device may be connected by a bus or other means, for example in fig. 4.
The memory 420, which is a computer-readable storage medium, may be used to store software programs, computer-executable programs, and modules, such as program instructions/modules (e.g., the target rendering environment determination module 310, the target configuration determination module 320, the target pixel value determination module 330, and the target pixel value rendering module 340) corresponding to the image rendering method in the embodiments of the present application. The processor 410 executes various functional applications of the electronic device and data processing, i.e., implements the image rendering method described above, by running software programs, instructions, and modules stored in the memory 420.
Memory 420 may include primarily a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application program required for functionality; the storage data area may store data created according to the use of the terminal, etc. In addition, memory 420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, memory 420 may further include memory remotely located relative to processor 410, which may be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 430 may be used to receive input character information and to generate key signal inputs related to user settings and function control of the electronic device. The output 440 may include a display device such as a display screen.
Example five
A fifth embodiment of the present application also provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing a method of image rendering, the method comprising: determining a target rendering environment where the image rendering is currently performed; determining target configuration in candidate configuration of alpha channel of the image to be rendered according to the target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode; determining target pixel values of pixels in an image to be rendered according to target configuration; and rendering the image to be rendered according to each target pixel value.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present application is not limited to the method operations described above, and may also perform the related operations in the image rendering method provided in any embodiment of the present application.
From the above description of embodiments, it will be clear to a person skilled in the art that the present application may be implemented by means of software and necessary general purpose hardware, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a FLASH Memory (FLASH), a hard disk, or an optical disk of a computer, etc., including several instructions for causing an electronic device (which may be a personal computer, a server, or a network device, etc.) to perform the method described in the embodiments of the present application.
It should be noted that, in the above-mentioned embodiments of the search apparatus, each unit and module included are only divided according to the functional logic, but not limited to the above-mentioned division, as long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present application.
Note that the above is only a preferred embodiment of the present application and the technical principle applied. Those skilled in the art will appreciate that the present application is not limited to the particular embodiments described herein, but is capable of numerous obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the present application. Therefore, while the present application has been described in connection with the above embodiments, the present application is not limited to the above embodiments, but may include many other equivalent embodiments without departing from the spirit of the present application, the scope of which is defined by the scope of the appended claims.

Claims (10)

1. An image rendering method, comprising:
determining a target rendering environment where the image rendering is currently performed;
determining target configuration in candidate configuration of alpha channel of the image to be rendered according to the target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode;
determining target pixel values of pixels in the image to be rendered according to the target configuration;
and rendering the image to be rendered according to each target pixel value.
2. The method of claim 1, wherein determining a target configuration among candidate configurations of alpha channels of the image to be rendered according to the target rendering environment comprises:
if the target rendering environment is a rendering environment based on a Central Processing Unit (CPU), determining that the target configuration of the alpha channel of the image to be rendered is a default configuration;
and if the target rendering environment is a rendering environment based on a Graphics Processor (GPU) of a Central Processing Unit (CPU), determining that the target configuration of the alpha channel of the image to be rendered is a pre-multiplication configuration.
3. The method of claim 1, wherein if the target configuration is a default configuration, the determining, according to the target configuration, a target pixel value for each pixel in the image to be rendered comprises:
and replacing the resource type of the image to be rendered with a webpage element type, and determining the target pixel value of each pixel in the image to be rendered through the webpage element type.
4. A method according to claim 3, wherein said determining the target pixel value of each pixel in the image to be rendered by the type of web page element comprises:
acquiring a target rendering mode adopted by current image rendering;
and determining target pixel values of pixels in the image to be rendered based on the target rendering mode through a webpage element type interface.
5. The method of claim 1, wherein if the target configuration is a pre-multiplied configuration, the determining, according to the target configuration, a target pixel value for each pixel in the image to be rendered comprises:
and determining the target pixel value of each current pixel value according to the target configuration and the current pixel value of each pixel in the image to be rendered.
6. The method of claim 5, wherein determining a target pixel value for each pixel in the image to be rendered based on the target configuration and a current pixel value for each pixel in the image to be rendered comprises:
and multiplying the current pixel value of each pixel in the image to be rendered by the value of the alpha channel to obtain a target pixel value of each current pixel value.
7. An image rendering apparatus, comprising:
the target rendering environment determining module is used for determining a target rendering environment where the image rendering is currently performed;
the target configuration determining module is used for determining target configuration in candidate configuration of an alpha channel of an image to be rendered according to the target rendering environment; the candidate configuration comprises a pre-multiplication processing mode and a default processing mode;
a target pixel value determining module, configured to determine a target pixel value of each pixel in the image to be rendered according to the target configuration;
and the target pixel value rendering module is used for rendering the image to be rendered according to each target pixel value.
8. The apparatus of claim 7, wherein the target configuration determination module comprises:
a default configuration determining unit, configured to determine that a target configuration of an alpha channel of the image to be rendered is a default configuration if the target rendering environment is a rendering environment based on a CPU;
and the pre-multiplication configuration determining unit is used for determining that the target configuration of the alpha channel of the image to be rendered is a pre-multiplication configuration if the target rendering environment is a rendering environment based on a Graphics Processor (GPU).
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the image rendering method of any one of claims 1-6 when the program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the image rendering method as claimed in any one of claims 1-6.
CN202310693085.5A 2023-06-12 2023-06-12 Image rendering method, device, electronic equipment and storage medium Pending CN116503535A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310693085.5A CN116503535A (en) 2023-06-12 2023-06-12 Image rendering method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310693085.5A CN116503535A (en) 2023-06-12 2023-06-12 Image rendering method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116503535A true CN116503535A (en) 2023-07-28

Family

ID=87328562

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310693085.5A Pending CN116503535A (en) 2023-06-12 2023-06-12 Image rendering method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116503535A (en)

Similar Documents

Publication Publication Date Title
US8446411B2 (en) Adaptive image rendering and use of imposter
US10423527B2 (en) Memory management and image display for mobile devices
CN106453572B (en) Method and system based on Cloud Server synchronous images
CN109949391B (en) Image-text drawing method, image-text drawing device, electronic equipment and storage medium
CN111026493B (en) Interface rendering processing method and device
CN111209422A (en) Image display method, image display device, electronic device, and storage medium
CN112312161A (en) Method and device for generating video, electronic equipment and readable storage medium
CN111951356B (en) Animation rendering method based on JSON data format
CN112307403A (en) Page rendering method, device, storage medium and terminal
CN110471700B (en) Graphic processing method, apparatus, storage medium and electronic device
CN111737614A (en) Page display method and device, electronic equipment and storage medium
CN114205680A (en) Video cover display method and device, equipment, medium and product thereof
CN111432142A (en) Video synthesis method, device, equipment and storage medium
CN116503535A (en) Image rendering method, device, electronic equipment and storage medium
CN111931111A (en) Webpage development method, webpage display method, device and equipment
JP5842029B2 (en) Information processing support apparatus, information processing apparatus, and information processing support program for caching image data
CN110730379B (en) Video information processing method, device and storage medium
CN116991600B (en) Method, device, equipment and storage medium for processing graphic call instruction
CN110020314B (en) Web page data processing method, device, computing equipment and storage medium
CN112463280A (en) Image generation method and device, electronic equipment and computer readable storage medium
CN116932490A (en) Picture loading method, device, computer equipment and storage medium
CN117372238A (en) Registration function method, video frame processing method, device, equipment and storage medium
CN115988169A (en) Method and device for rapidly displaying real-time video screen-combination characters in cloud conference
CN112445990A (en) Picture processing method, device, terminal and storage medium
CN112558849A (en) Graphic model generation method, device, equipment and storage medium

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