Image processing method and device, electronic equipment, storage medium and program product

By using a mask layer to perform color mixing on the layers to be processed in image processing, the problem of excessive GPU resource consumption is solved, and device performance is improved.

CN121982121APending Publication Date: 2026-05-05BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING XIAOMI MOBILE SOFTWARE CO LTD
Filing Date
2024-10-29
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Existing technologies for image processing, which use GPUs to call APIs such as OpenGL for layer composition, result in excessive resource consumption and reduced device performance.

Method used

By obtaining the mask layers of the source layer and the layer to be processed, performing color mixing, and then compositing, the reliance on the GPU is reduced. The mask layer is used to preprocess the layer to be processed to achieve layer compositing.

Benefits of technology

It reduces GPU resource consumption, improves device performance, and reduces GPU load.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121982121A_ABST
    Figure CN121982121A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and particularly provides an image processing method and device, electronic equipment, a storage medium and a program product. The method comprises the following steps: according to a layer synthesis instruction, obtaining a source layer and a to-be-processed layer; acquiring a mask layer corresponding to the to-be-processed layer; performing color mixing processing on the mask layer and the to-be-processed layer to obtain a target processing layer; and synthesizing the source image layer and the target processing image layer to obtain a target synthesized image. Therefore, the to-be-processed layer can be subjected to color mixing processing through the mask layer and then subjected to layer synthesis, and synthesis after layer operation through a GPU is not needed, so that resources consumed by the GPU are reduced, the load of the GPU is reduced, and the equipment performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, specifically to an image processing method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] In image processing scenarios, it is often necessary to composite multiple layers according to actual application requirements to obtain a composite image that meets the compositing intent (such as drawing rounded corners of windows, adding shadows, and blurring images) and display it on the screen.

[0003] In related technologies, in some complex scenarios, the target processing layer is usually manipulated by calling the Application Programming Interface (API) such as the Open Graphics Library (OpenGL) through the Graphics Processing Unit (GPU). For example, the target processing layer is rounded and clipped. Then, the manipulated target processing layer is combined with the source layer to obtain the composite layer.

[0004] However, using this method will consume a lot of GPU resources, thereby reducing device performance. Summary of the Invention

[0005] The purpose of this disclosure is to provide an image processing method, apparatus, electronic device, storage medium, and program product to reduce GPU resource consumption during image synthesis.

[0006] In one aspect, this disclosure provides an image processing method, including:

[0007] Based on the layer compositing instructions, obtain the source layer and the layer to be processed;

[0008] Get the mask layer corresponding to the layer to be processed;

[0009] Mix the mask layer with the layer to be processed to obtain the target processing layer;

[0010] The source layer and the target processing layer are combined to obtain the target composite image.

[0011] In one implementation, obtaining the mask layer corresponding to the layer to be processed includes:

[0012] Retrieve the composition intent identifier from the layer composition command;

[0013] Obtain the mask layer corresponding to the composition intent identifier.

[0014] In one embodiment, before performing color mixing between the mask layer and the layer to be processed to obtain the target processed layer, the method further includes:

[0015] Obtain the layer information of the layer to be processed;

[0016] Based on the composition intent identifier and layer information, the mask layer is adjusted to obtain the adjusted mask layer.

[0017] In one embodiment, the mask layer and the layer to be processed are mixed to obtain the target processing layer, including:

[0018] The target pixel matrix of the target processing layer is obtained by multiplying the first pixel matrix of the mask layer and the second pixel matrix of the layer to be processed; the first pixel matrix represents the color and transparency of each pixel in the mask layer; the second pixel matrix represents the color and transparency of each pixel in the layer to be processed.

[0019] In one implementation, before obtaining the mask layer corresponding to the layer to be processed, the method further includes:

[0020] Initialize the color and transparency of the mask layer;

[0021] Retrieve the mask layer configuration parameters set according to the compositing intent;

[0022] Based on the mask layer configuration parameters, the initially set mask layer is rendered to obtain the rendered mask layer.

[0023] In one aspect, this disclosure provides an image processing apparatus, comprising:

[0024] The receiving unit is used to obtain the source layer and the layer to be processed according to the layer compositing instruction;

[0025] The acquisition unit is used to acquire the mask layer corresponding to the layer to be processed.

