Color filling method and electronic device

By determining a new junction color based on the color to be filled, the seed point color, and the junction color on an electronic device, the jagged problem at the junction of the filled area and the adjacent area is solved, thereby improving the user's painting experience.

WO2025200983A1PCT designated stage Publication Date: 2025-10-02HUAWEI TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/081032
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-28
Filing Date
2025-03-06
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

When using the Fill tool to fill color on an electronic device, there is a noticeable jagged feeling at the junction of the filled area and the adjacent area, affecting user experience and drawing efficiency.

Method used

By determining the color to be filled, the seed point color, and the intersection color, the intersection is filled with the new intersection color to reduce the jagged effect and improve the color transition effect.

Benefits of technology

On the basis of ensuring the filling effect, the color transition is improved, which enhances the user's painting experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025081032_02102025_PF_FP_ABST
    Figure CN2025081032_02102025_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a color filling method and an electronic device. The method comprises: displaying a first interface, wherein the first interface comprises a first area and a second area, the color of the first area is a first color, the color of the second area is a second color, the junction of the first area and the second area comprises M colors, and the M colors are different from the first color and the second color; in response to a user's operation of filling the second area by using a third color, determining P colors on the basis of the second color, the third color and one or more colors among the M colors; and replacing the second color with the third color, and replacing one or more colors among the M colors with the P colors. Since new colors at a junction are determined on the basis of a color for filling, a seed point color, and original colors at the junction, smoother color transition can be achieved while ensuring the filling effect, thereby reducing aliasing artifacts and enhancing user experience in painting.
Need to check novelty before this filing date? Find Prior Art

Description

Color filling method and electronic device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 28, 2024, with application number 202410367319.1 and application name “A method for filling color and an electronic device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of electronic devices, and more particularly, to a method for filling color and an electronic device. Background Art

[0003] With the advancement of technology, more and more users choose to draw on electronic devices. Generally speaking, drawing applications on electronic devices provide a fill tool, which allows users to quickly fill the color of a certain area on the canvas with the desired color. However, in some application scenarios, when the user uses the fill tool to fill the filled area, there will be a clear sense of separation at the junction of the filled area and the adjacent area, and there will be a jagged phenomenon, which will seriously affect the user experience and drawing efficiency. Based on this, how to reduce the jagged feeling between the filled area and other areas has become a technical problem that needs to be solved urgently. Summary of the Invention

[0004] The present application provides a method for filling colors and an electronic device. In an embodiment of the present application, when performing flood filling, the electronic device can determine the color of a new junction based on the color to be filled, the seed point color, and the color of the junction, and then use the new junction color to fill the junction. On the basis of ensuring the filling effect, the color transition can be better performed, the jagged feeling can be reduced, and it helps to improve the user's painting experience.

[0005] In a first aspect, a method for filling color is provided, the method comprising: displaying a first interface, wherein the first interface comprises a first area and a second area, the color of the first area is a first color, the color of the second area is a second color, and the junction of the first area and the second area comprises M colors, the M colors are determined based on the first color and the second color, the M colors are different from the first color and the second color, M ≥ 1 and is an integer; in response to a user operation of filling the second area with a third color, determining P colors based on the second color, the third color and one or more colors of the M colors, P ≥ 1 and is an integer; replacing the second color with the third color, and replacing one or more colors of the M colors with the P colors.

[0006] In an embodiment of the present application, when performing flood fill, the electronic device can determine the color of the new junction based on the color to be filled, the seed point color and the color of the junction, and then use the new junction color to fill the junction. On the basis of ensuring the filling effect, the color transition can be better performed, the jagged feeling can be reduced, and it helps to improve the user's painting experience.

[0007] In combination with the first aspect, in certain implementations of the first aspect, the M colors include a fourth color, and determining the P colors based on the second color, the third color, and one or more colors among the M colors includes: determining a fifth color based on the second color, the third color, and the fourth color; and using the P colors to replace one or more colors among the M colors includes: replacing the fourth color with the fifth color.

[0008] In combination with the first aspect, in certain implementations of the first aspect, determining the fifth color based on the second color, the third color, and the fourth color includes: determining a first transparency based on the second color and the fourth color; and determining the fifth color based on the first transparency, the third color, and the fourth color.

[0009] In combination with the first aspect, in some implementations of the first aspect, determining the first transparency according to the second color and the fourth color includes: determining the first transparency according to the following formula:

[0010] Wherein, a is the first transparency, C is the RGB value of the fourth color, B is the RGB value of the second color, fun1() is a function for obtaining the maximum value, minimum value or average value of the RGB channel, and fun2() is a function for obtaining the maximum value of the RGB channel; determining the fifth color based on the first transparency, the third color and the fourth color includes: determining the fifth color according to the following formula: D=C+(AC)×a

[0011] Wherein, D is the RGB value of the fifth color, and A is the RGB value of the third color.

[0012] In combination with the first aspect, in certain implementations of the first aspect, the use of the third color to replace the second color includes: determining the second area as an initial flood area, the initial flood area being an area where the RGB value of the pixel point is equal to the RGB value of the second color; and filling the initial flood area with the third color.

[0013] In combination with the first aspect, in certain implementations of the first aspect, in response to the user's operation of filling the second area with a third color, P colors are determined based on the second color, the third color, and one or more colors of the M colors, including: determining P dynamic flooding areas based on the difference between the RGB value of the second color and the RGB value of one or more colors of the M colors; determining P colors based on the colors of the P dynamic flooding areas, the third color, and the second color; and using the P colors to replace one or more colors of the M colors includes: filling the P dynamic flooding areas with the P colors.

[0014] In combination with the first aspect, in certain implementations of the first aspect, P≤M.

[0015] In combination with the first aspect, in some implementations of the first aspect, the opacity of the pixels of the first interface is the same.

[0016] In combination with the first aspect, in some implementations of the first aspect, the opacity of the pixel points of the first interface is equal to 1.

[0017] In combination with the first aspect, in some implementations of the first aspect, the first interface is an interface of a drawing application, or a drawing interface in a game application, or a conference application, or a teaching application, or a note-taking application.

[0018] The second aspect is an electronic device of an embodiment of the present application, which includes modules / units for executing the above aspects or any possible design method of the above aspects; these modules / units can be implemented by hardware, or corresponding software implementations can be executed by hardware.

