Layer composition method and electronic device
Through pre-synthesis technology, the number of foreground layers for real-time layer synthesis is reduced, and the problem of high computational volume during layer synthesis is solved, improving efficiency and user experience.
Patent Information
- Application Number
- CN202411434443.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2043-12-05
AI Technical Summary
During the layer synthesis process, especially when there are a large number of layers, the calculation amount of real-time layer synthesis is huge, resulting in display lag and affecting the user experience.
Through pre-synthesis technology, the number of foreground layers participating in real-time synthesis is reduced. The specific method includes pre-synthesis between the foreground layers that meet the binding conditions, and exchanging the hierarchical order of the activation layer and the foreground layer to reduce the number of layers in the real-time processing stage.
Improves layer synthesis efficiency, avoids lag, and improves user experience.
Smart Images

Figure CN119444891B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of terminals, and in particular, to a method for layer synthesis and an electronic device. Background Art
[0002] With the development of terminal technology, multi-layer mixing technology is widely used in painting or image processing scenarios. For example, in a painting scenario, in response to a user's drawing operation, an electronic device displays the contour of a human face drawn by the user on layer 1. Then, in response to the user's operation of creating a layer, layer 2 is created. And in response to the user's drawing operation, the facial features of the human face drawn by the user are displayed on layer 2. After that, through the multi-layer mixing technology, the electronic device can synthesize layer 1 and layer 2 to display the final whole face image. Another example is in an image processing scenario. In response to a user's operation of inputting pictures, after obtaining multiple pictures, each picture is used as a layer, and multiple layers are synthesized through the multi-layer mixing technology to display the finally synthesized image.
[0003] Among them, during the layer synthesis process, the electronic device first applies for a texture for storing the mixing result. Then, the electronic device sequentially synthesizes multiple layers onto the texture in the order from bottom to top, and the obtained result texture is the final synthesized image. However, in a painting or image processing scenario, the electronic device needs to display the image change effect corresponding to the user's operation in real time for the user to confirm. Then, the electronic device needs to perform layer synthesis in real time. In the case of a large number of layers, the amount of calculation required for layer mixing is huge, and real-time layer synthesis will cause the display to freeze, affecting the user experience. Summary of the Invention
[0004] To solve the above technical problems, this application provides a method for layer synthesis and an electronic device. The technical solution provided by this application effectively reduces the number of foreground layers participating in real-time synthesis by pre-synthesizing the foreground layers, thereby improving the efficiency of real-time layer synthesis.
[0005] To achieve the above technical purpose, this application provides the following technical solutions:
[0006] In a first aspect, a method for layer synthesis is provided, which is applied to an electronic device. The method includes: obtaining a background layer, an active layer, a first foreground layer, a second foreground layer, and a third foreground layer that are sequentially set. Synthesizing the first foreground layer, the second foreground layer, and the third foreground layer to generate a first intermediate image. Synthesizing the background layer, the active layer, and the first intermediate image to generate a first target image.
[0007] Thus, in the preprocessing stage, the electronic device pre - synthesizes multiple foreground layers, effectively reducing the number of foreground layers participating in layer synthesis in the real - time processing stage, improving the layer real - time synthesis efficiency, thereby enhancing the image processing efficiency, and avoiding the occurrence of lags and anomalies that affect the user experience.
[0008] According to the first aspect, before synthesizing the first foreground layer, the second foreground layer, and the third foreground layer to generate the first intermediate image, the method further includes: determining that the first foreground layer, the second foreground layer, and the third foreground layer satisfy a combination condition based on the blending modes of the first foreground layer, the second foreground layer, and the third foreground layer; the combination condition indicates that the blending order between adjacent multiple layers can be changed.
[0009] For example, based on the combination condition, if the layer synthesis result remains the same after changing the hierarchical order of the layers, then these layers satisfy the combination condition. For example, the blending algorithms of these layers are the same and satisfy the combination condition.
[0010] Thus, the electronic device pre - synthesizes the foreground layers that satisfy the combination condition in the foreground layers, thereby reducing the number of foreground layers participating in the real - time layer synthesis process subsequently, so as to improve the layer synthesis efficiency.
[0011] In some examples, among the multiple foreground layers included in the layer list, there may be multiple groups of adjacent foreground layers that satisfy the combination condition, so that multiple groups of intermediate images can be pre - synthesized. Optionally, the multiple foreground layers may also include foreground layers that do not satisfy the combination condition. Subsequently, these foreground layers that do not satisfy the combination condition participate in the real - time layer synthesis to ensure the final layer synthesis effect.
[0012] According to the first aspect, or any one of the above implementation manners of the first aspect, the combination condition specifically indicates: synthesizing the second foreground layer and the third foreground layer to obtain the first transitional image; synthesizing the first transitional image and the first foreground layer to obtain the second transitional image. Synthesizing the first foreground layer and the second foreground layer to obtain the third transitional image; synthesizing the third transitional image and the third foreground layer to obtain the fourth transitional image. Among them, the second transitional image and the fourth transitional image are the same.
[0013] Thus, by judging whether the layer synthesis result changes after changing the hierarchical order of the layers, it is judged whether the layers satisfy the combination condition.
[0014] According to the first aspect, or any implementation of the above first aspect, generating the first target image includes: determining that the exchange condition is not satisfied between the first intermediate image and the activation layer based on the blending mode of the first intermediate image and the activation layer, and maintaining the layer order of the background layer, the activation layer, and the first intermediate image; the exchange condition indicates that the layer order between adjacent layers is interchangeable. Synthesize the background layer, the activation layer, and the first intermediate image to generate the first target image.
[0015] According to the first aspect, or any implementation of the above first aspect, generating the first target image includes: determining that the exchange condition is satisfied between the first intermediate image and the activation layer based on the blending mode of the first intermediate image and the activation layer; the exchange condition indicates that the layer order between adjacent layers is interchangeable. Synthesize the first intermediate image and the background layer to generate a second intermediate image. Synthesize the second intermediate image and the activation layer to generate the first target image.
[0016] For example, based on the exchange condition, after exchanging the activation layer and the first intermediate image, it does not affect the final layer synthesis result. For example, the blending algorithm of the activation layer and the first intermediate image satisfies the exchange condition.
[0017] According to the first aspect, or any implementation of the above first aspect, the exchange condition specifically indicates: synthesize the background layer, the activation layer, and the first intermediate image in sequence from bottom to top to obtain a fifth transitional image. Synthesize the background layer, the first intermediate image, and the activation layer in sequence from bottom to top to obtain a sixth transitional image. Among them, the fifth transitional image and the sixth transitional image are the same.
[0018] In this way, when the electronic device determines that the foreground layer adjacent to the activation layer and the activation layer satisfy the exchange condition, it can exchange the layer order of the adjacent foreground layer and the activation layer, so as to transform the foreground layer into the background layer and participate in pre-synthesis. In this way, the number of foreground layers participating in real-time layer synthesis is effectively reduced. Optionally, the foreground layer that satisfies the exchange condition can be one layer, or a layer after pre-synthesis.
[0019] In a second aspect, a layer synthesis method is provided, which is applied to an electronic device. The method includes: obtaining a set of background layers, an activation layer, and a first foreground layer that are sequentially set. Synthesize the first foreground layer and the set of background layers to generate a first intermediate image. Synthesize the activation layer and the first intermediate image to generate the first target image.
[0020] In this way, in the preprocessing stage, the electronic device exchanges the layer order of the foreground layer and the activation layer, transforms the foreground layer into the background layer, and performs pre-synthesis with other background layers, effectively reducing the number of foreground layers participating in layer synthesis in the real-time processing stage, thereby improving the layer real-time synthesis efficiency.
[0021] According to a second aspect, the background layer set includes a first background layer and a second background layer arranged in sequence.
[0022] In some examples, the background layer set may include a single layer obtained by synthesizing the first background layer and the second background layer.
[0023] In this way, the electronic device can first exchange the hierarchical order of the foreground layer and the active layer, and then pre-synthesize the background layer; the electronic device can also first pre-synthesize the background layer and then exchange the hierarchical order of the foreground layer and the active layer. Thus, the layer preprocessing process can be flexibly implemented.
[0024] According to the second aspect, or any implementation manner of the above second aspect, before synthesizing the first foreground layer and the background layer set to generate the first intermediate image, the method further includes: determining that an exchange condition is satisfied between the first foreground layer and the active layer based on the blending mode of the first foreground layer and the active layer; the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged.
[0025] For example, based on the exchange condition, after exchanging the active layer and the first foreground layer, the final layer synthesis result is not affected. For example, the blending algorithm of the active layer and the first foreground layer satisfies the exchange condition.
[0026] According to the second aspect, or any implementation manner of the above second aspect, the exchange condition specifically indicates: synthesizing the first background layer, the second background layer, the active layer, and the first foreground layer in sequence from bottom to top to obtain a first transitional image. Synthesizing the first background layer, the second background, the first foreground layer, and the active layer in sequence from bottom to top to obtain a second transitional image. Among them, the first transitional image and the second transitional image are the same.
[0027] According to the second aspect, or any implementation manner of the above second aspect, the first foreground layer is a composite layer, and the composite layer includes an associated mask layer and a foreground layer.
[0028] In this way, the composite layer in the foreground layer can also participate in the exchange of the hierarchical order with the active layer, thereby effectively reducing the number of layers participating in the real-time layer synthesis.
[0029] According to the second aspect, or any implementation manner of the above second aspect, the method further includes: determining that the pixel parameters of the active layer have changed, and re-synthesizing the active layer with the changed pixel parameters and the first intermediate image to generate a second target image.
[0030] In this way, the layers participating in the real-time layer synthesis only include the active layer and the first intermediate image, effectively improving the layer synthesis efficiency.
[0031] In a third aspect, a method for layer composition is provided and applied to an electronic device. The method includes: obtaining a first background layer, a second background layer, a third background layer, an activation layer, and a first foreground layer that are sequentially arranged; composing the first background layer, the second background layer, and the third background layer to generate a first intermediate image; composing the first foreground layer and the first intermediate image to generate a second intermediate image; and composing the activation layer and the second intermediate image to generate a first target image.
[0032] In this way, in the preprocessing stage, the electronic device pre - composes multiple background layers. Moreover, the electronic device exchanges the hierarchical order of the foreground layer and the activation layer, transforms the foreground layer into a background layer, and then pre - composes it with other background layers, effectively reducing the number of foreground layers participating in layer composition in the real - time processing stage, thereby improving the efficiency of real - time layer composition.
[0033] According to the third aspect, before composing the first foreground layer and the first intermediate image to generate the second intermediate image, the method further includes: determining that the first foreground layer and the activation layer meet an exchange condition based on the blending mode of the first foreground layer and the activation layer; the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged.
[0034] For example, based on the exchange condition, after exchanging the activation layer and the first foreground layer, it does not affect the final layer composition result. For example, the blending algorithm of the activation layer and the first foreground layer meets the exchange condition.
[0035] According to the third aspect, or any one of the above implementation manners of the third aspect, the exchange condition specifically indicates: sequentially composing the first intermediate image, the activation layer, and the first foreground layer from bottom to top to obtain a first transitional image; sequentially composing the first intermediate image, the first foreground layer, and the activation layer from bottom to top to obtain a second transitional image. Among them, the first transitional image and the second transitional image are the same.
[0036] According to the third aspect, or any one of the above implementation manners of the third aspect, before composing the first background layer, the second background layer, and the third background layer to generate the first intermediate image, the method further includes: determining that the first background layer, the second background layer, and the third background layer meet a combination condition based on the blending mode of the first background layer, the second background layer, and the third background layer; the combination condition indicates that the blending order between adjacent multiple layers can be changed.
[0037] According to a third aspect, or any implementation manner of the above third aspect, in combination with conditions, it is specifically characterized that: the first background layer and the second background layer are synthesized to obtain a third transitional image; the third transitional image and the third background layer are synthesized to obtain a fourth transitional image. The second background layer and the third background layer are synthesized to obtain a fifth transitional image; the fifth transitional image and the first background layer are synthesized to obtain a sixth transitional image. Among them, the fourth transitional image and the sixth transitional image are the same.
[0038] For example, based on the combination conditions, after the hierarchical order of the layers is changed, the synthesis results of the layers are the same, then these layers meet the combination conditions. For example, the blending algorithms of these layers are the same and meet the combination conditions.
[0039] In a fourth aspect, an electronic device is provided. The electronic device includes: a processor and a memory, the memory is coupled to the processor, the memory is used to store computer program code, the computer program code includes computer instructions, when the processor reads the computer instructions from the memory, the electronic device is caused to perform: obtaining background layers, an activation layer, a first foreground layer, a second foreground layer, and a third foreground layer arranged in sequence. The first foreground layer, the second foreground layer, and the third foreground layer are synthesized to generate a first intermediate image. The background layer, the activation layer, and the first intermediate image are synthesized to generate a first target image.
[0040] According to the fourth aspect, when the processor reads the computer instructions from the memory, the electronic device is further caused to perform: based on the blending modes of the first foreground layer, the second foreground layer, and the third foreground layer, it is determined that the first foreground layer, the second foreground layer, and the third foreground layer meet the combination conditions; the combination conditions characterize that the blending order between adjacent multiple layers can be changed.
[0041] According to the fourth aspect, or any implementation manner of the above fourth aspect, the combination conditions are specifically characterized that: the second foreground layer and the third foreground layer are synthesized to obtain a first transitional image; the first transitional image and the first foreground layer are synthesized to obtain a second transitional image. The first foreground layer and the second foreground layer are synthesized to obtain a third transitional image; the third transitional image and the third foreground layer are synthesized to obtain a fourth transitional image. Among them, the second transitional image and the fourth transitional image are the same.
[0042] According to the fourth aspect, or any implementation manner of the above fourth aspect, generating the first target image includes: based on the blending mode of the first intermediate image and the activation layer, it is determined that the first intermediate image and the activation layer do not meet the exchange conditions, and the hierarchical order of the background layer, the activation layer, and the first intermediate image is maintained; the exchange conditions characterize that the hierarchical order between adjacent layers can be interchanged. The background layer, the activation layer, and the first intermediate image are synthesized to generate a first target image.
[0043] According to the fourth aspect, or any implementation of the above fourth aspect, generating the first target image includes: determining that an exchange condition is satisfied between the first intermediate image and the activation layer based on the blending mode of the first intermediate image and the activation layer; the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged. Synthesize the first intermediate image and the background layer to generate a second intermediate image. Synthesize the second intermediate image and the activation layer to generate the first target image.
[0044] According to the fourth aspect, or any implementation of the above fourth aspect, the exchange condition specifically indicates that: synthesizing the background layer, the activation layer, and the first intermediate image in sequence from bottom to top to obtain a fifth transitional image. Synthesizing the background layer, the first intermediate image, and the activation layer in sequence from bottom to top to obtain a sixth transitional image. Among them, the fifth transitional image and the sixth transitional image are the same.
[0045] In a fifth aspect, an electronic device is provided. The electronic device includes: a processor and a memory, the memory is coupled to the processor, and the memory is used to store computer program code, the computer program code includes computer instructions, and when the processor reads the computer instructions from the memory, it causes the electronic device to perform: obtaining a sequentially arranged set of background layers, an activation layer, and a first foreground layer. Synthesize the first foreground layer and the set of background layers to generate a first intermediate image. Synthesize the activation layer and the first intermediate image to generate the first target image.
[0046] According to the fifth aspect, the set of background layers includes a first background layer and a second background layer arranged in sequence; or, the set of background layers may include a single layer obtained by synthesizing the first background layer and the second background layer.
[0047] According to the fifth aspect, or any implementation of the above fifth aspect, when the processor reads the computer instructions from the memory, it further causes the electronic device to perform: determining that an exchange condition is satisfied between the first foreground layer and the activation layer based on the blending mode of the first foreground layer and the activation layer; the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged.
[0048] According to the fifth aspect, or any implementation of the above fifth aspect, the exchange condition specifically indicates that: synthesizing the first background layer, the second background layer, the activation layer, and the first foreground layer in sequence from bottom to top to obtain a first transitional image. Synthesizing the first background layer, the second background layer, the first foreground layer, and the activation layer in sequence from bottom to top to obtain a second transitional image. Among them, the first transitional image and the second transitional image are the same.
[0049] According to the fifth aspect, or any implementation of the above fifth aspect, the first foreground layer is a composite layer, and the composite layer includes an associated mask layer and a foreground layer.
[0050] According to the fifth aspect, or any implementation manner of the above fifth aspect, when the processor reads computer instructions from the memory, it also causes the electronic device to perform: determining that the pixel parameters of the activation layer have changed, recombining the activation layer with the changed pixel parameters and the first intermediate image, and generating a second target image.
[0051] In a sixth aspect, an electronic device is provided. The electronic device includes: a processor and a memory, the memory is coupled to the processor, and the memory is used to store computer program code. The computer program code includes computer instructions. When the processor reads the computer instructions from the memory, it causes the electronic device to perform: obtaining a first background layer, a second background layer, a third background layer, an activation layer, and a first foreground layer that are sequentially set. Combining the first background layer, the second background layer, and the third background layer to generate a first intermediate image. Combining the first foreground layer and the first intermediate image to generate a second intermediate image. Combining the activation layer and the second intermediate image to generate a first target image.
[0052] According to the sixth aspect, when the processor reads computer instructions from the memory, it also causes the electronic device to perform: determining that the first foreground layer and the activation layer satisfy an exchange condition based on the blending mode between the first foreground layer and the activation layer; the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged.
[0053] According to the sixth aspect, or any implementation manner of the above sixth aspect, the exchange condition specifically indicates: combining the first intermediate image, the activation layer, and the first foreground layer in sequence from bottom to top to obtain a first transitional image. Combining the first intermediate image, the first foreground layer, and the activation layer in sequence from bottom to top to obtain a second transitional image. Among them, the first transitional image and the second transitional image are the same.
[0054] According to the sixth aspect, or any implementation manner of the above sixth aspect, when the processor reads computer instructions from the memory, it also causes the electronic device to perform: determining that the first background layer, the second background layer, and the third background layer satisfy a combination condition based on the blending mode between the first background layer, the second background layer, and the third background layer; the combination condition indicates that the blending order between adjacent multiple layers can be changed.
[0055] According to the sixth aspect, or any implementation manner of the above sixth aspect, the combination condition specifically indicates: combining the first background layer and the second background layer to obtain a third transitional image; combining the third transitional image and the third background layer to obtain a fourth transitional image. Combining the second background layer and the third background layer to obtain a fifth transitional image; combining the fifth transitional image and the first background layer to obtain a sixth transitional image. Among them, the fourth transitional image and the sixth transitional image are the same.
[0056] In a seventh aspect, an electronic device is provided. The electronic device has a function of implementing the layer synthesis method described in the first aspect and any possible implementation manner thereof as described above; or, the electronic device has a function of implementing the layer synthesis method described in the second aspect and any possible implementation manner thereof as described above; or, the electronic device has a function of implementing the layer synthesis method described in the third aspect and any possible implementation manner thereof as described above. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0057] In an eighth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program (which can also be referred to as an instruction or code). When the computer program is executed by an electronic device, the electronic device is caused to execute the method of the first aspect or any implementation manner of the first aspect; or, the electronic device is caused to execute the method of the second aspect or any implementation manner of the second aspect; or, the electronic device is caused to execute the method of the third aspect or any implementation manner of the third aspect.
[0058] In a ninth aspect, a computer program product is provided. When the computer program product runs on an electronic device, the electronic device is caused to execute the method of the first aspect or any implementation manner of the first aspect; or, the electronic device is caused to execute the method of the second aspect or any implementation manner of the second aspect; or, the electronic device is caused to execute the method of the third aspect or any implementation manner of the third aspect.
[0059] In a tenth aspect, a circuit system is provided. The circuit system includes a processing circuit configured to execute the method of the first aspect or any implementation manner of the first aspect; or, the processing circuit is configured to execute the method of the second aspect or any implementation manner of the second aspect; or, the processing circuit is configured to execute the method of the third aspect or any implementation manner of the third aspect.
[0060] In an eleventh aspect, a chip system is provided, including at least one processor and at least one interface circuit. The at least one interface circuit is used to perform a transceiver function and send instructions to the at least one processor. When the at least one processor executes the instructions, the at least one processor executes the method of the first aspect or any implementation manner of the first aspect; or, the at least one processor executes the method of the second aspect or any implementation manner of the second aspect; or, the at least one processor executes the method of the third aspect or any implementation manner of the third aspect.
[0061] The technical effects of the foregoing aspects can be referred to each other, and will not be elaborated herein. Description of the Drawings
[0062] Figure 1 Schematic diagram of the layer display interface provided by the embodiment of the present application;
[0063] Figure 2 Schematic diagram of layer blending provided by the embodiment of the present application;
[0064] Figure 3 Schematic diagram of pre - composition of the background layer provided by the embodiment of the present application;
[0065] Figure 4 Schematic diagram of the hardware structure of the electronic device provided by the embodiment of the present application;
[0066] Figure 5 Schematic diagram of the software structure block diagram of the electronic device provided by the embodiment of the present application;
[0067] Figure 6 Schematic diagram of the process flow of the layer composition method provided by the embodiment of the present application Figure 1 ;
[0068] Figure 7 Schematic diagram of the process flow of the layer composition method provided by the embodiment of the present application Figure 2 ;
[0069] Figure 8 Schematic diagram of the pre - composition scene of the composite layer provided by the embodiment of the present application;
[0070] Figure 9 Schematic diagram of the exchange conditions provided by the embodiment of the present application;
[0071] Figure 10 Schematic diagram of the scene of exchanging the hierarchical order of layers based on the exchange conditions provided by the embodiment of the present application;
[0072] Figure 11 Schematic diagram of the combination conditions provided by the embodiment of the present application;
[0073] Figure 12 Schematic diagram of the scene of pre - composing the foreground layer grouping based on the combination conditions provided by the embodiment of the present application;
[0074] Figure 13 Schematic diagram of the scene of pre - composing the background layer provided by the embodiment of the present application;
[0075] Figure 14 Schematic diagram of the layer composition scene provided by the embodiment of the present application Figure 1 ;
[0076] Figure 15 Schematic diagram of the layer composition scene provided by the embodiment of the present application Figure 2 ;
[0077] Figure 16Schematic diagram of the layer composition scenario provided by the embodiments of the present application Figure 3 ;
[0078] Figure 17 Schematic diagram of the layer composition scenario provided by the embodiments of the present application Figure 4 ;
[0079] Figure 18 Schematic diagram of the structure of the electronic device provided by the embodiments of the present application. Detailed implementation manners
[0080] Next, in combination with the accompanying drawings in the embodiments of the present application, the technical solutions in the embodiments of the present application will be described. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to limit the present application. As used in the specification and claims of the present application, the singular forms "a", "an", "the", "above-mentioned", "the foregoing", "this" are intended to include, for example, the expression "one or more", unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of the present application, "at least one" and "one or more" mean one or more than two (including two).
[0081] The reference to "one embodiment" or "some embodiments" in this specification means that a specific feature, structure, or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in another way. The term "connection" includes direct connection and indirect connection, unless otherwise stated. "First" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features.
[0082] In the embodiments of the present application, words such as "exemplarily" or "for example" are used to represent examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present relevant concepts in a specific manner.
[0083] First, the technical terms related to the embodiments of the present application will be introduced:
[0084] 1) Pixel: The basic unit of image display, which cannot be further divided. Each pixel is a small square of a single color.
[0085] 2) Texture: A data object containing image information. For example, this data object can be an array composed of pixels, where the data of each pixel represents the color of this pixel, and the array composed of pixels can represent the entire image. Exemplarily, the texture can be the memory storing layers or images.
[0086] 3) Image Layer: In an image processing application or a painting application, a layer is a component of a work (or described as an image). A work can be composed of multiple layers, and each layer contains different visual elements. Layers can be stacked on top of each other and blended into the final effect. Each layer can be modified individually without affecting the content of other layers.
[0087] 4) Blend: Taking multiple layers as input and outputting a result image.
[0088] 5) Synthesize: Taking multiple layers as input and outputting a result image.
[0089] 6) Blend Algorithm: The calculation method for layer blending, usually taking the textures of two layers as input and outputting a texture as the blend result.
[0090] 7) Blend Mode: The way of layer blending. Each blend mode corresponds to a blend algorithm, which determines the output result of layer blending. The art circle has defined a set of common blend modes. For example, the blend modes include Normal mode, Multiply mode, Linear Burn mode, Screen mode, etc.
[0091] Among them, the Normal mode is the default mode in the blend modes, which is used to indicate the pixels of the blend color layer without any layer blending, meaning that the base color layer (background layer) has no influence on the blend color layer. The Multiply mode is used to indicate multiplying the gray levels of the pixel colors of the upper and lower layers to obtain a color with a lower gray level as the synthesized color. Briefly speaking, the effect after layer synthesis is that pixels with low gray levels are shown while pixels with high gray levels are not shown. The Linear Burn mode is used to indicate making the base color darker by reducing the brightness to reflect the blend color. The Screen mode is opposite to the Multiply mode, which is used to indicate multiplying the gray levels of the pixel colors of the upper and lower layers to obtain a color with a higher gray level as the synthesized color. Briefly speaking, the effect after layer synthesis is that pixels with high gray levels are shown while pixels with low gray levels are not shown.
[0092] In some examples, different blending modes and blending algorithms for implementing the blending modes are pre-configured in the electronic device. The electronic device detects an operation by the user to set the blending mode of a layer, and determines the blending mode and the blending algorithm of the layer.
[0093] 8) Mask: A special layer that acts on other layers to produce special effects.
[0094] 9) Compound Layer: A special layer group, usually composed of a layer and a mask, used to achieve specific combined effects.
[0095] 10) Layer List: The layers in the work are arranged in order from bottom to top.
[0096] 11) Active Layer: The layer that the user is currently modifying.
[0097] 12) Background Layer: The layer in the layer list that is below the active layer.
[0098] 13) Foreground Layer: The layer in the layer list that is above the active layer.
[0099] 14) Painting Latency: The latency when the handwriting appears on the screen when the pen tip is drawing on the screen.
[0100] 15) Commutative Condition: For a blending algorithm f(A, B), if swapping its first input with the second input results in the same output, i.e., f(A, B) = f(B, A), then this blending algorithm is said to satisfy the commutative condition.
[0101] 16) Associative Condition: For a blending algorithm f(A, B), when it appears on two consecutive layers, if changing its calculation order results in the same output, i.e., f(f(A, B), C) = f(A, f(B, C)), then this blending algorithm is said to satisfy the associative condition.
[0102] In some embodiments, the multi-layer blending technology is widely applied to painting or image processing scenarios. For example, in a painting scenario, in response to a user's drawing operation, the electronic device displays the contour of the human face drawn by the user on Layer 1. Then, in response to the user's operation of creating a layer, Layer 2 is created. And in response to the user's drawing operation, the user-drawn eyes of the human figure are displayed on Layer 2. After that, repeating the foregoing steps, the electronic device creates more layers for drawing other facial features, hair, etc. of the human figure according to the user's operation. Then, through the multi-layer blending technology, the electronic device can synthesize the created multiple layers to display the final entire face image. Another example is in an image processing scenario. In response to the user's operation of inputting pictures, after obtaining multiple pictures, each picture is used as a layer, and the multiple layers are synthesized through the multi-layer blending technology to display the final synthesized image.
[0103] Among them, during the layer synthesis process, the electronic device first applies for a texture for storing the blending result. Then, the electronic device synthesizes multiple layers onto this texture in sequence from bottom to top, and the obtained result texture is the final synthesized image.
[0104] Exemplarily, as Figure 1 shown in (a) below, in a painting scenario, the electronic device displays Menu Bar 11, which can be used to display the layer information corresponding to the currently drawn image. Among them, the image includes at least one layer, and the electronic device manages the at least one layer through a layer management module. In some examples, one layer corresponds to a structure, and the structure includes multiple member variables, and each member variable corresponds to a type of layer information. For example, as Figure 1 shown in the scenario of (a) below, the currently drawn image includes 4 layers, and the layer list managed by the layer management module includes the layer information of these 4 layers, where the layer currently being edited by the user is Layer 3. As shown in Menu Bar 11, the member variables corresponding to Layer 3 include the layer name, blending mode, etc., that is, the layer information includes the layer name, blending mode, etc.
[0105] In some examples, the electronic device can determine the active layer according to the user's operation, and the active layer is the layer operated by the user. For example, as Figure 1 shown in (a) below, the current Layer 3 is the active layer, and the layer information corresponding to Layer 3 includes information indicating that Layer 3 is the active layer. Among them, the electronic device can perform layer switching according to the user's operation to determine a new active layer. For example, the electronic device detects the user's operation on Layer Option 12 and displays an interface as Figure 1 shown in (b) below. Among them, as shown by reference numeral 13, the electronic device displays the multiple layers included in the currently drawn image, and the user can indicate the electronic device to switch and display the layer to be edited as needed. After that, as Figure 1As shown by reference numeral 14 in FIG. (c), the electronic device switches the display layer 2 according to the user's selection operation, sets the layer information of layer 2 to include information indicating that layer 2 is the active layer, and modifies the layer information of layer 3. The modified layer information includes information indicating that layer 3 is the background layer.
[0106] It should be understood that the electronic device can also obtain the active layer in other ways. For example, after the electronic device starts a painting application (or other applications such as an image processing application), it sets the layer at the top layer as the active layer and displays the active layer; or sets the layer that was last edited after closing the painting application as the active layer and displays the active layer. Alternatively, the electronic device can also determine the active layer in other ways.
[0107] In some examples, a layer being edited by the user is the active layer (or described as the focus layer), the layers below this layer are the background layers, and the layers above this layer are the foreground layers. When the active layer is the topmost layer, there is no foreground layer; when the active layer is the bottommost layer, there is no background layer.
[0108] Exemplarily, as Figure 1 In the scenario shown in FIG. (b), the layer list includes 4 layers corresponding to the currently displayed image. The electronic device can add or delete layers, or change the layer hierarchy order according to the user operation. In response to the user's operation of selecting layer 3, the electronic device determines that the current layer 3 is the active layer, layer 4 is the background layer, and layers 1 and 2 are the foreground layers.
[0109] In some examples, the user can set a blending mode for each layer, and each blending mode corresponds to a blending algorithm. Among them, the blending algorithm of the layer is used to define the calculation method of blending this layer onto the texture. In some examples, the blending modes include, for example, the normal mode, the multiply mode, etc.
[0110] Exemplarily, as Figure 1 shown in FIG. (a), the blending mode of the current layer 3 is the multiply mode. In response to the user's operation on the blending mode option 15, the electronic device determines that the user instructs to set the blending mode of layer 3, and the electronic device can display the interface as Figure 1 shown in FIG. (d). Among them, as shown by reference numeral 16, the user can select the blending mode set for layer 3 according to the need. For example, as Figure 1 shown by reference numeral 17 in FIG. (e), the electronic device sets the blending mode of layer 3 to the linear burn mode according to the user's operation.
[0111] In some examples, as Figure 2As shown, the blending algorithm f(A, B) corresponding to the blending mode of layer X is a binary operation. Its first input is the composite result of the layers below layer X, and the second input is layer X itself. Its output C = f(A, B) is the blending result of layer X and the layers below it.
[0112] However, in the scenarios of painting or image processing, users usually operate on a layer in an image, and the electronic device needs to display the image change effect corresponding to the operation in real time for the user to confirm. Then, the electronic device needs to perform layer composition in real time. In the case of a large number of layers, the amount of calculation required for layer blending is huge, and real-time layer composition will cause painting delays, resulting in poor display followability, stuttering, and low efficiency of drawing or image processing.
[0113] In some embodiments, the electronic device pre-composes some layers in advance by pre-composing layers. In this way, during the real-time layer composition process, the number of layers to be composed can be reduced, thereby improving the composition efficiency and avoiding stuttering.
[0114] In some examples, during the painting or image processing process, users generally only operate on the content of the active layer and do not change the content of the background layer. Then, as Figure 3 shown, after the electronic device determines the active layer, it can execute the preprocessing stage. First, it applies for a temporary texture and composes all the background layers onto this temporary texture. Then, in the real-time layer composition stage, according to the change in the content of the active layer, the electronic device directly composes the active layer onto the temporary texture. After the composite result texture is obtained, one or more foreground layers are then composed onto the result texture in sequence from bottom to top to obtain the final composite result. Among them, during the pre-composition process, the composition of the background layers does not change the order of layer composition from bottom to top, so the accuracy of the composite result can be guaranteed. Moreover, the number of layers participating in the real-time composition is reduced, and the performance of real-time layer composition is improved.
[0115] However, in the scenario of a large number of foreground layers, the above solution has limited improvement effect on the efficiency of layer composition, and still causes abnormal stuttering, affecting the user experience.
[0116] In some embodiments, the layer composition method provided by the embodiments of the present application can be applied to the electronic device 100. In some examples, the electronic device 100 can be, for example, a mobile phone, a tablet computer, a laptop computer, a smart screen, a wearable device, a vehicle-mounted terminal, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an artificial intelligence (AI) device, or other terminal devices with a display function. The operating system installed on the electronic device 100 includes, but is not limited to or other operating systems. The present application does not limit the specific type of the electronic device 100 or the installed operating system.
[0117] Figure 4 shows a schematic structural diagram of the electronic device 100.
[0118] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0119] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
[0120] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0121] The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
[0122] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory may save the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0123] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0124] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be respectively coupled to a touch sensor, a charger, a flash, a camera 193, etc. through different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor through the I2C interface, enabling the processor 110 and the touch sensor to communicate through the I2C bus interface to implement the touch function of the electronic device 100.
[0125] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100.
[0126] The USB interface 130 is an interface compliant with the USB standard specification, which can specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used for data transmission between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. This interface can also be used to connect other electronic devices, such as AR devices, etc.
[0127] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are only illustrative descriptions and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0128] The charging management module 140 is used to receive a charging input from a charger. Among them, the charger can be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 may receive the charging input from the wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 may receive the wireless charging input through the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device through the power management module 141.
[0129] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives inputs from the battery 142 and / or the charging management module 140 and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, etc. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 can also be disposed in the same device.
[0130] The wireless communication function of the electronic device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.
[0131] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example: The antenna 1 can be multiplexed as the diversity antenna of the wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0132] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc. applied to the electronic device 100. The mobile communication module 150 can include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves by the antenna 1, filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least some functional modules of the mobile communication module 150 can be disposed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 can be disposed in the same device.
[0133] The modulation and demodulation processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through the audio device, or displays an image or video through the display screen 194. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 110 and be disposed in the same device as the mobile communication module 150 or other functional modules.
[0134] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive the signal to be transmitted from the processor 110, perform frequency modulation on it, amplify it, and convert it into electromagnetic waves through the antenna 2 and radiate it out.
[0135] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, such that electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).
[0136] Electronic device 100 implements a display function through a GPU, display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, and is connected to display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0137] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), for example, an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini-led, a Micro-led, a Micro-oled, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0138] In some embodiments, during the process of the electronic device 100 displaying an image through the display screen 194, when detecting a user's editing operation on the image, the processor 110 determines the layer where the user is currently editing the image content, and determines this layer as the active layer. After that, the electronic device 100 can perform a layer preprocessing stage on the foreground layer and / or the background layer through the processor 110, thereby effectively reducing the number of layers participating in real-time synthesis. Then, the electronic device 100 displays the final result of layer real-time synthesis through the display screen 194 to facilitate the user to determine the editing effect.
[0139] The camera 193 is used to capture still images or videos. An object generates an optical image through a lens and projects it onto a photosensitive element. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard format such as RGB, YUV, etc. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0140] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to implement the storage capacity expansion of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.
[0141] The internal memory 121 can be used to store computer-executable program codes, and the executable program codes include instructions. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.). The data storage area can store data created during the use of the electronic device 100 (such as audio data, phone book, etc.). In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121 and / or the instructions stored in the memory provided in the processor.
[0142] The audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some functional modules of the audio module 170 can be disposed in the processor 110. The electronic device 100 can perform functions such as music playback and recording through the audio module 170. The audio module 170 can include a speaker, a receiver, a microphone, a headphone interface, and an application processor, etc. to implement audio functions.
[0143] The sensor module 180 can include a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0144] The keys 190 include a power-on key, a volume key, etc. The keys 190 can be mechanical keys or touch keys. The electronic device 100 can receive key inputs and generate key signal inputs related to the user settings and function controls of the electronic device 100.
[0145] The motor 191 can generate vibration prompts. The motor 191 can be used for incoming call vibration prompts and also for touch vibration feedback. For touch operations on different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects. Different application scenarios (such as time reminder, receiving messages, alarm clock, games, etc.) can also correspond to different vibration feedback effects.
[0146] The indicator 192 can be an indicator light and can be used to indicate the charging status, power change, and can also be used to indicate messages, missed calls, notifications, etc.
[0147] The SIM card interface 195 is used to connect the SIM card. The SIM card can be inserted into or pulled out from the SIM card interface 195 to achieve contact and separation from the electronic device 100. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
[0148] The software system of the electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservices architecture, or cloud architecture. In the embodiments of this application, taking the Android system with a layered architecture as an example, the software structure of the electronic device 100 is exemplarily described.
[0149] Figure 5 It is the software structure block diagram of the electronic device 100 in the embodiments of this application.
[0150] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely the application layer, application framework layer, Android runtime and system libraries, and kernel layer.
[0151] The application layer can include a series of application packages.
[0152] As Figure 5 shown, the application packages can include target applications, contacts, memos, calls, clipboard, gallery, maps, cameras, videos and other applications.
[0153] In some examples, the target application is an application with functions such as image display and processing, such as an image processing application or a drawing application. In some examples, the target application is configured with function logics such as user interface, work management, layer management, brush, and filters.
[0154] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.
[0155] As Figure 5 shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.
[0156] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0157] The content provider is used to store and obtain data, and make this data accessible to application programs. The data may include videos, images, audio, incoming and outgoing calls, browsing history and bookmarks, phone books, etc.
[0158] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build application programs. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
[0159] The phone manager is used to provide the communication function of the electronic device 100. For example, the management of call states (including answering, hanging up, etc.).
[0160] The resource manager provides various resources for application programs, such as localized strings, icons, pictures, layout files, video files, etc.
[0161] The notification manager enables application programs to display notification information in the status bar. It can be used to convey message types of notifications, which can automatically disappear after a short stay without user interaction. For example, the notification manager is used to inform that the download is completed, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or a scroll bar text, such as the notification of a background running application program, and can also be a notification that appears on the screen in the form of a dialogue window. For example, prompt text information in the status bar, emit a prompt sound, the electronic device vibrates, the indicator light flashes, etc.
[0162] Android runtime includes a core library and a virtual machine. Android runtime is responsible for the scheduling and management of the Android system.
[0163] The core library contains two parts: one part is the functional functions that need to be called by the Java language, and the other part is the core library of Android.
[0164] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0165] The system libraries may include a drawing engine. The system libraries may also include multiple other functional modules. For example: surface manager, Media Libraries, 3D graphics processing library (e.g., OpenGL ES), 2D graphics engine (e.g., SGL), etc.
[0166] In some embodiments, the drawing engine is used to implement the painting or image processing functions of the target application. The drawing engine includes, for example, modules such as layer composition, brush painting, filters, and rendering pipelines. These modules can assemble and configure the rendering pipeline according to their own logic, and the rendering pipeline is used to generate rendering instructions. For example, the layer composition module is used to perform the preprocessing process of the layers and the real-time layer composition process. In the preprocessing process, the layer composition module performs preprocessing such as adjusting the layer hierarchy order and pre-composing some layers. After that, in the real-time layer composition process, the layer composition module composes the preprocessed layers (or textures). And, before the layer composition, the layer composition module triggers the rendering pipeline to generate rendering instructions to instruct the electronic device 100 to compose the rendered layers.
[0167] The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
[0168] The media library supports the playback and recording of various common audio and video formats, as well as static image files, etc. The media library can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0169] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition, and layer processing, etc.
[0170] The 2D graphics engine is a drawing engine for 2D drawing. In some examples, the drawing engine includes a 3D graphics processing library and a 2D graphics engine.
[0171] The kernel layer is the layer between the hardware and the software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.
[0172] In some examples, an interface for the GPU to call the GPU storage and computing functions is included between the kernel layer and the system library, such as a rendering hardware interface. In some examples, the rendering hardware interface includes, for example, a direct extension (DX) 12 interface, a metal interface, a vulkan interface, an OpenGL interface, etc.
[0173] Figure 6 FIG. is a schematic flowchart of a layer composition method provided by an embodiment of the present application. It should be noted that this method is not limited by Figure 6 the specific order described below. It should be understood that in other embodiments, the order of some steps of this method can be interchanged according to actual needs, or some of the steps can also be omitted or deleted. The method includes the following steps:
[0174] S601. The electronic device obtains layer information.
[0175] In some embodiments, the electronic device starts a target application in response to a user operation and displays an interface of the target application. On the interface of the target application, the electronic device determines a layer indicated by the user operation according to the user operation and determines the layer as an active layer. Then, the electronic device can obtain layer information including foreground layer information located above the active layer, active layer information, and background layer information located below the active layer according to the positional relationship between the active layer and other layers in the layer list.
[0176] Exemplarily, the target application is a painting application. The electronic device displays image A in the target application. The layer list of image A includes three layers from top to bottom: layer 1, layer 2, and layer 3. The electronic device detects an operation of the user clicking on layer 2 in the layer list and determines that the user indicates to edit the content on layer 2. Then, the electronic device can determine that the layer information includes layer 2 as the active layer, layer 1 as the foreground layer, and layer 3 as the background layer. Or, during the process of displaying the editing interface corresponding to layer 3, the electronic device detects an operation of the user adding a new layer, and can add a new layer 4 below layer 3 and display the editing interface of layer 4. And, the electronic device can determine that the layer information includes layer 4 as the active layer, and layers 1, 2, and 3 as the foreground layers. Among them, in the scenario of editing layer 4, the layer information may not include the background layer.
[0177] Exemplarily, the target application is an image processing application. The electronic device receives pictures 1, 2, and 3 input by the user, and creates layer 1 for editing picture 1, layer 2 for editing picture 2, and layer 3 for editing picture 3. The electronic device detects an operation indicating that the user wants to edit picture 2, and can determine that the layer information includes that layer 2 is the active layer, layer 1 above layer 2 is the foreground layer, and layer 3 below layer 2 is the background layer.
[0178] S602. The electronic device determines that there is a layer in the foreground layer that can be preprocessed.
[0179] When there is a layer in the foreground layer that can be preprocessed, step S603 is executed; when there is no layer in the foreground layer that can be preprocessed, step S604 is executed.
[0180] In some embodiments, in order to reduce the number of layers synthesized in real time, the electronic device can preprocess the foreground layer and / or the background layer in advance.
[0181] In some examples, through preprocessing, the electronic device can reduce the number of layers in the foreground layer that participate in subsequent real-time synthesis, thereby effectively improving the efficiency of real-time layer synthesis. Therefore, when the electronic device determines that there is a layer in the foreground layer that can be preprocessed, it can execute step S603 to preprocess the foreground layer. Alternatively, when the electronic device determines that there is no layer in the foreground layer that can be preprocessed, it can execute step S604 to preprocess the background layer, where the preprocessing of the background layer is to pre-compose the background layer.
[0182] Exemplarily, when the electronic device determines that the layer meets any one of the composite layer combination condition, the exchange condition, and the combination condition, it can determine that there is a layer that can be preprocessed.
[0183] Among them, the composite layer includes an associated mask layer and a normal layer. For example, after the electronic device obtains the foreground layer, it determines that adjacent foreground layers can be combined into a composite layer. Then, the electronic device can pre-compose these foreground layers into a composite layer, thereby reducing the number of foreground layers participating in subsequent real-time layer synthesis. It should be understood that the number of foreground layers constituting the composite layer is not limited.
[0184] Among them, the swapping condition indicates that the hierarchical order between adjacent layers can be interchanged. For example, an electronic device obtains a background layer, an activation layer, and a first foreground layer that are sequentially set. The electronic device sequentially composes the background layer, the activation layer, and the first foreground layer from bottom to top to obtain a first transitional image. The background layer, the first foreground layer, and the activation layer are sequentially composed from bottom to top to obtain a second transitional image. Among them, if the first transitional image is the same as the second transitional image. Then the electronic device can determine that there are a first foreground layer and an activation layer that meet the swapping condition. In some examples, the electronic device preprocesses the first foreground layer and the activation layer that meet the swapping condition, such as swapping the hierarchical order of the first foreground layer and the activation layer, and transforming the first foreground layer into a background layer, thereby reducing the number of foreground layers participating in real-time composition subsequently and improving the layer composition efficiency.
[0185] Among them, the combining condition indicates that the mixing order between multiple adjacent layers can be changed. For example, an electronic device obtains a first foreground layer, a second foreground layer, and a third foreground layer that are sequentially set. The electronic device composes the second foreground layer and the third foreground layer to obtain a first transitional image; composes the first transitional image and the first foreground layer to obtain a second transitional image. The electronic device composes the first foreground layer and the second foreground layer to obtain a third transitional image; composes the third transitional image and the third foreground layer to obtain a fourth transitional image. Among them, if the second transitional image is the same as the fourth transitional image, then the electronic device can determine that there are a first foreground layer, a second foreground layer, and a third foreground layer that meet the combining condition. In some examples, the electronic device preprocesses the first foreground layer, the second foreground layer, and the third foreground layer that meet the combining condition to generate an intermediate image. Then, in the subsequent real-time layer composition process, the number of foreground layers participating in real-time composition is effectively reduced, and the layer composition efficiency is improved.
[0186] In some examples, the electronic device determines whether there are layers that can be preprocessed by identifying whether there are layers that meet the above composite layer combination conditions, swapping conditions, and combining conditions in the layer. For the detailed content of the composite layer combination conditions, swapping conditions, and combining conditions, please refer to the relevant descriptions below.
[0187] In some examples, the electronic device can reduce the number of layers in the background layer that participate in subsequent real-time composition through preprocessing, thereby effectively improving the efficiency of real-time composition of layers. Therefore, the electronic device can perform pre-composition processing on the background layer. Among them, the composition of the background layer does not change the order of layer composition from bottom to top, so the accuracy of the composition result can be guaranteed.
[0188] It should be understood that in some scenarios, the embodiments of the present application do not limit the execution order between step S602 and step S604. For example, the preprocessing of the foreground layer by the electronic device includes pre-composing part of the foreground layer, and the pre-composing of the foreground layer does not affect the pre-composing of the background layer. Then, the electronic device may also first execute step S604, and then execute step S602 and step S603; or, the electronic device may execute step S604, step S602, and step S603 simultaneously. In other scenarios, the preprocessing of the foreground layer by the electronic device includes adjusting the layer hierarchy order and changing the foreground layer to the background layer, then the electronic device needs to execute these steps in the order of step S602, step S603, and step S604. Among them, the preprocessing method for the electronic device to adjust the layer hierarchy order is described in detail in step S603, which will not be elaborated here.
[0189] S603. The electronic device preprocesses the foreground layer.
[0190] In some embodiments, the preprocessing of the foreground layer by the electronic device includes one or more of composite layer synthesis, layer order exchange, and grouped pre-synthesis of the foreground layer.
[0191] Exemplarily, as Figure 7 shown, step S603 includes steps S6031 - S6033, and various preprocessing methods of the above foreground layer are introduced through steps S6031 - S6033.
[0192] S6031. The electronic device performs composite layer synthesis on the foreground layer.
[0193] Among them, the composite layer is a special layer group, usually composed of a layer and a mask, and is used to achieve a specific combined effect. Then, in some examples, when the electronic device determines that the foreground layer includes foreground layers that can be combined into a composite layer, it can first pre-compose these foreground layers to generate a composite layer. The composite layer can be stored in the electronic device in the form of a temporary texture, thereby reducing the number of foreground layers, and further reducing the number of layers participating in real-time layer synthesis. In some examples, a group of composite layers includes at least one layer and at least one mask. For example, the composite layer can include a foreground layer and a mask layer.
[0194] Among them, the combined effect of the composite layer is achieved by mixing the layers and masks included in the composite layer. Therefore, pre-composing the composite layer in advance will not affect the final result of subsequent layer synthesis.
[0195] Exemplarily, as Figure 8As shown, the electronic device obtains a layer list. In response to a user operation, it determines the activated layer A[m], and based on the layer position relationship in the layer list, determines the foreground layers A[m+1]…A[n] located above the activated layer. After that, the electronic device traverses the foreground layers A[m+1]…A[n]. If the electronic device determines that the layers from the i-th layer to the j-th layer form a composite layer among them. Then, the electronic device pre-composes A[i] to A[j] to generate a composite layer. After that, the electronic device continues to traverse the foreground layers and skips A[i+1] to A[j] during the traversal of the foreground layers. The electronic device repeats the foregoing steps until the synthesis of all composite layers included in the foreground layers is completed. Among them, m, i, and j are positive integers.
[0196] In some examples, after the electronic device synthesizes a composite layer from the foreground layers A[i] to A[j], it can determine the layer order of the composite layer as the layer order closest to the activated layer among the synthesized foreground layers. For example, as Figure 8 shown, after the electronic device pre-composes the foreground layers A[i] to A[j], it obtains the composite layer A[i].
[0197] In some examples, the electronic device obtains a composite layer through pre-composing the foreground layers, and this composite layer can also be described as an intermediate image generated during the layer synthesis process.
[0198] In some examples, during the pre-composition of the composite layer, the electronic device can also traverse the background layer to obtain the composite layer included in the background layer.
[0199] In this way, through the pre-composition of the composite layer, the electronic device effectively reduces the number of foreground layers, thereby reducing the number of layers participating in the real-time synthesis in the subsequent real-time layer synthesis process, improving the layer synthesis efficiency, reducing the painting delay, and enhancing the user experience.
[0200] S6032. The electronic device exchanges the layer order of the foreground layer.
[0201] In some embodiments, if the layer order in which the foreground layer can be exchanged with the activated layer allows the foreground layer to become the background layer, then the number of foreground layers participating in the subsequent real-time synthesis can be reduced.
[0202] In some examples, for the layer blending algorithm, if for a blending algorithm f(A,B), exchanging its first input and second input results in the same outcome, that is, f(A,B) = f(B,A), then this blending algorithm is said to satisfy the exchange condition.
[0203] Exemplarily, as Figure 9As shown, the layer list includes layer A and layer B, where layer B is above layer A. The blending algorithm of layer B is f, and the blending result of layer A and layer B is layer C = f(A, B). If the electronic device swaps the positions of layer A and layer B, and sets layer A above layer B, the blending result C' of layer B and layer A is C' = f(B, A). If C' is the same as C, then the electronic device can determine that the blending algorithm f(A, B) satisfies the swap condition. That is, even if the electronic device swaps the positions of layer A and layer B, it will not affect the final result of layer composition.
[0204] Exemplarily, Table 1 shows some blending modes that satisfy the swap condition and their corresponding blending algorithms in common blending modes. It should be understood that the blending algorithms of the blending modes that satisfy the swap condition are not limited to the content shown in Table 1.
[0205] Table 1
[0206] Blending mode Blending algorithm Multiply mode A * B Linear Burn mode A + B - 1 Screen mode 1–(1–A)*(1–B)
[0207] In some embodiments, after the electronic device determines the active layer, the electronic device can obtain a foreground layer adjacent to the active layer in the foreground layer, and determine whether the blending algorithm between the foreground layer and the active layer satisfies the swap condition. If it is satisfied, the electronic device can swap the layer hierarchy order between the layer and the active layer, so as to change the foreground layer into a background layer adjacent to the active layer.
[0208] The electronic device repeats the above steps until it determines that the blending algorithm of the foreground layer adjacent to the active layer does not satisfy the swap condition, and stops swapping the layer hierarchy order of the foreground layer. At this time, the electronic device has changed the layer hierarchy order of multiple consecutive layers above the active layer whose blending algorithms satisfy the swap condition into background layers.
[0209] In some examples, if the blending algorithm between the active layer and the adjacent foreground layer does not satisfy the swap condition. Then, the electronic device may no longer perform layer swapping on the foreground layer. That is, the electronic device does not need to determine whether the blending algorithm of the layer adjacent to the active layer satisfies the swap condition anymore.
[0210] Exemplarily, as Figure 10 shown, the electronic device obtains the layer list, and in response to a user operation, determines the active layer A[m]. Then, according to the layer hierarchy relationship of the layers in the layer list, the electronic device can obtain that the blending algorithms of k consecutive foreground layers A[m + 1]... A[m + k] adjacent to the active layer above the active layer satisfy the swap condition with the blending algorithm of the active layer, where k is an integer. Then, the electronic device can move the k consecutive foreground layers A[m + 1]... A[m + k] below the active layer A[m].
[0211] In some examples, such as Figure 10 As shown, the blending algorithm of the foreground layer A[m + k + 1] does not satisfy the commutation condition with the blending algorithm of the active layer. Therefore, the electronic device will not swap the layer hierarchy order of the foreground layer A[m + k + 1] and the foreground layers above the foreground layer A[m + k + 1] to the background layer.
[0212] Among them, since the blending algorithms of the active layer and the active layers participating in the swap all satisfy the commutation condition, after swapping the layer hierarchy order of the foreground layer and the active layer, it will not affect the final result of layer composition. Therefore, the electronic device can swap adjacent layers whose blending algorithms satisfy the commutation condition. In some examples, after swapping the layer hierarchy order of the layers that satisfy the commutation condition, it will not affect the layer composition result. Therefore, after the electronic device moves k consecutive foreground layers A[m + 1]…A[m + k] below the active layer A[m], it will not affect the composition result of the layers A[m + 1]…A[m + k] and the active layer A[m].
[0213] In some examples, after the electronic device moves k consecutive foreground layers A[m + 1]…A[m + k] below the active layer A[m], it does not limit the layer hierarchy order among the layers A[m + 1]…A[m + k].
[0214] In some examples, after the electronic device moves k consecutive foreground layers A[m + 1]…A[m + k] below the active layer A[m], if the layers in the new background layers A[m + 1]…A[m + k] are adjacent to the original background layer, the electronic device can also determine whether the blending algorithm of the adjacent new background layer and the original background layer satisfies the commutation condition. If it satisfies the commutation condition, the electronic device can also swap the layer hierarchy order between the adjacent new background layer and the original background layer again. Then, the electronic device can repeat the above steps to complete the layer hierarchy order swap for all the layers in the background layer whose blending algorithms satisfy the commutation condition.
[0215] In this way, by swapping the layer hierarchy order of the foreground layers, the electronic device effectively reduces the number of foreground layers, thereby reducing the number of layers participating in real-time composition in the subsequent real-time layer composition process, improving the layer composition efficiency, reducing the painting latency, optimizing the follow-up performance of the display, and thus enhancing the user experience.
[0216] S6033. The electronic device performs pre-composition of foreground layer grouping.
[0217] In some embodiments, if some layers in the foreground layer can be pre-composed, then the number of foreground layers participating in subsequent real-time composition can be reduced. Among them, in order not to affect the final result of layer composition, the electronic device can perform grouped pre-composition on the foreground layers that satisfy the combination condition.
[0218] In some examples, for the blending algorithm of layers, if for a blending algorithm f(A, B), when it appears on three consecutive layers, if the calculation order is changed and the resulting result remains the same, that is, f(f(A, B), C) = f(A, f(B, C)), then this blending algorithm is said to satisfy the associative condition. Exemplarily, as Figure 11 shown, the layer list includes layer A, layer B, and layer C. The order of these three layers from bottom to top is layer A, layer B, and layer C. The blending algorithms for layer B and layer C are both f. The electronic device first synthesizes layer A and layer B to obtain an intermediate image D, and the intermediate image D = f(A, B) can be obtained. Then, the electronic device synthesizes layer C and the intermediate image D to obtain the final result E of layer synthesis, E = f(D, C) = f(f(A, B), C). If the electronic device changes the layer synthesis order and first synthesizes layer B and layer C to obtain an intermediate image D', the intermediate image D' = f(B, C) can be obtained. Then, the electronic device synthesizes layer A and the intermediate image D' to obtain the final result E' of layer synthesis, E' = f(A, D') = f(A, f(B, C)). If the results of E and E' are the same, then the blending algorithm f is said to satisfy the associative condition.
[0219] In some examples, after the electronic device determines that multiple layers satisfy the associative condition, it can apply for a temporary texture. Then, after the electronic device generates an intermediate image, it can save the intermediate image to the temporary texture. In some examples, during the grouped pre-synthesis process, the electronic device can also directly synthesize multiple layers to be pre-synthesized onto the temporary texture.
[0220] Exemplarily, Table 2 shows some blending modes that satisfy the associative condition and their corresponding blending algorithms in common blending modes. It should be understood that the blending algorithms of the blending modes that satisfy the associative condition are not limited to the content shown in Table 2.
[0221] Table 2
[0222] Blending mode Blending algorithm Normal mode B Multiply mode A * B Screen mode 1–(1–A)*(1–B)
[0223] In some embodiments, after the electronic device determines the foreground layers above the active layer, it can obtain one or more groups of foreground layers that satisfy the associative condition among them. The electronic device pre-synthesizes these one or more groups of foreground layers respectively, and one or more intermediate images can be obtained. Moreover, during the grouped pre-synthesis process of the foreground layers, the electronic device keeps the hierarchical order between the layers and the intermediate images unchanged. In this way, the number of foreground layers can be effectively reduced, and it will not affect the accuracy of the final result of layer synthesis during the subsequent real-time layer synthesis process.
[0224] Exemplarily, as Figure 12As shown, the electronic device traverses the foreground layers A[m + 1] to A[n]. If there are several consecutive layers with the same blending mode and satisfying the combination condition, these several foreground layers can be divided into a group, and the foreground layers in this group are synthesized into an intermediate image. In this way, the electronic device can obtain one or more intermediate images. Among them, the electronic device directly outputs the layers in the foreground layers that do not belong to any group (or performs separate layer output for these layers), and keeps the layer hierarchy order unchanged.
[0225] In this way, the electronic device obtains intermediate images through grouped pre-synthesis of the foreground layers. This method can effectively reduce the number of foreground layers, so that in the subsequent real-time layer synthesis process, the number of layers participating in the real-time synthesis is reduced, the layer synthesis efficiency is improved, the painting delay is reduced, and the user experience is improved.
[0226] In some scenarios, the embodiments of the present application do not limit the execution order of the above steps S6031 - step S6033. For example, the electronic device can first perform the layer hierarchy order exchange, then perform the composite layer synthesis, and then perform the grouped pre-synthesis of the foreground layers (that is, the electronic device executes in the order of step S6032 - step S6031 - step S6033). For another example, the electronic device can first perform the layer hierarchy order exchange, then perform the grouped pre-synthesis of the foreground layers, and then perform the composite layer synthesis (that is, the electronic device executes in the order of step S6032 - step S6033 - step S6031).
[0227] It should be understood that if the layer hierarchy order exchange is performed first, the multiple layers (or masks) corresponding to the composite layer will be combined together to perform the layer hierarchy order exchange.
[0228] In some scenarios, the electronic device may choose to execute one or more of the above steps S6031 - S6033. For example, the electronic device reduces the number of foreground layers by swapping the layer hierarchy order (i.e., the electronic device executes step S6032 alone). For another example, the electronic device reduces the number of foreground layers by pre - compositing the foreground layer groups (i.e., the electronic device executes step S6033 alone). For another example, the electronic device reduces the number of foreground layers by swapping the layer hierarchy order and pre - compositing the foreground layer groups (i.e., the electronic device executes steps S6032 and S6033). For another example, the electronic device reduces the number of foreground layers by swapping the layer hierarchy order and using composite layers (i.e., the electronic device executes steps S6031 and S6032). For another example, the electronic device reduces the number of foreground layers by composite layer synthesis and pre - compositing the foreground layer groups (i.e., the electronic device executes steps S6031 and S6033). For yet another example, the electronic device reduces the number of foreground layers by composite layer synthesis, swapping the layer hierarchy order, and pre - compositing the foreground layer groups (i.e., the electronic device executes steps S6031, S6032, and S6033).
[0229] That is to say, through the above steps S6031 - S6033, the embodiments of the present application introduce three methods for pre - processing the foreground layers. The execution order and the number of executions of these three pre - processing methods are not limited in the embodiments of the present application.
[0230] S604. The electronic device pre - processes the background layer.
[0231] In some embodiments, during the painting or image - processing process, the user generally only operates on the content of the active layer and does not change the content of the background layer. Then, after determining the active layer, the electronic device can perform pre - composition on the background layer in the synthesis order from bottom to top to generate an intermediate image. It can be seen that during the pre - composition process, the electronic device does not change the layer synthesis order. Therefore, during the subsequent real - time layer synthesis process, the electronic device synthesizes the intermediate image and the layers above the intermediate image in the order from bottom to top, which can ensure the accuracy of the final synthesis result.
[0232] In some examples, during the process of pre - processing the background layer, the electronic device can apply for a temporary texture. After that, after generating the intermediate image, the electronic device can save the intermediate image to the temporary texture. In some examples, during the process of pre - processing the background layer, the electronic device can also directly composite the background layer onto the temporary texture.
[0233] In some embodiments, the electronic device executes the above step S6032 to exchange the layer hierarchy order, changing the layer hierarchy order of some foreground layers that meet the exchange conditions and transforming them into background layers. Therefore, during the pre-composition of the background layer, the electronic device includes the layers with the changed layer hierarchy order of these partial layers in the pre-composed background layer.
[0234] Exemplarily, as Figure 10 shown, after the electronic device exchanges the layer hierarchy order of some foreground layers that meet the exchange conditions with the active layer, it obtains a layer list, and the background layer of this layer list includes the layers that meet the exchange conditions with the changed layer hierarchy order of these partial layers. After that, the electronic device executes the preprocessing stage of the background layer, and composes the current background layer into an intermediate image in the order from bottom to top.
[0235] It should be understood that if the electronic device exchanges the layer hierarchy order of the intermediate image 1 generated after grouped pre-composition with the active layer after grouped pre-composition of the foreground layer, this intermediate image 1 is transformed into a background layer. Then, during the process of the electronic device preprocessing the background layer to generate an intermediate image, it pre-composes this intermediate image 1 with other background layers to generate an intermediate image 2.
[0236] In this way, through the pre-composition of the background layer, the electronic device effectively reduces the number of foreground layers and background layers participating in the subsequent real-time layer composition, thereby improving the performance of layer composition.
[0237] In this way, through the above steps S603 and S604, the electronic device can generate at least one of the intermediate images such as the intermediate image that meets the composite layer combination conditions, the intermediate image that meets the combination conditions, and the intermediate image corresponding to the background layer, and participate in the subsequent real-time layer composition.
[0238] S605. The electronic device performs real-time layer composition.
[0239] In some embodiments, during the process of the electronic device preprocessing the layers in the layer list, in response to a user operation, it can obtain the modification of the content in the active layer by the user. In response to the user's modification operation, the electronic device synthesizes the current active layer, the un-preprocessed layers, and the intermediate image in real time to obtain the corresponding real-time synthesized layer and display it, thereby realizing providing the user with real-time modification effects.
[0240] It should be understood that through the preprocessing process of the above steps S602 - S604, in the layer list synthesized in real time by the electronic device, there may not be un-preprocessed layers, that is, all foreground layers and background layers have been pre-composed into corresponding intermediate images through preprocessing.
[0241] Exemplarily, as Figure 13As shown, in the real-time processing stage, the electronic device obtains a layer list, which includes the intermediate image B[1] corresponding to the background layer that has been pre-composited, the active layer B[2], and the foreground layers A[m+1]-A[n], where the foreground layers A[m+1]-A[n] include the intermediate images corresponding to the background layers that have been grouped and pre-composited. The electronic device mixes the layers and intermediate images in the layer list in ascending order from bottom to top to obtain the final mixed result.
[0242] In some examples, the electronic device may apply for a memory for storing the mixed result. Then, the electronic device synthesizes the intermediate image corresponding to the obtained background layer, the active layer, and the layer or intermediate image corresponding to the foreground layer into the applied memory in ascending order from bottom to top to obtain the target image of layer mixing.
[0243] In other examples, after the electronic device completes the pre-composition of the background layer, it can obtain the intermediate image corresponding to the background layer. Then, the electronic device synthesizes the active layer and the layer or intermediate image corresponding to the foreground layer with the intermediate image corresponding to the background layer in ascending order from bottom to top to obtain the target image of layer mixing.
[0244] In this way, the electronic device reduces the number of layers participating in real-time layer composition through at least one layer preprocessing method such as composite layer synthesis, layer hierarchy order exchange, foreground layer grouped pre-composition, and background layer pre-composition, effectively improving the performance of real-time composition, thereby reducing latency, avoiding display jitter, and enhancing the user experience.
[0245] The above combines Figures 6 - 13 This detailedly introduces various implementation methods of layer preprocessing provided by the embodiments of this application. Next, through several specific example scenarios, the layer processing process will be introduced.
[0246] Scenario 1: The layer list includes a background layer, an active layer, and multiple foreground layers.
[0247] Exemplarily, as Figure 14 shown, the electronic device obtains the background layer 141, the active layer 142, the foreground layer 143, the foreground layer 144, and the foreground layer 145 arranged in sequence. Then, the electronic device synthesizes the foreground layer 143, the foreground layer 144, and the foreground layer 145 to generate the intermediate image 146. Then, the electronic device synthesizes the background layer 141, the active layer 142, and the intermediate image 146 to generate the target image 147.
[0248] In this way, in the preprocessing stage, the electronic device pre-composes multiple foreground layers, effectively reducing the number of foreground layers participating in layer composition in the real-time processing stage, thereby improving the layer real-time composition efficiency.
[0249] In some embodiments, the electronic device determines that the foreground layers 143, 144, and 145 meet the combination condition based on the blending modes of the foreground layers 143, 144, and 145. After that, the electronic device synthesizes the foreground layers 143, 144, and 145 to generate an intermediate image 146.
[0250] In some examples, the combination condition indicates that the blending order between adjacent multiple layers can be changed.
[0251] Exemplarily, the combination condition specifically indicates that: if the electronic device synthesizes the foreground layers 144 and 145 to obtain a first transitional image, and then synthesizes the first transitional image and the foreground layer 143 to obtain a second transitional image. If the electronic device synthesizes the foreground layers 143 and 144 to obtain a third transitional image, and then synthesizes the third transitional image and the foreground layer 145 to obtain a fourth transitional image. Then, the second transitional image and the fourth transitional image are the same.
[0252] For example, as Figure 11 shown, for the combination condition, after the hierarchical order of the layers is changed, the synthesis result of the layers is the same, then these layers meet the combination condition. For example, the blending algorithms of these layers are the same and meet the combination condition.
[0253] In some embodiments, the electronic device determines that the intermediate image 146 and the active layer 142 do not meet the exchange condition based on the blending mode of the intermediate image 146 and the active layer 142, and maintains the hierarchical order of the background layer 141, the active layer 142, and the intermediate image 146. The electronic device synthesizes the background layer 141, the active layer 142, and the intermediate image 146 to generate a target image 147. Wherein, the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged.
[0254] Exemplarily, as Figure 14 shown, in the real-time processing stage, the electronic device maintains the hierarchical order of the background layer 141, the active layer 142, and the intermediate image 146, and after synthesizing the background layer 141, the active layer 142, and the intermediate image 146, generates a target image 147.
[0255] In some other embodiments, the electronic device determines that the intermediate image 146 and the active layer 142 meet the exchange condition based on the blending mode of the intermediate image 146 and the active layer 142. The electronic device synthesizes the intermediate image 146 and the background layer 141 to generate an intermediate image 151. After that, the electronic device synthesizes the intermediate image 151 and the active layer 142 to generate a target image 147.
[0256] For example, the swapping condition is specifically characterized by: sequentially synthesizing the background layer 141, the activation layer 142, and the intermediate image 146 from bottom to top to obtain a fifth transitional image; sequentially synthesizing the background layer 141, the intermediate image 146, and the activation layer 142 from bottom to top to obtain a sixth transitional image; wherein, the fifth transitional image and the sixth transitional image are identical. For example, as Figure 9 shown in the swapping condition, after swapping the activation layer 142 and the intermediate image 146, it does not affect the final layer synthesis result. For example, the blending algorithm of the activation layer 142 and the intermediate image 146 satisfies the swapping condition.
[0257] Exemplarily, as Figure 15 shown, in the preprocessing stage, the electronic device first pre-synthesizes the foreground layer 143, the foreground layer 144, and the foreground layer 145 into the intermediate image 146, and then determines that the intermediate image 146 and the activation layer 142 satisfy the swapping condition, such as the blending algorithm of the intermediate image 146 and the activation layer 142 satisfies the swapping condition. Then, the electronic device swaps the hierarchical order of the activation layer 142 and the intermediate image 146, and changes the intermediate image 146 into the background layer. After that, the electronic device can pre-synthesize the intermediate image 146 and the background layer 141 to generate an intermediate image 151. In this way, in the real-time processing stage, the electronic device only needs to synthesize the activation layer 142 and the intermediate image 151 to generate the target image 152, effectively reducing the number of layers participating in the real-time layer synthesis.
[0258] In some embodiments, there may be other foreground layers above the foreground layer 145, but the other foreground layers do not satisfy the combination condition with the foreground layer 143, the foreground layer 144, and the foreground layer 145 and cannot be preprocessed. Then, in the subsequent real-time processing stage, the other foreground also participates in the real-time layer synthesis.
[0259] In some embodiments, in the current scenario, foreground layers 143, 144, and 145 are foreground layers adjacent to the active layer 142. After the electronic device determines that the foreground layer 143 and the active layer 142 meet the swapping conditions, it can first swap the hierarchical order of the foreground layer 143 and the active layer 142. After that, after the electronic device determines that the foreground layer 144 and the active layer 142 meet the swapping conditions, it can then swap the hierarchical order of the foreground layer 144 and the active layer 142. After that, after the electronic device determines that the foreground layer 145 and the active layer 142 meet the swapping conditions, it can then swap the hierarchical order of the foreground layer 145 and the active layer 142. That is, the electronic device can also directly swap the foreground layer that meets the swapping conditions to the background layer without pre-compositing the foreground layers first. It should be understood that there may be other foreground layers above the foreground layer 145, but these other foreground layers and the active layer 142 do not meet the swapping conditions and cannot be pre-processed. Then, in the subsequent real-time processing stage, these other foregrounds also participate in the real-time layer composition.
[0260] In some embodiments, as Figure 14 shown, the electronic device determines that the pixel parameters of the active layer 142 have changed, and re-composes the background layer 141, the active layer 142 with changed pixel parameters, and the intermediate image 146 to generate another target image.
[0261] In this way, the layers participating in the real-time layer composition only include the background layer 141, the active layer 142, and the intermediate image 146, effectively improving the layer composition efficiency.
[0262] In some embodiments, as Figure 15 shown, the electronic device determines that the pixel parameters of the active layer 142 have changed, and re-composes the active layer 142 with changed pixel parameters and the intermediate image 151 to generate another target image.
[0263] In this way, the layers participating in the real-time layer composition only include the active layer 142 and the intermediate image 151, effectively improving the layer composition efficiency.
[0264] Scenario 2: The layer list includes a background layer set, an active layer, and a foreground layer.
[0265] Exemplarily, as Figure 16 shown, the electronic device obtains a sequentially set background layer set 161, an active layer 162, and a foreground layer 163. After that, the electronic device composes the foreground layer 163 and the background layer set 161 to generate an intermediate image 164. After that, the electronic device composes the active layer 162 and the intermediate image 164 to generate a target image 165.
[0266] Thus, in the preprocessing stage, the electronic device exchanges the layer order of the foreground layer and the active layer, transforms the foreground layer into the background layer, and pre-combines it with other background layers, effectively reducing the number of foreground layers participating in layer composition in the real-time processing stage, thereby improving the layer real-time composition efficiency.
[0267] In some examples, the background layer set 161 includes a first background layer and a second background layer arranged in sequence. Alternatively, the background layer set 161 may include a single layer obtained by combining the first background layer and the second background layer.
[0268] Thus, the electronic device can first exchange the layer order of the foreground layer and the active layer, and then pre-combine the background layer; the electronic device can also first pre-combine the background layer and then exchange the layer order of the foreground layer and the active layer. Thus, the layer preprocessing process can be flexibly implemented.
[0269] In some examples, the foreground layer 163 is a composite layer, and the composite layer includes an associated mask layer and a foreground layer.
[0270] Thus, the composite layer in the foreground layer can also participate in the exchange of the layer order with the active layer, thereby effectively reducing the number of layers participating in layer composition in real time.
[0271] In some embodiments, as Figure 16 shown, in the preprocessing stage, based on the blending mode of the foreground layer 163 and the active layer 162, the electronic device determines that the exchange condition is satisfied between the foreground layer 163 and the active layer 162. Then, the electronic device combines the foreground layer 163 and the background layer set 161 to generate an intermediate image 164.
[0272] In some examples, the exchange condition indicates that the layer order between adjacent layers can be interchanged.
[0273] Exemplarily, the background layer set 161 includes a first background layer and a second background layer arranged in sequence. The exchange condition specifically indicates that: the first background layer, the second background layer, the active layer 162, and the foreground layer 163 are combined in sequence from bottom to top to obtain a first transitional image. The first background layer, the second background layer, the foreground layer 163, and the active layer 162 are combined in sequence from bottom to top to obtain a second transitional image. Among them, the first transitional image and the second transitional image are the same. For example, as Figure 9 shown in the exchange condition, after exchanging the active layer 162 and the foreground layer 163, it does not affect the final layer composition result. For example, the blending algorithm of the active layer 162 and the foreground layer 163 satisfies the exchange condition.
[0274] In some embodiments, the electronic device determines that the pixel parameters of the active layer 162 have changed, recombines the active layer 162 with the changed pixel parameters and the intermediate image 164, and generates another target image.
[0275] In this way, the layers participating in the real-time layer synthesis only include the active layer 162 and the intermediate image 164, effectively improving the layer synthesis efficiency.
[0276] In some embodiments, there may be other foreground layers above the foreground layer 163, but the other foreground layers do not meet the exchange conditions with the active layer 162 and cannot be preprocessed. Then, in the subsequent real-time processing stage, the other foreground also participates in the real-time layer synthesis.
[0277] Scenario 3: The layer list includes multiple background layers, an active layer, and a foreground layer.
[0278] In some embodiments, as Figure 17 shown, the electronic device obtains the sequentially arranged background layer 171, background layer 172, background layer 173, active layer 174, and foreground layer 175. Then, the electronic device synthesizes the background layer 171, background layer 172, and background layer 173 to generate an intermediate image 176. Then, the electronic device synthesizes the foreground layer 175 and the intermediate image 176 to generate an intermediate image 177. Then, the electronic device synthesizes the active layer 174 and the intermediate image 177 to generate a target image 178.
[0279] In this way, in the preprocessing stage, the electronic device pre-synthesizes multiple background layers. Moreover, the electronic device exchanges the hierarchical order of the foreground layer and the active layer, transforms the foreground layer into a background layer, and then pre-synthesizes it with other background layers, effectively reducing the number of foreground layers participating in the layer synthesis in the real-time processing stage, thereby improving the real-time layer synthesis efficiency.
[0280] In some embodiments, as Figure 17 shown, in the preprocessing stage, the electronic device determines that the foreground layer 175 and the active layer 174 meet the exchange conditions based on the blending mode of the foreground layer 175 and the active layer 174. Then, the electronic device synthesizes the foreground layer 175 and the intermediate image 176 to generate an intermediate image 177.
[0281] In some examples, the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged.
[0282] Exemplarily, the swapping condition specifically represents: synthesizing the intermediate image 176, the activated layer 174, and the foreground layer 175 in sequence from bottom to top to obtain a first transitional image; synthesizing the intermediate image 176, the foreground layer 175, and the activated layer 174 in sequence from bottom to top to obtain a second transitional image. Among them, the first transitional image and the second transitional image are the same. For example, as Figure 9 shown in the swapping condition, after swapping the activated layer 174 and the foreground layer 175, it does not affect the final layer synthesis result. For example, the blending algorithm of the activated layer 174 and the foreground layer 175 satisfies the swapping condition.
[0283] In some embodiments, as Figure 17 shown, in the preprocessing stage, the electronic device determines that the background layer 171, the background layer 172, and the background layer 173 satisfy the combination condition based on the blending modes of the background layer 171, the background layer 172, and the background layer 173. After that, the electronic device synthesizes the background layer 171, the background layer 172, and the background layer 173 to generate the intermediate image 176.
[0284] In some examples, the combination condition represents that the blending order between adjacent multiple layers can be changed.
[0285] Exemplarily, the combination condition specifically represents: synthesizing the background layer 171 and the background layer 172 to obtain a third transitional image; synthesizing the third transitional image and the background layer 173 to obtain a fourth transitional image. Synthesizing the background layer 172 and the background layer 173 to obtain a fifth transitional image; synthesizing the fifth transitional image and the background layer 171 to obtain a sixth transitional image. Among them, the fourth transitional image and the sixth transitional image are the same.
[0286] For example, as Figure 11 shown in the combination condition, after the hierarchical order of the layers is changed, the synthesis result of the layers is the same, then these layers satisfy the combination condition. For example, the blending algorithms of these layers are the same and satisfy the combination condition.
[0287] In some embodiments, there may be other foreground layers above the foreground layer 175, but the other foreground layers and the activated layer 174 do not satisfy the swapping condition and cannot be preprocessed. Then, in the subsequent real-time processing stage, the other foreground also participates in the real-time layer synthesis.
[0288] In some scenarios, an electronic device displays a 4K canvas. In response to a user operation, the bottom - most layer is determined as the active layer. Then, the current layer list does not include the background layer, but only includes the active layer and the foreground layers above the active layer. Taking the multiply blend mode of the layers as an example, as shown in Table 3, when the number of layers included in the layer list is different, if the original scheme of all layers participating in real - time layer composition is used for layer blending, as the number of layers increases, the frames per second (FPS), that is, the frame rate, of the electronic device decreases accordingly, resulting in abnormal lags in the display of the electronic device. Moreover, when the number of layers is small, a good frame rate display effect cannot be obtained either. However, if the electronic device pre - processes the layers, the minimum number of layers participating in real - time composition can be 2 layers, then the frame rate of the electronic device can be maintained at a relatively high level, improving the user experience.
[0289] Table 3
[0290]
[0291]
[0292] The above combines Figures 6 - 17 has described in detail the layer composition method provided by the embodiments of the present application. The following combines Figure 18 to detail the electronic device provided by the embodiments of the present application.
[0293] In one possible design, Figure 18 is a schematic structural diagram of the electronic device provided by the embodiments of the present application. As Figure 18 shown, the electronic device 1800 may include: a transceiver unit 1801 and a processing unit 1802. The electronic device 1800 can be used to implement the functions of the electronic device involved in the above - mentioned method embodiments.
[0294] In some examples, the transceiver unit 1801 is used to support the electronic device 1800 to execute Figure 6 in S601.
[0295] In some examples, the processing unit 1802 is used to support the electronic device 1800 to execute Figure 6 in S602, S603, S604, and S605; and / or, used to support the electronic device 1800 to execute Figure 7 in S6031, S6032, and S6033.
[0296] Among them, the transceiver unit may include a receiving unit and a transmitting unit, and may be implemented by a transceiver or transceiver-related circuit components, and may be a transceiver or a transceiver module. The operations and / or functions of the various units in the electronic device 1800 respectively implement the corresponding processes of the layer synthesis method described in the above method embodiments. All relevant contents of the steps involved in the above method embodiments can be cited in the function descriptions of the corresponding functional units. For the sake of brevity, they will not be elaborated here.
[0297] In some examples, Figure 18 the illustrated electronic device 1800 may further include a storage unit ( Figure 18 not shown in the figure), and a program or instruction is stored in the storage unit. When the transceiver unit 1801 and the processing unit 1802 execute the program or instruction, Figure 18 the illustrated electronic device 1800 can execute the layer synthesis method described in the above method embodiments.
[0298] Figure 18 The technical effects of the illustrated electronic device 1800 can refer to the technical effects of the layer synthesis method described in the above method embodiments, and will not be elaborated here.
[0299] In addition to being in the form of the electronic device 1800, the technical solution provided in this application can also be a functional unit or chip in the electronic device, or a device used in conjunction with the electronic device.
[0300] This application embodiment also provides a chip system, including: a processor, the processor is coupled to a memory, and the memory is used to store a program or instruction. When the program or instruction is executed by the processor, the chip system implements the method in any of the above method embodiments.
[0301] In some examples, the processor in the chip system can be one or more. The processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented by software, the processor can be a general-purpose processor that implements by reading the software code stored in the memory.
[0302] In some examples, the memory in the chip system can also be one or more. The memory can be integrated with the processor or can be separately arranged from the processor, and the embodiments of this application do not limit this. Exemplarily, the memory can be a non-transitory processor, such as a read-only memory ROM, which can be integrated with the processor on the same chip or can be separately arranged on different chips. The embodiments of this application do not specifically limit the type of the memory and the setting manner of the memory and the processor.
[0303] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.
[0304] It should be understood that each step in the above method embodiments can be completed by the integrated logic circuit in the hardware of the processor or the instructions in the form of software. The method steps disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware processor, or executed and completed by the combination of the hardware and software modules in the processor.
[0305] The embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer is enabled to execute the above-related steps to implement the layer composition method in the above embodiments.
[0306] The embodiment of the present application also provides a computer program product. When the computer program product runs on a computer, the computer is enabled to execute the above-related steps to implement the layer composition method in the above embodiments.
[0307] In addition, the embodiment of the present application also provides a device. The device can specifically be a component or a module. The device may include one or more processors and a memory connected to each other. Among them, the memory is used to store a computer program. When the computer program is executed by one or more processors, the device is enabled to execute the layer composition method in each of the above method embodiments.
[0308] Among them, the device, the computer-readable storage medium, the computer program product or the chip provided in the embodiment of the present application are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, which will not be elaborated here.
[0309] The steps of the method or algorithm described in connection with the disclosed content of the embodiments of the present application can be implemented in a hardware manner or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory (RAM), flash memory, read only memory (ROM), erasable programmable ROM (EPROM), electrically EPROM (EEPROM), registers, hard disk, removable hard disk, CD-ROM, or any other form of storage medium well-known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC).
[0310] Through the description of the above embodiments, those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs; that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated here.
[0311] In several embodiments provided in the present application, it should be understood that the disclosed method can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division, and there can be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection shown or discussed with each other can be through some interfaces, indirect coupling, or communication connection of modules or units, and can be in an electrical, mechanical, or other form.
[0312] In addition, each functional unit in the various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0313] Computer-readable storage media include, but are not limited to, any of the following: USB flash drives, external hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs, etc., all kinds of media that can store program code.
[0314] As described above, it is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claimed rights.
Claims
1. A layer synthesis method, applied to an electronic device, characterized in that, The method includes: Obtaining a background layer, an activation layer, a first foreground layer, a second foreground layer, and a third foreground layer that are sequentially set; Based on the blending modes of the first foreground layer, the second foreground layer, and the third foreground layer, determining that the first foreground layer, the second foreground layer, and the third foreground layer satisfy a combination condition; the combination condition indicates that the blending order between adjacent multiple layers can be changed; Combining the first foreground layer, the second foreground layer, and the third foreground layer to generate a first intermediate image; Combining the background layer, the activation layer, and the first intermediate image to generate a first target image.
2. The method according to claim 1, characterized in that, The blending mode of the first foreground layer, the second foreground layer, or the third foreground layer is any one of the following: normal mode, multiply mode, and screen mode.
3. The method according to claim 2, wherein The combination condition specifically indicates: Combining the second foreground layer and the third foreground layer to obtain a first transitional image; combining the first transitional image and the first foreground layer to obtain a second transitional image; Combining the first foreground layer and the second foreground layer to obtain a third transitional image; combining the third transitional image and the third foreground layer to obtain a fourth transitional image; Wherein, the second transitional image and the fourth transitional image are the same.
4. The method according to any one of claims 1 to 3, characterized in that The generating of the first target image includes: Based on the blending mode of the first intermediate image and the activation layer, determining that the first intermediate image and the activation layer do not satisfy an exchange condition, and maintaining the hierarchical order of the background layer, the activation layer, and the first intermediate image; the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged; Combining the background layer, the activation layer, and the first intermediate image to generate the first target image.
5. The method according to any one of claims 1 to 3, characterized in that The generating of the first target image includes: Based on the blending mode of the first intermediate image and the activation layer, determining that the first intermediate image and the activation layer satisfy an exchange condition; the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged; Combining the first intermediate image and the background layer to generate a second intermediate image; Combining the second intermediate image and the activation layer to generate the first target image.
6. The method according to claim 4, wherein The exchange condition specifically indicates: Sequentially combining the background layer, the activation layer, and the first intermediate image from bottom to top to obtain a fifth transitional image; Sequentially combining the background layer, the first intermediate image, and the activation layer from bottom to top to obtain a sixth transitional image; Wherein, the fifth transitional image and the sixth transitional image are the same.
7. A method for layer synthesis, applied to an electronic device, characterized in that, The method includes: Obtaining a set of background layers, an activation layer, and a first foreground layer that are sequentially set; Based on the blending mode of the first foreground layer and the activation layer, determining that the first foreground layer and the activation layer satisfy an exchange condition; the exchange condition indicates that the hierarchical order between adjacent layers can be interchanged; Combining the first foreground layer and the set of background layers to generate a first intermediate image; Combining the activation layer and the first intermediate image to generate a first target image.
8. The method according to claim 7, wherein The set of background layers includes a first background layer and a second background layer that are sequentially set.
9. The method according to claim 8, characterized in that, The blending mode of the background layer set or the first foreground layer is any one of the following: multiply mode, linear burn mode, and screen mode.
10. The method according to claim 9, characterized in that, The exchange condition specifically represents: Sequentially synthesizing the first background layer, the second background layer, the activation layer, and the first foreground layer from bottom to top to obtain a first intermediate image; Sequentially synthesizing the first background layer, the second background layer, the first foreground layer, and the activation layer from bottom to top to obtain a second intermediate image; Wherein, the first intermediate image and the second intermediate image are the same.
11. The method according to any one of claims 7-10, characterized in that, The first foreground layer is a composite layer, and the composite layer includes an associated mask layer and a foreground layer.
12. The method according to any one of claims 7 to 10, characterized in that The method further includes: Determining that the pixel parameters of the activation layer change, and re-synthesizing the activation layer with the changed pixel parameters and the first intermediate image to generate a second target image.
13. A method for layer synthesis, applied to an electronic device, characterized in that, The method includes: Obtaining a first background layer, a second background layer, a third background layer, an activation layer, and a first foreground layer that are sequentially set; Synthesizing the first background layer, the second background layer, and the third background layer to generate a first intermediate image; Based on the blending mode of the first foreground layer and the activation layer, determining that the exchange condition is satisfied between the first foreground layer and the activation layer; the exchange condition represents that the hierarchical order between adjacent layers can be interchanged; Synthesizing the first foreground layer and the first intermediate image to generate a second intermediate image; Synthesizing the activation layer and the second intermediate image to generate a first target image.
14. The method according to claim 13, wherein The blending mode of the first background layer, the second background layer, or the third background layer is any one of the following: multiply mode, linear burn mode, and screen mode.
15. The method according to claim 14, wherein The exchange condition specifically represents: Sequentially synthesizing the first intermediate image, the activation layer, and the first foreground layer from bottom to top to obtain a first intermediate image; Sequentially synthesizing the first intermediate image, the first foreground layer, and the activation layer from bottom to top to obtain a second intermediate image; Wherein, the first intermediate image and the second intermediate image are the same.
16. The method according to any one of claims 13 to 15, characterized in that Before synthesizing the first background layer, the second background layer, and the third background layer to generate a first intermediate image, the method further includes: Based on the blending modes of the first background layer, the second background layer, and the third background layer, determining that the combination condition is satisfied among the first background layer, the second background layer, and the third background layer; the combination condition represents that the blending order among adjacent multiple layers can be changed.
17. The method according to claim 16, wherein The combination condition specifically represents: Synthesizing the first background layer and the second background layer to obtain a third intermediate image; synthesizing the third intermediate image and the third background layer to obtain a fourth intermediate image; Synthesizing the second background layer and the third background layer to obtain a fifth intermediate image; synthesizing the fifth intermediate image and the first background layer to obtain a sixth intermediate image; Wherein, the fourth intermediate image and the sixth intermediate image are the same.
18. An electronic device, characterized in that, Includes: A processor and a memory, the memory being coupled to the processor, the memory being configured to store computer program code, the computer program code including computer instructions, when the processor reads the computer instructions from the memory, causing the electronic device to execute the method according to any one of claims 1-6; or causing the electronic device to execute the method according to any one of claims 7-12; or causing the electronic device to execute the method according to any one of claims 13-17.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a computer program, when the computer program runs on an electronic device, causing the electronic device to execute the method according to any one of claims 1-6; or causing the electronic device to execute the method according to any one of claims 7-12; or causing the electronic device to execute the method according to any one of claims 13-17.
20. A computer program product, characterized in that, When the computer program product runs on a computer, causing the computer to execute the method according to any one of claims 1-6; or causing the computer to execute the method according to any one of claims 7-12; or causing the computer to execute the method according to any one of claims 13-17.
Citation Information
Patent Citations
Layer synthesis method and device, electronic equipment and storage medium
CN110377257A