Image processing method and electronic device

CN123011110APending Publication Date: 2026-10-30HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510599863.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2025-04-29
Filing Date
2025-05-09
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0005]但是,当前的绘图应用提供的油画笔刷算法通常采用简单的纹理叠加或颜色混合,无法真实再现油画颜料的厚度、光泽以及笔触的立体感,这种局限性不仅限制了数字艺术的表现力,也影响了用户体验

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011110A_ABST
    Figure CN123011110A_ABST
Patent Text Reader

Abstract

The application provides an image processing method and an electronic device. In the method, the electronic device receives a drawing operation of a user, obtains initial color information of each pixel point in a pigment track corresponding to the drawing operation, and the initial color information is determined according to brush color information. The electronic device determines height information of each pixel point in the pigment track, and the height information of each pixel point is used to indicate a pigment height when each pixel point simulates a three-dimensional effect of a painting. The electronic device determines target color information of each pixel point based on a lighting system, according to the height information of each pixel point and the initial color information of each pixel point, and displays the pigment track according to the target color information of each pixel point. Through the scheme, the electronic device can adjust the initial color information of the pixel point based on the lighting system according to the height information of the pixel point, so that the pigment track displays the thickness, gloss and three-dimensional sense of the brush stroke of the painting pigment, and improves the realistic effect of the painting brush.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Cross-references

[0002] This application claims priority to Chinese Patent Application No. 202510574177.0, filed on April 29, 2025, with the State Intellectual Property Office of the People's Republic of China, entitled "An Image Processing Method and Electronic Device", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of terminal technology, and in particular to an image processing method and an electronic device. Background Technology

[0004] Drawing applications on electronic devices have become a primary tool in the field of digital art creation. When running drawing applications on electronic devices, users can use their fingers or styluses to create digital paintings on the screen. Drawing applications can provide realistic brush effects, such as pencil brushes, crayon brushes, and airbrush brushes.

[0005] However, current drawing applications typically use simple texture overlays or color mixing algorithms for oil painting brushes, which cannot realistically reproduce the thickness, gloss, and three-dimensionality of oil paint strokes. This limitation not only restricts the expressiveness of digital art but also affects the user experience. Summary of the Invention

[0006] This application provides an image processing method and an electronic device for providing a more realistic oil painting brush effect.

[0007] In a first aspect, this application provides an image processing method that can be executed by an electronic device. In this method, a user's drawing operation is received; initial color information of each pixel in the paint trajectory corresponding to the drawing operation is obtained, wherein the initial color information of each pixel is determined based on the brush color information corresponding to the drawing operation; height information of each pixel in the paint trajectory is determined, wherein the height information of each pixel is used to indicate the paint height when simulating a three-dimensional oil painting effect; target color information of each pixel is determined based on a lighting system, according to the height information and the initial color information of each pixel; and the paint trajectory is displayed according to the target color information of each pixel.

[0008] In the above method, the electronic device can obtain the height information of each pixel in the paint trajectory corresponding to the user's drawing operation. This height information can be used to simulate the height of the paint when the three-dimensional effect of oil painting is achieved. The electronic device can adjust the initial color information of the pixel based on the lighting system according to the height information of the pixel, so that the adjusted paint trajectory can display the thickness, gloss and three-dimensionality of the oil paint and the brushstrokes, thereby improving the realism of the oil painting brush.

[0009] In one possible design, prior to receiving the user's drawing operation, the method further includes: displaying a settings interface; and activating a height mode in response to a first operation by the user on the settings interface. With this design, the electronic device can also support the user activating a height mode in the painting application. After activating the height mode, the electronic device can display the thickness and gloss effects of oil paint based on the paint trails shown by the user's drawing operation.

[0010] In one possible design, the height mode includes at least one of the following adjustable parameters: highlight parameter, shadow parameter, duotone parameter, height decay parameter, and pigment humidity parameter; wherein, the highlight parameter is used to adjust the area and intensity of the highlight region in the pigment trajectory, the shadow parameter is used to adjust the area and intensity of the shadow region in the pigment trajectory, the duotone parameter is used to control the display of different colors at different heights in the pigment trajectory, the height decay parameter is used to control the effect of highlights and shadows within the pigment trajectory based on the detected pressure value, and the pigment humidity parameter is used to control the pigment mixing effect. Through this design, this application can provide multiple adjustable parameters in various height modes, supporting users to manually adjust parameter values, thereby allowing users to adjust the brushstroke effects corresponding to different parameters and improving the user experience.

[0011] In one possible design, the initial color information of each pixel is determined based on the brush color information corresponding to the drawing operation, including: the initial color information of each pixel is determined based on the first value of the two-color parameter, the information of the primary color and the information of the secondary color in the brush color information. With this design, when the user adjusts the two-color parameter in the height mode to the first value, the electronic device can determine whether the pixel's color is the primary or secondary color based on the adjusted two-color parameter, thereby simulating the effect of a single stroke in a real oil painting potentially producing two colors, further enhancing the realism of the oil painting brush.

[0012] In one possible design, determining the initial color information of each pixel in the pigment trajectory based on the first value, the information of the primary color, and the information of the secondary color includes: when the shape parameter of the first pixel in the pigment trajectory in the stamp is greater than or equal to the first value, determining the initial color information of the first pixel as the information of the primary color; or when the shape parameter of the first pixel in the stamp is less than the first value, determining the initial color information of the first pixel as the information of the secondary color; wherein, the first pixel refers to each pixel in the pigment trajectory. Through this design, an electronic device can determine the color of a pixel based on its shape parameter in the stamp and the first value, thereby determining the possible color displayed at that pixel in the pigment trajectory based on the shape of the stamp, making the two-color effect in the pigment trajectory more realistic.

[0013] In one possible design, the initial color information of each pixel is determined based on the brush color information corresponding to the drawing operation. Specifically, when historical paint trails exist in the previous frame image displayed by the electronic device, the initial color information of each pixel is determined based on the brush color information, the historical color information of each pixel in the previous frame image, and the paint humidity parameter. With this design, when historical paint trails exist on the digital canvas of the electronic device, the device can determine the color of the pixel based on the user-set paint humidity parameter, thereby adjusting the paint mixing effect.

[0014] In one possible design, determining the height information of each pixel in the paint trajectory includes: determining a first height value, a second height value, a total drawing amount, and an opacity influence value for each pixel; wherein, the first height value is the height value of the multiple stamps superimposed on the paint trajectory at each pixel; the second height value is the height influence value of each pixel on the paint trajectory determined based on the pressure value; the total drawing amount represents the number of times each pixel is drawn; and the opacity influence value is the influence value of factors other than the flow parameter on the opacity, where the flow parameter is a parameter used to control the color depth. Through this design, the pixel height information determined by the electronic device in this application can include multiple parameters, thereby combining various factors that may affect the paint height, highlight effect, and shadow effect at that pixel to determine the pixel height information, ensuring the realistic effect of the oil painting brush.

[0015] In one possible design, the total number of times each pixel in the paint trajectory is drawn is determined based on the historical total number of times each pixel is drawn and a spacing parameter, where the spacing parameter represents the distance between the center points of two adjacent stamps. With this design, the electronic device can determine the total number of times a pixel is drawn based on the spacing parameter in the brush parameters, thereby determining the number of times a pixel is drawn; this total number of draws can affect the height of the pixel.

[0016] In one possible design, the method further includes: acquiring the height attenuation parameter set by the user; calculating a pressure height value based on the height attenuation parameter and the pressure value corresponding to each pixel, wherein the pressure height value represents the influence of the stamp shape parameter on the height increment after multiple stamps are superimposed on the paint trajectory; and determining a first height value for each pixel based on the shape parameter of each pixel in the stamp, the pressure height value, the historical height value of each pixel, and the historical total drawing amount of each pixel. Through this design, the electronic device can determine the first height value at a pixel, which is the height value of the pixel after multiple stamps are superimposed by the electronic device. This first height value can be used to represent the height of the pixel after multiple stamp superpositions. For example, in the solution provided in this application, when a user performs repeated smearing operations in the same area, the electronic device determines that the first height value of the pixel in that area is a small value, thereby achieving the effect of flattening the repeatedly smeared area.

[0017] In one possible design, the method further includes: acquiring the user-set height attenuation parameter; determining a second height value for each pixel based on the historical second height value of each pixel, the height attenuation parameter, the pressure value corresponding to each pixel, and a pressure-flow parameter, wherein the pressure-flow parameter is used to control the flow parameter based on the pressure value. Through this design, the electronic device can determine a second height value at a pixel, which is the influence value of that pixel on the height of the entire paint trajectory determined based on the pressure value. Therefore, the electronic device can determine the height of the pixel by combining the detected pressure value, allowing the user to change the display effect of the paint trajectory by changing the pressure value applied to the screen when performing a drawing operation, thus improving the user experience.

[0018] In one possible design, the method further includes: determining a rendering mode; determining a first influence value based on the shape parameters, texture information, and percolation parameters of each pixel in the stamp; and determining the opacity influence value of each pixel based on the opacity blending formula corresponding to the rendering mode, the first influence value, and the historical opacity influence value of each pixel.