[0026] The color mixing unit is used to mix the mask layer with the layer to be processed to obtain the target processing layer;

[0027] The compositing unit is used to composite the source layer and the target processing layer to obtain the target composite image.

[0028] In one embodiment, the acquisition unit is used for:

[0029] Retrieve the composition intent identifier from the layer composition command;

[0030] Obtain the mask layer corresponding to the composition intent identifier.

[0031] In one embodiment, the color mixing unit is further used for:

[0032] Obtain the layer information of the layer to be processed;

[0033] Based on the composition intent identifier and layer information, the mask layer is adjusted to obtain the adjusted mask layer.

[0034] In one embodiment, the color mixing unit is used for:

[0035] The target pixel matrix of the target processing layer is obtained by multiplying the first pixel matrix of the mask layer and the second pixel matrix of the layer to be processed; the first pixel matrix represents the color and transparency of each pixel in the mask layer; the second pixel matrix represents the color and transparency of each pixel in the layer to be processed.

[0036] In one embodiment, the acquisition unit is further configured to:

[0037] Initialize the color and transparency of the mask layer;

[0038] Retrieve the mask layer configuration parameters set according to the compositing intent;

[0039] Based on the mask layer configuration parameters, the initially set mask layer is rendered to obtain the rendered mask layer.

[0040] In one aspect, this disclosure provides an electronic device, including:

[0041] Processor; and

[0042] The memory stores computer instructions that cause the processor to perform the steps of the methods provided in the various alternative implementations of any of the image processing described above.

[0043] In one aspect, this disclosure provides a computer-readable storage medium storing computer instructions for causing a computer to perform the steps of the methods provided in various alternative implementations of any of the above-described image processing methods.

[0044] On one hand, this disclosure provides a computer program product including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device performs the steps of the method provided in various alternative implementations of any of the above-described image processing methods.

[0045] The image processing method in this embodiment includes obtaining a source layer and a layer to be processed according to a layer compositing instruction; obtaining a mask layer corresponding to the layer to be processed; performing color mixing processing on the mask layer and the layer to be processed to obtain a target processing layer; and compositing the source layer and the target processing layer to obtain a target composite image. In this way, color mixing processing on the layer to be processed can be performed through a mask layer, thereby enabling layer compositing without requiring GPU layer operations, reducing GPU resource consumption, lowering GPU load, and improving device performance. Attached Figure Description

[0046] Figure 1 This is a flowchart of an image processing method according to an embodiment of the present disclosure.

[0047] Figure 2 This is an example image of a layer to be synthesized in an embodiment of this disclosure.

[0048] Figure 3 This is an example diagram of layer color mixing in an embodiment of this disclosure.

[0049] Figure 4 This is an example diagram of layer composition in an embodiment of this disclosure.

[0050] Figure 5 This is an example diagram of a target synthetic image in an embodiment of this disclosure.

[0051] Figure 6 This is a structural block diagram of an image processing apparatus according to an embodiment of the present disclosure.

[0052] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. Detailed Implementation

[0053] The technical solutions of this disclosure will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure. Furthermore, the technical features involved in the different embodiments of this disclosure described below can be combined with each other as long as they do not conflict with each other.

[0054] In image processing scenarios, it's often necessary to composite multiple layers to obtain a composite image that meets the intended purpose and is then displayed on the screen. In some complex scenarios, related technologies typically require the GPU to call APIs such as OpenGL to manipulate the target processing layer (e.g., drawing rounded corners of a window), and then composite the manipulated target processing layer with the source layer to obtain the composite layer. However, this approach consumes significant GPU resources, thus degrading device performance.

[0055] Based on the deficiencies of the aforementioned related technologies, this disclosure provides an image processing method, apparatus, electronic device, storage medium, and program product, aiming to reduce the cost of GPU consumption during image synthesis.

[0056] This disclosure provides an image processing method that can be applied to electronic devices. This disclosure does not limit the type of electronic device, which can be any suitable type of device, such as terminal devices and servers, etc. This disclosure will not elaborate further.

