Color processing method and apparatus, electronic device, and computer-readable storage medium

By adjusting the background color of the marker drawing area to the color to be mixed, and then mixing it with the marker color and adjusting the transparency, the problem of unrealistic marker drawing effects was solved, achieving a more realistic drawing effect.

CN115239833BActive Publication Date: 2026-02-13GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210867013.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-21
Publication Date
2026-02-13
Estimated Expiration
2042-07-21

AI Technical Summary

Technical Problem

The existing marker drawing technology has a relatively fixed effect, poor display effect, and difficulty in achieving a realistic effect.

Method used

The goal is to improve the drawing effect by adjusting the background color of the drawing area to the color to be mixed, mixing the color to be mixed with the marker color, and then mixing the transparency.

Benefits of technology

It achieves a realistic effect similar to marker drawing, enhancing the realism of the drawing effect through transparency overlay and color mixing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115239833B_ABST
    Figure CN115239833B_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of color processing, and provides a color processing method and device, electronic equipment and a computer readable storage medium. The method comprises the following steps: when a marker pen is used for drawing, a drawing area of the marker pen is determined; a background color of the drawing area is adjusted to be a color to be mixed, the color to be mixed being a color with the same display effect as the background color and a target value of transparency, the target value representing opacity; the color to be mixed and a color of the marker pen are mixed to obtain a target mixed color; and the target mixed color and the background color are mixed in transparency to obtain a color of the drawing area. Through the application, the drawing effect of the marker pen can be improved, and the drawing effect of the marker pen is more realistic.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of color processing, and particularly relates to a color processing method and device, an electronic device, and a computer readable storage medium. BACKGROUND

[0002] In a graffiti software, a plurality of brushes are often provided for a user to select, such as a pencil, a ballpoint pen, a pen, a marker, etc., which can meet different drawing requirements of the user. When drawing using these brushes, the drawing effect of the brushes is usually as real as possible. However, in the prior art, when drawing using a marker, the color of the marker is usually directly displayed in the drawing area, and the display effect is relatively fixed, and the drawing effect is poor. SUMMARY

[0003] The embodiments of the present application provide a color processing method and device, an electronic device, and a computer readable storage medium, to improve the drawing effect of a marker, so that the drawing effect of the marker is more real.

[0004] In a first aspect, the embodiments of the present application provide a color processing method, comprising:

[0005] When drawing using a marker, determining a drawing area of the marker;

[0006] Adjusting a background color of the drawing area to be a color to be mixed, the color to be mixed being a color having the same display effect as the background color and a target value of transparency, the target value representing opacity;

[0007] Mixing the color to be mixed with a color of the marker to obtain a target mixed color;

[0008] Transparency mixing the target mixed color with the background color to obtain a color of the drawing area.

[0009] In the embodiments of the present application, when drawing using a marker, the drawing area of the marker can be determined, and the background color of the drawing area is adjusted to be a color to be mixed, so as to mix the color to be mixed with the color of the marker to obtain a target mixed color, the target mixed color being determined by the background color and the color of the marker, and the target mixed color being different when the background color is different. By transparency mixing the target mixed color with the background color, the color of the drawing area obtained is also changed with the target mixed color, and the transparency superposition effect of the marker can be achieved, thereby improving the drawing effect of the marker, and making the drawing effect of the marker more real.

[0010] In a second aspect, the embodiments of the present application provide a color processing device, comprising:

[0011] The area determining module is configured to, when drawing using a marker, determine a drawing area of the marker.

[0012] a background adjustment module, configured to adjust a background color of the drawing area to a to-be-blended color, the to-be-blended color being a color having a display effect same as the background color and a transparency value being a target value, the target value representing non-transparency;

[0013] a blending module, configured to blend the to-be-blended color with a color of the marker to obtain a target mixed color;

[0014] a transparency mixing module, configured to perform transparency mixing between the target mixed color and the background color to obtain a color of the drawing area.

[0015] In a third aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the steps of the color processing method according to the first aspect when running the computer program.

[0016] In a fourth aspect, a chip is provided, which includes a processor, and the processor is configured to read and execute a computer program stored in a memory to perform the steps of the color processing method according to the first aspect.

[0017] Optionally, the memory and the processor are connected through a circuit or a wire.

[0018] In a fifth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the steps of the color processing method according to the first aspect.

[0019] In a sixth aspect, a computer program product is provided, which, when running on an electronic device, causes the electronic device to perform the steps of the color processing method according to the first aspect.

[0020] It can be understood that the second aspect, the third aspect, the fourth aspect, the fifth aspect and the sixth aspect provided above are all used to execute the corresponding method provided above, and thus the beneficial effects that can be achieved by them can refer to the beneficial effects in the corresponding method provided above, which will not be described here again. BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0022] Figure 1-1 is an example picture of a background color;

[0023] Figure 1-2 is an example picture of a stroke drawn by a marker pen;

[0024] Figure 1-3 is an example picture of a drawing effect of a marker pen;

[0025] Figure 1-4 is another example picture of a drawing effect of a marker pen;