[0019] In one possible design, determining the target color information of each pixel based on the lighting system, according to the height information and initial color information of each pixel, includes: determining the target highlight value and target shadow value of the target pixel based on the lighting system, according to a first height value and a second height value in the height information of the target pixel in the paint trajectory; and determining the target color information of the target pixel based on the target highlight value, target shadow value, and initial color information. Through this design, the electronic device can determine the target highlight value and target shadow value based on the height information of the pixel using the lighting system, and adjust the initial color information of the pixel based on the target highlight value and target shadow value, so that the paint trajectory can display the highlight and shadow effects of oil paint under illumination, enhancing the realism of the oil painting brush.

[0020] In one possible design, the target pixel is the pixel among the first pixels whose opacity influence value meets a preset condition, and the first pixel is each pixel in the pigment trajectory. With this design, the electronic device can determine whether texture information exists at the pixel based on the opacity influence value. For pixels that do not meet the preset condition, the electronic device can determine that no texture information exists at that pixel, thus eliminating the need for the electronic device to adjust the pixel's color information again based on the lighting system, reducing the computational load on the electronic device.

[0021] In one possible design, determining the target specular value of the target pixel based on the first and second height values ​​in the height information of the target pixel in the pigment trajectory includes: acquiring the height information of multiple adjacent pixels of the target pixel; determining the normal vector of the target pixel based on the height information of the multiple adjacent pixels, the first height value, and the second height value of the target pixel; calculating the reflection vector of the target pixel based on the normal vector and a preset perpendicular vector; calculating specular diffuse reflection based on a predefined specular direction and the normal vector; calculating specular specular reflection based on the predefined specular direction, the reflection vector, and the parameters of the Von Lehn lighting model; calculating Fresnel coefficients based on the normal vector and the reflection vector of the target pixel; and calculating the target specular value of the target pixel based on the user-set specular parameters, specular diffuse reflection, specular specular reflection, and Fresnel coefficients.

[0022] In one possible design, determining the target shadow value of the target pixel based on the first height value and the second height value in the height information of the target pixel in the pigment trajectory includes: acquiring the height information of multiple adjacent pixels of the target pixel; determining the normal vector of the target pixel based on the height information of the multiple adjacent pixels, the first height value, and the second height value of the target pixel; calculating the reflection vector of the target pixel based on the normal vector of the target pixel and a preset perpendicular vector; calculating the diffuse reflection of the shadow based on a predefined shadow direction and the normal vector; calculating the specular reflection of the shadow based on the predefined shadow direction, the reflection vector, and the parameters of the Von Lehn lighting model; calculating the Fresnel coefficient based on the normal vector and the reflection vector of the target pixel; and calculating the target shadow value of the target pixel based on the user-set shadow parameters, the diffuse reflection of the shadow, the specular reflection of the shadow, and the Fresnel coefficient.

[0023] In one possible design, before determining the target color information of each pixel based on the lighting system, the method further includes: determining the adjusted initial color information of each pixel based on a preset adjustment value and the initial color information of each pixel, wherein the preset adjustment value is used to correct color differences caused by inconsistencies between highlight and shadow intensities; the determination of the target color information of each pixel based on the lighting system, the height information of each pixel, and the initial color information of each pixel includes: determining the target color information of each pixel based on the lighting system, the height information of each pixel, and the adjusted initial color information of each pixel. Through this design, since this application supports users to adjust highlight and shadow parameters separately, when the user adjusts the highlight and shadow parameters differently, the highlight and shadow intensities may be inconsistent, potentially causing color differences in the paint trajectory. Therefore, adjusting the initial color information of the pixel based on the preset adjustment value can make the highlight and shadow effects of the adjusted paint trajectory closer to the effect of a realistic oil painting.

[0024] Secondly, this application provides an image processing method that can be executed by an electronic device. In this method, in response to a user operation, the electronic device activates a dual-brush function, which includes a primary brush and a secondary brush. The method receives the user's drawing operation, determines the first color information and height information of each pixel in a first pigment trajectory obtained based on the primary brush, and determines the second color information of each pixel in a second pigment trajectory obtained based on the secondary brush. The method performs a mixing process based on the first color information of each pixel in the first pigment trajectory and the second color information of each pixel in the second pigment trajectory to obtain the initial color information of each pixel in the pigment trajectory corresponding to the dual brush. Based on a lighting system, and according to the height information of each pixel in the first pigment trajectory and the initial color information of each pixel in the pigment trajectory corresponding to the dual brush, the method determines the target color information of each pixel in the pigment trajectory corresponding to the dual brush. Finally, the method draws and displays the pigment trajectory corresponding to the dual brush based on the target color information of each pixel in the pigment trajectory corresponding to the dual brush.

[0025] In the above method, the electronic device supports dual brush functionality. Users can set a primary brush and a secondary brush. Based on the user's drawing operation, the electronic device can determine the color of the pixels in the paint trajectory according to the color information of the primary brush and the secondary brush, and determine the height information of the pixels in the paint trajectory corresponding to the dual brush according to the height information of the pixels in the first paint trajectory corresponding to the primary brush. Thus, the primary brush determines the three-dimensional effect in the displayed paint trajectory, while the secondary brush can form a planar effect different from the primary brush.

[0026] In one possible design, determining the height information of each pixel in the first paint trajectory obtained based on the main brush includes a first height value, a second height value, a total drawing amount, and an opacity influence value for each pixel; wherein, the first height value is the height value of the multiple stamps superimposed on the paint trajectory at each pixel, the second height value is the height influence value of each pixel on the paint trajectory determined based on the pressure value, the total drawing amount is used to represent the number of times each pixel is drawn, and the opacity influence value is the influence value of factors other than the flow parameter on the opacity, the flow parameter being a parameter used to control the color depth.

[0027] In one possible design, determining the total number of times each pixel in the paint trajectory is drawn includes: obtaining a spacing parameter from the brush parameters of the main brush, the spacing parameter representing the distance between the center points of two adjacent stamps; and determining the total number of times each pixel is drawn based on its historical total number of draws and the spacing parameter. With this design, the electronic device can determine the total number of times each pixel is drawn based on the spacing parameter in the brush parameters, thereby determining the number of times a pixel is drawn, and this total number of draws can affect the height of the pixel.

[0028] In one possible design, determining the first height value of each pixel in the paint trajectory includes: acquiring the height attenuation parameter set by the user; calculating a pressure height value based on the height attenuation parameter and the pressure value corresponding to each pixel, wherein the pressure height value represents the influence of the stamp shape parameter on the height increment after multiple stamps are superimposed on the paint trajectory; and determining the first height value of each pixel based on the shape parameter of each pixel in the stamp, the pressure height value, the historical height value of each pixel, and the historical total drawing amount of each pixel. Through this design, the electronic device can determine the first height value at a pixel, which is the height value of the pixel after multiple stamps are superimposed by the electronic device. This first height value can be used to represent the height of the pixel after multiple stamp superpositions. For example, in the solution provided in this application, when a user performs repeated smearing operations in the same area, the electronic device determines that the first height value of the pixel in that area is a small value, thereby achieving the effect of flattening the repeatedly smeared area.

[0029] In one possible design, determining the second height value of each pixel in the paint trajectory includes: acquiring the user-set height attenuation parameter; and determining the second height value of each pixel based on the historical second height value of each pixel, the height attenuation parameter, the pressure value corresponding to each pixel, and a pressure-flow parameter, wherein the pressure-flow parameter is used to control the flow parameter based on the pressure value. Through this design, the electronic device can determine the second height value at a pixel, which is the influence value of that pixel on the height of the entire paint trajectory determined based on the pressure value. Therefore, the electronic device can determine the height of the pixel by combining the detected pressure value, allowing the user to change the display effect of the paint trajectory by changing the pressure value applied to the screen when performing a drawing operation, thus improving the user experience.

[0030] In one possible design, determining the opacity influence value of each pixel in the pigment trajectory includes: determining a rendering mode; determining a first influence value based on the shape parameters, texture information, and percolation parameters of each pixel in the stamp; and determining the opacity influence value of each pixel based on the opacity blending formula corresponding to the rendering mode, the first influence value, and the historical opacity influence value of each pixel.

[0031] In one possible design, determining the target color information of each pixel in the pigment trajectory corresponding to the dual brush based on the lighting system and according to the height information of each pixel in the first pigment trajectory and the initial color information of each pixel in the pigment trajectory corresponding to the dual brush includes: determining the target highlight value and target shadow value of the target pixel based on the lighting system and according to the first height value and the second height value in the height information of the target pixel in the first pigment trajectory; and determining the target color information of the target pixel based on the target highlight value, target shadow value and initial color information of the target pixel.

[0032] In one possible design, the target pixel is the pixel in the first pigment trajectory whose opacity influence value meets a preset condition.

[0033] In one possible design, determining the target specular value of the target pixel based on the first and second height values ​​in the height information of the target pixel in the pigment trajectory includes: acquiring the height information of multiple adjacent pixels of the target pixel; determining the normal vector of the target pixel based on the height information of the multiple adjacent pixels, the first height value, and the second height value of the target pixel; calculating the reflection vector of the target pixel based on the normal vector and a preset perpendicular vector; calculating specular diffuse reflection based on a predefined specular direction and the normal vector; calculating specular specular reflection based on the predefined specular direction, the reflection vector, and the parameters of the Von Lehn lighting model; calculating Fresnel coefficients based on the normal vector and the reflection vector of the target pixel; and calculating the target specular value of the target pixel based on the user-set specular parameters, specular diffuse reflection, specular specular reflection, and Fresnel coefficients.