[0057] Terminal devices can be mobile terminals, fixed terminals, or portable terminals, such as mobile phones, sites, units, devices, multimedia computers, multimedia tablets, internet nodes, communicators, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, personal communication system devices, personal navigation devices, personal digital assistants, audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio receivers, e-book devices, gaming devices, or any combination thereof, including accessories and peripherals of these devices, or any combination thereof. It is also foreseeable that terminal devices can support any type of user-facing interface (e.g., wearable devices). Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms.

[0058] See Figure 1 The diagram shown is a flowchart of an image processing method according to an embodiment of this disclosure. The following is a description of the method in conjunction with... Figure 1 The method described herein is applied to a Hardware Composer (HWC). The HWC is a module located in the Hardware Abstraction Layer (HAL) and is responsible for the composition and display of windows (Layers). The specific implementation flow of the method in this embodiment is as follows:

[0059] Step 101: Obtain the source layer and the layer to be processed according to the layer compositing instructions.

[0060] In one implementation, a SurfaceFlinger in an electronic device receives application instructions from an upper-layer application for layer compositing. Based on these instructions, the SurfaceFlinger composites all layers marked for GPU compositing into an output buffer. Then, based on this output buffer and other layers (e.g., layers marked for HWC compositing), it sends image compositing instructions to the HWC, delivering the output buffer and other layers to the HWC for compositing and displaying the remaining layers. The HWC, based on these layer compositing instructions, obtains the home layer and the layer to be processed; for example, the home layer and the layer to be processed are obtained from data sent by the SurfaceFlinger. The HWC also indicates the compositing method for each layer, specifying whether the layer is composed via GPU or HWC.

[0061] In this context, the source layer is the layer that does not require preprocessing; for example, the source layer could be the main screen layer. The layers to be processed are the layers that require preprocessing according to business requirements; optionally, there can be one or more layers to be processed. The following section will combine... Figure 2 This section explains how to handle multiple layers based on layer composition commands. See also... Figure 2 The image shown is an example of a layer to be composited. Figure 2 The middle layer contains the source layer and the layer to be processed.

[0062] SurfaceFlinger is a crucial module in the Android system, responsible for layering multiple application windows to form the final screen display. Its main functions include compositing, blending, and rendering surfaces from different sources to ensure correct display on the screen. SurfaceFlinger handles tasks such as applying visual effects like transparency, rotation, and scaling, as well as ensuring efficient graphics rendering performance. Within the Android display subsystem, SurfaceFlinger plays a central role, receiving window hierarchy information from the Window Manager Service (WMS) and then drawing each window onto the screen based on this information. This process involves sophisticated graphics processing techniques to ensure smooth and efficient screen updates.

[0063] Since SurfaceFlinger is directly related to the presentation of the user interface, its performance optimization is crucial for improving the overall system performance. This includes reducing latency, increasing frame rate, and optimizing memory usage. With each Android version update, SurfaceFlinger is continuously improved and optimized to adapt to new hardware developments and user needs.

[0064] Step 102: Obtain the mask layer corresponding to the layer to be processed.

[0065] In one implementation, HWC obtains the composition intent identifier from the layer composition instruction; and obtains the mask layer corresponding to the composition intent identifier.

[0066] Furthermore, different mask layers can be pre-set for different composition intent identifiers. For example, composition intent identifiers can be identifiers representing composition intents such as rounded corners, shadows, and blurs on windows.

[0067] Furthermore, the layers to be processed can be pre-marked, i.e., marked with special mask layers, so that preprocessing operations can be performed on the layers based on these marks. Special mask layer marking is an effective tool for identifying and processing layers or objects with special attributes in graphics rendering and image processing. It has a wide range of applications, diverse implementation methods, and significant advantages and value. Special mask layer marking is typically applied to specific layers or objects to indicate that the layer or object has a certain special attribute or effect. Its main function is to help the system or user quickly identify and process these layers or objects with special attributes. For example, in graphic design software, special mask layer marking may be used to identify layers that require the application of specific filters or effects. Optionally, special mask layer marking can be implemented in various ways, such as using specific layer names, color labels, and metadata. In some software, more complex special mask layer marking functions can also be implemented through scripts or plugins.

[0068] Using special mask layer markers can greatly improve workflow efficiency because it allows users or systems to quickly locate and manipulate layers or objects with specific attributes. It can also enhance the readability and maintainability of a project because others can more easily understand the project's structure by viewing the special mask layer markers.