[0026] Figure 2 is a schematic diagram of an implementation process of a color processing method according to an embodiment of the present application;

[0027] Figure 3 is a schematic diagram of an implementation process of a color processing method according to another embodiment of the present application;

[0028] Figure 4 is a schematic diagram of a structure of a color processing apparatus according to an embodiment of the present application;

[0029] Figure 5 is a schematic diagram of a structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] In the following description, for the purposes of explanation and not limitation, specific details are set forth, such as particular sequences of acts, techniques, etc. in order to provide a thorough understanding of the embodiments of the application. However, it will be apparent to those skilled in the art that the application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known devices, circuits, and methods are omitted so as not to obscure the description of the application with unnecessary detail.

[0031] It is to be understood that the terminology "includes", "has", "holds", "contains" used in the present specification and annexed claims are used to describe the presence of a feature, number, step, operation, element, component or a group thereof but do not exclude the presence or addition of one or more other features, numbers, steps, operations, elements, components or groups thereof.

[0032] It is also to be understood that the terminology "and / or" used in the present specification and annexed claims refers to any combination of one or more of the associated listed items and all possible combinations thereof, and includes these combinations.

[0033] As used in the specification and the appended claims, the term "if' can be interpreted as meaning "when" or "upon" or "in response to determining" or "in response to detecting" depending on the context. Similarly, the phrase "if it is determined" or "if [the described condition or event] is detected" can be interpreted as meaning "upon determining" or "in response to determining" or "upon detecting [the described condition or event]" or "in response to detecting [the described condition or event]" depending on the context.

[0034] In addition, the terms "first", "second", "third", etc. as used in the description of the application and the appended claims are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.

[0035] Reference in the specification to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment", "in some embodiments", "in other embodiments", "in additional embodiments", and so on, in various places in the specification are not necessarily all referring to the same embodiment, unless otherwise specifically specified. The terms "comprise", "comprising", "have", "having", "include", "including", and "contain", "containing", or variants thereof, mean "including but not limited to", unless otherwise specifically specified.

[0036] Before explaining the present application, the terms involved in the present application are explained for the convenience of the reader to understand the present application.

[0037] Overlay is a blending mode in computer graphics image software Adobe Photoshop. Simply put, overlay is to add a colored plastic sheet between the light source and the screen. If the plastic sheet is black, the result is black. If the plastic sheet is white, it is equivalent to no shielding. If the plastic sheet is other colors except black and white, it meets the rule that complementary colors become black after overlay, for example, a red plastic sheet shields green light, a green plastic sheet shields red light, etc.

[0038] The color in the present application includes a color value and a transparency. The color value can be a value of any color model, such as an RGB value, an HSV value, a YUV value, etc. R in RGB represents red, G represents green, and B represents blue, and the RGB value includes an R component value, a G component value, and a B component value. H in HSV represents hue, S represents saturation, and V represents value, and the HSV value includes an H component value, an S component value, and a V component value. Y in YUV represents luminance or luma, and U and V represent chrominance or chroma, and the YUV value includes a Y component value, a U component value, and a V component value.

[0039] The color value in the present application is valued between 0 and 1, and this value range can provide rich color changes when mixing colors, giving users more color choices.

[0040] The transparency represents the degree of light transmission. The transparency can be valued between 0 and 1, 0 representing complete transparency and 1 representing opacity. When the transparency of a color is greater than or equal to 0 and less than 1, the color can exhibit a transparent effect, so the color with a transparency greater than or equal to 0 and less than 1 can be referred to as a color with transparency, and the color with a transparency equal to 1 can be referred to as an opaque color.

[0041] Taking an RGB value as an example, the color can be represented as RGBA, where RGB in RGBA represents the RGB value, and A represents the transparency.

[0042] It can be understood that the present application does not limit the object to be drawn by the marker pen, for example, the object to be drawn by the marker pen can be a rectangle, a Chinese character, a kitten, a flower, a house, a cloud, etc. The object to be drawn by the marker pen can be composed of various strokes such as line segments and arcs, and a stroke is the smallest continuous drawing unit of the object to be drawn by the marker pen.

[0043] As shown in FIG. 1A, a circle region in a background is red. Figure 1-1 As shown in FIG. 1B, a triangle region in a background is a stroke drawn by a marker pen in a fresh green color. Figure 1-1 As shown in FIG. 1C, a circle region in a background is red. Figure 1-2 As shown in FIG. 1D, a triangle region in a background is a stroke drawn by a marker pen in a fresh green color. Figure 1-2 As shown in FIG. 1E, a circle region in a background is red. Figure 1-1 As shown in FIG. 1F, a triangle region in a background is a stroke drawn by a marker pen in a fresh green color. Figure 1-2 As shown in FIG. 1G, a circle region in a background is red. Figure 1-3As shown, the color of the drawing area of the green marker is the color of the green marker, i.e., green, and the display effect is relatively fixed, and the drawing effect is poor.

