Layer processing method and related apparatus

MYPI2025003513A0Undetermined Publication Date: 2024-10-20HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
MYPI2025003513
Authority / Receiving Office
MY · MY
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-20
Filing Date
2024-04-15
Publication Date
2024-10-20

AI Technical Summary

Technical Problem

In the existing technology, display freeze and delay problems caused by a large number of layers during layer synthesis affect the user experience.

Method used

By pre-synthesizing the layers that satisfy the associative law and have continuous layer order among multiple layers, a pre-synthesis layer is generated, and the layer is directly used for synthesis during user operation, thereby reducing the processing volume and improving synthesis efficiency.

Benefits of technology

It effectively reduces the processing load during layer synthesis, reduces display lag, and improves user experience. Users can see the operated image faster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure PI2025003513_DRAWING_001
    Figure PI2025003513_DRAWING_001
  • Figure PI2025003513_DRAWING_002
    Figure PI2025003513_DRAWING_002
  • Figure PI2025003513_DRAWING_003
    Figure PI2025003513_DRAWING_003
Patent Text Reader

Abstract

A layer processing method includes: displaying a first image, where the first image includes a plurality of layers; and performing layer composition based on a pre-composed layer and a first layer in response to a first user operation, to obtain a second image, where the first user operation is an operation performed by a user on the first layer in the plurality of layers, the pre-composed layer is obtained by performing pre-composition on target layers in the plurality of layers, and the target layers are at least two layers that are consecutive in a layer sequence in the plurality of layers and that satisfy an associative law. The image is obtained through layer composition based on the pre-composed layer obtained by performing pre-composition on the target layers. This helps shorten time consumed for image composition, and improve composition efficiency, thereby helping improve user experience.
Need to check novelty before this filing date? Find Prior Art

Description

A layer processing method and related device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on April 20, 2023, with application number 202310451566.5 and application name “A layer processing method and related device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminal technology, and in particular to a layer processing method and related devices. Background Art

[0003] Layers are like films containing elements like text or graphics, which are combined to form the entire image. Generally, layers are combined in a certain order. For example, the order from bottom to top is Layer 1, Layer 2, and so on, where n is a positive integer. Layer 1 is combined with Layer 2, and the result is combined with Layer 3, and so on, until all layers are combined to form the final image.

[0004] Currently, each time a layer is modified, all layers need to be synthesized in sequence to obtain the modified image. It can be imagined that the more layers there are, the more time-consuming the synthesis process will be each time a layer is modified, and the more likely it is to cause display freezes and display delays, thereby affecting the user experience.

[0005] Summary of the Invention

[0006] This application provides a layer processing method and related devices to improve synthesis efficiency, solve the problems of display freeze and delay, and improve user experience.

[0007] In the first aspect, the present application provides a layer processing method, which can be executed by an electronic device, or by a component configured in the electronic device (such as a chip, a chip system, etc.), or by a logic module or software that can realize all or part of the functions of the electronic device. The present application does not limit this.

[0008] Exemplarily, the method includes: displaying a first image, which includes multiple layers; in response to a first user operation, performing layer synthesis based on a pre-synthesized layer and the first layer to obtain a second image, wherein the first user operation is an operation performed by the user on the first layer among the multiple layers, the above-mentioned pre-synthesized layer is obtained by pre-synthesizing a target layer among the multiple layers, and the above-mentioned target layer is at least two layers among the above-mentioned multiple layers whose layer order is continuous and satisfies the associative law.

[0009] In the above technical solution, the pre-synthesized layer is obtained by pre-synthesizing at least two layers among multiple layers whose layer order is continuous and satisfies the associative law. When the user operates a layer among the multiple layers (such as the first layer), the electronic device can directly perform layer synthesis based on the pre-synthesized layer obtained by pre-synthesis. That is, the synthesis operation of the layers that satisfy the associative law and have a continuous layer order is omitted, which is conducive to reducing the processing amount, improving the synthesis efficiency, and solving the problems of display freeze and display delay. In other words, after the user performs an operation on the layer, he can see the image obtained based on the operation more quickly, which is conducive to improving the user experience.

[0010] In combination with the first aspect, in some possible implementations of the first aspect, before performing layer synthesis based on the pre-synthesized layer and the first layer to obtain the second image in response to the first user operation, the above method also includes: in response to the second user operation, pre-synthesizing the target layer among the above-mentioned multiple layers to obtain the pre-synthesized layer.

[0011] The pre-synthesized layer obtained by pre-synthesizing the target layer can be directly used for subsequent layer synthesis. For example, when a user operates a certain layer, the layer synthesis can be directly performed based on the pre-synthesized layer and the layer on which the user performs the operation. There is no need to synthesize multiple layers one by one every time the user performs an operation, which saves synthesis processing volume and improves synthesis efficiency.

[0012] Optionally, the second user operation includes an operation of the user opening the first image or an operation of the user on the second layer among the multiple layers.

[0013] In other words, when the user opens the first image, it triggers the electronic device to pre-synthesize the target layer to obtain a pre-synthesized layer, or the user's operation on a layer among the multiple layers of the first image (such as the second layer) triggers the electronic device to pre-synthesize the target layer to obtain a pre-synthesized layer.

[0014] It can be understood that if the user's operation on a certain layer (such as the second layer) among the multiple layers of the first image (i.e., the second user operation) triggers the electronic device to pre-synthesize the target layer to obtain a pre-synthesized layer, then in response to the second user operation, the electronic device can not only pre-synthesize the target layer but also display a third image. The third image is an image obtained based on the second user operation, which is different from the second image obtained based on the first user operation.

[0015] Optionally, the user's operation on the second layer among the multiple layers includes: the user's operation of modifying the second layer, or the user's operation of selecting a layer blending mode for the second layer.

[0016] The user's operation on the second layer can be an operation in which the user modifies the second layer (such as drawing the second layer with a brush), or an operation in which the user selects a layer blending mode for the second layer. This application does not limit this.

[0017] Similarly, the user's operation on the first layer among multiple layers (i.e., the first user operation) can be an operation in which the user modifies the first layer (such as drawing the first layer with a brush), or it can be an operation in which the user selects the layer blending mode of the first layer. This application does not limit this.

[0018] The first layer and the second layer may be the same layer or different layers, and this application does not limit this.

[0019] In combination with the first aspect, in some possible implementations of the first aspect, the first layer does not belong to the target layer.

[0020] It is easy to understand that if the first layer does not belong to the target layer, that is, the target layer has not been operated, layer synthesis can be performed directly based on the pre-synthesized layer obtained by pre-synthesizing the target layer.

[0021] One possible scenario is that the first layer is a layer other than the target layer in the multiple layers. For example, the multiple layers include layers 1 through 10, where layers 1 through 4 are the target layers and are pre-composited to obtain pre-composited layer 1. Layers 7 through 10 are also target layers and are pre-composited to obtain pre-composited layer 2. The first layer is, for example, layer 5, meaning that the first layer belongs neither to layers 1 through 4 nor to layers 7 through 10.

[0022] Another possible scenario is that the multiple layers include multiple groups of target layers, and the first layer belongs to a certain group of target layers. For example, the multiple layers include layers 1 to 10, where layers 1 to 4 are a group of target layers, which are pre-synthesized to obtain pre-synthesized layer 1. Layers 7 to 10 are also a group of target layers, which are pre-synthesized to obtain pre-synthesized layer 2. The first layer is, for example, layer 4, which means that the first layer belongs to layers 1 to 4, but not to layers 7 to 10. It is understandable that in this case, the electronic device can also perform layer synthesis based on pre-synthesized layer 2 obtained by pre-synthesizing layers 7 to 10. Relatively speaking, this also saves the time of synthesizing layers 7 to 10 and improves synthesis efficiency.

[0023] In combination with the first aspect, in some possible implementations of the first aspect, a target layer is determined among multiple layers included in the first image.

[0024] In combination with the first aspect, in some possible implementations of the first aspect, any layer in the target layer satisfies: the pre-synthesized layer obtained by pre-synthesizing with the previous layer and then pre-synthesizing with the next layer is the same as the pre-synthesized layer obtained by pre-synthesizing with the next layer and then pre-synthesizing with the previous layer, wherein the above-mentioned previous layer and next layer are determined according to the layer order.

[0025] For example, taking layer 2 in the target layer as an example, assuming that the previous layer of layer 2 is layer 3 and the next layer is layer 1, the pre-composite layer obtained by first pre-compositing layer 2 with layer 1 and then pre-compositing with layer 3 is the same as the pre-composite layer obtained by first pre-compositing layer 2 with layer 3 and then pre-compositing with layer 1.

[0026] In combination with the first aspect, in some possible implementations of the first aspect, the above-mentioned response to the first user operation, performing layer synthesis based on the pre-synthesized layer and the first layer to obtain the second image includes: responding to the first user operation, performing layer synthesis on the pre-synthesized layer, the first layer and the remaining layers to obtain the second image, where the remaining layers are layers in the multiple layers other than the target layer and the first layer.

[0027] Secondly, the present application provides another layer processing method, which can be executed by an electronic device, or by a component configured in the electronic device (such as a chip, a chip system, etc.), or by a logic module or software that can realize all or part of the functions of the electronic device. The present application does not limit this.

[0028] Exemplarily, the method includes: determining the confidence of each layer pair in at least one layer pair, each layer pair in the at least one layer pair includes any two adjacent layers in multiple layers of the first image; merging the target layer pair in the at least one layer pair to obtain a merged layer, the target layer pair being determined based on the confidence of each layer pair in the at least one layer pair; and displaying the merged layer and other layers in the multiple layers except the target layer pair.

[0029] In the above technical solution, the electronic device can determine the target layer pair to be merged through the confidence of each layer pair in at least one layer pair, merge the target layer pair, and display the merged layer and other layers outside the target layer pair. In this way, the number of displayed layers is reduced, and the performance requirements for the electronic device can be lowered. Users can view images with a larger number of layers through devices with lower performance, which is conducive to improving user experience.

[0030] In combination with the second aspect, in some possible implementations of the second aspect, before determining the confidence of each layer pair in at least one layer pair, the above method also includes: determining that the number of layers to be displayed exceeds the maximum number of layers supported by the electronic device.