[0034] In one possible design, determining the target shadow value of the target pixel based on the first height value and the second height value in the height information of the target pixel in the pigment trajectory includes: acquiring the height information of multiple adjacent pixels of the target pixel; determining the normal vector of the target pixel based on the height information of the multiple adjacent pixels, the first height value, and the second height value of the target pixel; calculating the reflection vector of the target pixel based on the normal vector of the target pixel and a preset perpendicular vector; calculating the diffuse reflection of the shadow based on a predefined shadow direction and the normal vector; calculating the specular reflection of the shadow based on the predefined shadow direction, the reflection vector, and the parameters of the Von Lehn lighting model; calculating the Fresnel coefficient based on the normal vector and the reflection vector of the target pixel; and calculating the target shadow value of the target pixel based on the user-set shadow parameters, the diffuse reflection of the shadow, the specular reflection of the shadow, and the Fresnel coefficient.

[0035] Thirdly, this application provides an image processing method that can be executed by an electronic device. In this method, in response to a user operation, a dual-brush function is activated, the dual-brush function including a main brush and a secondary brush; the user's drawing operation is received; first color information and first height information of each pixel in a first paint trajectory obtained based on the main brush are determined; second color information and second height information of each pixel in a second paint trajectory obtained based on the secondary brush are determined; and a mixing process is performed based on the first color information of each pixel in the first paint trajectory and the second color information of each pixel in the second paint trajectory to obtain the first color information of each pixel in the paint trajectory corresponding to the dual brush. The initial color information of each pixel; the target height information of each pixel in the pigment trajectory corresponding to the dual brush is obtained by mixing the first height information of each pixel in the first pigment trajectory and the second height information of each pixel in the second pigment trajectory; the target color information of each pixel in the pigment trajectory corresponding to the dual brush is determined based on the lighting system, the initial color information of each pixel in the pigment trajectory corresponding to the dual brush, and the target height information of each pixel in the pigment trajectory corresponding to the dual brush; the pigment trajectory corresponding to the dual brush is drawn and displayed based on the target color information of each pixel in the pigment trajectory corresponding to the dual brush.

[0036] In the above method, the electronic device supports dual brush functionality. Users can set a primary brush and a secondary brush. The electronic device can determine the color and height information of the pixels in the paint trajectory obtained by the primary brush and the secondary brush respectively, and perform a mixing process on the color and height information of the pixels in the paint trajectory obtained by the primary brush and the secondary brush. Thus, the paint trajectory corresponding to the dual brush can integrate the three-dimensional effect and color information of the primary brush and the secondary brush.

[0037] In one possible design, determining the height information of each pixel in the first paint trajectory obtained based on the main brush includes a first height value, a second height value, a total drawing amount, and an opacity influence value for each pixel; wherein, the first height value is the height value of the multiple stamps superimposed on the paint trajectory at each pixel, the second height value is the height influence value of each pixel on the paint trajectory determined based on the pressure value, the total drawing amount is used to represent the number of times each pixel is drawn, and the opacity influence value is the influence value of factors other than the flow parameter on the opacity, the flow parameter being a parameter used to control the color depth.

[0038] In one possible design, determining the height information of each pixel in the second paint trajectory obtained based on the secondary brush includes a first height value, a second height value, a total drawing amount, and an opacity influence value for each pixel; wherein, the first height value is the height value of the multiple stamps superimposed on the paint trajectory at each pixel, the second height value is the height influence value of each pixel on the paint trajectory determined based on the pressure value, the total drawing amount is used to represent the number of times each pixel is drawn, and the opacity influence value is the influence value of factors other than the flow parameter on the opacity, the flow parameter being a parameter used to control the color depth.

[0039] In one possible design, determining the total number of times each pixel in the paint trajectory is drawn includes: obtaining a spacing parameter from the brush parameters of the main brush, the spacing parameter representing the distance between the center points of two adjacent stamps; and determining the total number of times each pixel is drawn based on its historical total number of draws and the spacing parameter. With this design, the electronic device can determine the total number of times each pixel is drawn based on the spacing parameter in the brush parameters, thereby determining the number of times a pixel is drawn, and this total number of draws can affect the height of the pixel.

[0040] In one possible design, determining the first height value of each pixel in the paint trajectory includes: acquiring the height attenuation parameter set by the user; calculating a pressure height value based on the height attenuation parameter and the pressure value corresponding to each pixel, wherein the pressure height value represents the influence of the stamp shape parameter on the height increment after multiple stamps are superimposed on the paint trajectory; and determining the first height value of each pixel based on the shape parameter of each pixel in the stamp, the pressure height value, the historical height value of each pixel, and the historical total drawing amount of each pixel. Through this design, the electronic device can determine the first height value at a pixel, which is the height value of the pixel after multiple stamps are superimposed by the electronic device. This first height value can be used to represent the height of the pixel after multiple stamp superpositions. For example, in the solution provided in this application, when a user performs repeated smearing operations in the same area, the electronic device determines that the first height value of the pixel in that area is a small value, thereby achieving the effect of flattening the repeatedly smeared area.

[0041] In one possible design, determining the second height value of each pixel in the paint trajectory includes: acquiring the user-set height attenuation parameter; and determining the second height value of each pixel based on the historical second height value of each pixel, the height attenuation parameter, the pressure value corresponding to each pixel, and a pressure-flow parameter, wherein the pressure-flow parameter is used to control the flow parameter based on the pressure value. Through this design, the electronic device can determine the second height value at a pixel, which is the influence value of that pixel on the height of the entire paint trajectory determined based on the pressure value. Therefore, the electronic device can determine the height of the pixel by combining the detected pressure value, allowing the user to change the display effect of the paint trajectory by changing the pressure value applied to the screen when performing a drawing operation, thus improving the user experience.

[0042] In one possible design, determining the opacity influence value of each pixel in the pigment trajectory includes: determining a rendering mode; determining a first influence value based on the shape parameters, texture information, and percolation parameters of each pixel in the stamp; and determining the opacity influence value of each pixel based on the opacity blending formula corresponding to the rendering mode, the first influence value, and the historical opacity influence value of each pixel.

[0043] In one possible design, determining the target color information of each pixel in the pigment trajectory corresponding to the dual brush based on the lighting system and according to the height information of each pixel in the first pigment trajectory and the initial color information of each pixel in the pigment trajectory corresponding to the dual brush includes: determining the target highlight value and target shadow value of the target pixel based on the lighting system and according to the first height value and the second height value in the height information of the target pixel in the pigment trajectory corresponding to the dual brush; and determining the target color information of the target pixel based on the target highlight value, target shadow value and initial color information of the target pixel.

[0044] In one possible design, the target pixel is the pixel in the pigment trajectory corresponding to the dual brush whose opacity influence value meets a preset condition.

[0045] In one possible design, determining the target specular value of the target pixel based on the first and second height values ​​in the height information of the target pixel in the pigment trajectory includes: acquiring the height information of multiple adjacent pixels of the target pixel; determining the normal vector of the target pixel based on the height information of the multiple adjacent pixels, the first height value, and the second height value of the target pixel; calculating the reflection vector of the target pixel based on the normal vector and a preset perpendicular vector; calculating specular diffuse reflection based on a predefined specular direction and the normal vector; calculating specular specular reflection based on the predefined specular direction, the reflection vector, and the parameters of the Von Lehn lighting model; calculating Fresnel coefficients based on the normal vector and the reflection vector of the target pixel; and calculating the target specular value of the target pixel based on the user-set specular parameters, specular diffuse reflection, specular specular reflection, and Fresnel coefficients.

[0046] In one possible design, determining the target shadow value of the target pixel based on the first height value and the second height value in the height information of the target pixel in the pigment trajectory includes: acquiring the height information of multiple adjacent pixels of the target pixel; determining the normal vector of the target pixel based on the height information of the multiple adjacent pixels, the first height value, and the second height value of the target pixel; calculating the reflection vector of the target pixel based on the normal vector of the target pixel and a preset perpendicular vector; calculating the diffuse reflection of the shadow based on a predefined shadow direction and the normal vector; calculating the specular reflection of the shadow based on the predefined shadow direction, the reflection vector, and the parameters of the Von Lehn lighting model; calculating the Fresnel coefficient based on the normal vector and the reflection vector of the target pixel; and calculating the target shadow value of the target pixel based on the user-set shadow parameters, the diffuse reflection of the shadow, the specular reflection of the shadow, and the Fresnel coefficient.

[0047] Fourthly, this application provides an electronic device comprising a plurality of functional modules; the plurality of functional modules interact to implement the methods performed by the electronic device in any of the above aspects and their respective embodiments. The plurality of functional modules can be implemented based on software, hardware, or a combination of software and hardware, and the plurality of functional modules can be arbitrarily combined or divided based on specific implementations.

[0048] Fifthly, this application provides an electronic device including at least one processor and at least one memory, wherein the at least one memory stores computer program instructions, and when the electronic device is running, the at least one processor executes any of the above aspects and the methods executed by the electronic device in its various embodiments.

[0049] Sixthly, this application also provides a computer program product containing instructions that, when the computer program product is run on a computer, cause the computer to perform the method executed by the electronic device in any of the above aspects and embodiments.