[0069] Furthermore, the layer information of the layer to be processed is obtained; based on the composition intention identifier and the layer information, the mask layer is adjusted to obtain the adjusted mask layer.

[0070] The layer information can include details such as the position and size of the object to be manipulated in the layer to be processed. For example, if the intention of the composition is to add a shadow to a rectangle in the layer to be processed, then the size and position of the rectangle are obtained, and the corresponding shadow area in the mask layer is adjusted based on the size and position of the rectangle, such as moving and scaling the shadow area. In practical applications, the layer information can be set according to the actual application scenario, and there are no restrictions here.

[0071] Furthermore, a mask layer can be pre-generated. When generating the mask layer, any of the following methods can be used:

[0072] Method 1: Set the initial color and transparency of the mask layer according to the application scenario requirements.

[0073] Since some scenarios are relatively simple, simple mask layers can be pre-set. In one implementation, different preset files corresponding to different scenarios can be pre-set in the system for the mask layer according to different application scenarios. The preset file contains the pixel information corresponding to each pixel in the mask layer, namely red, green, blue, and transparency (Red GreenBlue Alpha, RGBA). In practical applications, when using the preset file for the first time, it is usually necessary to read and decompress the preset file, parse the preset file, and associate the parsed content with the mask layer for storage, so as to be called later.

[0074] RGBA is a color model widely used in digital image processing, computer graphics, and other fields. It uses three color components—red, green, and blue—and a transparency component to precisely describe and control the color and transparency of an image.

[0075] Red is the first component in the RGBA model, representing the red component of a color. In computer image processing, the intensity of red is typically represented by one byte (8 bits), ranging from 0 to 255. Higher values ​​indicate more saturated red; lower values ​​indicate a paler red.

[0076] Green is the second component in the RGBA model, representing the green component of the color. Similar to red, the intensity of green is also represented by one byte (8 bits), ranging from 0 to 255. The value of the green component determines the shade of green in an image.

[0077] Blue is the third component in the RGBA model, representing the blue component of the color. The intensity of blue is also represented by one byte (8 bits), ranging from 0 to 255. The value of the blue component affects the intensity of blue in the image. The alpha channel is the fourth component in the RGBA model, representing the transparency of the color. Unlike the three RGB color components, the alpha channel is usually represented by a percentage or a decimal between 0 and 1. The higher the alpha value, the less transparent the image; the lower the alpha value, the more transparent the image. In some cases, the alpha channel can also be represented by an 8-bit number, ranging from 0 to 255, where 0 represents complete transparency and 255 represents complete opacity.

[0078] Method 2: Based on the complex application requirements, the initially set mask layer is edited again.

[0079] In one implementation, the color and transparency of the mask layer are initially set; mask layer configuration parameters set according to the compositing intention are obtained; and the initially set mask layer is rendered according to the mask layer configuration parameters to obtain the rendered mask layer. The mask layer configuration parameters are used for secondary editing of the mask layer to meet refined scene requirements.

[0080] This is because in complex scenarios, simply reading pre-built files directly is often insufficient to meet practical application requirements. Therefore, the pre-built files can be parsed, and the parsed content can be stored as shaders. Then, through the rendering thread, GPU resources are invoked to render the stored shader file according to the mask layer configuration parameters, obtaining the rendered mask layer. The GPU is typically responsible for performing complex graphics rendering operations.

[0081] In this way, the initial mask layer can be further refined according to the mask layer configuration parameters for different complex scenarios, thereby obtaining a mask layer that can meet higher and more refined requirements.

[0082] Step 103: Mix the mask layer with the layer to be processed to obtain the target processing layer.

[0083] In one implementation, HWC obtains the target pixel matrix of the target processing layer by multiplying the first pixel matrix of the mask layer and the second pixel matrix of the layer to be processed; the first pixel matrix represents the color and transparency of each pixel in the mask layer; the second pixel matrix represents the color and transparency of each pixel in the layer to be processed.

[0084] Optionally, the following formula can be used to determine the target pixel matrix of the target processing layer:

[0085] colorOut = S(x) * D(y);

[0086] Where colorOut represents the target pixel matrix, D(y) represents the first pixel matrix, and S(x) represents the second pixel matrix.