[0044] The present application adjusts the background color to the color to be mixed, which is opaque and has the same display effect as the background color, mixes the color to be mixed with the color of the green marker, obtains the target mixed color, and performs transparency mixing on the target mixed color and the background color. The color of the drawing area obtained is darker than the color of the green marker, and the display effect is as shown in Figure 1-4 Since the color of the marker has transparency, the transparency of the marker can also be superimposed by performing transparency mixing on the target mixed color and the background color, thereby improving the drawing effect of the marker and making the drawing effect of the marker more realistic.

[0045] The color processing method provided in the embodiments of the present application can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), etc. The embodiments of the present application do not make any limitation on the specific type of electronic device.

[0046] It should be understood that the size of the serial number of each step in the embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0047] In order to illustrate the technical solutions of the present application, the following will be described by specific embodiments.

[0048] Referring to Figure 2 is a flowchart of the implementation of the color processing method provided in an embodiment of the present application, which is applied to an electronic device. As shown in Figure 2 The color processing method can include the following steps:

[0049] Step 201, when drawing with a marker, determining the drawing area of the marker.

[0050] Before drawing with a marker, a user can select the color of the marker, so that the color of the drawn strokes of the marker is the selected color when drawing with the marker.

[0051] The electronic device can display at least one color, and in response to a selection operation on a target color in the at least one color, determine the color of the marker pen as the target color. The target color is a color selected by the user. The present application does not limit the specific form of the selection operation, for example, the selection operation can be a click operation, a sliding operation, etc. For example, the electronic device displays three colors, red, bright green, and yellow, and in response to a click operation on the bright green color, the color of the marker pen is determined as bright green.

[0052] Optionally, the electronic device can also set a default color, and if the user does not select a color when using the marker pen to draw, the color of the marker pen can be determined as the default color.

[0053] It can be understood that the electronic device can use the marker pen to draw multiple times, and the color of the marker pen for each drawing can be the same or different, which is not limited herein. The number of times of drawing is related to the number of strokes, for example, if the number of strokes drawn by the marker pen is 1, it means drawing once; if the number of strokes drawn by the marker pen is 2, it means drawing twice. For each drawing of the marker pen, the present application can improve the drawing effect of the marker pen during each drawing, so that the drawing effect of the marker pen during each drawing is more realistic.

[0054] For each drawing of the marker pen, the position information of the trajectory point of the drawing trajectory of the marker pen can be obtained, and based on the position information of the trajectory point, the region where the trajectory point is located can be determined, and the region where the trajectory point is located is determined as the drawing region.

[0055] The trajectory point is a point that constitutes the drawing trajectory. A coordinate system can be established during drawing (for example, a two-dimensional coordinate system is established with the lower left corner of the canvas as the origin, and the canvas is used to display the drawn content), and the coordinate point on the drawing trajectory is the trajectory point.

[0056] Based on the position information of the trajectory point, a bounding box can be drawn with the trajectory point as the center point, and the region inside the bounding box is the region where the trajectory point is located. The shape of the bounding box can be a square, a rectangle, a circle, etc., which is not limited herein. The size of the bounding box is determined by the thickness of the marker pen, for example, if the shape of the bounding box is a square, the length and width of the square cannot exceed the thickness value of the marker pen, and the thickness value represents the thickness of the marker pen.

[0057] In an optional embodiment, when the marker pen draws on the screen through the target touch component, the position information of the touch point of the target touch component on the screen can be obtained; and the position information of the touch point is determined as the position information of the trajectory point.

[0058] The electronic device can include a screen, which is a window for the user to interact with the electronic device, and all visual operations can be presented through the screen. The screen displays a canvas, and drawing on the screen can mean drawing on the canvas.

[0059] In an actual application scenario, the marker pen can be used to draw on the screen by using a finger, a stylus, a wired mouse or a wireless mouse as a target touch component.

[0060] When the marker pen is used to draw on the screen, the position information of a touch point, i.e., a track point, can be reported according to the refresh rate of each frame displayed on the screen. For example, if the refresh rate is 60 Hz, the position information of a touch point is reported every 16.6 ms.

[0061] When the marker pen is used to draw on the screen, each frame drawn by using the marker pen can be color-processed by the present application in order to update the content drawn on the screen by the user in real time.

[0062] The touch point is a discrete point. In the case where there are at least two touch points, interpolation can be performed between the two adjacent touch points in order to increase the number of track points. Specifically, the position information of an interpolation point between the two adjacent touch points can be obtained by performing interpolation between the two adjacent touch points, and the position information of the interpolation point is determined as the position information of a track point.

[0063] Optionally, interpolation can be performed between the two adjacent touch points by using a preset interpolation algorithm. The preset interpolation algorithm can be any interpolation algorithm that is preset, such as a bilinear interpolation algorithm, a bicubic interpolation algorithm, etc., which are not limited herein.

[0064] The background color of the drawing area refers to the color of the background of the drawing area. The background can be understood as a layer located below the next stroke drawn by the marker pen. For example, a yellow marker pen has been used to draw a cat on a canvas, and if a user draws a small flower on the cat by using a red marker pen, the cat is the background of the small flower drawn by the red marker pen.

[0065] In step 202, the background color of the drawing area is adjusted to be a color to be mixed, which refers to a color having the same display effect as the background color and a target value of transparency, and the target value represents opacity.