[0050] In a seventh aspect, this application also provides a computer-readable storage medium storing a computer program that, when executed by a computer, causes the computer to perform the method executed by the electronic device in any of the above aspects and embodiments.

[0051] Eighthly, this application also provides a chip for reading a computer program stored in a memory and executing the method executed by the electronic device in any of the above aspects and embodiments.

[0052] Ninthly, this application also provides a chip system including a processor for supporting a computer device in implementing the methods executed by electronic devices in any of the above aspects and their embodiments. In one possible design, the chip system further includes a memory for storing programs and data necessary for the computer device. The chip system may be composed of chips or may include chips and other discrete devices. Attached Figure Description

[0053] Figure 1 This is a schematic diagram illustrating an application scenario of an image processing method provided in an embodiment of this application;

[0054] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0055] Figure 3 A software structure block diagram of an electronic device provided in an embodiment of this application;

[0056] Figure 4This is a schematic diagram of the interface of the drawing application displayed on the electronic device in the embodiments of this application;

[0057] Figure 5 A schematic diagram of a stamp setting interface displayed on an electronic device according to an embodiment of this application;

[0058] Figure 6 A schematic diagram of the settings interface of a drawing application provided in an embodiment of this application;

[0059] Figure 7 A schematic diagram illustrating a two-color effect provided in an embodiment of this application;

[0060] Figure 8 A schematic diagram illustrating a pigment overlay effect provided in an embodiment of this application;

[0061] Figure 9 This is a schematic diagram illustrating the effect of a height attenuation parameter on the trajectory drawing effect, provided in an embodiment of this application.

[0062] Figure 10 This is a schematic diagram illustrating the drawing effect provided in an embodiment of this application;

[0063] Figure 11 This is a schematic diagram of an oil painting brush effect provided in an embodiment of this application;

[0064] Figure 12 A schematic diagram of the interface of a drawing application provided in an embodiment of this application;

[0065] Figure 13 This is a schematic diagram illustrating the effect of a dual brush in an embodiment of this application.

[0066] Figure 14 This is a flowchart of an image processing method provided in an embodiment of this application. Detailed Implementation

[0067] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the embodiments of this application will be further described in detail below with reference to the accompanying drawings. In the description of the embodiments of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include one or more of that feature.

[0068] It should be understood that in the embodiments of this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single 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, b, and c, where a, b, and c can be single or multiple.

[0069] Drawing applications on electronic devices can provide users with a variety of digital painting functions. For example, drawing applications can provide realistic brush effects, such as pencil brushes, crayon brushes, spray brushes, and oil paint brushes. Users can select brush effects in the drawing application and use their fingers or styluses to draw digitally on the screen.

[0070] In current drawing applications, oil painting brushes are achieved through simple texture overlay or color mixing, which cannot realistically reproduce the thickness, gloss, and three-dimensionality of oil paint, thus failing to demonstrate the expressive power of digital oil painting and impacting the user experience.

[0071] To address the above problems, embodiments of this application provide an image processing method to deliver a more realistic oil painting brush effect. For example... Figure 1 This is a schematic diagram illustrating an application scenario of an image processing method provided in an embodiment of this application. (Refer to...) Figure 1 The image processing method provided in this application can be applied to electronic devices, such as drawing applications within the electronic device. These drawing applications can be third-party applications or system applications. Optionally, the electronic device can also establish a connection with a stylus, for example, through Bluetooth. When the electronic device is running a drawing application, it can display a canvas, allowing the user to draw on the screen using their finger or a stylus. The canvas displayed by the electronic device can show paint trails.

[0072] The following describes an electronic device and embodiments for using such an electronic device. The electronic device in this application embodiment can be a tablet computer, mobile phone, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), wearable device, etc. This application embodiment does not limit the specific type of electronic device.

[0073] In some embodiments of this application, the electronic device may also be a portable terminal device that includes other functions such as a personal digital assistant and / or a music player. Exemplary embodiments of the portable terminal device include, but are not limited to, devices equipped with... Or portable terminal devices with other operating systems.

[0074] Figure 2 This is a schematic diagram of the structure of an electronic device 100 provided in an embodiment of this application. Figure 2 As shown, 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, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0075] Processor 110 may include one or more processing units, such as an application processor (AP), 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 / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. The controller may serve as the central nervous system and command center of the electronic device 100. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. 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 processor 110 has recently used or is repeatedly used. If processor 110 needs to reuse an instruction or data, it can directly retrieve it from the memory. This avoids repeated access, reduces the waiting time of processor 110, and thus improves system efficiency.

[0076] USB interface 130 is a USB standard compliant interface, specifically a Mini USB interface, Micro USB interface, USB Type-C interface, etc. USB interface 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. Charging management module 140 receives charging input from the charger. Power management module 141 connects battery 142, charging management module 140, and processor 110. Power management module 141 receives input from battery 142 and / or charging management module 140, providing power to processor 110, internal memory 121, external memory, display 194, camera 193, and wireless communication module 160, etc.

[0077] The wireless communication function of electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. 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 one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0078] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0079] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0080] 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, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0081] The display screen 194 is used to display the display interface of an application, such as the display page of an application installed on the electronic device 100. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.

[0082] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0083] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system and software code for at least one application program. The data storage area may store data generated during the use of electronic device 100 (e.g., captured images, recorded videos, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0084] The external storage 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. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, images, videos, and other files can be saved on the external memory card.

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

[0086] The sensor module 180 may include a pressure sensor 180A, an acceleration sensor 180B, a touch sensor 180C, etc.

[0087] The pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194.

[0088] Touch sensor 180C, also known as a "touch panel," can be located on display screen 194. The touch sensor 180C and display screen 194 together form a touchscreen, also known as a "touch screen." Touch sensor 180C detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180C may also be located on the surface of electronic device 100, in a different position than display screen 194.

[0089] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch buttons. Electronic device 100 can receive button inputs and generate key signal inputs related to user settings and function control. Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, touch operations applied to different applications (such as taking photos, audio playback, etc.) can correspond to different vibration feedback effects. Touch vibration feedback effects can also be customized. Indicator 192 can be an indicator light, used to indicate charging status, battery level changes, or to indicate messages, missed calls, notifications, etc. SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to achieve contact and separation with electronic device 100.

[0090] Understandable, Figure 2The components shown do not constitute a specific limitation on the electronic device 100. The electronic device may also include more or fewer components than shown, or combine some components, or separate some components, or have different component arrangements. Furthermore, Figure 2 The combination / connection relationships between the components can also be adjusted and modified.

[0091] Figure 3 This is a software structure block diagram of an electronic device provided in an embodiment of this application. For example... Figure 3 As shown, the software architecture of an electronic device can be a layered architecture. For example, the software can be divided into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the operating system is divided into four layers, from top to bottom: the application layer, the application framework layer (framework, FWK), the runtime and system libraries, and the kernel layer.

[0092] The application layer can include a series of application packages. For example... Figure 3 As shown, the application layer may include a camera, settings, skin modules, a user interface (UI), and third-party applications. These third-party applications may include a gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS. In this embodiment, the application layer may also include a drawing application that can provide digital drawing capabilities.

[0093] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer can include some predefined functions. For example... Figure 3 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, and notification manager.

[0094] The window manager is used to manage windowed applications. It can obtain the screen size, determine if a status bar is present, lock the screen, and capture screenshots. The content provider stores and retrieves data, making this data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0095] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0096] A phone manager is used to provide communication functions for electronic devices. For example, it manages call status (including connection and disconnection).

[0097] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0098] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0099] The runtime includes the core libraries and the virtual machine. The runtime is responsible for the scheduling and management of the operating system.

[0100] The core library consists of two parts: one part contains the functionalities that the Java language needs to call, and the other part contains the core libraries of the operating system. The application layer and application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0101] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), image processing libraries, etc.

[0102] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0103] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

[0104] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0105] A 2D graphics engine is a graphics engine for 2D drawing.

[0106] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0107] The hardware layer can include various types of sensors, such as accelerometers, gyroscopes, and touch sensors.

[0108] It should be noted that, Figure 2 and Figure 3 The structure shown is merely an example of an electronic device provided in this application embodiment and is not intended to limit the electronic device provided in this application embodiment in any way. In specific implementations, the electronic device may have more than Figure 2 or Figure 3 The structure shown may contain more or fewer devices or modules.

[0109] The image processing method provided in the embodiments of this application will be described below.

[0110] First, let's introduce the terminology used in the drawing applications involved in this application. A brush is one of the most basic tools in drawing applications, used to draw lines or fill areas on a digital canvas. Brushes can simulate the functions of traditional painting tools, such as simulating the effects of a brush, pencil, or oil paintbrush. The drawing application of the electronic device in this application supports multiple brushes. Users can select the desired brush in the drawing application, and the brushes support various adjustable parameters, such as brush size, transparency, and spacing. Users can adjust the brush parameters to obtain different brushstroke effects. For example, Figure 4 This is a schematic diagram of the interface of the drawing application displayed on the electronic device in an embodiment of this application. (Refer to...) Figure 4 The electronic device can display an interface including multiple brush options, allowing the user to select the desired brush. The drawing brush method provided in this application can be applied to oil painting brushes to enhance the brushstroke effects.