[0031] In scenarios where the number of layers to be displayed exceeds the maximum number of layers supported by the electronic device, the solution provided in this application can be used to merge the target layer pairs, display the merged layers, and reduce the number of layers to be displayed, thereby facilitating users to smoothly open images with more layers than the maximum number of layers supported by the electronic device, thereby improving the user experience.

[0032] In combination with the second aspect, in some possible implementations of the second aspect, the confidence of each layer pair is determined based on the correlation and / or coverage of the layer pair. The correlation of the layer pair is used to reflect the physical distance between the two layers in the layer pair in the first image, and the coverage of the layer pair is used to reflect the degree of overlap between the two layers in the layer pair in the first image.

[0033] Optionally, each layer pair includes a first layer and a second layer, and the correlation degree of the layer pair satisfies: correlation degree = max(area of ​​the first layer, area of ​​the second layer) / area of ​​the union area of ​​the first layer and the second layer, where the boundary of the union area is determined by the boundary of the first layer and the boundary of the second layer.

[0034] It can be understood that the smaller the area of ​​the union region is, the smaller the physical distance between the first layer and the second layer in the first image is, and therefore, the less independent the two layers are.

[0035] Optionally, each layer pair includes a first layer and a second layer, and the coverage of the layer pair satisfies: coverage = area of ​​the overlapping area of ​​the first layer and the second layer / min (area of ​​the first layer, area of ​​the second layer).

[0036] The larger the area of ​​the overlapping region, the greater the degree of overlap between the two layers in the first image.

[0037] In combination with the second aspect, in some possible implementations of the second aspect, the confidence of each layer pair satisfies: confidence = correlation × K1 + coverage × K2, where K1 is the preset weight of the correlation, K2 is the preset weight of the coverage, 0≤K1≤1, 0≤K2≤1.

[0038] Among them, when K2=0, the target layer pair includes the layer pair with the highest correlation among at least one layer pair. The larger the correlation, the smaller the area of ​​the union region, and the smaller the physical distance between the first layer and the second layer in the first image. The layer pair with the highest correlation is selected for merging. The physical distance between the two layers included in this layer pair in the first image is smaller, which is conducive to retaining layer pairs with a larger distance, and thus maintaining the independence between layers.

[0039] When K1=0, the target layer pair includes at least one layer pair with the smallest coverage. The smaller the coverage, the smaller the area of ​​the overlapping region. The layer pair with the smallest coverage is selected for merging. The area of ​​the overlapping region of this layer pair is smaller, which helps to reduce the possibility of loss of drawing details between layers.

[0040] When K1≠0 and K2≠0, the target layer pair includes the layer pair with the highest confidence score among at least one layer pair. Merging the layer pair with the highest confidence score preserves the independence of the layers while avoiding loss of drawing details, thereby reducing the impact of the merged layers on the first image.

[0041] In combination with the second aspect, in some possible implementations of the second aspect, before determining the confidence of each layer pair in at least one layer pair, the above method also includes: determining the area of ​​each layer in the multiple layers.

[0042] The electronic device can determine the effective area of ​​each layer, thereby facilitating the calculation of the correlation and / or coverage, and then obtain the confidence of the layer pair, and determine the target layer pair based on the confidence of each layer pair.

[0043] In a third aspect, the present application provides an electronic device, comprising: a display module for displaying a first image, the first image comprising multiple layers; a drawing engine module for performing layer synthesis based on a pre-synthesized layer and a first layer in response to a first user operation to obtain a second image, wherein the first user operation is an operation by the user on the first layer among the multiple layers, the pre-synthesized layer is obtained by pre-synthesizing a target layer among the multiple layers, and the target layer is at least two layers among the multiple layers whose layer order is continuous and satisfies the associative law.

[0044] Optionally, the rendering engine module is further configured to: in response to a second user operation, pre-synthesize a target layer among the multiple layers to obtain a pre-synthesized layer.

[0045] Optionally, the second user operation includes an operation of a user opening the first image or an operation of a user on a second layer among the multiple layers.

[0046] Optionally, the user's operation on the second layer among the multiple layers includes: the user's operation of modifying the second layer, or the user's operation of selecting a layer blending mode for the second layer.

[0047] Optionally, the first layer does not belong to the target layer.

[0048] Optionally, the rendering engine module is further configured to: determine the target layer among a plurality of layers included in the first image.

[0049] Optionally, any layer in the target layer satisfies: a pre-synthesized layer obtained by pre-synthesizing with the previous layer and then pre-synthesizing with the next layer is the same as a pre-synthesized layer obtained by pre-synthesizing with the next layer and then pre-synthesizing with the previous layer, and the previous layer and the next layer are determined according to the layer order.

[0050] Optionally, the drawing engine module is specifically used to: perform layer synthesis on the pre-synthesized layer, the first layer and the remaining layers to obtain the second image, and the remaining layers are the layers of the multiple layers except the target layer and the first layer.

[0051] In a fourth aspect, the present application provides an electronic device, comprising: a drawing engine module, used to determine the confidence of each layer pair in at least one layer pair, each layer pair in the at least one layer pair includes any two adjacent layers in multiple layers of a first image; merging the target layer pair in the above-mentioned at least one layer pair to obtain a merged layer, the target layer pair being determined based on the confidence of each layer pair in the at least one layer pair; and a display module, used to display the above-mentioned merged layer and other layers in the multiple layers except the target layer pair.

[0052] Optionally, the rendering engine module is further configured to: determine that the number of layers to be displayed exceeds the maximum number of layers supported by the electronic device.

[0053] Optionally, the confidence of each layer pair is determined based on the correlation and / or coverage of the layer pair. The correlation of the layer pair is used to reflect the physical distance between the two layers in the layer pair in the first image, and the coverage of the layer pair is used to reflect the degree of overlap between the two layers in the layer pair in the first image.

[0054] Optionally, each layer pair includes a first layer and a second layer, and the correlation degree of the layer pair satisfies: correlation degree = max(area of ​​the first layer, area of ​​the second layer) / area of ​​the union area of ​​the first layer and the second layer, where the boundary of the union area is determined by the boundary of the first layer and the boundary of the second layer.

[0055] Optionally, each layer pair includes a first layer and a second layer, and the coverage of the layer pair satisfies: coverage = area of ​​the overlapping area of ​​the first layer and the second layer / min (area of ​​the first layer, area of ​​the second layer).

[0056] Optionally, the confidence of each layer pair satisfies: confidence = correlation × K1 + coverage × K2, where K1 is a preset weight of correlation, K2 is a preset weight of coverage, 0≤K1≤1, 0≤K2≤1.

[0057] Optionally, the rendering engine module is further configured to: determine the area of ​​each layer in the plurality of layers.

[0058] In a fifth aspect, the present application provides an electronic device comprising a processor, wherein the processor is used to execute the layer processing method described in the first aspect and any possible implementation of the first aspect, or to execute the layer processing method described in the second aspect and any possible implementation of the second aspect.

[0059] Optionally, the electronic device may further include a memory for storing instructions and data. The memory is coupled to the processor, and when the processor executes the instructions stored in the memory, the methods described in the above aspects may be implemented.

[0060] Optionally, the electronic device may further include a communication interface, and the communication interface is used to communicate with other devices. Exemplarily, the communication interface may be a transceiver, a circuit, a bus, a module, or other types of communication interfaces.

[0061] In a sixth aspect, the present application provides a chip system comprising at least one processor for supporting the implementation of the functions involved in the above-mentioned first aspect and any possible implementation method of the first aspect, or for supporting the implementation of the functions involved in the above-mentioned second aspect and any possible implementation method of the second aspect, for example, receiving or processing the data and / or information involved in the above-mentioned method.

[0062] In one possible design, the chip system further includes a memory, which is used to store program instructions and data, and the memory is located inside or outside the processor.

[0063] The chip system can be composed of chips, or can include chips and other discrete devices.

[0064] In the seventh aspect, the present application provides a computer-readable storage medium, including a computer program, which, when running on a computer, enables the computer to implement the method in the first aspect and any possible implementation of the first aspect, or to implement the method in the second aspect and any possible implementation of the second aspect.

[0065] In an eighth aspect, the present application provides a computer program product, comprising: a computer program (also referred to as code, or instructions), which, when executed, enables a computer to execute the method of the first aspect and any possible implementation of the first aspect, or to execute the method of the second aspect and any possible implementation of the second aspect.

[0066] It should be understood that the third to eighth aspects of the present application correspond to the technical solutions of the first and second aspects of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] FIG1 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0068] FIG2 is a block diagram of the software and hardware structure of the electronic device provided in an embodiment of the present application;

[0069] FIG3 is a schematic diagram of a scenario applicable to the method provided in an embodiment of the present application;

[0070] FIG4 is a schematic diagram of the architecture of a layer processing system provided in an embodiment of the present application;

[0071] FIG5 is a schematic flow chart of a layer processing method provided in an embodiment of the present application;

[0072] FIG6 is a schematic diagram of pre-synthesis of a target layer according to an embodiment of the present application;

[0073] FIG7 is another schematic diagram of pre-synthesis of a target layer provided by an embodiment of the present application;

[0074] FIG8 is another schematic diagram of pre-synthesis of a target layer provided by an embodiment of the present application;

[0075] FIG9 is another schematic diagram of pre-synthesis of a target layer provided by an embodiment of the present application;

[0076] FIG10 is a schematic diagram of a detailed process of pre-synthesizing a target layer according to an embodiment of the present application;

[0077] FIG11 is a schematic diagram of a detailed process of changing a layer blending mode according to an embodiment of the present application;

[0078] FIG12 is a schematic flow chart of another layer processing method provided in an embodiment of the present application;

[0079] FIG13 is a schematic diagram of the effective area of ​​a layer provided in an embodiment of the present application;

[0080] FIG14 is a schematic diagram of a union region provided in an embodiment of the present application;

[0081] FIG15 is a schematic diagram of an overlap area provided in an embodiment of the present application;

[0082] FIG16 is a detailed flowchart of the process of merging layers provided in an embodiment of the present application. DETAILED DESCRIPTION

[0083] The technical solution in this application will be described below with reference to the accompanying drawings.

[0084] To facilitate understanding of the embodiments of the present application, the following description is first made:

[0085] First, to facilitate a clear description of the technical solutions of the embodiments of this application, the embodiments of this application use terms such as "first" and "second" to distinguish between identical or similar items with substantially identical functions and effects. For example, the terms "first layer" and "second layer" are used solely to distinguish between different layers and do not limit their order. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that terms such as "first" and "second" do not necessarily imply differences.

[0086] Second, in the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship, but does not exclude the situation where the previous and next associated objects are in an "and" relationship. The specific meaning can be understood in conjunction with the context. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c; a and b; a and c; b and c; or a and b and c. Where a, b, c can be single or multiple.

[0087] Third, the electronic devices mentioned in the embodiments of the present application can be any type of device, including but not limited to: mobile phones, personal computers (PCs) (such as desktops, laptops, PDAs, tablets, etc.), wireless terminals in smart homes (such as smart TVs), vehicle-mounted devices, wearable devices, etc.

[0088] The possible hardware structure of the electronic device will be described in detail below with reference to FIG1 .

[0089] For example, FIG1 shows a schematic structural diagram of an electronic device 100. As shown in FIG1 , 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 speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0090] The processor 110 may include one or more processing units. For example, the processor 110 may include one or more of an application processor (AP), a microcontroller unit (MCU), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.

[0091] In this application, electronic device 100 can implement display functions using a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. For example, the GPU is used to render a synthesized image. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0092] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0093] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0094] In the present application, the memory can be used to store data of the pre-synthesized layer obtained after pre-synthesis of the target layer, so that the processor 110 can call the data to synthesize the image.

[0095] The processor 110 can perform different operations to implement different functions by executing instructions. The instructions can be, for example, instructions pre-stored in the memory before the device leaves the factory, or instructions read from a new application (APP) after the user installs it during use. This embodiment of the application does not impose any limitation on this.

[0096] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device via the power management module 141.

[0097] 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 input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193 and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0098] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, the baseband processor, and the like.

[0099] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0100] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process 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 for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0101] The modem processor may include a modulator and a demodulator. 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. The demodulator then 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 passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0102] The wireless communication module 160 can provide wireless communication solutions applied to the electronic device 100, including wireless local area networks (WLAN), such as wireless fidelity (Wi-Fi) networks, Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0103] 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 , so that electronic device 100 can communicate with the network and other devices through wireless communication technology.

[0104] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include one or more display screens 194.

[0105] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0106] The camera 193 is used to capture still images or videos. The object is projected onto the photosensitive element through the lens to generate an optical image. In some embodiments, the electronic device 100 may include one or more cameras 193.

[0107] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0108] The internal memory 121 can be used to store computer executable program codes, which include instructions. 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. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0109] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170 , such as the speaker 170A, the receiver 170B, the microphone 170C, and the headphone jack 170D, as well as the application processor.

[0110] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0111] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.

[0112] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.

[0113] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.

[0114] The headphone jack 170D is used to connect a wired headphone and can be a USB interface 130 or a 3.5 mm (millimeter, mm) open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0115] The buttons 190 include a power button (also known as a power button), a volume button, etc. The buttons 190 can be mechanical buttons or touch buttons. The electronic device 100 can receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0116] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0117] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0118] It should be understood that the structure illustrated in this application does not constitute a specific limitation on the electronic device 100. In other embodiments, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0119] The possible software structure of the terminal will be described in detail below with reference to FIG. 2 .

[0120] Figure 2 is a block diagram of the software and hardware of an electronic device applicable to the method provided in an embodiment of the present application. For example, Figure 2 may be a block diagram of the software and hardware of a mobile phone.

[0121] As shown in Figure 2, a layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other via software interfaces. In some embodiments, the Android system is divided into four layers: from top to bottom, the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0122] The application layer can include a series of application packages. As shown in Figure 2, the application layer can include lock screen applications, desktop applications, etc. Desktop applications can further include calendars, maps, music, short messages, calls, gallery, smart home, etc.

[0123] In the present application, the application layer may also include, for example, a painting APP, which can be used to draw images, etc.

[0124] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions. As shown in Figure 2, the application framework layer may include activity management services, process management services, resource management services, drawing services, power management services (PMS), window management services, etc. This application does not limit the specific services included.

[0125] The drawing service can be used to draw the interface. For example, the drawing service can convert the application layout and resources into a format that can be recognized by the display service of the kernel layer. The drawing service can send the drawn interface to the display service of the kernel layer to display the drawn interface.

[0126] The Android runtime can include core libraries and a virtual machine. The Android runtime is responsible for scheduling and management of the Android system.

[0127] The core library can contain 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 the Android system.

[0128] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0129] The system library may include multiple functional modules, such as status monitoring services, surface managers, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), and 2D graphics engines (e.g., SGL).

[0130] The status monitoring service is used to determine the specific orientation of the mobile phone, the physical state of the flexible screen, etc. based on the monitoring data reported by the kernel layer. The surface manager is used to manage the display subsystem and provide the fusion of 2D and three-dimensional (3D) layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The three-dimensional graphics processing library is used to implement three-dimensional graphics drawing, image rendering, synthesis and layer processing. The 2D graphics engine is a drawing engine for 2D drawing.

[0131] The kernel layer is the layer between hardware and software. The kernel layer includes at least power management services, sensor services (also known as sensor drivers), display services (also known as display drivers), camera drivers, audio drivers, etc. This embodiment of the application does not impose any restrictions on this.

[0132] As shown in Figure 2, the system libraries and kernel layer below the application framework layer are referred to as the underlying system. This underlying system includes the underlying display system for providing display services. For example, the underlying display system includes the display driver in the kernel layer and the surface manager in the system libraries.

[0133] Below the underlying system is the hardware, which provides the foundation for software operation. As shown in Figure 2, the hardware of the terminal may include but is not limited to the power button, sensor, display, fingerprint, camera, etc.

[0134] It should be understood that the structures of the terminals shown in FIG. 1 and FIG. 2 are merely examples and should not constitute any limitation to the embodiments of the present application.

[0135] To facilitate understanding of the layer processing method provided in the embodiments of the present application, the application scenarios of the method provided in the embodiments of the present application are described below. It is understood that the application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application.

[0136] FIG3 is a schematic diagram of a scenario applicable to the method provided in an embodiment of the present application.

[0137] As shown in Figure 3, a user opens an image through a painting app and modifies certain elements in the image (i.e., a certain layer), such as using a brush to modify certain elements in the image. It can be understood that the above image includes multiple layers, and the layers are synthesized in sequence to form the entire image. For example, the layers in the image shown in Figure 3 include: a layer for the character's facial features, a layer for the character's right ear, a layer for the character's hair, a layer for the character's upper body, a layer for the character's mouth, etc., wherein the image shown in Figure 3 and the layers it includes are only examples and should not constitute any limitation to the embodiments of this application.

[0138] Each time a user modifies a layer, the electronic device (such as the computer shown in Figure 3) must synthesize all layers in layer order (such as from bottom to top) to obtain the modified image and then display it. It can be imagined that the more layers there are, the more time it takes to synthesize each time a layer is modified, and the more likely it is to cause display freezes and display delays, thereby affecting the user experience.

[0139] To solve the above problems, the present application provides a layer processing method, by pre-synthesizing at least two layers (i.e., target layers) among the multiple layers included in the image that satisfy the associative law and have a continuous layer order, obtaining and saving the data of the pre-synthesized layer, so that the data of the above-mentioned pre-synthesized layer can be directly used for the synthesis of the modified image. For example, when modifying a certain layer in the image (such as the first layer), the data of the above-mentioned pre-synthesized layer can be used to avoid synthesizing the layers one by one according to the layer order each time, reducing the processing amount, thereby improving the image synthesis efficiency, reducing display jams, and improving fluency. That is, as soon as the user makes a modification, he can see the modified image in time, which is beneficial to improving the user experience.

[0140] Before describing the embodiments of the present application in detail, in order to better understand the methods provided by the embodiments of the present application, the terms involved in the present application will be briefly explained below.

[0141] 1. Layers: These are the widgets that make up an image. Each widget is drawn as a separate unit. Layers are like filmstrips containing elements like text or graphics. Layers are combined to form the entire image, as shown in Figure 3. Generally, layer composition follows a certain order. For example, from bottom to top (think of it like looking down at an image, with layers stacked up from the bottom up), the order is Layer 1, Layer 2, and so on, where n is a positive integer. Layer 1 is composited with Layer 2, and the resulting composite is then composited with Layer 3, and so on, until all layers are composited to form the final image.

[0142] 2. Associativity: This means that in an expression containing two or more associative operators, as long as the positions of the operators remain unchanged, the order of operations will not affect the resulting value. For example, in this application, layers satisfying the associativity mean that the order in which they are composited does not affect the resulting composite.

[0143] 3. Layer synthesis: This can also be called layer blending, which refers to combining elements of two layers. For example, in this application, an image is obtained by synthesizing multiple layers in a layer order. An electronic device can display an image obtained by synthesizing multiple layers, and can also display multiple layers to facilitate the user to select the layer to be modified. The pre-synthesized layer in this application is a layer obtained by synthesizing the target layer. It can be considered as the result of synthesizing the target layer and does not need to be displayed to the user.

[0144] Layer blending (or layer compositing) has different blending modes. A layer blending mode is how the colors of a layer are superimposed on the layers below it. Two layers will produce different results when different blending modes (or compositing modes) are selected. Common layer blending modes include but are not limited to: Normal, Darken, Multiply, Color Burn, Linear Burn, Darker Color, Lighten, Screen, Color Dodge, Linear Dodge, Lighter Color, Overlay (or Cover), Soft Light, Vivid Light, Linear Light, Pin Light, Solid Color Blend, Difference, Exclusion, Subtract, Divide, Hue, Saturation, Color, Value, etc.

[0145] 4. Layer merging: In this application, it refers to merging at least two layers to form one layer, which can be called a merged layer. In this application, layer merging is irreversible, that is, after the layers are merged, the at least two layers constituting the merged layer will not be displayed.