[0019] The third aspect is a chip according to an embodiment of the present application, which is coupled to a memory in an electronic device and is used to call a computer program stored in the memory and execute the above-mentioned aspects of the embodiment of the present application and any possible design of the above-mentioned aspects; in the embodiment of the present application, "coupling" refers to the direct or indirect combination of two components with each other.

[0020] The fourth aspect is an electronic device of an embodiment of the present application, which includes one or more processors; one or more memories; the one or more memories store one or more computer programs, and the one or more computer programs include instructions. When the instructions are executed by the one or more processors, the above aspects or any possible implementation of the above aspects are executed.

[0021] In a fifth aspect, a computer-readable storage medium is provided, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the first aspect and any possible implementation method of the first aspect are executed.

[0022] In a sixth aspect, a computer program product is provided, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the first aspect and any possible implementation method of the first aspect are executed.

[0023] In a seventh aspect, a computer program is provided, which, when executed on a computer, enables the method in the first aspect and any possible implementation thereof to be executed.

[0024] Among them, for the beneficial effects of the second to seventh aspects, please refer to the beneficial effects of the first to third aspects and will not be repeated. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] FIG1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.

[0026] FIG2 is a block diagram of the software structure of the electronic device according to an embodiment of the present application.

[0027] FIG3 is a schematic diagram of a flood fill algorithm.

[0028] FIG4 is a schematic diagram of a flood fill algorithm.

[0029] FIG5 is a schematic flow chart of a method for filling color provided in an embodiment of the present application.

[0030] FIG6 is a flowchart of flood filling provided by an embodiment of the present application.

[0031] FIG7 is a schematic flowchart of a method for filling color provided in an embodiment of the present application.

[0032] FIG8 is a schematic diagram of the composition of an electronic device 800 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the specification of this application and the appended claims, the singular expressions "a", "an", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one, two or more. The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship.

[0034] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0035] The following describes an electronic device, a user interface for such an electronic device, and embodiments for using such an electronic device. In some embodiments, the electronic device may be a personal computer (PC), such as a laptop computer or a desktop computer. The operating system used by the PC includes, but is not limited to, desktop operating systems such as Windows, Linux, and macOS, and may also be future desktop operating systems.

[0036] 1 shows a schematic structural diagram of an electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

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

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

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

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

[0041] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.

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

[0043] Display screen 194 is used to display images, videos, and the like. 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, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.

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

[0045] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0046] Figure 2 is a software structure diagram of the electronic device 100 according to an embodiment of the present application. The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer, the application framework and service layer, the Android runtime and system libraries, and the kernel layer. The application layer may include a series of application packages.

[0047] As shown in Figure 2, the application layer may include camera, settings, third-party applications, etc. Among them, the third-party applications may include gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.

[0048] The application framework layer provides an application programming interface (API) and a programming framework for applications in the application layer. The application framework layer may include some predefined functions.

[0049] As shown in FIG2 , the application framework and service layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0050] The window manager manages windowed applications. It can determine the display size, determine whether a status bar is present, lock the screen, and take screenshots. Content providers store and retrieve data and make it accessible to applications. This data can include video, images, audio, incoming and outgoing calls, browsing history and bookmarks, and phone books.

[0051] The view system includes visual controls, such as controls for displaying text and images, such as the instructions for prompting a virtual shutter button in the embodiments of this application. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0052] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including answering, hanging up, etc.).

[0053] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, beeps, vibrations on electronic devices, and flashing indicator lights.

[0054] The Android runtime includes the core library and the virtual machine. The Android runtime is responsible for scheduling and management of the Android system.

[0055] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

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

[0057] The system library can include multiple functional modules, such as a surface manager, media libraries, a 3D graphics processing library (such as OpenGL ES), and a 2D graphics engine (such as SGL).

[0058] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0059] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

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

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

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

[0063] The hardware layer may include various sensors, such as the various sensors introduced in FIG. 1 , the acceleration sensor, gyroscope sensor, touch sensor, etc. involved in the embodiments of the present application.

[0064] It should be noted that Figure 2 only uses the framework of the Android system as an example and should not be understood as a specific limitation on the embodiments of the present application. In the embodiments of the present application, the electronic device may also be equipped with other operating systems (for example, Hongmeng operating system), and different frameworks may be used for different operating systems. It is understandable that when different frameworks are adopted, the specific naming of each layer of the framework may be different.

[0065] To facilitate understanding of the embodiments of the present application, the following concepts may be involved in the embodiments of the present application:

[0066] RGB (Red, Green, Blue): This color model uses the variations and superposition of red, green, and blue color channels to create a wide range of colors. It encompasses nearly every color perceptible to humans and is one of the most widely used color systems. RGB images use only three colors, blending them in varying proportions to present 16,777,216 (256*256*256) colors on the screen.

[0067] RGBA: This is a color model that adds an opaque (Alpha) channel to the RGB color model. The Alpha channel is referred to as the a channel below. The a channel value represents the degree of transparency of the color. The a channel value range can be [0, 1] or [0, 255]. The a channel value range is [0, 1] for the purpose of introduction. When the a channel value is 1, it indicates complete opacity, and when the a channel value is 0, it indicates complete transparency.

[0068] Flood fill is an image processing technique that starts from a seed point and expands the fill area by selecting adjacent pixels and changing their colors according to certain conditions until a stopping condition is met. In other words, the essence of flood fill is to find a region that meets the condition and replace the pixels in that region with a specified color. The following is a detailed explanation of flood fill with reference to Figure 3.

[0069] The image displayed by the electronic device on the drawing interface may be as shown in FIG3 (a). In response to the user's filling operation, the electronic device determines a seed point, also known as a starting point. The seed point can be the location where the user clicks on the screen, indicated by a blue five-pointed star in FIG3 (a). The initial color at this seed point can be represented as (255, 255, 255), which is the RGB value of the color at the seed point.