[0066] The background color of the drawing area can refer to the color of the background located in the drawing area. The display effect is the visual perception caused to the user, which can also be referred to as a visual effect.

[0067] When the value of the transparency is 0 to 1, and 1 represents opacity, the above target value can refer to 1. For example, the color of the background color of the drawing area is (1, 0, 0, 0.5), which can be adjusted to (1, 0.5, 0.5, 1), and (1, 0.5, 0.5, 1) is a color value (1, 0.5, 0.5) and a transparency of 1. The visual effect of the color to be mixed is consistent with the visual effect of the background color.

[0068] In general, when mixing colors, an opaque color is needed, so the electronic device can adjust the background color of the drawing area to obtain an opaque color to be mixed, facilitating the execution of step 203.

[0069] In an optional embodiment, the background color can be mixed with white having a target value of transparency to obtain the color to be mixed.

[0070] The white having the target value of transparency is an opaque white, which can be represented as (1, 1, 1, 1).

[0071] Mixing the background color having transparency with the opaque white can be understood as superimposing the background color having transparency on the opaque white. For the scenario of superimposing the color having transparency on the opaque color, the following formula can be used for transparency mixing.

[0072] B'.rgb = B.rgb * B.a + vec3(1) * (1.0 - B.a)

[0073] Wherein, B'.rgb represents the color to be mixed, B.rgb represents the color value of the background color, B.a represents the transparency of the background color, and vec3(1) represents the color value (1.0, 1.0, 1.0) of white.

[0074] Mixing the background color with the white having the target value of transparency can also avoid directly changing the target mixed color to pure black after mixing the color in step 203, and can provide more color transition in the process.

[0075] Step 203: mixing the color to be mixed with the color of the marker to obtain a target mixed color.

[0076] Wherein, the target mixed color is the color obtained by mixing the color to be mixed with the color of the marker. Mixing colors is also called color matching, which is mixing two or more colors to obtain another color.

[0077] By mixing the color to be mixed with the color of the marker, the color of the drawing area can be changed, so that the color of the drawing area is similar to the color of the marker, but different from the color of the marker. For example, the color of the marker is bright green, and the color of the drawing area is dark green after mixing.

[0078] In an optional embodiment, the color to be mixed can be mixed with the color of the marker based on the color value of the color to be mixed and the color value of the marker.

[0079] The embodiment can apply the overprint to the marker, and realize the color mixing of the color to be mixed and the color of the marker based on the overprint. Specifically, the color value of the color to be mixed is multiplied by the color value of the marker, and the result obtained after the multiplication is the color value of the target mixed color.

[0080] When the color value of the color to be mixed and the color value of the marker are both greater than 0 and less than 1, the multiplication of the two color values is a smaller color value, and therefore the color mixing by the multiplication of the color values can generate more colors with different depths. The multiplication of the two color values means that the component values belonging to the same component in the two color values are multiplied. Taking the RGB value as an example, the multiplication of the two color values means that the R component values in the two color values are multiplied, the G component values in the two color values are multiplied, and the B component values in the two color values are multiplied.

[0081] For example, the color value of the color to be mixed is (1, 0.5, 0.5), and the color value of the marker is (0, 1, 0). Then the multiplication of the color value of the color to be mixed and the color value of the marker is (1*0, 0.5*1, 0.5*0) = (0, 0.5, 0). According to the color value of the marker (0, 1, 0) and the color value of the target mixed color (0, 0.5, 0), it can be seen that the target mixed color is deeper in green than the marker.

[0082] In another optional embodiment, the color to be mixed and the color of the marker can also be mixed by steps 303 to 305. For details, refer to the related description of steps 303 to 305.

[0083] It should be noted that before mixing the color to be mixed and the color of the marker, the color of the marker is not mixed with the opaque white color in terms of transparency, which can avoid the color after mixing from being whitened and deviating from the color of the marker.

[0084] Step 204: Transparency mixing the target mixed color and the background color to obtain the color of the drawing area.

[0085] In the formula, the transparency of the target mixed color is the transparency of the marker.

[0086] Transparency mixing the target mixed color and the background color can realize the transparency superposition of the target mixed color and the background color, and reflect the effect of transparency superposition.

[0087] Transparency mixing the target mixed color and the background color can be understood as superimposing a target mixed color with transparency on a background color with transparency. For the superposition of two colors with transparency, the following formula can be used for transparency mixing.

[0088]

[0089] Ca = 1.0 - (1.0 - Aa) * (1.0 - Ba)

[0090] Where C.rgb represents the color value of the drawing area, Ca represents the transparency of the drawing area, A′.rgb represents the color value of the target blend color, and Aa represents the transparency of the target blend color.

[0091] In one optional embodiment, the background color is stored in a first color buffer and a second color buffer respectively. The background color is retrieved from the second color buffer and adjusted to the color to be mixed. The background color is retrieved from the first color buffer and the target blend color is mixed with the background color retrieved from the first color buffer using transparency. After obtaining the color of the drawing area, the background color in the first color buffer is updated to the color of the drawing area.