[0146] It should be understood that in the present application, layer synthesis and layer merging are different. For example, in the embodiment shown in FIG5 , the pre-synthesized layer obtained by pre-synthesizing the target layer is an intermediate data in the layer synthesis process. The pre-synthesized layer is continued to be used for layer synthesis to obtain an image. The pre-synthesized layer will not be displayed to the user. In the embodiment shown in FIG12 , layer merging refers to merging two or more layers to obtain a layer. The layer can include the content of the above two or more layers, but the number of layers is reduced. For example, image 1 has 10 layers, namely layers 1 to 10. Two of the layers (such as layers 9 and 10) are merged to obtain layer A. Layer A includes the content of layers 9 and 10. However, in fact, image 1 currently has only 9 layers, namely layers 1 to 8 and layer A. When image 1 is opened, the electronic device can display layers 1 to 8 and layer A to the user.

[0147] Before describing in detail the layer processing method provided by the present application, the architecture of the layer processing system provided by an embodiment of the present application will be described in detail with reference to FIG4 .

[0148] FIG4 is a schematic diagram of the architecture of a layer processing system provided in an embodiment of the present application.

[0149] The system includes a business layer and a painting engine layer. The business layer can include multiple functional modules, such as a drawing operation module, a brush management module, a color management module, and a data management module. The painting engine layer can also include multiple functional modules, such as a layer management module, a color framework module, a video framework module, a drawing engine module, a gesture framework module, a stylus framework module, an artificial intelligence (AI) engine module, a brush framework module, and a data framework module. In this application, the above system (including the business layer and the painting engine layer) can be packaged into a single application and placed in the application layer shown in Figure 2. Alternatively, the various functional modules of the business layer can be placed in the application layer, and the various functional modules of the painting engine layer can be placed in the application framework layer shown in Figure 2. This application does not limit this.

[0150] In this application, the business layer can be used for human-computer interaction, such as sending the identifier of the operated layer to the drawing engine layer in response to user operations. The drawing engine module can be used to pre-synthesize the target layer to obtain a pre-synthesized layer; it can also be used to determine the layers that satisfy the associativity law and thus determine the target layer. The data framework module can be used to store data, such as data for the active layer, foreground layer, and background layer.

[0151] It should be understood that the functional modules included in the above system are merely examples. In other embodiments, the system may include more or fewer modules. For example, a rendering framework module may be included, which can be used to notify the rendering engine module of messages from the business layer. Another example is a display module, which can be used to display images and their layers. For example, in this application, the display module can be used to display a first image and the multiple layers included in the first image.

[0152] It should also be understood that the division of the functional modules of the system in the embodiments of the present application is illustrative and is merely a logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in the various embodiments of the present application may be integrated into a single processor, or may exist physically as separate modules, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or software functional modules.

[0153] The layer processing method provided by this application will be described in detail below with reference to specific embodiments.

[0154] It should be understood that the embodiments shown below describe the method from the perspective of electronic devices, but should not constitute any limitation on the execution subject of the method. As long as it is possible to run a computer program that records the method provided by the embodiment of the present application, the method provided by the embodiment of the present application can be executed. For example, the electronic device can also be replaced by a component (such as a chip, a chip system, etc.) configured in the electronic device, or other functional modules that can call a program and execute the program, and the embodiment of the present application does not limit this.

[0155] Figure 5 is a schematic flow chart of a layer processing method 500 provided by an embodiment of the present application. The method 500 shown in Figure 5 may include step 510 and step 520. Each step in the method 500 is described in detail below.

[0156] In step 510 , a first image is displayed, the first image including a plurality of layers.

[0157] The first image may be an image in any format, and the first image is an image obtained by sequentially synthesizing multiple layers in a layer order.

[0158] It should be understood that if a layer of an image is modified or a layer blending mode is selected, the layer will change, and the image resulting from combining the layer with other layers will also be different from the previous image. Therefore, for ease of distinction, if a layer among the multiple layers of a first image is modified, the resulting image is referred to as a second image. The number of layers in each image remains the same.

[0159] For example, in a painting scenario, in response to a user opening a first image through a painting app, the electronic device displays the first image, which includes multiple layers. Furthermore, the electronic device may also display multiple layers of the first image to facilitate the user's selection of a layer for which a layer blending mode needs to be modified or changed.

[0160] In step 520 , in response to the first user operation, layer synthesis is performed based on the pre-synthesized layer and the first layer to obtain a second image.

[0161] The first user operation is an operation performed by the user on a first layer among the multiple layers of the first image. The pre-composited layers are obtained by pre-compositing target layers among the multiple layers. The target layers are at least two layers among the multiple layers that are continuous in layer order and satisfy the associative law.

[0162] In other words, in response to the user's operation on the first layer in the first image, the electronic device can directly perform layer synthesis based on the pre-synthesized layer obtained by pre-synthesizing the target layer and the first layer to obtain the second image.

[0163] One possible scenario is that the first layer is a layer other than the target layer among the multiple layers. For example, the multiple layers include layers 1 to 10, where layers 1 to 4 are target layers and are pre-synthesized to obtain pre-synthesized layer 1. Layers 7 to 10 are also target layers and are pre-synthesized to obtain pre-synthesized layer 2. The first layer is, for example, layer 5, which means that the first layer does not belong to layers 1 to 4 or layers 7 to 10. In this case, the electronic device can perform layer synthesis based on pre-synthesized layer 1, pre-synthesized layer 2, and layer 5. More specifically, pre-synthesized layer 1, layer 5, layer 6, and pre-synthesized layer 2 are sequentially synthesized.

[0164] Another possible scenario is that the multiple layers include multiple groups of target layers, and the first layer belongs to a certain group of target layers. For example, the multiple layers include layers 1 to 10, where layers 1 to 4 are a group of target layers, which are pre-synthesized to obtain pre-synthesized layer 1. Layers 7 to 10 are also a group of target layers, which are pre-synthesized to obtain pre-synthesized layer 2. The first layer is, for example, layer 4, that is, the first layer belongs to layers 1 to 4, but not to layers 7 to 10. It is understandable that in this case, the electronic device can also perform layer synthesis based on pre-synthesized layer 2 obtained by pre-synthesizing layers 7 to 10. For example, the electronic device can perform layer synthesis based on pre-synthesized layer 2 and layer 4. In more detail, layer synthesis can be performed on layers 1, 2, 3, 4, 5, 6, and pre-synthesized layer 2 in sequence.

[0165] Optionally, the user's operation on the first layer among multiple layers of the first image (i.e., the first user operation) may be an operation in which the user modifies the first layer (such as drawing the first layer with a brush), or an operation in which the user selects a layer blending mode for the first layer. This application does not limit this.

[0166] As mentioned above, the pre-synthesized layer is obtained by pre-synthesizing the target layer. The following will describe in detail the process of determining the target layer and pre-synthesizing the target layer.

[0167] Optionally, after step 510 and before step 520 , the method 500 further includes step 511 : in response to a second user operation, pre-compositing a target layer among the multiple layers to obtain a pre-composited layer.

[0168] Precompositing refers to the layer composition resulting from image modifications. For example, precompositing the target layer creates a precomposited layer. This precomposited layer can be used to compose a new image the next time the image is modified. The layer created by precompositing is called a precomposited layer.

[0169] It can be understood that in the present application, the pre-synthesized layer will not be displayed on the screen, that is, the user will not be aware of the pre-synthesized layer.

[0170] Optionally, the second user operation includes a user operation of opening the first image or a user operation of a second layer among the multiple layers.

[0171] That is, when a user opens the first image, the electronic device is triggered to pre-compose the target layer, resulting in a pre-composed layer. Alternatively, when a user operates on a layer (e.g., the second layer) among the multiple layers of the first image, the electronic device is triggered to pre-compose the target layer, resulting in a pre-composed layer. The following uses the example of a user operating on a layer (e.g., the second layer) among the multiple layers of the first image to trigger the electronic device to pre-compose the target layer.

[0172] If the user's operation on a certain layer (such as the second layer) among the multiple layers of the first image (i.e., the second user operation) triggers the electronic device to pre-synthesize the target layer to obtain a pre-synthesized layer, then in response to the second user operation, the electronic device can not only pre-synthesize the target layer but also display a third image. The third image is an image obtained based on the second user operation and can be distinguished from the second image obtained based on the first user operation.

[0173] Optionally, the user's operation on the second layer among the multiple layers may be an operation of the user modifying the second layer, or an operation of the user selecting a layer blending mode for the second layer, which is not limited in this application.

[0174] The target layer is described in detail below.

[0175] The target layer includes at least two layers whose layer order is continuous, and each layer of the at least two layers satisfies the associative law.

[0176] For any layer in the target layer to satisfy the associativity rule, it means that the pre-composited layer obtained by pre-compositing with the previous layer and then with the next layer is the same as the pre-composited layer obtained by pre-compositing with the next layer and then with the previous layer. The previous and next layers are determined by the layer order. In other words, changing the order of pre-compositing layers does not affect the pre-compositing result.

[0177] For example, layer 1, layer 2, and layer 3 are three layers in a continuous layer order. The pre-synthesized layer obtained by pre-synthesizing layer 2 with layer 3 and then with layer 1 is the same as the pre-synthesized layer obtained by pre-synthesizing layer 2 with layer 1 and then with layer 3. Then layer 2 satisfies the associative law.

[0178] The process of determining the target layer from the multiple layers of the first image will be described in detail below.

[0179] One possible design is that the electronic device traverses each layer of the multiple layers included in the first image, and determines at least two layers that satisfy the associative law and have a continuous layer sequence. The at least two layers are the target layers.

[0180] Another possible design is that the electronic device traverses each of the multiple layers included in the first image to determine a layer that does not satisfy the associative law. When a layer that does not satisfy the associative law is found, the electronic device continues to traverse the upper layer (or lower layer) of the layer that does not satisfy the associative law, using the layer that does not satisfy the associative law as a boundary. Then, based on the layer that does not satisfy the associative law, the electronic device determines at least two layers that satisfy the associative law and have a continuous layer sequence. These at least two layers are target layers. After the electronic device determines the target layer, it pre-synthesizes the target layer to obtain a pre-synthesized layer.

[0181] Several examples of pre-synthesis of the target layer are given below in conjunction with FIG. 6 to FIG. 9 .