[0070] Assuming that the RGB value of the color filled by the user can be expressed as (255, 192, 0), the electronic device can search for a qualified area around the seed point until it encounters a black boundary. For example, the qualified area can be an area where the difference between the RGB value of the pixel point and the RGB value of the seed point is less than a threshold N, that is, when the difference between the RGB value of a certain pixel point and the RGB value of the seed point is less than N, the pixel point is a pixel point in the filled area. Conversely, when the difference between the RGB value of a certain pixel point and the RGB value of the seed point is greater than N, the pixel point is not a pixel point in the filled area. For example, the difference between the RGB value of the black pixel point in Figure 3 and the RGB value of the seed point is greater than N.

[0071] As shown in (b) to (d) of FIG3 , the electronic device may fill all the areas meeting the conditions with the color selected by the user.

[0072] It can be seen that the flood fill algorithm can quickly fill an area with the color required by the user. However, in some scenarios, when the user uses the fill tool to fill the filled area, there will be a clear sense of separation at the junction of the filled area and its adjacent areas, and there will be a jagged phenomenon, which will seriously affect the user experience and drawing efficiency. The following is explained with reference to Figure 4.

[0073] As shown in FIG4(a), the electronic device displays interface 401, which is a drawing interface and is filled with blue. At this time, the RGBA of interface 401 is (0, 0, 255, 1.0). When the electronic device detects a user drawing operation on interface 401, it can display the GUI shown in FIG4(b), where the user's drawing operation is to draw a circle on interface 401 using a green brush.

[0074] Exemplarily, the drawing interface may be an interface of a drawing application, an interface of a game application, or the like.

[0075] As shown in (b) of FIG4 , in response to the user's operation, the electronic device may display a green circle on the interface 401 , where the RGB value corresponding to the green is RGB value #1.

[0076] It should be noted that, in order to more clearly display the details of the junction of the green straight line and the blue background, (c) to (f) in FIG. 4 show the screen of the area 402 of the interface 401.

[0077] As shown in Figure 4(c), when the electronic device draws a green circle on interface 401, to avoid appearing abrupt, a gradient effect is applied at the intersection of the green circle and the blue background, gradually transitioning from green to blue. After the electronic device completes the green circle drawing frame, the opacity of the pixels in interface 401 remains constant, for example, the opacity of the pixels in interface 401 is 1.

[0078] It is understood that the intersection of the green circle and the blue background includes multiple colors to create a gradient effect. These multiple colors are determined by the electronic device based on the green and blue colors when drawing the circle. Below, we will use the example of the intersection of the green circle and the blue background including colors #1, #2, #3, and #4. Here, the difference between the RGB value corresponding to color #1 and RGB value #1 is less than the difference between the RGB value corresponding to color #2 and RGB value #1, less than the difference between the RGB value corresponding to color #3 and RGB value #1, and less than the difference between the RGB value corresponding to color #4 and RGB value #1. In other words, color #1 is closer to the green in interface 401 than color #2, color #2 is closer to the green in interface 401 than color #3, and color #3 is closer to the green in interface 401 than color #4. Alternatively, color #4 is closer to the blue in interface 401 than color #3, color #3 is closer to the blue in interface 401 than color #2, and color #2 is closer to the blue in interface 401 than color #1.

[0079] When the electronic device detects that the user fills a green circle with red, in response to the operation, the location clicked by the user can be determined as the seed point (i.e., the location marked with a blue five-pointed star in the figure), and flood filling can be performed with the seed point as the starting point.

[0080] When performing flood filling, the electronic device can adjust N to control the size of the filled area.

[0081] For example, when N=0, the electronic device may determine the filling area #1 and change the color of the filling area #1 from green to red, as shown in (d) in FIG. 4 .

[0082] It can be understood that when N=0, the RGB value of each pixel in the filling area #1 determined by the electronic device is the same as the RGB value of the seed point, that is, RGB value #1.

[0083] For example, when N=50%*255=127.5, the electronic device can determine the filling area #2 based on N and RGB value #1, and replace all the colors in the filling area #2 with red, as shown in (e) in Figure 4, where the difference between the RGB value of the pixel point in the filling area #2 and the RGB value #1 is less than 127.5.

[0084] It is understood that the area of ​​fill area #2 is larger than the area of ​​fill area #1, and fill area #2 can include multiple colors, that is, it can include the color corresponding to the seed point (i.e., green), or it can include color #1 and color #2. In other words, when the fill area is fill area #2, the electronic device will replace green, color #1, and color #2 with red.

[0085] For example, when N=90%*255=229.5, the electronic device can determine the filling area #3 based on N and RGB value #1, and replace all the colors in the filling area #3 with red, as shown in (f) in Figure 4, where the difference between the RGB value of the pixel point in the filling area #3 and the RGB value #1 is less than 229.5.

[0086] It is understood that the area of ​​fill area #3 is larger than the area of ​​fill area #2, and fill area #3 can include multiple colors, that is, it can include the color corresponding to the seed point (i.e., green), or it can include color #1, color #2, and color #3. In other words, when the fill area is fill area #3, the electronic device will replace green, color #1, color #2, and color #3 with red.

[0087] It is not difficult to see from (d)-(f) in Figure 4 that in order to better fill the green circle, N needs to be adjusted to expand the filling area. When N is adjusted to a larger value, the filling area can be gradually expanded to the junction of the green circle and the blue background. The original one or more colors used to transition from green to blue at the junction will be replaced by red, thus losing the gradient effect of the junction. The transition from red to blue will be very unnatural, forming a strong sense of fragmentation and obvious jagged phenomenon.

[0088] In addition, even if the filled area is not expanded to the intersection of the green circle and the blue background, since one or more colors at the intersection are determined based on green and blue, when the circle in the image changes from green to red, the transition will be very abrupt and unnatural.

[0089] For example, before filling, the intersection of the green circle and the blue background includes Color #1, Color #2, Color #3, and Color #4, meaning that these four colors gradually transition from green to blue. After filling the green circle with red, since Color #1, Color #2, and Color #3 at the intersection are all replaced with red, there is only one transition color between red and blue: Color #4. Color #4 is determined based on green and blue. Therefore, after filling the green circle with red, the gradient effect at the intersection is lost, and the transition from red to blue becomes very unnatural, creating a strong sense of fragmentation and obvious jaggedness.