[0111] A stamp is a basic drawing unit in a drawing application. Based on a preset pattern or shape, it is repeatedly applied to a digital canvas as the user draws, forming a paint trail. In this embodiment, the electronic device's drawing application can provide multiple stamps, allowing the user to select different stamps for different drawing effects. When generating and displaying a paint trail on the digital canvas based on the user's drawing operations, the electronic device can draw in units of stamps. Each time, the electronic device can draw multiple pixels comprising one stamp, and multiple stamps can be repeatedly drawn according to the user's drawing path to form a paint trail. For example... Figure 5 This is a schematic diagram of a stamp setting interface displayed on an electronic device according to an embodiment of this application. (Refer to...) Figure 5Users can choose from a variety of stamps provided by the drawing application. The electronic device can display a schematic diagram of the selected stamp's shape, as well as a schematic diagram of the paint trail drawn based on that stamp. (Reference) Figure 5 The drawing application can also support a variety of adjustable parameters for the stamp, such as whether to retain the color information of the stamp's shape material, as well as parameters related to the stamp shape.

[0112] In this embodiment, the electronic device runs a drawing application. The user can choose to create a new canvas and select a brush type, such as an oil painting brush. In this embodiment, the drawing application can also support a height mode for oil painting brushes. When the height mode is enabled, the electronic device can display different heights of paint accumulation perspectives based on different positions in the paint trajectory displayed by the user's drawing operation, thereby enhancing the realism of the oil painting brush.

[0113] In some examples, such as Figure 6 A schematic diagram of the settings interface of a drawing application provided in an embodiment of this application, with reference to... Figure 6 Drawing applications on electronic devices can display a brush settings interface, which may include an on / off control for "height mode." When the user selects to enable the height mode of the oil painting brush, the brush settings interface may also include multiple adjustable parameters. These adjustable parameters are attributes derived from the breakdown of actual oil painting brushstrokes, such as... Figure 6 As shown, the adjustable parameters of the height mode can include highlights, shadows, duotones, height decay, and pigment wetness. The highlight parameter adjusts the area and intensity of the highlight region in the pigment trail, while the shadow parameter adjusts the area and intensity of the shadow region. The duotone parameter controls the display of different colors at different heights within a single pigment stroke drawn by the user, creating an effect of transitioning from a primary color to an auxiliary color. The height decay parameter controls the effects of highlights and shadows within the pigment trail based on the detected pressure value. For example, when the user adjusts the height decay parameter to 0, the highlights and shadows in the pigment trail after the user performs a drawing operation are both at a preset intensity. When the user adjusts the height decay parameter to a non-zero value, the greater the pressure applied by the user on the screen, the stronger the highlights and shadows at the corresponding positions in the pigment trail; conversely, the smaller the pressure applied by the user on the screen, the weaker the highlights and shadows at the corresponding positions in the pigment trail. The pigment wetness parameter controls the effect of pigment mixing when the user applies multiple strokes to the same area. All the adjustable parameters of the height mode described in the above embodiments support manual adjustment by the user, allowing the user to adjust the brushstroke effects corresponding to different parameters.

[0114] In this embodiment, after enabling the height mode, the electronic device receives the user's drawing operation and obtains the initial color information of each pixel in the paint trajectory corresponding to the drawing operation. The initial color information of each pixel is determined based on the brush color information corresponding to the drawing operation. The electronic device determines the height information of each pixel in the paint trajectory based on the brush stamp shape information. The height information of each pixel is used to indicate the paint height when simulating a three-dimensional oil painting effect. The electronic device determines the target color information of each pixel based on the lighting system, the height information, and the initial color information. The electronic device displays the paint trajectory based on the target color information of each pixel in the paint trajectory.

[0115] Optionally, in the embodiments of this application, the initial color information and target color information of the pixel can be, for example, RGBA information, where RGBA are Red, Green, Blue, and Alpha, respectively.

[0116] In one optional implementation, when the electronic device draws a pigment trajectory based on the user's drawing operation, it can draw in units of stamps. Multiple stamps can be superimposed or arranged to form a pigment trajectory. When drawing a stamp, the electronic device can draw each pixel in the stamp according to the shape of the stamp. The electronic device can determine the initial color information and height information of each pixel separately, and determine the target color information based on the initial color information and height information.

[0117] The method for determining the initial color information of each pixel in a stamp by an electronic device in the embodiments of this application is described below.

[0118] In some examples, the electronic device can obtain brush color information. The brush color corresponding to this information can be a color set by the user, or if the user has not set a brush color, the brush color corresponding to the information obtained by the electronic device can be the default color of the drawing application. The electronic device can use the obtained brush color information as the initial color information for each pixel in the stamp.

[0119] In some other examples, refer to Figure 6 In height mode, the adjustable parameter "dual color" is supported. Users can set a dual-color brush in the brush settings, specifying the primary and secondary colors. The brush color information received by the electronic device includes both the primary and secondary color information. Users can also set the dual-color parameter in height mode to its first value. Figure 6Users can adjust the value of the dual-color parameter, which can be any value between 0 and 100%. A higher value results in a more pronounced dual-color effect in the paint trail. When the user adjusts the dual-color parameter to 0, the dual-color effect is turned off. The electronic device uses the user-adjusted dual-color parameter value as a first value and can determine the initial color information of pixels based on this first value and brush color information. For example, refer to... Figure 5 A stamp is composed of multiple pixels. The shape parameters of the stamp include the shape parameters of each pixel within the stamp. The electronic device can acquire these shape parameters. When the shape parameter of a pixel within the stamp is greater than or equal to a first value, the electronic device can determine that the initial color information of that pixel is the primary color. When the shape parameter of a pixel within the stamp is less than the first value, the electronic device can determine that the initial color information of that pixel is the secondary color. For example, the shape parameter of a pixel within the stamp can be the grayscale value of that pixel within the stamp.

[0120] For example, Figure 7 This is a schematic diagram of a two-color effect provided in an embodiment of this application, with reference to... Figure 7 After the user performs a drawing operation on the canvas, the electronic device can determine the initial color information of each pixel based on the shape parameters of each pixel in the stamp and the first value of the dual-color parameters set by the user. Then, the paint trajectory determined by the electronic device may contain two colors: a primary color and an auxiliary color.

[0121] It should be noted that, Figure 7 The two-color effect shown is for illustrative purposes only and not a limitation. In actual drawing, the auxiliary color may appear at any position on the paint path.

[0122] In other examples, when a user triggers a drawing operation, historical paint trails already exist on the canvas. The electronic device can then determine the initial color information based on the historical color information of the pixels and the brush color information. Optionally, refer to... Figure 6 Adjustable parameters in height mode can include pigment humidity parameters, such as... Figure 6 Users can adjust the pigment humidity parameter, which can be any value between 0 and 100%. The smaller the value, the stronger the coverage of the current pigment trajectory over the previous pigment trajectory. When the user adjusts the two-color parameter to 0, the color of the currently drawn pixel will completely cover the color of the previous pixel. For example, Figure 8 This is a schematic diagram illustrating a pigment overlay effect provided in an embodiment of this application. (Refer to...) Figure 8When the user sets a high value for the pigment humidity parameter, after the user performs a drawing operation again in an area where a historical pigment trajectory already exists, the pigment trajectory corresponding to the current drawing operation will not completely cover the historical pigment trajectory; that is, the coverage effect of the current drawing pigment trajectory on the historical pigment trajectory is weak. Conversely, when the user sets a low value for the pigment humidity parameter, the coverage effect of the current drawing pigment trajectory on the historical pigment trajectory is strong. In this example, the electronic device can obtain the pigment humidity parameter set by the user and determine the initial color information of the pixel based on the brush color information, the historical color information of the pixel in the previous frame image, and the pigment humidity parameter. Optionally, the electronic device can also determine the initial color information of the pixel based on the brush color information, the historical color information of the pixel in the previous frame image, the pigment humidity parameter, and the opacity of the stamp.

[0123] It should be noted that the methods described above for determining the initial color information of pixels can be selected or combined based on the actual application scenario to determine the initial color information of each pixel in the stamp. For example, when the user adjusts the two-color parameter to a non-zero value in the height mode settings interface, and there are already historical paint traces on the canvas before the user triggers the drawing operation, the electronic device can first determine the brush color used to draw the pixel this time from the primary color and secondary color based on the two-color parameter, and then determine the initial color information of the pixel based on the paint humidity, historical color, and the brush color used to draw the pixel this time. For specific implementation, please refer to the above embodiments, and repeated parts will not be described again.

[0124] The method for determining the height information of each pixel in a stamp by an electronic device in the embodiments of this application is described below.

[0125] In this embodiment, the height information of each pixel may include the total number of times the pixel is drawn, a first height value, a second height value, and an opacity influence value. The total number of times the pixel is drawn indicates the number of times the pixel is drawn after the current stamp is drawn. The first height value is the height value of the pixel after multiple stamps are superimposed following the current stamp. The second height value is the height influence value of the pixel on the overall paint trajectory, determined based on the pressure value. The opacity influence value is the influence value of factors other than the flow parameter on the pixel's opacity. The flow parameter controls the depth of color; for example, it controls the amount of paint left on the canvas. A larger flow parameter results in a darker color in the paint trajectory, while a smaller flow parameter results in a lighter color. It should be noted that any one of the parameters in the height information of each pixel in this embodiment is optional. The height information may include some or all of the total number of times the pixel is drawn, the first height value, the second height value, and the opacity influence value. For example, in some embodiments, the height information may include the total number of times the pixel is drawn, the first height value, and the second height value. During implementation, the parameters included in the height information can be adjusted according to the application scenario, and this application embodiment does not limit this.