[0092] The first color buffer is the video memory area on the screen that displays colors and stores the background color. When you start drawing with a marker, you can synchronize the second color buffer with the first color buffer so that the background color in the second color buffer is the same as the background color in the first color buffer.

[0093] Storing the background color in the color buffer can mean storing the product of the background color's color value and its transparency, along with the background color's transparency itself. This storage method can speed up the blending of the background color with white and the blending of the background color with the target blend color.

[0094] By storing the background color in two color buffers, different drawing effects can be displayed for different drawing scenarios using the marker.

[0095] Marker drawing scenarios include, but are not limited to, single-stroke drawing with non-overlapping drawing areas, single-stroke drawing with at least partial overlapping drawing areas, and multi-stroke drawing with at least partial overlapping drawing areas. In the single-stroke drawing scenario with non-overlapping drawing areas, the background color of the same drawing area is the same in both the first and second color buffers. In the single-stroke drawing scenario with at least partial overlapping drawing areas, because the background color in the first color buffer is updated in real time, the transparency of the overlapping area is greater and the transparency effect is deeper compared to the single-stroke drawing scenario with non-overlapping drawing areas. In the multi-stroke drawing scenario with at least partial overlapping drawing areas, because the first and second color buffers are synchronized at the beginning of each stroke (i.e., the background colors in both buffers are updated), the color value of the overlapping area changes compared to the single-stroke drawing scenario with non-overlapping and single-stroke drawing scenario with at least partial overlapping drawing areas, resulting in greater transparency and a deeper transparency effect.

[0096] In the embodiment of the present application, when the marker pen is used for drawing, the drawing area of the marker pen can be determined, and the background color of the drawing area is adjusted to be the color to be mixed, so as to facilitate color mixing with the color of the marker pen, and obtain a target mixed color, which is determined by the background color and the color of the marker pen. The target mixed color is different when the background color is different. By performing transparency mixing on the target mixed color and the background color, the color of the drawing area obtained also changes with the target mixed color, and the transparency superposition effect of the marker pen can be realized, thereby improving the drawing effect of the marker pen and making the drawing effect of the marker pen more realistic.

[0097] Referring to Figure 3 is a schematic diagram of an implementation process of a color processing method provided by another embodiment of the present application, and the color processing method is applied to an electronic device. As Figure 3 indicated, the color processing method can include the following steps:

[0098] Step 301, when the marker pen is used for drawing, the drawing area of the marker pen is determined.

[0099] This step is the same as step 201, and for details, please refer to the related description of step 201, which will not be repeated here.

[0100] Step 302, the background color of the drawing area is adjusted to be the color to be mixed, and the color to be mixed refers to a color with the same display effect as the background color and a target value of transparency, and the target value represents opacity.

[0101] This step is the same as step 202, and for details, please refer to the related description of step 202, which will not be repeated here.

[0102] Step 303, if the color value of the color to be mixed is greater than 0 and less than 1, the color value of the color to be mixed is increased to obtain a first color value, and the first color value is greater than the color value of the color to be mixed and less than or equal to 1.

[0103] Step 304, if the color value of the marker pen is greater than 0 and less than 1, the color value of the marker pen is increased to obtain a second color value, and the second color value is greater than the color value of the marker pen and less than or equal to 1.

[0104] Based on the component values in the color value, it can be determined whether the color value is greater than 0 and less than 1. For example, when there is a component value greater than 0 and less than 1 in the color value, it can be determined that the color value is greater than 0 and less than 1. Of course, it can also be determined that the color value is greater than 0 and less than 1 when all component values in the color value are greater than 0 and less than 1, which is not limited here.

[0105] By increasing the color value, the process of the color value tending to 0 can be slowed down, the number of color mixing in step 305 is increased, the change of the color is slowed down, rich color change is provided, and more color choices are provided for the user. For example, when mixing the red color with transparency and the green color with transparency, the color does not immediately change to black, but there is a transition of some colors.

[0106] Optionally, the color value of the color to be mixed and the color value of the marker can be increased by a preset function. The preset function can be a function that is preset to satisfy: when 0

[0107] For example, f(x) can be the following multiple functions:

[0108] f(x) = x a , 0 < a < 1

[0109] f(x) = x 1-x

[0110]

[0111]

[0112] In another embodiment, if the color value of the color to be mixed is equal to 0 or the color value of the marker is equal to 0, it is determined that the color value of the target mixed color is 0, and the color value equal to 0 means that all component values in the color value are 0. If the color value of the color to be mixed is equal to 1 and the color value of the marker is equal to 1, it is determined that the color value of the target mixed color is 1, and the color value equal to 1 means that all component values in the color value are 1. If the color value of the color to be mixed is equal to 1, and the color value of the marker is greater than 0 and less than 1, it is determined that the color of the marker is the target mixed color. If the color value of the color to be mixed is greater than 0 and less than 1, and the color value of the marker is 1, it is determined that the color value of the color to be mixed is the color value of the target mixed color.