[0090] In summary, in some scenarios, when a user uses the fill tool to fill an area, there will be a noticeable sense of disconnection and jaggedness at the junction of the filled area and its adjacent areas, which will seriously affect the user experience and drawing efficiency. Based on this, the present application provides a method for filling color, which can better perform color transitions while ensuring the filling effect, helping to improve the user experience. The following first introduces the method for filling color provided by an embodiment of the present application in conjunction with Figures 5 and 6.

[0091] FIG5 shows a schematic flow chart of a method for filling color provided in an embodiment of the present application. As shown in FIG5 , the method includes:

[0092] S501 : Determine a color to be filled and an area to be filled, wherein the area to be filled includes an initial flooding area and a dynamic flooding area.

[0093] The electronic device may determine the color to be filled and the filled area according to the user's operation, wherein the filled area may include an initial flooding area (initmask) and a dynamic flooding area (currentmask).

[0094] In an embodiment of the present application, the filled area can be divided into an initial flood area and a dynamic flood area, wherein the RGB value of the pixel point in the initial flood area is equal to the RGB value of the seed point, and the RGB value of the pixel point in the dynamic flood area is not equal to the RGB value of the seed point, but the difference between the two is less than N.

[0095] The electronic device can fill the initial flooding area with the color to be filled. That is, in the example shown in Figure 6, the initial flooding area is filled with red. In addition, the electronic device can also determine one or more colors based on the color to be filled, the seed point color, and the color of the boundary between the filled area and other areas, and use the one or more colors to fill the dynamic flooding area. For details, please refer to the following description.

[0096] For example, as shown in Figure 6(a), the drawing interface displayed by the electronic device includes a blue background and a yellow circle. The RGB value corresponding to blue is denoted as RGB value #1, and the RGB value corresponding to yellow is denoted as RGB value #2. As can be seen in Figure 6(a), there are multiple colors at the intersection of the yellow circle and the blue background: Color #1, Color #2, Color #3, Color #4, Color #5, and Color #6, which are labeled C1, C2, C3, C4, C5, and C6 in the figure, respectively.

[0097] It can be understood that the difference between the RGB value of color #1 and the RGB value #2 is less than the difference between the RGB value of color #2 and the RGB value #2 is less than the difference between the RGB value of color #3 and the RGB value #2 is less than the difference between the RGB value of color #4 and the RGB value #2 is less than the difference between the RGB value of color #5 and the RGB value #2 is less than the difference between the RGB value of color #6 and the RGB value #2, and the difference between the RGB value of color #1 and the RGB value #1 is greater than the difference between the RGB value of color #2 and the RGB value #1 is greater than the difference between the RGB value of color #3 and the RGB value #1 is greater than the difference between the RGB value of color #4 and the RGB value #1 is greater than the difference between the RGB value of color #5 and the RGB value #1 is greater than the difference between the RGB value of color #6 and the RGB value #1.

[0098] In the example shown in Figure 6, the area where the RGB value of the pixel point is RGB value #1 can be called area #1, the area where the RGB value of the pixel point is RGB value #2 can be called area #2, and the junction between area #1 and area #2 can be called area #3. Area #3 can be further divided into sub-area #1, sub-area #2, sub-area #3, sub-area #4, sub-area #5 and sub-area #6 according to different colors, and correspond to color #1, color #2, color #3, color #4, color #5 and color #6 respectively.

[0099] When the electronic device detects an operation of a user filling a yellow circle with red, in response to the operation, red may be determined as the color to be filled.

[0100] In addition to determining the color to be filled, the electronic device also needs to determine the area to be filled, which can also be called the fill area. When determining the fill area, the electronic device can use the location clicked by the user as the seed point (i.e., the location marked with a blue five-pointed star in (a) of Figure 6) and perform flood filling using the seed point as the starting point. The color of the seed point is yellow, i.e., the corresponding RGB value is RGB value #2.

[0101] When determining the initial flooding area, the electronic device can adjust N to 0, thereby determining the area with the same RGB value as RGB value #2 as the initial flooding area. In other words, the initial flooding area is the area where the RGB value of the pixel point is equal to the RGB value of the seed point. It will be understood that in the example shown in Figure 6, the initial flooding area is the same as area #2.

[0102] When determining the dynamic flooding area, the electronic device can gradually increase N. As mentioned above, the area selected by the electronic device will also become larger and larger. The electronic device can determine the difference between the area determined when N is greater than 0 and the initial flooding area as the dynamic flooding area. When determining the dynamic flooding area, the electronic device can determine one or more dynamic flooding areas, which is explained below in conjunction with Figure 6.

[0103] As shown in (a) in Figure 6, area #3 includes color #1, color #2, color #3, color #4, color #5 and color #6. Assume that the difference between the RGB value of color #1 and the RGB value #2 is difference #1, the difference between the RGB value of color #2 and the RGB value #2 is difference #2, the difference between the RGB value of color #3 and the RGB value #2 is difference #3, the difference between the RGB value of color #4 and the RGB value #2 is difference #4, the difference between the RGB value of color #5 and the RGB value #2 is difference #5, and the difference between the RGB value of color #6 and the RGB value #2 is difference #6.

[0104] When determining a dynamic flooding area, the electronic device may include the following possible implementation methods.

[0105] In one possible implementation, the number of dynamic flooding areas determined by the electronic device is the same as the number of colors of area #3.

[0106] For example, the electronic device can first adjust N to: difference #1<N<difference #2. Under this condition, the electronic device can select an area whose difference with RGB value #2 is less than N. Since difference #1<N<difference #2, the difference between the RGB value of the area selected by the electronic device and RGB value #2 is less than difference #2. In the example described in Figure 6, the area selected by the electronic device includes area #2 and sub-area #1. Since area #2 is the initial flooding area, the dynamic flooding area #1 finally determined by the electronic device is sub-area #1.

[0107] After the electronic device determines the dynamic flooding area #1, it can continue to adjust N and adjust N to: difference #2<N<difference #3. Under this condition, the electronic device can select an area whose difference with RGB value #2 is less than N. Since difference #2<N<difference #3, the difference between the RGB value of the area selected by the electronic device and RGB value #2 is less than difference #3. In the example described in Figure 6, the area selected by the electronic device includes area #2, sub-area #1 and sub-area #2. Since area #2 is the initial flooding area and sub-area #1 is the dynamic flooding area #1, the dynamic flooding area #2 finally determined by the electronic device is sub-area #2.