[0126] 1. Total number of pixels drawn

[0127] refer to Figure 5 A stamp may include areas that do not have shape parameters. Electronic devices will not draw these areas when drawing the stamp. In this embodiment, the areas in the stamp that do not need to be drawn can be called transparent areas. Electronic devices can determine that the total number of pixels drawn in the transparent areas is the total number of pixels drawn in the past. That is to say, the total number of pixels drawn in the transparent areas will not be superimposed after the current stamp is drawn.

[0128] In this embodiment of the application, for non-transparent areas in the stamp, the electronic device can determine the total number of pixels drawn based on the historical total number of pixels drawn and the spacing parameter in the adjustable parameters of the brush, wherein the spacing parameter in the adjustable parameters of the brush is used to represent the distance between the center points of two adjacent stamps.

[0129] For example, the total number of pixels drawn can satisfy the following relationship:

[0130] R = HeightParam + preR

[0131] HeightParam = a + b * space

[0132] Where R is the total number of pixels drawn, 0≤R≤1, HeightParam is the pixel drawing increment after overlaying the current drawing stamp, preR is the historical number of pixels drawn, space is the spacing parameter in the adjustable parameters of the brush, and a and b are preset constant values, for example, a is 0.003 and b is 0.01.

[0133] 2. The first height value of the pixel

[0134] refer to Figure 6 The adjustable parameters for height mode can include a height attenuation parameter, which is a coefficient that controls the pixel height based on the pressure value. For example... Figure 6 Users can adjust the height attenuation parameter, which can be any value between 0% and 100%. A higher value indicates greater pressure applied to the screen, resulting in stronger highlights and shadows in the pigment trail. For example, Figure 9 This is a schematic diagram illustrating the effect of a height attenuation parameter on the trajectory drawing effect, provided in an embodiment of this application. Figure 9 When the user sets the height attenuation parameter to a non-zero value, the effect of the drawn paint trajectory will also change as the pressure applied during the user's drawing operation changes. For example, areas where the user applies greater pressure will show an effect of paint accumulation, while areas where the user applies less pressure will show an effect of less paint.

[0135] For pixels in the transparent area of ​​a stamp, the electronic device can use the historical first height value of the pixel in the transparent area as the pixel's first height value. For pixels in the non-transparent area of ​​a stamp, the electronic device can obtain the user-set height attenuation parameter and calculate the pressure height value based on the height attenuation parameter. The pressure height value can be used to represent the influence of the stamp shape parameter on the height increment after multiple stamps are superimposed. The electronic device can determine the first height value based on the pixel's shape parameter in the stamp, the pressure height value, the pixel's historical height value, and the pixel's historical total drawing value.

[0136] For example, the first height value of a pixel can satisfy the following relationship:

[0137] A=(newshape*c+preA)*(1.0-heightRatio*preR)

[0138] Where A is the first height value of the pixel, preA is the historical first height value of the pixel, preR is the historical total drawing value of the pixel, c is a preset constant value, newshape is a value determined based on the shape parameters of the pixel in the stamp, and heightRatio is the pressure height value. For example, newshape can satisfy the following relationship:

[0139] newshape = (shape + 1.0) * d

[0140] Where shape is the shape parameter of the pixel in the stamp, and d is a preset constant value.

[0141] The heightRatio can satisfy the following relationship:

[0142] heightRatio = 1.0 - v_height * e

[0143] Where v_height is a value determined based on the height attenuation parameter set by the user and the detected pressure value, and e is a preset constant value.

[0144] For example, v_height can satisfy the following relationship:

[0145] v_height=1.0–pressureHeight+pressureHeight*p

[0146] Where pressureHeight is the height attenuation parameter set by the user, and p is the pressure value corresponding to the detected pixel. The pressure value corresponding to the pixel can be the pressure value corresponding to the stamp to which the pixel belongs.

[0147] Based on the scheme for calculating the first height value of a pixel provided in this application embodiment, if a user performs repeated smearing operations in the same area (e.g., increasing preR), the electronic device determines that the first height value of the pixel in that area is a small value, thereby achieving the effect of flattening the repeatedly smeared area. For example, Figure 10 This is a schematic diagram illustrating a drawing effect provided in an embodiment of this application. (Reference) Figure 10 In (a), when the user's drawing operation is a flat stroke, the first height value is different at different positions in the paint trajectory, so the paint trajectory drawn by the electronic device will show highlight or shadow effects in different areas; see reference. Figure 10 In (b), when the user performs a drawing operation that involves repeatedly smearing the same area, the electronic device calculates the first height value of the repeatedly smeared area to be a smaller value, and the repeatedly smeared area in the paint trajectory drawn by the electronic device will appear to be flattened.

[0148] 3. The second height value of the pixel

[0149] For pixels in the transparent area of ​​the stamp, the electronic device can use the historical second height value of the pixel in the transparent area as the second height value of the pixel. For pixels in the non-transparent area of ​​the stamp, the electronic device can determine the second height value of the pixel based on the historical second height value of the pixel, the user-set height attenuation parameter, and the detected pressure value.

[0150] For example, the second height value of a pixel can satisfy the following relationship:

[0151] G = (preG + v_height * alpha) * f

[0152] Where G is the second height value of the pixel, preG is the historical second height value of the pixel, v_height is the value determined based on the height attenuation parameter set by the user and the detected pressure value, alpha is the preset pressure flow parameter, which can be used to control the flow parameter based on the detected pressure value, and f is a preset constant value.

[0153] For example, v_height can satisfy the following relationship:

[0154] v_height=1.0–pressureHeight+pressureHeight*p

[0155] Where pressureHeight is the height attenuation parameter set by the user, and p is the pressure value corresponding to the detected pixel. The pressure value corresponding to the pixel can be the pressure value corresponding to the stamp to which the pixel belongs.

[0156] 4. The effect of pixel opacity on the value

[0157] The electronic device can determine the current rendering mode, which may include weak, uniform, strong, and blended modes. Different rendering modes correspond to different opacity blending formulas. The electronic device can determine a first influence value based on the pixel's shape parameters, texture information, and percolation parameters within the stamp. Then, based on the opacity blending formula corresponding to the current rendering mode, the first influence value, and the pixel's historical opacity influence values, the electronic device determines the pixel's opacity influence value. Here, the stamp's texture information determines its internal structure, and the percolation parameters alter the stamp's texture structure. Both the stamp's texture information and percolation parameters influence the stamp's opacity.

[0158] In this embodiment, when the opacity influence value of a pixel meets a preset condition, the electronic device can adjust the color information of the pixel based on the lighting system. For example, the preset condition can be that the opacity influence value is non-zero. When the opacity influence value of a pixel is 0, it indicates that there is no texture information at that pixel. In this case, when determining the target color information of the pixel, the electronic device can use the initial color information of the pixel as the target color information instead of adjusting the pixel color based on the lighting system. When the opacity influence value of a pixel is non-zero, the electronic device can determine the target color information of the pixel based on the lighting system. For details, please refer to the following embodiments.

[0159] In this embodiment of the application, taking a target pixel as an example, after obtaining the initial color information and height information of the target pixel, the electronic device can determine the target color information of the target pixel based on the lighting system and the height information and initial color information of the target pixel. Optionally, refer to... Figure 6 The height mode supports adjustable parameters including highlight and shadow parameters. The highlight parameter can be any value between 0 and 100%; a higher value results in a more pronounced highlight effect in the pigment trail. Similarly, the shadow parameter can also be any value between 0 and 100%; a higher value results in a more pronounced shadow effect in the pigment trail. The electronic device can acquire the user-set highlight and shadow parameters and configure the lighting system accordingly. Based on the lighting system, the electronic device can determine the target highlight and shadow values ​​based on the first and second height values ​​in the target pixel's height information, and determine the target color information based on the target highlight, target shadow values, and the initial color information of the target pixel.

[0160] For example, the target color information and initial color information, target highlight value, and target shadow value of a target pixel can satisfy the following relationship:

[0161] C ′ =C+PBR(light_pos)-PBR(dark_pos)

[0162] Among them, C ′ C represents the target color information of the target pixel, C represents the initial color information of the target pixel, PBR(light_pos) represents the target highlight value determined based on the lighting system, and PBR(dark_pos) represents the target shadow value determined based on the lighting system. For example, PBR(light_pos) and PBR(dark_pos) are determined based on the height information of the target pixel by the lighting system.

[0163] In one optional implementation, when the electronic device determines the highlight value or shadow value of a target based on a lighting system, it can acquire the height information of multiple adjacent pixels of the target pixel. These multiple adjacent pixels can include pixels adjacent to the target pixel in each direction. The electronic device can then determine the normal vector of the target pixel based on the height information of these multiple adjacent pixels. Where the normal vector The height value is determined based on the first and second height values ​​in the height information of the target pixel, such as the normal vector. The height value can be the product of the first height value and the second height value. The electronic device can determine the height based on the normal vector of the target pixel. and preset vertical vector Calculate the reflection vector of the target pixel. The preset vertical vector is used to simulate the human eye's position relative to the screen; for example, the preset vertical vector is a vector perpendicular to the screen of the electronic device. Taking the calculation of target highlight values ​​as an example, the lighting system can predefine the highlight direction, and the electronic device can calculate the highlight value based on the highlight direction and the normal vector. Calculate the diffuse reflection of a specular highlight based on the specular highlight direction and reflection vector. Calculate specular reflection using parameters from the shininess von Neumann illumination model, and based on the normal vector. and reflection vector By calculating Fresnel coefficients, electronic devices can calculate the target highlight value of a target pixel based on user-defined highlight parameters, diffuse reflection, specular reflection, and Fresnel coefficients.