[0182] In this application, the layer on which the user performs an operation (e.g., the first layer) is referred to as the active layer, the layers above the active layer are referred to as the foreground layers, and the layers below the active layer are referred to as the background layers. It is understood that when the active layer changes (e.g., the layer on which the user performs an operation one time is different from the layer on which the user performs an operation the next time), the layers included in the foreground and background layers will also be different.

[0183] FIG6 is a schematic diagram of pre-synthesis of a target layer provided in an embodiment of the present application.

[0184] As shown in Figure 6, the first image includes multiple layers including layer A, layer B, layer C, layer D, layer E, layer F, layer G, layer H, layer I, layer J, and layer K. Among them, the active layer (that is, the layer on which the user performs an operation) is layer E, the foreground layers are layers F to layer K, and the background layers are layers A to layer D. The electronic device determines that layers A to layer D satisfy the associative law, and layers F to layer K satisfy the associative law. Further, layers A to layer D are pre-synthesized to obtain pre-synthesized layer 1, and layers F to layer K are pre-synthesized to obtain pre-synthesized layer 2, wherein layers A to layer D are examples of target layers, and layers F to layer K are also examples of target layers. The electronic device can save the above-mentioned pre-synthesized layer 1 and pre-synthesized layer 2 so that the next time layer E is modified, the above-mentioned pre-synthesized layers can be directly used to synthesize the image.

[0185] FIG7 is another schematic diagram of pre-synthesis of a target layer provided by an embodiment of the present application.

[0186] As shown in Figure 7, the first image includes multiple layers, layers A through K. The active layer (i.e., the layer on which the user performs an operation) is layer E, the foreground layers are layers F through K, and the background layers are layers A through D. The electronic device determines that layers A through D satisfy the associative law, layers G through K satisfy the associative law, and layer F does not satisfy the associative law. Furthermore, layers A through D are pre-synthesized to obtain pre-synthesized layer 1, and layers G through K are pre-synthesized to obtain pre-synthesized layer 2. Layers A through D are examples of target layers, and layers G through K are also examples of target layers. The electronic device can save these pre-synthesized layers 1 and 2 so that the next time layer E or layer F is modified, the pre-synthesized layers can be directly used to synthesize the image.

[0187] It should be understood that the next time a layer from layers G to K is modified, pre-composite layer 1 obtained by pre-compositing layers A to D can be directly used to compose the image. The next time a layer from layers A to D is modified, pre-composite layer 2 obtained by pre-compositing layers G to K can be directly used to compose the image.

[0188] FIG8 is another schematic diagram of pre-synthesis of a target layer provided in an embodiment of the present application.

[0189] As shown in Figure 8, the first image includes multiple layers, layers A through K. The active layer (i.e., the layer on which the user performs an operation) is layer E, the foreground layers are layers F through K, and the background layers are layers A through D. The electronic device determines that layers A through D satisfy the associative law, layers F and layers H through K satisfy the associative law, and layer G does not satisfy the associative law. Since layers A through D are sequentially continuous, they can be referred to as target layers. Layers H through K are sequentially continuous and can be referred to as target layers. However, layer F is a single layer and is not continuous with layers H or D, so it cannot be the target layer. Furthermore, layers A through D are pre-composited to obtain pre-composited layer 1, and layers H through K are pre-composited to obtain pre-composited layer 2. Layers A through D are examples of target layers, and layers H through K are also examples of target layers. The electronic device can save these pre-composited layers 1 and 2 so that the next time a layer is modified, the pre-composited layers can be directly used to compose an image.

[0190] FIG9 is another schematic diagram of pre-synthesis of a target layer provided in an embodiment of the present application.

[0191] As shown in Figure 9, the first image includes multiple layers, layers A to K. The active layer (i.e., the layer on which the user performs an operation) is layer E, the foreground layers are layers F to K, and the background layers are layers A to D. The electronic device determines that layers A to D satisfy the associative law, layers F, G, I, J, and K satisfy the associative law, and layer H does not satisfy the associative law. Since layers A to D are sequentially continuous, they can be referred to as target layers, layers F and G are sequentially continuous and can be referred to as target layers, and layers I to K are sequentially continuous and can be referred to as target layers. Furthermore, layers A to D are pre-synthesized to obtain pre-synthesized layer 1, layers G and F are pre-synthesized to obtain pre-synthesized layer 2, and layers I to K are pre-synthesized to obtain pre-synthesized layer 3. Layers A to D are examples of target layers, layers G and F are also examples of target layers, and layers I to K are also examples of target layers. The electronic device can save the pre-synthesized layer 1, the pre-synthesized layer 2, and the pre-synthesized layer 3, so that the pre-synthesized layers can be directly used to synthesize an image when a certain layer is modified next time.

[0192] As can be seen above, in response to a user operation on a second layer among multiple layers (i.e., a second user operation), the electronic device can pre-compose the target layer to obtain a pre-composed layer, and can also perform layer composition to obtain and display a third image. The third image is an image obtained based on the second user operation. Furthermore, in response to a user operation on a first layer among the multiple layers (in this case, the multiple layers are multiple layers of the third image, where the content of the multiple layers of the first image and the multiple layers of the third image may differ due to the user changing the second layer of the first image) (i.e., a first user operation), the electronic device can directly perform layer composition based on the pre-composed layer and the first layer to obtain a second image. The second image can be understood as an image obtained based on the user operation on the first layer of the third image. The first layer in the third image and the first layer of the first image can be considered to be the same layer, except that the content of the first layer in the first image and the content in the third image may be different. For example, if the first and second layers are the same layer, i.e., the same layer in both operations, the content of the first layer in the third image will be different from the content of the first layer in the first image. The processes of obtaining the third image and obtaining the second image will be described below with reference to Figures 6 to 9.

[0193] The following first describes the process of obtaining the third image.

[0194] One possible design is that the electronic device obtains the third image based on the pre-synthesized layer. Layer E is an example of the second layer.

[0195] In one example, as shown in Figure 6, the electronic device pre-synthesizes layers A to D to obtain pre-synthesized layer 1, pre-synthesizes layers F to K to obtain pre-synthesized layer 2, and further synthesizes pre-synthesized layer 1, layer E, and pre-synthesized layer 2 in sequence according to the layer order to obtain a third image.

[0196] In another example, as shown in Figure 7, the electronic device pre-synthesizes layers A to D to obtain pre-synthesized layer 1, pre-synthesizes layers G to K to obtain pre-synthesized layer 2, and further synthesizes pre-synthesized layer 1, layer E, layer F, and pre-synthesized layer 2 in layer order to obtain a third image.

[0197] In another example, as shown in Figure 8, the electronic device pre-synthesizes layers A to D to obtain pre-synthesized layer 1, pre-synthesizes layers H to K to obtain pre-synthesized layer 2, and further synthesizes pre-synthesized layer 1, layer E, layer F, layer G, and pre-synthesized layer 2 in layer order to obtain a third image.

[0198] In another example, as shown in Figure 9, the electronic device pre-synthesizes layers A to D to obtain pre-synthesized layer 1, pre-synthesizes layers G and F to obtain pre-synthesized layer 2, pre-synthesizes layers I to K to obtain pre-synthesized layer 3, and further performs layer synthesis on pre-synthesized layer 1, layer E, pre-synthesized layer 2, layer H, and pre-synthesized layer 3 to obtain a third image.

[0199] Another possible design is that the electronic device can synthesize multiple layers in order. For example, as shown in FIG6 , the electronic device synthesizes layers A to K in order to obtain a third image.

[0200] The process of obtaining the second image is described below.

[0201] The first layer and the second layer may be the same layer or different layers.

[0202] One possible situation is that the first layer and the second layer are the same layer. Taking Figure 6 as an example, the first layer and the second layer are both layer E, that is, the layer on which the user performs operations twice is both layer E. In response to the first user operation, the electronic device performs layer synthesis based on pre-synthesized layer 1, layer E and pre-synthesized layer 2 to obtain a second image.

[0203] Another possible scenario is that the first and second layers are not the same layer. Taking Figure 6 as an example, assuming the first user operation is on layer F among the multiple layers of the third image, in response to the first user operation, the electronic device performs layer synthesis based on pre-synthesized layer 1 and layer F to obtain the second image. More specifically, the electronic device sequentially synthesizes pre-synthesized layer 1, layer E, layer F, and layers G through K to obtain the second image.

[0204] Optionally, the electronic device can also determine at least two layers that satisfy the associative law and have a continuous layer order from the pre-synthesized layer 1, layer E, and layers G to K, that is, determine the target layer, and then pre-synthesize the target layer.

[0205] For example, the electronic device traverses the pre-synthesized layer 1, layer E, and each layer from layer G to layer K, determines the target layer, and then pre-synthesizes the target layer to obtain the pre-synthesized layer 3. The pre-synthesized layer 3 can be used to synthesize the image when the user performs an operation on a layer in the second image.

[0206] Optionally, the above-mentioned layer synthesis based on the pre-synthesized layer and the first layer to obtain the second image includes: performing layer synthesis on the pre-synthesized layer, the first layer and the remaining layers to obtain the second image, where the remaining layers are multiple layers (if the second user operation is an operation to open the first image, the multiple layers are the multiple layers of the first image; if the second user operation is an operation on the second layer among the multiple layers of the first image, the multiple layers are the multiple layers of the third image) excluding the target layer and the second layer.

[0207] That is to say, the electronic device can directly perform layer synthesis on the pre-synthesized layer, the second layer and the remaining layers to obtain a second image, saving the time of synthesizing the target layer again and helping to improve synthesis efficiency.

[0208] It can be understood that in the present application, after an operation is performed on a layer among the multiple layers of the first image, the content of the layer may be modified. Therefore, the contents of the multiple layers of the second image, the third image, and the multiple layers of the first image may be different, but the number of layers is the same.

[0209] Optionally, the method 500 further includes step 530: displaying a second image, where the second image is an image obtained based on the first user operation.

[0210] After obtaining the second image, the electronic device may display it through the user interface.

[0211] Based on the above technical solution, the pre-synthesized layer is obtained by pre-synthesizing at least two layers among multiple layers that have a continuous layer order and satisfy the associative law. When the user operates a layer among the multiple layers (such as the first layer), the electronic device can directly perform layer synthesis based on the pre-synthesized layer obtained by pre-synthesis. That is, the synthesis operation of the layers that satisfy the associative law and have a continuous layer order is omitted, which is conducive to reducing the processing amount in the layer synthesis process, improving synthesis efficiency, and solving the problems of display freeze and display delay. In other words, after the user performs an operation on the layer, he can see the image obtained based on the operation more quickly, which is conducive to improving the user experience.