[0108] Similarly, the electronic device may determine sub-area #3 as dynamic flooding area #3, sub-area #4 as dynamic flooding area #4, sub-area #5 as dynamic flooding area #5, and sub-area #6 as dynamic flooding area #6.

[0109] In other words, in this possible implementation, the electronic device may determine an area corresponding to each color at the boundary between area #1 and area #2 as a dynamic flooding area.

[0110] In a possible implementation, the number of dynamic flooding areas determined by the electronic device is smaller than the number of colors in area #3, and all sub-areas in area #3 are dynamic flooding areas.

[0111] For example, the electronic device can first adjust N to: difference #1<N<difference #3. Under this condition, the electronic device can select an area whose difference with RGB value #2 is less than N. Since difference #1<N<difference #3, the difference between the RGB value of the area selected by the electronic device and RGB value #2 is less than difference #3. In the example described in Figure 6, the area selected by the electronic device includes area #2, sub-area #1 and sub-area #2. Since area #2 is the initial flooding area, the dynamic flooding area #1 finally determined by the electronic device includes sub-area #1 and sub-area #2.

[0112] After the electronic device determines the dynamic flooding area #1, it can continue to adjust N and adjust N to: difference #3<N<difference #5. Under this condition, the electronic device can select an area whose difference with RGB value #2 is less than N. Since difference #3<N<difference #5, the difference between the RGB value of the area selected by the electronic device and RGB value #2 is less than difference #5. In the example described in Figure 6, the area selected by the electronic device includes area #2, sub-area #1, sub-area #2, sub-area #3 and sub-area #4. Since area #2 is the initial flooding area, sub-area #1 and sub-area #2 are the dynamic flooding area #1, and the dynamic flooding area #2 finally determined by the electronic device is sub-area #3 and sub-area #4.

[0113] After the electronic device determines the dynamic flooding area #2, it can continue to adjust N and adjust N to: difference #5<N<difference #7, where difference #7>difference #6. Under this condition, the electronic device finally determines the dynamic flooding area #3 as sub-area #5 and sub-area #6.

[0114] In a possible implementation, the number of dynamic flooding areas determined by the electronic device is smaller than the number of colors in area #3, and not all sub-areas in area #3 are dynamic flooding areas.

[0115] For example, the electronic device can first adjust N to: difference #1<N<difference #3. Under this condition, the electronic device can select an area whose difference with RGB value #2 is less than N. Since difference #1<N<difference #3, the difference between the RGB value of the area selected by the electronic device and RGB value #2 is less than difference #3. In the example described in Figure 6, the area selected by the electronic device includes area #2, sub-area #1 and sub-area #2. Since area #2 is the initial flooding area, the dynamic flooding area #1 finally determined by the electronic device includes sub-area #1 and sub-area #2.

[0116] After the electronic device determines the dynamic flooding area #1, it can continue to adjust N and adjust N to: difference #3<N<difference #5. Under this condition, the electronic device can select an area whose difference with RGB value #2 is less than N. Since difference #3<N<difference #5, the difference between the RGB value of the area selected by the electronic device and RGB value #2 is less than difference #5. In the example described in Figure 6, the area selected by the electronic device includes area #2, sub-area #1, sub-area #2, sub-area #3 and sub-area #4. Since area #2 is the initial flooding area, sub-area #1 and sub-area #2 are the dynamic flooding area #1, and the dynamic flooding area #2 finally determined by the electronic device is sub-area #3 and sub-area #4.

[0117] After the electronic device determines the dynamic flooding area #2, it can further adjust N to: difference #5<N<difference #6. Under this condition, the electronic device finally determines the dynamic flooding area #3 as sub-area #5.

[0118] It can be understood that, in this possible implementation, sub-area #6 is not a dynamic flooding area, that is, sub-area #6 will not be filled.

[0119] For another example, the electronic device can adjust N to determine that sub-area #1 is the dynamic flooding area #1, sub-area #2 is the dynamic flooding area #2, sub-area #3 is the dynamic flooding area #3, sub-area #4 is the dynamic flooding area #4, sub-area #5 is the dynamic flooding area #5, and sub-area #6 is not a dynamic flooding area.

[0120] S502: Fill the initial flood area with the color to be filled.

[0121] After the electronic device determines the initial flooding area, it can fill the initial flooding area with red, that is, replace yellow with red. The filling effect can be shown as (b) in Figure 6.

[0122] S503 : Determine a filling color for the dynamic flooding area according to the color to be filled, the color of the dynamic flooding area, and the color of the seed point.

[0123] After determining the dynamic flooding area, the electronic device may also determine a filling color for the dynamic flooding area, so as to fill the dynamic flooding area with the filling color of the dynamic flooding area.

[0124] Referring to the description of S501, since there are multiple possible implementations for the electronic device to determine the dynamic flooding area, the electronic device may determine the filling color of the dynamic flooding area differently for different implementations of determining the dynamic flooding area.

[0125] In a possible implementation, when the dynamic flooding area includes only one color, the electronic device determines the filling color of the dynamic flooding area according to the color to be filled, the one color, and the seed point color.

[0126] For example, in the example shown in FIG6 , assuming that dynamic flooding area #1 is sub-area #1, that is, dynamic flooding area #1 only includes color #1, the electronic device can determine the filling color of dynamic flooding area #1 based on red, yellow and color #1.

[0127] When the electronic device determines the filling color of the dynamic flooding area #1 according to red, yellow, and color #1, it can determine the filling color of the dynamic flooding area #1 according to the following formulas (1) and (2). D=C+(AC)×a (2)

[0128] Where a is opacity, C is the RGB value of the color of the dynamic flooding area, that is, the RGB value of color #1, B is the color of the seed point, that is, the RGB value of yellow, A is the RGB value of the color to be filled, that is, the RGB value of red, and D is the RGB value of the fill color of the dynamic flooding area. Fun1() is a function used to find the maximum, minimum, or average value of the RGB channel, and fun2() is a function used to find the maximum value of the RGB channel.