[0164] Similarly, the lighting system can predefine the shadow direction, and the electronic device can then determine the shadow direction and normal vector. Calculate the diffuse reflection of a shadow based on the shadow direction and reflection vector. Calculate specular reflection using parameters from the shininess von Neumann illumination model, and based on the normal vector. and reflection vector By calculating Fresnel coefficients, electronic devices can calculate the target shadow value of a target pixel based on user-defined shadow parameters, diffuse reflection, specular reflection, and Fresnel coefficients.

[0165] It should be noted that, in this embodiment of the application, the electronic device can also determine the target color information of each pixel in the pigment trajectory based on the lighting system. In this scheme, the height information of each pixel in the pigment trajectory may not include the opacity influence value. After determining the height information, the electronic device can directly determine the target pixel value of each pixel based on the lighting system. For pixels in the pigment trajectory that do not have texture information (opacity influence value is 0), these pixels will not be displayed in the pigment trajectory. Therefore, even if the target color information of the pixel is determined based on the lighting system, the target color information will not affect the pigment trajectory.

[0166] In some examples, before determining the target color information, the electronic device can adjust the initial color information of the pixels according to preset adjustment values. These preset adjustment values ​​are used to correct color differences caused by inconsistencies between highlight and shadow intensity. Since the drawing application in this embodiment allows users to adjust highlight and shadow parameters separately, inconsistencies in highlight and shadow intensity when the user adjusts different parameters may lead to color differences in the paint trajectory. Adjusting the initial color information of the pixels according to preset adjustment values ​​makes the highlight and shadow effects of the adjusted paint trajectory closer to the effect of a realistic oil painting. The electronic device can determine the target color information of each pixel based on the lighting system and the adjusted initial color and height information of each pixel.

[0167] The electronic device can draw multiple stamps in the paint trajectory based on the target color information of each pixel in each stamp, thereby drawing the paint trajectory. The electronic device can then draw and display the paint trajectory on the canvas displayed by the drawing application.

[0168] For example, Figure 11 This is a schematic diagram of an oil painting brush effect provided in an embodiment of this application, for reference. Figure 11 Electronic devices can draw the pigment trajectory based on the target color information of each pixel in the pigment trajectory, and the drawn pigment trajectory can display the highlight and shadow effects produced by lighting. For example, Figure 11 The pigment trail shown in the image has a highlight area at the bottom and a shadow area at the top.

[0169] This application also provides a dual brush function. When the dual brush function is enabled, the user can draw a paint trajectory that includes two brush effects in a single drawing operation. For example, Figure 12 This is a schematic diagram of the interface of a drawing application provided in an embodiment of this application, with reference to... Figure 12 Users can trigger a click operation on the dual brush switch to enable the dual brush function. Users can set the parameters of each brush separately in the brush settings. For example, users can set the stamp of brush 1 and the stamp of brush 2 separately. After the user performs a drawing operation using the set dual brushes, the paint trajectory includes lines with two stamp shapes.

[0170] In some examples, embodiments of this application also support enabling a height mode when the dual brush function is enabled. The electronic device can determine the primary and secondary brushes in the dual brush, such as the primary brush being the first brush added by the user in the dual brush, or the primary brush being the brush selected by the user from the two brushes included in the dual brush. The electronic device can determine the first color information and height information of each pixel in the first paint trajectory obtained based on the primary brush, and determine the second color information of each pixel in the second paint trajectory obtained based on the secondary brush. The electronic device can mix the first color information of each pixel in the first paint trajectory and the second color information of each pixel in the second paint trajectory to obtain the initial color information of each pixel in the paint trajectory corresponding to the dual brush, and determine the target color information of each pixel in the paint trajectory corresponding to the dual brush based on the lighting system, the height information of each pixel in the first paint trajectory, and the initial color information of each pixel in the paint trajectory corresponding to the dual brush. The electronic device can draw and display the paint trajectory according to the target color information of each pixel. Optionally, if a pixel in the paint trajectory corresponding to the dual brush does not belong to the first paint trajectory, then the pixel does not have height information, and the electronic device can use the initial color information of the pixel as the target color information.

[0171] For example, Figure 13 This is a schematic diagram illustrating the effect of a dual brush in an embodiment of this application. (Refer to...) Figure 13 After the user enables the dual brush function and selects a primary and secondary brush, the electronic device displays the paint trajectory based on the user's drawing operations on the digital canvas. The electronic device determines the color information of each pixel in the paint trajectory based on the primary and secondary brushes, and displays a 3D effect based on the height information of each pixel in the first paint trajectory obtained from the primary brush. Figure 13 The secondary brush does not determine the height information of each pixel in the paint path, but it can create a planar effect different from the main brush.

[0172] In other examples, when the user enables the dual brush function and performs a drawing operation, the electronic device can determine the first color information and first height information of each pixel in the first paint trajectory obtained based on the main brush, and determine the second color information and second height information of each pixel in the second paint trajectory obtained based on the secondary brush. The electronic device can mix the first color information of each pixel in the first paint trajectory and the second color information of each pixel in the second paint trajectory to obtain the initial color information of each pixel in the paint trajectory corresponding to the dual brush. The electronic device can also determine the height information of each pixel in the paint trajectory corresponding to the dual brush based on the first height information of each pixel in the first paint trajectory and the second height information of each pixel in the second paint trajectory. The electronic device can determine the target color information of each pixel based on the lighting system, the height information of each pixel in the paint trajectory corresponding to the dual brush, and the initial color information of each pixel. The electronic device can draw and display the paint trajectory corresponding to the dual brush according to the target color information of each pixel.

[0173] In practice, the method by which the electronic device determines the initial color information, height information, and target color information of pixels in the paint trajectory drawn by the dual brushes can be found in the above embodiments of this application, and the repeated parts will not be described again.

[0174] Based on the above embodiments, this application also provides an image processing method, which can be executed by an electronic device, such as... Figure 14 A flowchart of an image processing method provided in an embodiment of this application is shown below. Figure 14 The method includes the following steps:

[0175] S1401: The electronic device receives the user's drawing operation and obtains the initial color information of each pixel in the pigment trajectory corresponding to the drawing operation.

[0176] The initial color information of each pixel is determined based on the brush color information corresponding to the drawing operation.

[0177] S1402: The electronic device determines the height information of each pixel in the pigment trajectory.

[0178] Optionally, the height information of each pixel is used to indicate the height of the paint when simulating the three-dimensional effect of an oil painting. The height information of each pixel includes a first height value, a second height value, a total drawing amount, and an opacity influence value; wherein, the first height value is the height value of the multiple stamps superimposed on the paint trajectory at each pixel, the second height value is the height influence value of each pixel on the paint trajectory determined based on the pressure value, the total drawing amount is used to represent the number of times each pixel is drawn, and the opacity influence value is the influence value of factors other than the flow parameter on the opacity, the flow parameter being a parameter used to control the color depth.

[0179] S1403: The electronic device determines the target color information of each pixel based on the illumination system, the height information of each pixel, and the initial color information of each pixel.

[0180] S1404: The electron displays the pigment trajectory based on the target color information of each pixel.

[0181] It should be noted that, Figure 14 The image processing method shown can be referred to the above embodiments of this application in specific implementation, and repeated parts will not be described again.

[0182] Based on the above embodiments, this application also provides an electronic device, which includes multiple functional modules; the multiple functional modules interact to realize the functions performed by the electronic device in the methods described in the embodiments of this application. For example, [the following is an example of implementation]. Figure 14 The steps performed by the electronic device in the illustrated embodiment. The plurality of functional modules can be implemented based on software, hardware, or a combination of software and hardware, and the plurality of functional modules can be arbitrarily combined or divided based on specific implementation.

[0183] Based on the above embodiments, this application also provides an electronic device, which includes at least one processor and at least one memory, wherein the at least one memory stores computer program instructions. When the electronic device is running, the at least one processor executes the functions performed by the electronic device in the various methods described in the embodiments of this application. For example, when executing... Figure 14 The steps performed by the electronic device in the illustrated embodiment.

[0184] Based on the above embodiments, this application also provides a computer program product containing instructions, which, when run on a computer, causes the computer to execute the methods described in the embodiments of this application.

[0185] Based on the above embodiments, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a computer, causes the computer to perform the methods described in the embodiments of this application.

[0186] Based on the above embodiments, this application also provides a chip for reading computer programs stored in a memory to implement the methods described in the embodiments of this application.

[0187] Based on the above embodiments, this application provides a chip system including a processor for supporting a computer device in implementing the methods described in the embodiments of this application. In one possible design, the chip system further includes a memory for storing necessary programs and data of the computer device. This chip system may be composed of chips or may include chips and other discrete devices.