[0212] The pre-synthesis process will be described in detail below with reference to Figure 10. In the embodiment shown in Figure 10, the description is made from the perspective of the interaction between the functional modules inside the electronic device.

[0213] FIG10 is a schematic diagram of a detailed process of pre-synthesizing a target layer according to an embodiment of the present application.

[0214] In step 1001, the business layer sends an identifier of the activated layer.

[0215] Step 1001 specifically includes: the business layer sends the identification of the activated layer to the drawing framework module, and accordingly, the drawing framework module receives the identification of the activated layer; the drawing framework module sends the identification of the activated layer to the drawing engine module.

[0216] The active layer is the layer on which the user performs operations. The active layer identifier is used to identify which layer is the active layer.

[0217] Exemplarily, in response to a user operation on a layer (e.g., a user drawing on a layer with a brush), the business layer sends the identifier of the activated layer to the drawing framework module. After receiving the identifier of the activated layer, the drawing framework module sends the identifier of the activated layer to the drawing engine module. For example, using Figure 6 as an example, in response to a user operation to modify layer E (e.g., a user drawing on layer E with a brush), the business layer sends the identifier of layer E to the drawing framework module. After receiving the identifier of layer E, the drawing framework module sends the identifier of layer E to the drawing engine module.

[0218] In step 1002, the rendering engine module saves the identifier of the activated layer.

[0219] The drawing engine module saves the identifier of the activated layer. On the one hand, when the user draws a layer with a brush again, it can be used to determine whether the layer has been operated. If the layer has been operated, the pre-synthesized layer and the activated layer can be directly synthesized without synthesizing each layer one by one, which is beneficial to improving the efficiency of layer synthesis. On the other hand, the drawing engine module can use the activated layer as the boundary to divide its upper layer into the foreground layer and its lower layer into the background layer.

[0220] In step 1003, the rendering engine module uses all layers below the active layer as background layers, performs pre-synthesis on the background layers, and obtains a pre-synthesis result a.

[0221] In other words, all layers below the activated layer are recorded as background layers, and the drawing engine module can pre-synthesize the background layers to obtain a pre-synthesis result a.

[0222] It can be understood that the drawing engine module can pre-synthesize the background layer to obtain the pre-synthesis result a when each layer in the background layer satisfies the associative law. That is, the drawing engine module can determine whether the layers in the background layer satisfy the associative law according to the pre-synthesis algorithm in step 1004.

[0223] In step 1004 , the rendering engine module activates all layers above the activated layer as foreground layers and starts a pre-composition algorithm.

[0224] That is, all layers above the activated layer are recorded as foreground layers, and the drawing engine module can start the pre-composition algorithm for the foreground layers.

[0225] Step 1004 specifically includes the following steps:

[0226] 1. Traverse the layer properties of each layer in all foreground layers.

[0227] The layer attribute can be, for example, the layer's layer blending mode. The drawing engine module can traverse the layer blending mode of each layer in the foreground layer and then determine whether each layer satisfies the associativity based on the layer blending mode of each layer. For example, for a layer A, it can be composited with the previous layer and the next layer in different composite orders based on the layer blending mode of the layer A, and then determine whether the layer A satisfies the associativity based on the composite results.

[0228] 2. Identify the layers that do not satisfy the associative law.

[0229] For a certain layer, the drawing engine module can determine whether the pre-synthesized layer obtained by pre-synthesizing the layer with the previous layer and then with the next layer is the same as the pre-synthesized layer obtained by pre-synthesizing the layer with the next layer and then with the previous layer. If they are the same, the layer satisfies the associative law; if they are different, the layer does not satisfy the associative law.

[0230] 3. Taking the layer that does not satisfy the associative law as the boundary, traverse all the layers above the layer that does not satisfy the associative law to see if they satisfy the associative law.

[0231] For example, taking Figure 9 as an example, the drawing engine module determines that layers F and G satisfy the associative law, and further determines that layer H does not satisfy the associative law. Then, using layer H as the boundary, it further determines whether each layer in all layers above layer H satisfies the associative law.

[0232] 4. Pre-synthesize at least two layers that satisfy the associative law and have a continuous layer order, and obtain and save pre-synthesis results (such as pre-synthesis result b, pre-synthesis result c, and pre-synthesis result d).

[0233] 5. The pre-synthesis results (such as pre-synthesis result b, pre-synthesis result c and pre-synthesis result d) obtained by pre-synthesizing the layers in the foreground layer that do not satisfy the associative law or satisfy the associative law but the layer order is not continuous, and the layers that satisfy the associative law and the layer order is continuous, form a layer pre-synthesis list.

[0234] Exemplarily, taking FIG. 9 as an example, the layer pre-composition list includes: a pre-composition result obtained by pre-composing layer G and layer F, and a pre-composition result obtained by pre-composing layer H, layer I to layer K.

[0235] In step 1005, the business layer sends a brush drawing notification to the drawing framework module in response to the user operation.

[0236] The brush drawing can be one stroke or multiple strokes.

[0237] The user operation described above may be, for example, a user drawing one or more strokes with a brush on the active layer. That is, the user operates the active layer again. In response to the user's operation on the active layer again (e.g., drawing on the active layer with a brush), the business layer sends a notification to the drawing framework module, which in turn notifies the drawing engine module.

[0238] In step 1006, the rendering framework module notifies the rendering engine module to perform texture mapping on the active layer.

[0239] After receiving the notification, the rendering engine module executes step 1007 .

[0240] In step 1007, the rendering engine module synthesizes the active layer and the brush texture, and then synthesizes them with the pre-synthesis result a to obtain result A, and synthesizes result A with the layers in the layer pre-synthesis list one by one to obtain an image.

[0241] The brush texture is a property setting of the brush. By changing the brush texture, the texture effect of the brush painting can be changed. The drawing engine module synthesizes the active layer and the brush texture. This can be understood as when the user paints the active layer with a brush, the drawing engine module synthesizes the brush texture on the painted layer (i.e., the active layer). In this application, before synthesizing the active layer and the pre-synthesis result a, the drawing engine module can first synthesize the brush texture on the active layer, and then synthesize it with the pre-synthesis result a to obtain result A.

[0242] The rendering engine module can also display the above image on the screen.

[0243] Exemplarily, taking Figure 9 as an example, in response to the user's operation on the activated layer again, the drawing engine module maps the texture to the activated layer, and further synthesizes it with the pre-synthesis result a (obtained by pre-synthesis of the background layer) to obtain result A, and result A is synthesized with the pre-synthesis result b (obtained by pre-synthesis of layer G and layer F) to obtain result B, and result B is synthesized with layer H to obtain result C, and result C is synthesized with the pre-synthesis result c (obtained by pre-synthesis of layers I to K) to obtain an image.

[0244] It should be understood that the steps shown in FIG10 are merely exemplary. In actual application scenarios, the order of the steps in the method shown in FIG10 may be different. For example, the rendering engine module may first execute step 1004 and then execute step 1003. In addition, individual interaction steps may be added or removed, and this application does not limit this.

[0245] In the embodiment shown in FIG10 , the drawing engine module determines a target layer in the foreground layer and a target layer in the background layer, and pre-synthesizes the target layer in the foreground layer and the target layer in the background layer respectively to obtain respective pre-synthesized layers. This allows the drawing engine module to directly perform layer synthesis based on the pre-synthesized layers and the layer operated by the user to obtain an image when the user operates a certain layer again. This is beneficial to the processing volume in the layer synthesis process, improves synthesis efficiency, and thereby improves user experience.

[0246] FIG11 is a schematic diagram of a detailed process of changing the layer blending mode provided in an embodiment of the present application.

[0247] In step 1101, the business layer sends an identifier of the activated layer.

[0248] Step 1101 specifically includes: the business layer sends the identification of the activated layer to the drawing framework module, and accordingly, the drawing framework module receives the identification of the activated layer; the drawing framework module sends the identification of the activated layer to the drawing engine module.

[0249] In step 1102 , the rendering engine module saves the identifier of the activated layer.

[0250] In step 1103, the rendering engine module uses all layers below the active layer as background layers, and pre-synthesizes the background layers to obtain a pre-synthesis result a.

[0251] In step 1104 , the rendering engine module sets all layers above the activated layer as foreground layers and starts a pre-composition algorithm.

[0252] Step 1004 specifically includes the following steps:

[0253] 1. Traverse the layer properties of each layer in all foreground layers.

[0254] 2. Identify the layers that do not satisfy the associative law.

[0255] 3. Taking the layer that does not satisfy the associative law as the boundary, traverse all the layers above the layer that does not satisfy the associative law to see if they satisfy the associative law.

[0256] 4. Pre-synthesize at least two layers that satisfy the associative law and have a continuous layer order, and obtain and save pre-synthesis results (such as pre-synthesis result b, pre-synthesis result c, and pre-synthesis result d).

[0257] 5. The pre-synthesis results (such as pre-synthesis result b, pre-synthesis result c, and pre-synthesis result d) obtained by pre-synthesizing the layers in the foreground layer that do not satisfy the associative law or satisfy the associative law but the layer order is discontinuous, and the layers that satisfy the associative law and have a continuous layer order, form a layer pre-synthesis list.

[0258] The process from step 1101 to step 1104 is the same as step 1001 to step 1004 in FIG. 10 . For a more detailed description, please refer to FIG. 10 .

[0259] In step 1105 , in response to the user operation, the business layer sends a notification of a change in the layer blending mode of the activated layer to the drawing framework layer.

[0260] The user can modify the layer blending mode of the active layer, for example, using more advanced color mixing methods. In response to the user's operation of modifying the layer blending mode of the active layer, the business layer sends a notification of the change of the layer blending mode of the active layer to the drawing framework layer.

[0261] In step 1106 , the drawing framework module sends the new layer blending mode to the drawing engine module.

[0262] That is, the drawing framework module sends the newly set blending mode to the drawing engine module, and accordingly, the drawing engine module receives the new layer blending mode.