[0129] Assuming that the RGB value of color #1 in Figure 6 is (235, 228, 166), the RGB value of yellow is (242, 218, 148), and the RGB value of red is (250, 57, 0), then |CB| = (7, 10, 18). Assuming that fun1() is the function for finding the maximum value of the RGB channels and fun2() is the function for finding the maximum value of the RGB channels, the obtained a = 1-18 / 242 = 0.93. The electronic device can determine the RGB value of the fill color of the dynamic flooding area according to formula (2): (235, 228, 166) + ((250, 57, 0) - (235, 228, 166)) * 0.93 = (249, 69, 12), which determines the fill color of the dynamic flooding area.

[0130] It should be noted that formula (1) and formula (2) are merely examples and should not be understood as specific limitations on the embodiments of the present application. In other embodiments of the present application, other formulas including the above parameters may also be established.

[0131] In one possible implementation, when the dynamic flooding area includes multiple colors, the electronic device first determines a color based on the multiple colors, and then determines the filling color of the dynamic flooding area based on the to-be-filled color, the newly determined color, and the seed point color.

[0132] For example, in the example shown in Figure 6, assuming that dynamic flooding area #1 includes sub-area #1 and sub-area #2, that is, dynamic flooding area #1 includes color #1 and color #2, the electronic device can determine color #7 based on color #1 and color #2, and then the electronic device determines the filling color of dynamic flooding area #1 based on red, yellow and color #7.

[0133] For example, when the electronic device determines color #7 based on color #1 and color #2, it may randomly determine color #1 or color #2 as color #7.

[0134] For example, when an electronic device determines color #7 based on color #1 and color #2, it can calculate the average of the RGB values ​​of color #1 and the RGB values ​​of color #2, and then determine the color corresponding to the calculated average as color #7. For example, if the RGB values ​​of color #1 are (235, 228, 166) and the RGB values ​​of color #2 are (232, 213, 158), and the average of the RGB values ​​of color #1 and color #2 is calculated to be (234, 221, 162) with integer digits retained, then the RGB value of color #7 is (234, 221, 162).

[0135] It should be understood that the description of determining the filling color of the dynamic flooding area #1 according to red, yellow, and color #7 can be found above and will not be repeated here.

[0136] One possible implementation method is that when the dynamic flooding area includes multiple colors, the electronic device can determine multiple filling colors based on each of the multiple colors, the color to be filled, and the seed point color, and then determine the final filling color of the dynamic flooding area based on the multiple filling colors.

[0137] For example, in the example shown in Figure 6, assuming that the dynamic flooding area #1 includes sub-area #1 and sub-area #2, that is, the dynamic flooding area #1 includes color #1 and color #2, the electronic device can determine the fill color #1 based on color #1, red, and yellow, determine the fill color #2 based on color #2, red, and yellow, and then determine the final fill color of the dynamic flooding area #1 based on fill color #1 and fill color #2.

[0138] Illustratively, when the electronic device determines the final filling color of the dynamic flooding area #1 based on the filling color #1 and the filling color #2, it may randomly determine the filling color #1 or the filling color #2 as the final filling color of the dynamic flooding area #1.

[0139] For example, when the electronic device determines the final fill color of the dynamic flood area #1 based on fill color #1 and fill color #2, it can calculate the average value of the RGB value of fill color #1 and the RGB value of fill color #2, and then determine the color corresponding to the calculated average value as the final fill color of the dynamic flood area #1.

[0140] S504: Fill the dynamic flood area with the filling color of the dynamic flood area.

[0141] After determining one or more dynamic flooding areas, the electronic device may fill the one or more dynamic flooding areas with the filling colors corresponding to the one or more dynamic flooding areas. The filling effect may be as shown in (c) and (d) in FIG6 .

[0142] Figure 6 (e) shows a red fill effect where the intersection of multiple colors is filled with red. The transition from red to blue is immediate, losing the transition effect and making it very abrupt. Comparing this with Figure 6 (d), it's clear that the intersection of the red circle and the blue background in Figure 6 (d) gradually transitions from red to blue. It's conceivable that if Figures 6 (d) and (e) were scaled down to the same size, users would perceive Figure 6 (d) as more natural and less likely to notice jagged edges.

[0143] In an embodiment of the present application, when performing flood fill, the electronic device can determine the color of the new junction based on the color to be filled, the seed point color and the color of the junction, and then use the new junction color to fill the junction. On the basis of ensuring the filling effect, the color transition can be better performed, the jagged feeling can be reduced, and it helps to improve the user's painting experience.

[0144] It should be noted that the example in FIG6 is based on a circle filled with yellow. When the user chooses to fill the blue background, the electronic device can still change the color of the blue background and the boundary according to the method of filling color described above.

[0145] FIG7 shows a method for filling color provided by the present application. As shown in FIG7 , the method includes:

[0146] S701, displaying a first interface, where the first interface includes a first area and a second area.

[0147] The electronic device displays a first interface, which includes a first area and a second area, wherein the color of the first area is the first color, the color of the second area is the second color, and the junction of the first area and the second area includes M colors, which are determined based on the first color and the second color. The colors in the M colors are different from the first color and the second color, and M ≥ 1 and is an integer.

[0148] For example, taking Figure 6 as an example, area #1 is the first area, the first color is blue, area #2 is the second area, the second color is yellow, and the junction of area #1 and area #2 is area #3. The junction includes 6 colors, namely color #1, color #2, color #3, color #4, color #5 and color #6.

[0149] The method for filling color provided in the embodiment of the present application can be applied to any application scenario with filling requirements.

[0150] In some embodiments, the first interface may be an interface of a drawing application.

[0151] In some embodiments, the first interface may be an interface of a game application, for example, a game application such as "Draw and Guess the Word" or "Draw and Guess the Object" that requires the user to perform a drawing operation.

[0152] In some embodiments, the first interface may be an interface of a conference application.

[0153] In some embodiments, the first interface may be an interface of a teaching application.

[0154] In some embodiments, the first interface may be an interface of a note-taking application.

[0155] In some embodiments, the opacity of pixels on the first interface is equal.

[0156] In some embodiments, the opacity of the pixels of the first interface is equal to 1.

[0157] S702 : In response to a user operation of filling the second area with a third color, P colors are determined according to the second color, one or more colors among the M colors, and the third color.