[0113] Step 305, based on the color value of the color to be mixed, the first color value, the color value of the marker, and the second color value, the color to be mixed is mixed with the color of the marker to obtain a target mixed color.

[0114] In this embodiment, the scheme of steps 303 to 305 not only can achieve the effect of positive film superimposition, but also can increase the number of color mixing and slow down the change of the color, so the scheme of steps 303 to 305 can be called a kind of positive film superimposition algorithm.

[0115] In an optional embodiment, the above step 305 comprises:

[0116] Based on the color value of the color to be mixed and the second color value, the color to be mixed is mixed with the color of the marker to obtain a first mixed color;

[0117] based on the first color value and the color value of the marker, mixing the color to be mixed with the color of the marker to obtain a second mixed color;

[0118] comparing the color value of the first mixed color with the color value of the second mixed color;

[0119] determining the mixed color with the minimum color value as the target mixed color.

[0120] The positive superimposition is directly multiplying the color value to be mixed with the color value of the marker. The present scheme improves the positive superimposition by multiplying the color value to be mixed with the second color value and multiplying the color value of the marker with the first color value. The second color value is obtained by increasing the color value of the marker, and the first color value is obtained by increasing the color value to be mixed. Therefore, the present scheme can slow down the process of the color value tending to 0 after multiplication on the basis of the positive superimposition.

[0121] By selecting the minimum value from the color value of the first mixed color and the color value of the second mixed color, the deviation can be resisted to avoid randomly selecting the target mixed color from the two mixed colors, resulting in a large color deviation.

[0122] It can be understood that the comparison of the two color values can be realized by comparing the component values belonging to the same component in the two color values respectively. Of course, the comparison of the two color values can also be realized by other ways (for example, calculating the sum of squares of all component values in the color values respectively to obtain the sum of squares of the two color values, and comparing the sum of squares of the two color values), which is not limited here.

[0123] By comparing the component values belonging to the same component in the two color values respectively, the comparison result corresponding to each component can be obtained, and based on the comparison result, the minimum component value corresponding to each component can be obtained, and the color value with the most minimum component value is determined as the minimum value in the two color values.

[0124] Taking the RGB value as an example, the R component value in the color value of the first mixed color is compared with the R component value in the color value of the second mixed color, the G component value in the color value of the first mixed color is compared with the G component value in the color value of the second mixed color, and the B component value in the color value of the first mixed color is compared with the B component value in the color value of the second mixed color. If the R component value in the color value of the first mixed color is greater than the R component value in the color value of the second mixed color, the G component value in the color value of the first mixed color is greater than the G component value in the color value of the second mixed color, and the B component value in the color value of the first mixed color is less than the B component value in the color value of the second mixed color, then the color value of the second mixed color is determined to be the minimum.

[0125] If the number of minimum component values of the two color values is same, the square sum of the component value of the target component in the two color values can be calculated respectively, the square sum of the component value of the target component in the two color values is compared, the color value corresponding to the minimum of the two square sums is determined to be the minimum, and if the two square sums are same, any mixed color can be selected as the target mixed color. Wherein, the target component can be the component with different component values in the two color values. For example, the R component value in the color value of the first mixed color is greater than the R component value in the color value of the second mixed color, the G component value in the color value of the first mixed color is equal to the G component value in the color value of the second mixed color, and the B component value in the color value of the first mixed color is less than the B component value in the color value of the second mixed color. It can be determined that the number of minimum component values of the color value of the first mixed color is same, which is 1. The target components are R component and B component. The square sum of the R component value and the B component value in the color value of the first mixed color and the square sum of the R component value and the B component value in the color value of the second mixed color can be calculated respectively. If the square sum of the R component value and the B component value in the color value of the first mixed color is greater than the square sum of the R component value and the B component value in the color value of the second mixed color, it is determined that the color value of the second mixed color is the minimum.

[0126] In step 306, the target mixed color is mixed with the background color in transparency to obtain the color of the drawing area.

[0127] This step is the same as step 204, and details can be referred to the related description of step 204, which will not be repeated here.

[0128] In the embodiment of the present application, by increasing the color value to be mixed and the color value of the marker, and mixing based on the increased color value, the overprinting can be improved, the number of mixing colors can be increased, the color change can be slowed down, so that the user can create more rich and delicate paintings when using the marker to doodle, the product competitiveness can be improved, and the user experience can be improved.

[0129] Referring to Figure 4 is a structural schematic diagram of a color processing device provided by an embodiment of the present application, only parts related to the embodiments of the present application are shown for ease of description.

[0130] The color processing device described above comprises:

[0131] The area determination module 41 is configured to determine the drawing area of the marker when the marker is used to draw.

[0132] The background adjustment module 42 is configured to adjust the background color of the drawing area to be mixed, and the color to be mixed refers to a color with the same display effect as the background color and a target value of transparency, and the target value represents opacity.

[0133] The color mixing module 43 is used to mix the color to be mixed with the color of the marker to obtain the target mixed color;

[0134] The transparency blending module 44 is used to blend the target blend color with the background color to obtain the color of the drawing area.

[0135] Optionally, the above-mentioned color processing apparatus further includes:

[0136] The first amplification module is used to increase the color value of the color to be mixed if the color value to be mixed is greater than 0 and less than 1, to obtain a first color value, wherein the first color value is greater than or equal to the color value to be mixed and less than or equal to 1;

[0137] The second increasing module is used to increase the color value of the marker if the color value of the marker is greater than 0 and less than 1, so as to obtain a second color value. The second color value is greater than or equal to the color value of the marker and less than or equal to 1.

[0138] The aforementioned color mixing module 43 is specifically used for:

[0139] Based on the color value to be mixed, the first color value, the color value of the marker, and the second color value, the color to be mixed is mixed with the color of the marker to obtain the target mixed color.

[0140] Optionally, the above-mentioned color mixing module 43 is specifically used for:

[0141] Based on the color value to be mixed and the second color value, the color to be mixed is mixed with the color of the marker to obtain the first mixed color;

[0142] Based on the first color value and the marker color value, the color to be mixed is mixed with the marker color to obtain the second mixed color;

[0143] Compare the color values ​​of the first mixed color with the color values ​​of the second mixed color;

[0144] The target color is the color with the smallest color value.

[0145] Optionally, the above-mentioned color mixing module 43 is specifically used for:

[0146] Based on the color value of the color to be mixed and the color value of the marker, the color to be mixed is mixed with the color of the marker.

[0147] Optionally, the background adjustment module 42 described above is specifically used for:

[0148] The background color is blended with white with the target transparency value to obtain the color to be blended.

[0149] Optionally, the aforementioned region determination module 41 is specifically used for:

[0150] In the drawing using the marker pen, position information of a trajectory point of a drawing track of the marker pen is acquired;

[0151] Based on the position information of the trajectory point, a region where the trajectory point is located is determined;

[0152] The region where the trajectory point is located is determined as the drawing region.

[0153] Optionally, the region determining module 41 is specifically configured to:

[0154] In the drawing of the marker pen on the screen through the target touch component, position information of a touch point of the target touch component on the screen is acquired;

[0155] The position information of the touch point is determined as the position information of the trajectory point.

[0156] Optionally, in the case that there are at least two touch points, the region determining module 41 is further configured to:

[0157] Interpolation is performed between the two adjacent touch points to obtain position information of an interpolation point between the two adjacent touch points;

[0158] The position information of the interpolation point is determined as the position information of the trajectory point.

[0159] Optionally, in the case that the background color is respectively stored in the first color buffer and the second color buffer, the background adjusting module 42 is specifically configured to:

[0160] The background color is taken out from the second color buffer, and the background color taken out from the second color buffer is adjusted as the to-be-mixed color;

[0161] The transparency mixing module 44 is specifically configured to:

[0162] The background color is taken out from the first color buffer, and the target mixed color is transparently mixed with the background color taken out from the first color buffer;

[0163] The color processing apparatus further includes:

[0164] The first updating module is configured to update the background color in the first color buffer as the color of the drawing region.

[0165] The color processing apparatus provided by the embodiments of the present application can be applied in the foregoing method embodiments, and details are referred to the description of the method embodiments, which will not be described herein.

[0166] Figure 5 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. As shown in FIG. 1, the electronic device includes a display screen 10, a touch component 20, a color processing apparatus 30, and a storage device 40. Figure 5As shown, the electronic device 5 of the embodiment includes one or more processors 50 (only one is shown in the figure), a memory 51, and a computer program 52 stored in the memory 51 and executable on the at least one processor 50. The processor 50 implements the steps in each of the color processing method embodiments described above when executing the computer program 52.

[0167] The electronic device 5 can be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The electronic device can include, but is not limited to, the processor 50 and the memory 51. Those skilled in the art can understand that the electronic device can include other components, such as an input / output device, a network access device, a bus, and the like. Figure 5 The electronic device 5 is only an example and does not constitute a limitation on the electronic device 5, which can include more or fewer components than shown, or combine certain components, or include different components, such as an input / output device, a network access device, a bus, and the like.

[0168] The processor 50 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic components, discrete hardware components, or the like. The general-purpose processor can be a microprocessor or can be any conventional processor.

[0169] The memory 51 can be an internal storage unit of the electronic device 5, such as a hard disk or a memory of the electronic device 5. The memory 51 can also be an external storage device of the electronic device 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, or the like. Further, the memory 51 can include both an internal storage unit and an external storage device of the electronic device 5. The memory 51 is used to store the computer program and other programs and data required by the electronic device. The memory 51 can also be used to temporarily store data that has been output or will be output.

[0170] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is taken as an example for description, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit, and the integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of each functional unit and module are only for convenient distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the apparatus can refer to the corresponding process in the foregoing method embodiments, which will not be described here.

[0171] The embodiment of the present application further provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the steps in each method embodiment.

[0172] The embodiment of the present application further provides a computer program product, when the computer program product runs on an electronic device, the electronic device is caused to execute to realize the steps in each method embodiment.

[0173] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in a certain embodiment can be referred to the related description of other embodiments.