[0087] The following is combined Figure 3 and Figure 4 This section explains how to draw rounded corners for windows; please refer to [link / reference]. Figure 3 The image shown is an example of layer color mixing. Figure 4 This is an example image of a layer composite. Figure 3 The middle layer contains a mask layer and a layer to be processed. Figure 4 The text contains the target layer after color mixing and the source layer.

[0088] Figure 3 In the process, if the intention of the composition is to draw rounded corners of windows, the corresponding mask layer is obtained. This mask layer only contains transparency information, which can be represented by alpha. Therefore, the alpha of the middle part of the mask layer is all 1, meaning it can be displayed. The alpha of the four rounded corners of the window is all 0, meaning it will not be displayed. The mask layer and the layer to be processed are then mixed to obtain... Figure 4 The target processing layer is shown. The specific color information displayed in the target processing layer is derived from the layer to be processed, and the display effect is consistent with the layer to be processed. However, the transparency is affected by the double superposition of the maskLayer and the layer to be processed. The alpha of the four corners of the maskLayer is 0. Any alpha multiplied by 0 will result in 0, and therefore will not be displayed. This achieves the rounded corner drawing of the layer to be processed.

[0089] In practical applications, the blending mode of the layer to be processed can be marked as a new capability, denoted as newBlendMode. This new capability is the blending process, which can be represented as colorOut = S(x) * D(y).

[0090] Furthermore, if there are multiple layers to be processed, one or more mask layers can be used to perform color mixing on each layer according to the actual application requirements.

[0091] In one implementation, according to the composition intention of each layer to be processed, the mask layer corresponding to each layer to be processed is obtained, and each layer to be processed is mixed with its corresponding mask layer.

[0092] In one implementation, a mask layer is obtained according to the compositing intention, and the mask layer is mixed with the topmost layer of each layer to be processed. The obtained target processing layer is then sequentially composited with the next layer to be processed to obtain a final new target processing layer.

[0093] In one implementation, one or more layers that need to be mixed are selected from the layers to be processed, and the selected layers are mixed with their respective mask layers. The layers (i.e., the unmixed layers and the mixed target processing layers) are then sequentially composited in the order of their top and bottom layers to obtain a final new target processing layer.

[0094] In this way, the layers to be processed can be preprocessed, i.e., mixed colors.

[0095] Step 104: Combine the source layer and the target processing layer to obtain the target composite image.

[0096] See Figure 5 The image shown is an example of a target composite image. In one implementation, HWC composites the source layer and the target processing layer to obtain... Figure 5 The target composite image is shown. Furthermore, the target composite image can also be displayed on the screen.

[0097] HWC is a hardware compositor in the Android system used to interact with the underlying hardware, optimize display performance, and directly handle the display of some layers, reducing CPU load and improving rendering efficiency.

[0098] In this way, the marked layers to be processed can be preprocessed using a mask layer to obtain the target processing layer, and then composited with the unmarked source layer to obtain the target composite image, which can then be displayed on the screen.

[0099] In this embodiment of the disclosure, HWC is used to perform color mixing on the corresponding mask layer to be processed according to the actual application requirements, and then HWC is used for subsequent image compositing to achieve a composite image that meets the actual application requirements (e.g., image drawing). In this way, layer color mixing can be achieved simply by expanding the color mixing mode, without calling the GPU to perform layer operations and then compositing, which reduces the resources consumed by the GPU, reduces the GPU load, and thus improves device performance.

[0100] Based on the same inventive concept, this disclosure also provides an image processing apparatus. Since the principle of the above-described apparatus and device in solving the problem is similar to that of an image processing method, the implementation of the above-described apparatus can refer to the implementation of the method, and repeated details will not be elaborated further. This apparatus can be applied to electronic devices. This disclosure does not limit the type of electronic device; it can be any suitable type of device, such as terminal devices and servers, etc., which will not be elaborated further in this disclosure. The apparatus embodiment can be implemented by software, or by hardware, or a combination of software and hardware. Taking software implementation as an example, as a logically defined apparatus, it is formed by the processor of the electronic device loading the corresponding computer program instructions from non-volatile memory into memory for execution.

[0101] See Figure 6 The diagram shown is a structural block diagram of an image processing apparatus according to an embodiment of this disclosure. In some embodiments, the image processing apparatus of this disclosure includes:

[0102] The receiving unit 601 is used to obtain the source layer and the layer to be processed according to the layer compositing instruction;

[0103] Unit 602 is used to obtain the mask layer corresponding to the layer to be processed;

[0104] The color mixing unit 603 is used to mix the mask layer and the layer to be processed to obtain the target processing layer.

[0105] The compositing unit 604 is used to composite the source layer and the target processing layer to obtain the target composite image.

[0106] In one embodiment, the acquisition unit 602 is used for:

[0107] Retrieve the composition intent identifier from the layer composition command;

[0108] Obtain the mask layer corresponding to the composition intent identifier.

[0109] In one embodiment, the color mixing unit 603 is further configured to:

[0110] Obtain the layer information of the layer to be processed;

[0111] Based on the composition intent identifier and layer information, the mask layer is adjusted to obtain the adjusted mask layer.

[0112] In one embodiment, the color mixing unit 603 is used for:

[0113] The target pixel matrix of the target processing layer is obtained by multiplying the first pixel matrix of the mask layer and the second pixel matrix of the layer to be processed; the first pixel matrix represents the color and transparency of each pixel in the mask layer; the second pixel matrix represents the color and transparency of each pixel in the layer to be processed.

[0114] In one embodiment, the acquisition unit 602 is further configured to:

[0115] Initialize the color and transparency of the mask layer;

[0116] Retrieve the mask layer configuration parameters set according to the compositing intent;

[0117] Based on the mask layer configuration parameters, the initially set mask layer is rendered to obtain the rendered mask layer.

[0118] The image processing method in this embodiment includes obtaining a source layer and a layer to be processed according to a layer compositing instruction; obtaining a mask layer corresponding to the layer to be processed; performing color mixing processing on the mask layer and the layer to be processed to obtain a target processing layer; and compositing the source layer and the target processing layer to obtain a target composite image. In this way, color mixing processing on the layer to be processed can be performed through a mask layer, thereby enabling layer compositing without requiring GPU layer operations, reducing GPU resource consumption, lowering GPU load, and improving device performance.

[0119] In this embodiment of the disclosure, an electronic device is also provided, including:

[0120] Processor; and

[0121] The memory stores computer instructions that cause the processor to execute the methods of any of the above-described embodiments.

[0122] In this embodiment of the disclosure, a computer-readable storage medium is provided, storing computer instructions for causing a computer to perform the methods of any of the above embodiments.

[0123] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device performs the method described in any of the above embodiments.

[0124] Figure 7 A schematic diagram of the structure of an electronic device 7000 is shown. (See also...) Figure 7 As shown, the electronic device 7000 includes a processor 7010 and a memory 7020, and optionally may also include a power supply 7030, a display unit 7040, and an input unit 7050.

[0125] The processor 7010 is the control center of the electronic device 7000. It connects various components through various interfaces and lines, and performs various functions of the electronic device 7000 by running or executing software programs and / or data stored in the memory 7020, thereby performing overall monitoring of the electronic device 7000.

[0126] In this embodiment of the present disclosure, the processor 7010 executes the steps in the above embodiments when it calls the computer program stored in the memory 7020.

[0127] Optionally, the processor 7010 may include one or more processing units; preferably, the processor 7010 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 7010. In some embodiments, the processor and memory may be implemented on a single chip; in some embodiments, they may also be implemented separately on independent chips.

[0128] The memory 7020 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, various applications, etc.; the data storage area may store data created based on the use of the electronic device 7000, etc. In addition, the memory 7020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device, etc.

[0129] Electronic device 7000 also includes a power supply 7030 (such as a battery) that supplies power to various components. The power supply can be logically connected to processor 7010 through a power management system, thereby enabling the management of charging, discharging, and power consumption.

[0130] The display unit 7040 can be used to display information input by the user or information provided to the user, as well as various menus of the electronic device 7000. In this embodiment, it is mainly used to display the display interface of various applications in the electronic device 7000, as well as text, images, and other objects displayed on the display interface. The display unit 7040 may include a display panel 7041. The display panel 7041 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

[0131] The input unit 7050 can be used to receive information such as numbers or characters input by the user. The input unit 7050 may include a touch panel 7051 and other input devices 7052. The touch panel 7051, also known as a touch screen, can collect touch operations on or near the touch panel 7051 (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 7051).