[0158] During the drawing process, the user will use the filling tool to fill. When the electronic device detects that the user uses the third color to fill the second area, in response to the operation, P colors can be determined based on the second color of the second area, the third color to be filled, and one or more of the M colors at the intersection, where P ≥ 1 and is an integer.

[0159] For example, taking FIG. 6 as an example, the electronic device determines red as the third color in response to the user's operation, and determines P colors based on one or more colors of red, yellow, and the color at the intersection.

[0160] In some embodiments, M=P.

[0161] For example, taking Figure 6 as an example, the intersection includes color #1, color #2, color #3, color #4, color #5 and color #6, and the electronic device can determine the new colors corresponding to color #1, color #2, color #3, color #4, color #5 and color #6 respectively.

[0162] In some embodiments, M>P.

[0163] For example, taking Figure 6 as an example, the intersection includes color #1, color #2, color #3, color #4, color #5 and color #6, and the electronic device can determine the new colors corresponding to color #1, color #2, color #3, color #4 and color #5 respectively.

[0164] For another example, as shown in Figure 6, the intersection includes color #1, color #2, color #3, color #4, color #5 and color #6. The electronic device can determine that color #1 and color #2 correspond to the same new color, determine that color #3 and color #4 correspond to the same new color, and determine that color #5 and color #6 correspond to the same new color.

[0165] S703: Replace the second color with a third color, and replace one or more colors of the M colors with P colors.

[0166] In some embodiments, M=P.

[0167] For example, taking Figure 6 as an example, the intersection includes color #1, color #2, color #3, color #4, color #5 and color #6. The electronic device can determine the new colors corresponding to color #1, color #2, color #3, color #4, color #5 and color #6 respectively, and use the new colors corresponding to color #1, color #2, color #3, color #4, color #5 and color #6 to replace color #1, color #2, color #3, color #4, color #5 and color #6 respectively.

[0168] In some embodiments, M>P.

[0169] For example, taking Figure 6 as an example, the intersection includes color #1, color #2, color #3, color #4, color #5 and color #6. The electronic device can determine the new colors corresponding to color #1, color #2, color #3, color #4 and color #5 respectively, and then use the new colors corresponding to color #1, color #2, color #3, color #4 and color #5 to replace color #1, color #2, color #3, color #4 and color #5 respectively, without replacing color #6.

[0170] For another example, as shown in Figure 6, the intersection includes color #1, color #2, color #3, color #4, color #5 and color #6. The electronic device can determine the same new color corresponding to color #1 and color #2, determine the same new color corresponding to color #3 and color #4, determine the same new color corresponding to color #5 and color #6, and then use the same new color corresponding to color #1 and color #2 to replace color #1 and color #2, use the same new color corresponding to color #3 and color #4 to replace color #3 and color #4, and use the same new color corresponding to color #5 and color #6 to replace color #5 and color #6.

[0171] In an embodiment of the present application, when performing flood fill, the electronic device can determine the color of the new junction based on the color to be filled, the seed point color and the color of the junction, and then use the new junction color to fill the junction. On the basis of ensuring the filling effect, the color transition can be better performed, the jagged feeling can be reduced, and it helps to improve the user's painting experience.

[0172] In some embodiments, the M colors include a fourth color, determining the P colors based on the second color, the third color, and one or more of the M colors includes determining a fifth color based on the second color, the third color, and the fourth color, and replacing one or more of the M colors with the P colors includes replacing the fourth color with the fifth color.

[0173] For example, taking Figure 6 as an example, the second color is yellow, the third color is red, and the fourth color is color #1. The fifth color can be determined based on the above three colors, and then the fifth color can be used to replace the fourth color. For specific instructions, please refer to the above. For the sake of brevity, it will not be repeated here.

[0174] In some embodiments, replacing the second color with the third color includes: determining the second area as an initial flooded area; and filling the initial flooded area with the third color.

[0175] For example, taking FIG. 6 as an example, the electronic device may determine that area #2 is an initial flooding area, and then fill area #2 with red.

[0176] In some embodiments, in response to a user operation of filling the second area with a third color, determining P colors based on the second color, the third color, and one or more of the M colors includes: determining P dynamic flooding areas based on the difference between the RGB value of the second color and the RGB value of one or more of the M colors; determining the P colors based on the colors of the P dynamic flooding areas, the third color, and the second color. Replacing one or more of the M colors with the P colors includes: filling the P dynamic flooding areas with the P colors.

[0177] In some embodiments, M=P.

[0178] For example, taking Figure 6 as an example, the intersection is divided into sub-area #1, sub-area #2, sub-area #3, sub-area #4, sub-area #5 and sub-area #6. The electronic device can determine sub-area #1 as dynamic flooding area #1, determine sub-area #2 as dynamic flooding area #2, determine sub-area #3 as dynamic flooding area #3, determine sub-area #4 as dynamic flooding area #4, determine sub-area #5 as dynamic flooding area #5, determine sub-area #6 as dynamic flooding area #6, and then fill the dynamic flooding area with the color corresponding to the above dynamic flooding area.

[0179] In some embodiments, M>P.

[0180] For example, taking Figure 6 as an example, the intersection is divided into sub-area #1, sub-area #2, sub-area #3, sub-area #4, sub-area #5 and sub-area #6. The electronic device can determine sub-area #1 as dynamic flooding area #1, determine sub-area #2 as dynamic flooding area #2, determine sub-area #3 as dynamic flooding area #3, determine sub-area #4 as dynamic flooding area #4, determine sub-area #5 as dynamic flooding area #5, and then use the colors corresponding to the above dynamic flooding areas to fill the dynamic flooding areas.

[0181] For another example, as shown in Figure 6, the intersection is divided into sub-area #1, sub-area #2, sub-area #3, sub-area #4, sub-area #5 and sub-area #6. The electronic device can determine that sub-area #1 and sub-area #2 are dynamic flooding area #1, determine that sub-area #3 and sub-area #4 are dynamic flooding area #2, and determine that sub-area #5 and sub-area #6 are dynamic flooding area #3, and then fill the dynamic flooding area with the color corresponding to the above dynamic flooding area.

[0182] The above mainly introduces a method for filling color provided by an embodiment of the present application from the perspective of an electronic device. It is understandable that, in order to implement the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0183] In the case of dividing each functional module (or unit) corresponding to each function, Figure 8 shows a schematic diagram of the composition of an electronic device 800 provided in an embodiment of the present application. As shown in Figure 8, the electronic device 800 includes: a drawing output module 810 and a color mixing module 820.