[0263] In step 1107, the rendering engine module synthesizes the active layer and the pre-synthesis result a using a new layer blending mode to obtain result A, and then synthesizes result A with the layer pre-synthesis list to obtain an image.

[0264] The rendering engine module can also display the above image on the screen.

[0265] Exemplarily, taking Figure 9 as an example, in response to the user's operation of changing the layer blending mode of the activated layer, the drawing engine module synthesizes the activated layer and the pre-synthesis result a (obtained by pre-synthesis of the background layer) with the new layer blending mode to obtain result A, and result A is then synthesized with the pre-synthesis result b (obtained by pre-synthesis of layer G and layer F) to obtain result B, and result B is then synthesized with layer H to obtain result C, and result C is then synthesized with the pre-synthesis result c (obtained by pre-synthesis of layers I to K) to obtain an image, and the image is displayed on the screen.

[0266] In the embodiment shown in FIG11 , the drawing engine module pre-synthesizes the layers that satisfy the associative law and have a continuous layer order among the multiple layers included in the image, and saves the data of the pre-synthesized layers. In this way, the data of the pre-synthesized layers can be used for synthesizing the image when the user performs an operation on the activated layer again. For example, when the user changes the layer blending mode of the activated layer, the data of the pre-synthesized layers can be used to avoid synthesizing the layers one by one according to the layer order each time. This is beneficial to reducing the amount of processing in the layer synthesis process, reducing display jams, and improving fluency. That is, once the user makes a modification, he can see the modified image in a timely manner, which is beneficial to improving the user experience.

[0267] Understandably, in real-world scenarios, images containing many layers may not be displayed due to the low performance of electronic devices. Therefore, when an image contains more layers than the maximum number of layers supported by the electronic device, resulting in an inability to display the image properly, some of the layers can be merged to reduce the number of layers, thereby smoothly displaying the image and obtaining the merged layers.

[0268] Currently, when selecting layer pairs to be merged, layer pairs with confidence levels exceeding a threshold are generally selected from multiple layer pairs. These multiple layer pairs are obtained by performing a Cartesian product on multiple layers of the image. This may destroy the order between the layers and affect the complete display of the image.

[0269] Therefore, another layer processing method is provided in the present application, in which the electronic device combines two adjacent layers from the multiple layers included in the image into at least one layer pair, and then determines the target layer pair to be merged from the above at least one layer pair based on the confidence of the layer pair, and then merges the target layer pair. In this way, the number of layers can be reduced, and since the layer pairs are adjacent, it can ensure that the order between the layers is not destroyed, thereby reducing the impact on the image.

[0270] The above-mentioned layer processing method provided by this application will be described in detail below in conjunction with specific embodiments.

[0271] It should be understood that the embodiments shown below describe the method from the perspective of electronic devices, but should not constitute any limitation on the execution subject of the method. As long as it is possible to run a computer program that records the method provided by the embodiment of the present application, the method provided by the embodiment of the present application can be executed. For example, the electronic device can also be replaced by a component (such as a chip, a chip system, etc.) configured in the electronic device, or other functional modules that can call a program and execute the program, and the embodiment of the present application does not limit this.

[0272] Figure 12 is a schematic flow chart of another layer processing method 1200 provided by an embodiment of the present application. The method 1200 shown in Figure 12 may include steps 1210 to 1230. Each step in the method 1200 is described in detail below.

[0273] In step 1210 , a confidence level for each layer pair in at least one layer pair is determined.

[0274] Each of the at least one layer pair comprises any two adjacent layers from the plurality of layers of the first image. For example, if the plurality of layers of the first image include layers 1 through 5, the layer pairs are {layer 1, layer 2}, {layer 2, layer 3}, {layer 3, layer 4}, and {layer 4, layer 5}.

[0275] Exemplarily, the electronic device determines the confidence level of every two adjacent layers (a layer pair) among the multiple layers included in the first image.

[0276] Optionally, before determining the confidence level of each layer pair in at least one layer pair, the method further includes: determining whether the number of layers to be displayed exceeds the maximum number of layers supported by the electronic device.

[0277] Exemplarily, the electronic device determines whether the number of layers to be displayed exceeds the maximum number of layers. If so, the confidence of each layer pair is further determined; if not, the layers to be displayed are displayed. In addition, the electronic device can also display the first image.

[0278] Optionally, the confidence of each layer pair is determined based on the correlation and / or coverage of the layer pair, where the correlation of the layer pair is used to reflect the physical distance between the two layers in the layer pair in the first image, and the coverage of the layer pair is used to reflect the degree of overlap between the two layers in the layer pair in the first image.

[0279] For example, the closer the physical distance between the two layers in the layer pair in the first image, the greater the correlation of the layer pair; the greater the degree of overlap between the two layers in the layer pair in the first image, the greater the coverage of the layer pair.

[0280] One possible design is that the confidence level of the layer pair is determined based on the correlation level of the layer pair. That is, the electronic device determines the target layer pair based on the correlation level of the layer pair.

[0281] Another possible design is that the confidence level of the layer pair is determined based on the coverage level of the layer pair, that is, the electronic device determines the target layer pair based on the coverage level of the layer pair.

[0282] Another possible design is to determine the confidence level of a layer pair based on both the layer pair's association and its coverage. That is, the electronic device determines the target layer pair based on the layer pair's association and coverage. For example, confidence level = association level × K1 + coverage level × K2, where K1 is a preset association weight, and K2 is a preset coverage weight, with 0 ≤ K1 ≤ 1 and 0 ≤ K2 ≤ 1.

[0283] The following will explain in detail the correlation and coverage of a layer pair with reference to the accompanying drawings, taking a layer pair including a first layer and a second layer as an example.

[0284] Exemplarily, the correlation degree of a layer pair satisfies: correlation degree = max(area of ​​the first layer, area of ​​the second layer) / area of ​​the union area of ​​the first layer and the second layer, where the boundary of the union area is determined by the boundary of the first layer and the boundary of the second layer.

[0285] The electronic device can determine the degree of association of the layer pair according to the area of ​​the first layer, the area of ​​the second layer, the area of ​​the union region, and the above formula.

[0286] Before introducing the degree of association between layer pairs, we first introduce how to determine the area of ​​a layer.

[0287] FIG13 is a schematic diagram of the effective area of ​​the layer provided in an embodiment of the present application.

[0288] As shown in Figure 13, the first image includes multiple layers, such as the character's left ear, the character's right ear, the character's hair, etc. Taking layer 1 (character's hair) as an example, the effective area of ​​layer 1 is the area surrounded by the upper boundary, lower boundary, left boundary and right boundary of the hair. The height and width of the area are shown in the figure. The effective area of ​​layer 1 (or simply the area) is the product of the height and width.

[0289] It should be understood that the effective area of ​​the layer shown in FIG13 is merely an example and does not constitute any limitation on the embodiments of the present application. For example, the shape of the effective area of ​​the layer can also be a circle, such as a circle formed by taking the center of the hair as the origin and the distance between the farthest points (where the farthest points refer to the two points farthest from each other among the multiple points constituting the boundary of layer 1) as the diameter. Alternatively, the shape of the effective area of ​​the layer can also be an irregular shape, which is not limited by the present application.

[0290] The union area of ​​the above-mentioned layer pair is a union area obtained based on the effective area of ​​the layer. One possible design of the union area is a square. Under this design, the shape of the effective area of ​​the layer can be a square or other shapes, and this application does not limit this.

[0291] Exemplarily, the union area is surrounded by upper, lower, left, and right boundaries. The upper boundary of the union area is the uppermost boundary of the upper boundaries of the first layer and the second layer, the lower boundary of the union area is the lowermost boundary of the lower boundaries of the first layer and the second layer, the left boundary of the union area is the leftmost boundary of the left boundaries of the first layer and the second layer, and the right boundary of the union area is the rightmost boundary of the right boundaries of the first layer and the second layer.

[0292] FIG14 is a schematic diagram of a union region provided in an embodiment of the present application.

[0293] As shown in Figure 14, the first image includes multiple layers, such as the character's left ear, right ear, hair, and mouse. Layer 1 (character's hair) and layer 2 (mouse) are used as examples of the layer pair. The union region is the area enclosed by the dashed line. It can be seen that the upper boundary of the union region is the uppermost boundary of the upper boundaries of layer 1 and layer 2, the lower boundary of the union region is the lowermost boundary of the lower boundaries of layer 1 and layer 2, the left boundary of the union region is the leftmost boundary of the left boundaries of layer 1 and layer 2, and the right boundary of the union region is the rightmost boundary of the right boundaries of layer 1 and layer 2.

[0294] It is understandable that the shape of the union area may also be other shapes, such as a circle, or other irregular shapes.

[0295] For example, when the shape of the union region is a circle, the diameter of the union region is the maximum distance between the plurality of points constituting the boundary of layer 1 and the plurality of points constituting the boundary of layer 2 .

[0296] The coverage of layer pairs is introduced below.

[0297] The coverage of the layer pair satisfies: Coverage = Area of ​​the overlapping area of ​​the first layer and the second layer / min (Area of ​​the first layer, Area of ​​the second layer).

[0298] The electronic device can determine the coverage of the layer pair according to the area of ​​the first layer, the area of ​​the second layer, the area of ​​the overlapping region, and the above formula.

[0299] FIG15 is a schematic diagram of the overlapping area provided in an embodiment of the present application.

[0300] As shown in Figure 15, the first image includes multiple layers, such as layers of facial features, right ear, and hair. Taking layer 1 (facial features) and layer 2 (hair) as examples, the overlapping area is the shaded part.

[0301] After determining the confidence level of each layer pair, the electronic device determines a target layer pair according to the confidence level of each layer pair.

[0302] One possible design is that the confidence is determined based on the correlation, and the target layer pair is the layer pair with the largest correlation.

[0303] Another possible design is that the confidence is determined based on the coverage, and the target layer pair is the layer pair with the smallest coverage.

[0304] Another possible design is that the confidence of the layer pair is determined comprehensively based on the correlation degree and coverage degree of the layer pair, and the target layer pair is the layer pair with the highest confidence.

[0305] In step 1220 , the target layer pair in the at least one layer pair is merged to obtain a merged layer.