[0188] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0189] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0190] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0191] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0192] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the scope of protection of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. An image processing method, characterized in that, Applied to electronic devices, the method includes: Receive the user's drawing operation, obtain the initial color information of each pixel in the paint trajectory corresponding to the drawing operation, wherein the initial color information of each pixel is determined according to the brush color information corresponding to the drawing operation; Determine the height information of each pixel in the pigment trajectory, wherein the height information of each pixel is used to indicate the height of the pigment when simulating the three-dimensional effect of oil painting; Based on the lighting system, the target color information of each pixel is determined according to the height information and the initial color information of each pixel; The pigment trajectory is displayed based on the target color information of each pixel.

2. The method as described in claim 1, characterized in that, Before receiving the user's drawing operation, the method further includes: Display settings interface; In response to the user's first action in the settings interface, height mode is enabled.

3. The method as described in claim 2, characterized in that, The height mode includes at least one of the following adjustable parameters: highlight parameter, shadow parameter, duotone parameter, height attenuation parameter, and pigment humidity parameter; The highlight parameter is used to adjust the area and intensity of the highlight region in the pigment trajectory; the shadow parameter is used to adjust the area and intensity of the shadow region in the pigment trajectory; the duocolor parameter is used to control the display of different colors at different heights in the pigment trajectory; the height attenuation parameter is used to control the effect of highlights and shadows in the pigment trajectory based on the detected pressure value; and the pigment humidity parameter is used to control the pigment mixing effect.

4. The method as described in claim 3, characterized in that, The initial color information of each pixel is determined based on the brush color information corresponding to the drawing operation, including: The initial color information of each pixel is determined based on the first value of the dual-color parameter, the information of the primary color and the information of the secondary color in the brush color information.

5. The method as described in claim 4, characterized in that, When the shape parameter of the first pixel in the pigment trajectory is greater than or equal to the first value in the stamp, the initial color information of the first pixel is the information of the main color. or When the shape parameter of the first pixel in the stamp is less than the first value, the initial color information of the first pixel value is the information of the auxiliary color. Wherein, the first pixel point is each pixel point in the pigment trajectory.

6. The method as described in claim 3, characterized in that, The initial color information of each pixel is determined based on the brush color information corresponding to the drawing operation, including: When the previous frame image displayed by the electronic device contains historical pigment trails, the initial color information of each pixel is determined based on the brush color information, the historical color information of each pixel in the previous frame image, and the pigment humidity parameter.

7. The method according to any one of claims 1-6, characterized in that, The height information of each pixel in the pigment trajectory includes a first height value, a second height value, a total drawing amount, and an opacity influence value. The first height value is the height of the multiple stamps superimposed on the pigment trajectory at each pixel. The second height value is the height influence value of each pixel on the pigment trajectory, determined based on the pressure value. The total drawing amount represents the number of times each pixel is drawn. The opacity influence value is the influence of factors other than the flow parameter on the opacity. The flow parameter is a parameter used to control the color depth.

8. The method as described in claim 7, characterized in that, The total number of pixels drawn in the pigment trajectory is determined based on the historical total number of pixels drawn and the spacing parameter, which represents the distance between the center points of two adjacent stamps.

9. The method as described in claim 7 or 8, characterized in that, The method further includes: Obtain the height attenuation parameter; The pressure height value is calculated based on the height attenuation parameter and the pressure value corresponding to each pixel. The pressure height value is used to represent the influence of the stamp shape parameter on the height increment of the multiple stamps superimposed on the pigment trajectory. The first height value of each pixel is determined based on the shape parameters of each pixel in the stamp, the pressure height value, the historical height value of each pixel, and the total historical drawing volume of each pixel.

10. The method according to any one of claims 7-9, characterized in that, The method further includes: Obtain the height attenuation parameter; The second height value of each pixel is determined based on the historical second height value of each pixel, the height attenuation parameter, the pressure value corresponding to each pixel, and the pressure flow parameter, wherein the pressure flow parameter is used to control the flow parameter according to the pressure value.

11. The method according to any one of claims 7-10, characterized in that, The method further includes: Determine the rendering mode; A first influence value is determined based on the shape parameters, texture information, and percolation parameters of each pixel in the stamp; Based on the opacity blending formula corresponding to the rendering mode, the opacity influence value of each pixel is determined according to the first influence value and the historical opacity influence value of each pixel.

12. The method according to any one of claims 7-11, characterized in that, The determination of the target color information of each pixel based on the illumination system, according to the height information and the initial color information of each pixel, includes: Based on the lighting system, the target highlight value and target shadow value of the target pixel are determined according to the first height value and the second height value in the height information of the target pixel in the pigment trajectory, and the target color information of the target pixel is determined according to the target highlight value, target shadow value and initial color information of the target pixel.

13. The method as described in claim 12, characterized in that, The target pixel is the pixel whose opacity influence value among the first pixels meets the preset condition, and the first pixel is each pixel in the pigment trajectory.

14. The method as described in claim 12 or 13, characterized in that, Determining the target highlight value of the target pixel based on the first height value and the second height value in the height information of the target pixel in the pigment trajectory includes: Obtain the height information of multiple neighboring pixels of the target pixel, and determine the normal vector of the target pixel based on the height information of the multiple neighboring pixels and the first height value and the second height value of the target pixel; Calculate the reflection vector of the target pixel based on the normal vector and the preset perpendicular vector of the target pixel; Calculate specular diffuse reflection based on predefined specular direction and normal vector; Specular reflection is calculated based on the predefined specular direction, the reflection vector, and the parameters of the Von Leigh lighting model. Calculate the Fresnel coefficients based on the normal vector and the reflection vector of the target pixel. The target highlight value of the target pixel is calculated based on the user-set highlight parameters, highlight diffuse reflection, highlight specular reflection, and Fresnel coefficient.

15. The method according to any one of claims 12-14, characterized in that, Determining the target shadow value of the target pixel based on the first height value and the second height value in the height information of the target pixel in the pigment trajectory includes: Obtain the height information of multiple neighboring pixels of the target pixel, and determine the normal vector of the target pixel based on the height information of the multiple neighboring pixels and the first height value and the second height value of the target pixel; Calculate the reflection vector of the target pixel based on the normal vector and the preset perpendicular vector of the target pixel; Calculate the diffuse reflection of the shadow based on the predefined shadow direction and normal vector; The shadow specular reflection is calculated based on the predefined shadow direction, the reflection vector, and the parameters of the Von Leigh lighting model. Calculate the Fresnel coefficients based on the normal vector and the reflection vector of the target pixel. The target shadow value of the target pixel is calculated based on the shadow parameters, diffuse reflection, specular reflection, and Fresnel coefficient set by the user.

16. The method according to any one of claims 1-15, characterized in that, Before determining the target color information of each pixel based on the illumination system, the method further includes: The initial color information of each pixel after adjustment is determined based on the preset adjustment value and the initial color information of each pixel. The preset adjustment value is used to correct the color difference caused by the inconsistency between the highlight intensity and the shadow intensity. The determination of the target color information of each pixel based on the illumination system, according to the height information and the initial color information of each pixel, includes: Based on the lighting system, the target color information of each pixel is determined according to the height information of each pixel and the adjusted initial color information of each pixel.

17. An image processing method, characterized in that, Applied to electronic devices, the method includes: In response to user operation, the dual brush function is enabled, which includes a main brush and a secondary brush. Receive the user's drawing operation, determine the first color information and height information of each pixel in the first paint trajectory obtained based on the main brush, and determine the second color information of each pixel in the second paint trajectory obtained based on the secondary brush; The initial color information of each pixel in the first pigment trajectory and the second color information of each pixel in the second pigment trajectory are mixed to obtain the initial color information of each pixel in the pigment trajectory corresponding to the dual brush. Based on the lighting system, the target color information of each pixel in the first pigment trajectory and the initial color information of each pixel in the pigment trajectory corresponding to the dual brush are determined; The paint trajectory corresponding to the dual brush is drawn and displayed based on the target color information of each pixel in the paint trajectory corresponding to the dual brush.

18. An image processing method, characterized in that, Applied to electronic devices, the method includes: In response to user operation, the dual brush function is enabled, which includes a main brush and a secondary brush. Receive the user's drawing operation, determine the first color information and first height information of each pixel in the first paint trajectory obtained based on the main brush, and determine the second color information and second height information of each pixel in the second paint trajectory obtained based on the secondary brush; The initial color information of each pixel in the first pigment trajectory and the second color information of each pixel in the second pigment trajectory are mixed to obtain the initial color information of each pixel in the pigment trajectory corresponding to the dual brush. The target height information of each pixel in the pigment trajectory corresponding to the dual brush is obtained by mixing the first height information of each pixel in the first pigment trajectory and the second height information of each pixel in the second pigment trajectory. Based on the lighting system, the target color information of each pixel in the paint trajectory corresponding to the dual brush is determined according to the initial color information of each pixel in the paint trajectory corresponding to the dual brush and the target height information of each pixel in the paint trajectory corresponding to the dual brush. The paint trajectory corresponding to the dual brush is drawn and displayed based on the target color information of each pixel in the paint trajectory corresponding to the dual brush.

19. An electronic device, characterized in that, The method includes at least one processor coupled to at least one memory, the at least one processor being configured to read a computer program stored in the at least one memory to perform the method as described in any one of claims 1-16, or to perform the method as described in claim 17, or to perform the method as described in claim 18.

20. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-16, or the method as described in claim 17, or the method as described in claim 18.