[0132] Specifically, the touch panel 7051 can detect user touch operations and the signals generated by these operations, converting them into touch point coordinates and sending them to the processor 7010. It can also receive and execute commands from the processor 7010. Furthermore, the touch panel 7051 can be implemented using various types of sensors, including resistive, capacitive, infrared, and surface acoustic wave sensors. Other input devices 7052 can include, but are not limited to, one or more of the following: a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick.

[0133] Of course, the touch panel 7051 can cover the display panel 7041. When the touch panel 7051 detects a touch operation on or near it, it transmits the information to the processor 7010 to determine the type of touch event. Subsequently, the processor 7010 provides corresponding visual output on the display panel 7041 based on the type of touch event. Although in Figure 7 In this embodiment, the touch panel 7051 and the display panel 7041 are two separate components to realize the input and output functions of the electronic device 7000. However, in some embodiments, the touch panel 7051 and the display panel 7041 can be integrated to realize the input and output functions of the electronic device 7000.

[0134] The electronic device 7000 may also include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity light sensor, etc. Of course, depending on the specific application, the electronic device 7000 may also include other components such as a camera. Since these components are not the focus of this disclosure, therefore... Figure 7 It is not shown in the text and will not be described in detail here.

[0135] Those skilled in the art will understand that Figure 7 This is merely an example of an electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than shown, or a combination of certain components, or different components.

[0136] For ease of description, the above sections are divided into modules (or units) according to their functions and described separately. Of course, in implementing this disclosure, the functions of each module (or unit) can be implemented in one or more software or hardware components.

Claims

1. An image processing method, characterized in that, The method includes: Based on the layer compositing instructions, obtain the source layer and the layer to be processed; Obtain the mask layer corresponding to the layer to be processed; The mask layer and the layer to be processed are mixed to obtain the target processing layer; The source layer and the target processing layer are combined to obtain the target composite image.

2. The method according to claim 1, characterized in that, The step of obtaining the mask layer corresponding to the layer to be processed includes: Obtain the composition intent identifier from the layer composition command; Obtain the mask layer corresponding to the synthetic intent identifier.

3. The method according to claim 2, characterized in that, Before performing color mixing between the mask layer and the layer to be processed to obtain the target processing layer, the method further includes: Obtain the layer information of the layer to be processed; Based on the composition intent identifier and layer information, the mask layer is adjusted to obtain the adjusted mask layer.

4. The method according to any one of claims 1-3, characterized in that, The step of mixing the mask layer with the layer to be processed to obtain the target processing layer includes: The target pixel matrix of the target processing layer is obtained by multiplying the first pixel matrix of the mask layer and the second pixel matrix of the layer to be processed; the first pixel matrix represents the color and transparency of each pixel in the mask layer; the second pixel matrix represents the color and transparency of each pixel in the layer to be processed.

5. The method according to any one of claims 1-3, characterized in that, Before obtaining the mask layer corresponding to the layer to be processed, the method further includes: Initialize the color and transparency of the mask layer; Retrieve the mask layer configuration parameters set according to the compositing intent; Based on the mask layer configuration parameters, the initially set mask layer is rendered to obtain the rendered mask layer.

6. An image processing apparatus, characterized in that, The device includes: The receiving unit is used to obtain the source layer and the layer to be processed according to the layer compositing instruction; The acquisition unit is used to acquire the mask layer corresponding to the layer to be processed; The color mixing unit is used to perform color mixing processing on the mask layer and the layer to be processed to obtain the target processing layer; The compositing unit is used to combine the source layer and the target processing layer to obtain a target composite image.

7. The apparatus according to claim 6, characterized in that, The step of obtaining the mask layer corresponding to the layer to be processed includes: Obtain the composition intent identifier from the layer composition command; Obtain the mask layer corresponding to the synthetic intent identifier.

8. An electronic device, characterized in that, include: processor; as well as A memory storing computer instructions for causing the processor to perform the method according to any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that, The computer contains computer instructions for causing the computer to perform the method according to any one of claims 1 to 5.

10. A computer program product, characterized in that, Includes computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is executed in a processor of an electronic device, the processor in the electronic device is the method according to any one of claims 1 to 5.