[0306] Exemplarily, after the electronic device determines the target layer pair, it merges the target layer pair to obtain a merged layer. It will be appreciated that if the number of layers after merging still exceeds the maximum number of layers supported by the electronic device, the target layer pair can be further determined based on the merged layer and the remaining layers, and then the target layer pair can be merged. The remaining layers are the layers in the multiple layers other than the target layer pair.

[0307] In step 1230 , the merged layer and other layers in the plurality of layers except the target layer pair are displayed.

[0308] Exemplarily, when the number of layers to be displayed after merging is less than or equal to the maximum number of layers, the electronic device displays the merged layer and other layers in the plurality of layers except the target layer pair. In addition, the electronic device may also display the first image.

[0309] Figure 16 is a detailed flowchart of the process of merging layers provided by an embodiment of the present application. The process of merging layers until the number of layers is less than or equal to the maximum number of layers will be described in detail below with reference to Figure 16.

[0310] In step 1601, all layers of the image are read.

[0311] The image includes multiple layers, and the electronic device can read each of the multiple layers.

[0312] In step 1602, all layers are traversed to determine the effective area of ​​each layer.

[0313] The electronic device traverses each of the multiple layers mentioned above and determines the effective area of ​​each layer. The process of determining the effective area of ​​the layer can be found in the relevant description of FIG. 12 and will not be described in detail here.

[0314] In step 1603, the confidence of the layer pair is calculated.

[0315] In one example, the confidence level of a layer pair is determined based on the layer pair's association level. The electronic device determines the layer pair's association level based on the effective areas of the two layers in the layer pair and the area of ​​the union area. The process of determining the layer pair's association level can be found in the description of FIG. 12 and will not be further elaborated here.

[0316] In another example, the confidence level of a layer pair is determined based on the layer pair's coverage. The electronic device determines the layer pair's coverage based on the effective areas of the two layers in the layer pair and the area of ​​the overlapping region. The process of determining the layer pair's coverage can be found in the description of FIG. 12 and will not be further described here.

[0317] In another example, the confidence level of a layer pair is determined based on the layer pair's coverage and correlation. The electronic device determines the layer pair's coverage based on the effective areas of the two layers in the layer pair and the area of ​​their overlapped area. It also determines the layer pair's correlation based on the effective areas of the two layers in the layer pair and the area of ​​their unioned area. Finally, the confidence level is determined based on the correlation and coverage. The process of determining the layer pair's confidence level can be found in the description of FIG. 12 and will not be detailed here.

[0318] In step 1604, a target layer pair is determined and merged to obtain a merged layer.

[0319] Exemplarily, the electronic device determines the target layer pair based on the confidence of each layer pair, and merges the target layer pair to obtain a merged layer. For more detailed process, please refer to the relevant description of Figure 12, which will not be described in detail here.

[0320] In step 1605, it is determined whether the number of layers exceeds the maximum number of layers.

[0321] If the number of layers after merging still exceeds the maximum number of layers supported by the electronic device, continue to execute from step 1601, that is, continue to determine the target layer pair based on the merged layer and the remaining layers, and then merge the target layer pair, where the remaining layers are other layers in the multiple layers except the target layer pair.

[0322] If the number of layers after merging does not exceed the maximum number of layers supported by the electronic device, step 1606 is executed.

[0323] In step 1606, the merged layer and other unmerged layers are displayed.

[0324] Exemplarily, when the number of layers to be displayed after merging is less than or equal to the maximum number of layers, the electronic device displays the merged layer and other layers in the plurality of layers except the target layer pair. In addition, the electronic device may also display the first image.

[0325] Based on the above technical solution, the electronic device can determine the target layer pair to be merged through the confidence of each layer pair in at least one layer pair, merge the target layer pair, and display the merged layer and other layers outside the target layer pair. In this way, the number of displayed layers is reduced, and the performance requirements for the electronic device can be lowered. Users can view images with a larger number of layers through devices with lower performance, which is conducive to improving user experience.

[0326] The present application also provides an electronic device that can implement the method shown in Figures 5, 10, 11, 12, or 16. The electronic device includes corresponding modules for performing the above methods. The modules included in the electronic device can be implemented in software and / or hardware.

[0327] An embodiment of the present application also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to call and execute the computer program, so that the electronic device implements the method shown in Figure 5, Figure 10, Figure 11, Figure 12 or Figure 16.

[0328] An embodiment of the present application also provides a chip system, which includes at least one processor for implementing the method shown in Figures 5, 10, 11, 12 or 16, for example, receiving or processing the data and / or information involved in the above method.

[0329] In one possible design, the chip system further includes a memory, which is used to store program instructions and data, and the memory is located inside or outside the processor.

[0330] The chip system can be composed of chips, or can include chips and other discrete devices.

[0331] An embodiment of the present application also provides a computer program product, which includes: a computer program (also referred to as code, or instructions), which, when executed, enables a computer to execute the method shown in Figures 5, 10, 11, 12, or 16.

[0332] The present application also provides a computer-readable storage medium storing a computer program (also referred to as code or instructions). When the computer program is executed, the computer executes the method shown in FIG. 5 , FIG. 10 , FIG. 11 , FIG. 12 , or FIG. 16 .

[0333] It should be understood that the processor in the embodiments of the present application can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above-mentioned method embodiment can be completed by hardware integrated logic circuits in the processor or by software instructions. The above-mentioned processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above-mentioned method.

[0334] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0335] The terms "unit", "module", etc. used in this specification can be used to refer to computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. The terms "unit" and "module" in the embodiments of this application have the same meaning and can be used interchangeably.

[0336] Those skilled in the art will appreciate that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented using electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application. In the several embodiments provided in this application, it should be understood that the disclosed devices, equipment, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of devices or units, and can be electrical, mechanical, or other forms.

[0337] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0338] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0339] In the above embodiments, the functions of each functional unit can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions (programs). When the computer program instructions (program) are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0340] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

[0341] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A layer processing method, characterized in that: include: displaying a first image, the first image comprising a plurality of layers; In response to a first user operation, layer synthesis is performed based on a pre-synthesized layer and a first layer to obtain a second image, wherein the first user operation is an operation performed by a user on the first layer among the multiple layers, the pre-synthesized layer is obtained by pre-synthesizing a target layer among the multiple layers, and the target layer is at least two layers among the multiple layers whose layer order is continuous and satisfies the associative law.

2. The method according to claim 1, characterized in that Before performing layer synthesis based on the pre-synthesized layer and the first layer to obtain the second image in response to the first user operation, the method further includes: In response to a second user operation, the target layer among the multiple layers is pre-synthesized to obtain a pre-synthesized layer.

3. The method according to claim 2, characterized in that The second user operation includes an operation of a user opening the first image or an operation of a user on a second layer among the multiple layers.

4. The method according to claim 3, characterized in that The user's operation on the second layer among the multiple layers includes: an operation of the user modifying the second layer, or an operation of the user selecting a layer blending mode of the second layer.

5. The method according to any one of claims 1 to 4, characterized in that The first layer does not belong to the target layer.

6. The method according to any one of claims 1 to 5, characterized in that The method further includes: determining the target layer among a plurality of layers included in the first image.

7. The method according to any one of claims 1 to 6, characterized in that Any layer in the target layer satisfies: a pre-synthesized layer obtained by pre-synthesizing with the previous layer and then with the next layer is the same as a pre-synthesized layer obtained by pre-synthesizing with the next layer and then with the previous layer, and the previous layer and the next layer are determined according to the layer order.

8. The method according to any one of claims 1 to 7, characterized in that The step of synthesizing the layers based on the pre-synthesized layer and the first layer to obtain the second image in response to the first user operation includes: In response to the first user operation, the pre-synthesized layer, the first layer, and the remaining layers are layered to obtain the second image, where the remaining layers are layers among the multiple layers except the target layer and the first layer.

9. An electronic device, characterized in that: include: A display module, configured to display a first image, wherein the first image includes a plurality of layers; A drawing engine module is used to respond to a first user operation, perform layer synthesis based on a pre-synthesized layer and a first layer to obtain a second image, wherein the first user operation is an operation performed by a user on the first layer among the multiple layers, the pre-synthesized layer is obtained by pre-synthesizing a target layer among the multiple layers, and the target layer is at least two layers among the multiple layers whose layer order is continuous and satisfies the associative law.

10. The electronic device according to claim 9, characterized in that: The drawing engine module is further used for: in response to a second user operation, pre-compositing the target layer among the multiple layers to obtain a pre-composited layer.

11. The electronic device according to claim 10, characterized in that: The second user operation includes an operation of a user opening the first image or an operation of a user on a second layer among the multiple layers.

12. The electronic device according to claim 11, characterized in that: The user's operation on the second layer among the multiple layers includes: an operation of the user modifying the second layer, or an operation of the user selecting a layer blending mode of the second layer.

13. The electronic device according to any one of claims 9 to 12, characterized in that: The first layer does not belong to the target layer.

14. The electronic device according to any one of claims 9 to 13, characterized in that: The drawing engine module is further used to determine the target layer among a plurality of layers included in the first image.

15. The electronic device according to any one of claims 9 to 14, characterized in that: Any layer in the target layer satisfies: a pre-synthesized layer obtained by pre-synthesizing with the previous layer and then with the next layer is the same as a pre-synthesized layer obtained by pre-synthesizing with the next layer and then with the previous layer, and the previous layer and the next layer are determined according to the layer order.

16. The electronic device according to any one of claims 9 to 15, characterized in that: The drawing engine module is specifically used to: in response to the first user operation, perform layer synthesis on the pre-synthesized layer, the first layer and the remaining layers to obtain the second image, and the remaining layers are the layers among the multiple layers except the target layer and the first layer.

17. An electronic device, characterized in that: comprising a processor and a memory, wherein: The memory is used to store computer programs; The processor is configured to call the computer program so that the electronic device executes the method according to any one of claims 1 to 8.

18. A computer-readable storage medium, characterized in that: The storage medium stores a computer program or instruction. When the computer program or instruction is executed by a computer, the method according to any one of claims 1 to 8 is implemented.

19. A computer program product, characterized in that The computer program product comprises instructions, and when the instructions are executed by a computer, the method according to any one of claims 1 to 8 is implemented.