[0184] The drawing output module 810 is used to display a first interface, wherein the first interface includes a first area and a second area, the color of the first area is the first color, the color of the second area is the second color, and the junction between the first area and the second area includes M colors, the M colors are determined based on the first color and the second color, the M colors are different from the first color and the second color, and M ≥ 1 is an integer.

[0185] The color mixing module 820 is configured to determine P colors based on the second color, the third color, and one or more of the M colors in response to a user operation of filling the second area with a third color, where P is an integer and is greater than or equal to 1.

[0186] The drawing output module 810 is further configured to replace the second color with a third color, and replace one or more colors among the M colors with P colors.

[0187] In some embodiments, the M colors include a fourth color, the color mixing module 820 is specifically configured to determine a fifth color based on the second color, the third color, and the fourth color, and the drawing output module 810 is specifically configured to replace the fourth color with the fifth color.

[0188] In some embodiments, the M colors include a fourth color, and the color mixing module 820 is specifically configured to determine a first transparency according to the second color and the fourth color; and determine a fifth color according to the first transparency, the third color, and the fourth color.

[0189] In some embodiments, the electronic device further includes an initial flooding area calculation module 830, which is configured to determine that the second area is an initial flooding area, where the RGB value of the pixel is equal to the RGB value of the second color.

[0190] The drawing output module 810 is specifically configured to fill the initial flood area with a third color.

[0191] In some embodiments, the color mixing module 820 is further configured to determine P dynamic flooding areas according to a difference between an RGB value of the second color and an RGB value of one or more colors among the M colors.

[0192] The color mixing module 820 is specifically configured to determine P colors according to the second color, the third color, and the colors of the P dynamic flooding areas.

[0193] The drawing output module 810 is specifically configured to fill P dynamic flooding areas with P colors.

[0194] The present application provides a computer program product that, when executed on an electronic device, enables the electronic device to execute the technical solution in the above embodiment. The implementation principle and technical effects are similar to those of the above method-related embodiments and will not be described in detail here.

[0195] The embodiment of the present application provides a readable storage medium, which contains instructions. When the instructions are executed on an electronic device, the electronic device executes the technical solution of the above embodiment. The implementation principle and technical effect are similar and will not be repeated here.

[0196] The present application provides a chip for executing instructions. When the chip is running, the technical solution of the above embodiment is executed. The implementation principle and technical effect are similar and will not be described here.

[0197] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of this application.

[0198] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0199] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

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

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

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

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

Claims

1. A method for filling color, characterized in that, The method comprises: Displaying a first interface, wherein the first interface includes a first area and a second area, the color of the first area is a first color, the color of the second area is a second color, and the boundary between the first area and the second area includes M colors, the M colors are determined based on the first color and the second color, the M colors are different from the first color and the second color, and M is ≥ 1 and is an integer; In response to a user operation of filling the second area with a third color, determining P colors according to the second color, the third color, and one or more of the M colors, where P is an integer and greater than or equal to 1; The second color is replaced by the third color, and one or more colors of the M colors are replaced by the P colors.

2. The method according to claim 1, characterized in that The M colors include a fourth color, and determining P colors according to the second color, the third color, and one or more colors among the M colors includes: determining a fifth color based on the second color, the third color, and the fourth color; The replacing one or more colors of the M colors with the P colors includes: The fourth color is replaced with the fifth color.

3. The method according to claim 2, characterized in that The determining of the fifth color according to the second color, the third color, and the fourth color includes: determining a first transparency according to the second color and the fourth color; The fifth color is determined according to the first transparency, the third color, and the fourth color.

4. The method according to claim 3, characterized in that The determining the first transparency according to the second color and the fourth color includes: The first transparency is determined according to the following formula, Wherein, a is the first transparency, C is the RGB value of the fourth color, B is the RGB value of the second color, fun1() is a function for obtaining the maximum, minimum, or average value of the RGB channel, and fun2() is a function for obtaining the maximum value of the RGB channel; The determining of the fifth color according to the first transparency, the third color, and the fourth color includes: The fifth color is determined according to the following formula, D=C+(AC)×a Wherein, D is the RGB value of the fifth color, and A is the RGB value of the third color.

5. The method according to any one of claims 1 to 4, characterized in that The replacing the second color with the third color comprises: Determining the second area as an initial flooding area, where the initial flooding area is an area where the RGB value of the pixel is equal to the RGB value of the second color; The initial flooded area is filled with the third color.

6. The method according to any one of claims 1 to 5, characterized in that In response to the user's operation of filling the second area with a third color, determining P colors based on the second color, the third color, and one or more of the M colors includes: determining P dynamic flooding areas according to a difference between an RGB value of the second color and an RGB value of one or more colors of the M colors; determining P colors according to the colors of the P dynamic flooding areas, the third color, and the second color; The replacing one or more colors of the M colors with the P colors includes: The P dynamic flooding areas are filled with the P colors.

7. The method according to claim 6, characterized in that P≤M.

8. The method according to any one of claims 1 to 7, characterized in that The opacity of the pixels of the first interface is the same.

9. The method according to claim 8, characterized in that The opacity of the pixels of the first interface is equal to 1.

10. The method according to any one of claims 1 to 9, characterized in that The first interface is an interface of a drawing application, or a drawing interface in a game application, or a conference application, or a teaching application, or a note-taking application.

11. An electronic device, characterized in that: The method comprises one or more processors; one or more memories; the one or more memories storing one or more computer programs, the one or more computer programs comprising instructions, which, when executed by the one or more processors, cause the method according to any one of claims 1 to 10 to be executed.

12. A chip, characterized in that: The chip includes a processor and a communication interface, wherein the communication interface is configured to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method according to any one of claims 1 to 10 is executed.

13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the method according to any one of claims 1 to 10 is executed.

14. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Color filling method and electronic equipment

    CN120726175A

  • File image correction method and mobile terminal

    CN107944438A

  • Image processing method and device and computer readable medium

    CN108197567A

  • Image drawing method and apparatus

    CN108597000A

  • Color filling method and device and electronic equipment

    CN111161378A