[0174] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0175] In the embodiments of the present disclosure, it should be understood that the disclosed apparatus / equipment and method can be implemented in other manners. For example, the described apparatus / equipment embodiments are merely schematic. Taking the division of the modules or units as an example, the division can be changed in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.

[0176] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0177] If the integrated modules / units are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, all or part of the processes in the above-mentioned embodiment methods can also be completed by computer programs instructing related hardware, and the computer programs can be stored in a computer readable storage medium. When the processor executes the computer programs, the steps of the above-mentioned various method embodiments can be implemented. The computer programs include computer program codes, which can be in the form of source code, object code, executable files or some intermediate forms. The computer readable medium can include any entity or device capable of carrying the computer program codes, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the computer readable medium can include or exclude contents according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.

[0178] The above-described embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A color processing method characterized by, The method comprises the following steps: When a marker pen is used for drawing, a drawing area of the marker pen is determined; A background color of the drawing area is adjusted to a color to be mixed, the color to be mixed being a color having the same display effect as the background color and a target value of transparency, the target value representing opacity; The color to be mixed and a color of the marker pen are mixed to obtain a target mixed color; The target mixed color and the background color are mixed in transparency to obtain a color of the drawing area.

2. The color processing method of claim 1, wherein, Before the color to be mixed and the color of the marker pen are mixed, the method further comprises the following steps: If a color value of the color to be mixed is greater than 0 and less than 1, the color value of the color to be mixed is increased to obtain a first color value, the first color value being greater than the color value of the color to be mixed and less than or equal to 1; If a color value of the color of the marker pen is greater than 0 and less than 1, the color value of the color of the marker pen is increased to obtain a second color value, the second color value being greater than the color value of the color of the marker pen and less than or equal to 1; The mixing of the color to be mixed and the color of the marker pen to obtain the target mixed color comprises the following steps: The color to be mixed and the color of the marker pen are mixed based on the color value of the color to be mixed, the first color value, the color value of the color of the marker pen and the second color value to obtain the target mixed color.

3. The color processing method of claim 2, wherein, The mixing of the color to be mixed and the color of the marker pen to obtain the target mixed color based on the color value of the color to be mixed, the first color value, the color value of the color of the marker pen and the second color value comprises the following steps: The color to be mixed and the color of the marker pen are mixed based on the color value of the color to be mixed and the second color value to obtain a first mixed color; The color to be mixed and the color of the marker pen are mixed based on the first color value and the color value of the color of the marker pen to obtain a second mixed color; The color value of the first mixed color is compared with the color value of the second mixed color; The mixed color with the smallest color value is determined as the target mixed color.

4. The color processing method of claim 1, wherein, The mixing of the color to be mixed and the color of the marker pen comprises the following step: The color to be mixed and the color of the marker pen are mixed based on the color value of the color to be mixed and the color value of the color of the marker pen.

5. The color processing method of claim 1, wherein, The adjustment of the background color of the drawing area to the color to be mixed comprises the following step: The background color and white with the target value of transparency are mixed in transparency to obtain the color to be mixed.

6. The color processing method of claim 1, wherein, The determination of the drawing area of the marker pen when the marker pen is used for drawing comprises the following steps: When the marker pen is used for drawing, position information of a track point of a drawing track of the marker pen is acquired; Based on the position information of the track point, a region where the track point is located is determined; The region where the track point is located is determined as the drawing area.

7. The color processing method of claim 6, wherein, The acquisition of the position information of the track point of the drawing track of the marker pen when the marker pen is used for drawing comprises the following steps: When the marker pen is used for drawing on a screen through a target touch component, position information of a touch point of the target touch component on the screen is acquired; The position information of the touch point is determined as the position information of the track point.

8. The color processing method of claim 7, wherein, In the case that there are at least two touch points, the method further comprises the following steps: interpolating between the two adjacent touch points to obtain position information of an interpolation point between the two adjacent touch points; determining the position information of the interpolation point as the position information of the track point.

9. The color treatment method according to any one of claims 1 to 8, characterized in that, In a case where the background color is respectively stored in a first color buffer and a second color buffer, the adjusting the background color of the drawing region as a color to be mixed includes: taking the background color from the second color buffer and adjusting the background color taken from the second color buffer as the color to be mixed; the transparency blending of the target mixed color and the background color includes: taking the background color from the first color buffer and transparency blending the target mixed color and the background color taken from the first color buffer; after obtaining the color of the drawing region, further including: updating the background color in the first color buffer as the color of the drawing region.

10. A color processing apparatus characterized by comprising: including: a region determining module, configured to determine a drawing region of a marker when the marker is used to draw; a background adjusting module, configured to adjust a background color of the drawing region as a color to be mixed, the color to be mixed being a color having the same display effect as the background color and a target value of transparency, the target value representing non-transparency; a color mixing module, configured to mix the color to be mixed and a color of the marker to obtain a target mixed color; a transparency blending module, configured to transparency blend the target mixed color and the background color to obtain a color of the drawing region.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the color processing method according to any one of claims 1 to 9.

12. A computer-readable storage medium, the computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the color processing method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Digital overpainting controlled by opacity and flow parameters

    CN110930468A