CN112907700A - Color filling method and device - Google Patents

Color filling method and device Download PDF

Info

Publication number
CN112907700A
CN112907700A CN202110200911.9A CN202110200911A CN112907700A CN 112907700 A CN112907700 A CN 112907700A CN 202110200911 A CN202110200911 A CN 202110200911A CN 112907700 A CN112907700 A CN 112907700A
Authority
CN
China
Prior art keywords
color
matrix
filling
parameter
filled
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110200911.9A
Other languages
Chinese (zh)
Inventor
侯效雷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN202110200911.9A priority Critical patent/CN112907700A/en
Publication of CN112907700A publication Critical patent/CN112907700A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Color Image Communication Systems (AREA)
  • Image Processing (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the application provides a color filling method and a color filling device, wherein the color filling method comprises the following steps: receiving a color filling instruction submitted by a user aiming at an object to be processed, responding to the color filling instruction, loading a template to be filled of the object to be processed to a color filling interface, determining a region to be filled based on the operation of the user on the template to be filled, responding to the color parameter operation of the user on the color filling interface, determining an adjusted target color, and filling the target color to the region to be filled.

Description

Color filling method and device
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a color filling method. One or more embodiments of the present application are also directed to a color filling apparatus, a computing device, and a computer-readable storage medium.
Background
With the continuous development of the drawing technology, the drawing presents a rich and diversified situation, the drawing does not rely on single display of lines or geometric figures, but focuses on color matching and application, the color not only spreads throughout the human society, but also is in the world, so that the life is more colorful, and any drawing element cannot be replaced, therefore, with the rapid development of computer technology and artificial intelligence, the intelligent drawing is more and more favored by the society.
At present, some products capable of providing a color filling function exist in the market, and a user can perform color filling on a picture to be filled through the products, but when the products provide the color filling function for the user, color filling information of the picture to be filled is mostly generated in advance, for example, each area to be filled in the picture to be filled is numbered, color information corresponding to different numbers is recorded, and when the user clicks a certain area to be filled of the picture to be filled, a system can determine a target color according to the number in the area to be filled, and the target color is filled into the area to be filled.
Therefore, the current picture color filling process can be realized only based on related products, and a user can only perform color filling according to color filling information of a picture to be filled, which is set in advance by the product, so that the filling effect is not ideal.
Disclosure of Invention
In view of the above, the present application provides a color filling method. One or more embodiments of the present application also relate to a color filling apparatus, a computing device, and a computer-readable storage medium, so as to solve the technical defect in the prior art that the filling effect is not ideal when color filling of pictures is performed based on a color filling product.
According to a first aspect of embodiments of the present application, there is provided a color filling method, including:
receiving a color filling instruction submitted by a user aiming at an object to be processed;
responding to the color filling instruction, and loading a template to be filled of the object to be processed to a color filling interface;
determining a region to be filled based on the operation of a user on the template to be filled;
responding to the color parameter operation of the user on the color filling interface, and determining an adjusted target color;
and filling the target color into the area to be filled.
According to a second aspect of embodiments of the present application, there is provided a color filling apparatus including:
the instruction receiving module is configured to receive a color filling instruction submitted by a user aiming at the object to be processed;
the loading module is configured to respond to the color filling instruction and load a template to be filled of the object to be processed to a color filling interface;
the first determination module is configured to determine a region to be filled based on the operation of a user on the template to be filled;
a second determination module configured to determine an adjusted target color in response to the user operating on the color parameters of the color fill interface;
a filling module configured to fill the target color into the region to be filled.
According to a third aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is configured to store computer-executable instructions and the processor is configured to execute the computer-executable instructions, wherein the processor implements the steps of the color filling method when executing the computer-executable instructions.
According to a fourth aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, perform the steps of color filling.
An embodiment of the application realizes a color filling method and a color filling device, wherein the color filling method comprises the steps of receiving a color filling instruction submitted by a user aiming at an object to be processed, responding to the color filling instruction, loading a template to be filled of the object to be processed to a color filling interface, determining a region to be filled based on the operation of the user on the template to be filled, responding to the color parameter operation of the user on the color filling interface, determining an adjusted target color, and filling the target color to the region to be filled.
In the embodiment of the application, the user adjusts the target color by clicking and adjusting the color parameters in the color filling interface, so that the user-defined filling color is realized, and the individuation of the color filling result generated by filling the template to be filled according to the target color generated by the user-defined filling color is favorably ensured.
Drawings
FIG. 1 is a system architecture diagram of a color filling method provided by one embodiment of the present application;
FIG. 2 is a flow chart of a color filling method provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of a color fill interface provided by one embodiment of the present application;
FIG. 4 is a flowchart illustrating a processing procedure of the color filling method according to an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a color filling apparatus according to an embodiment of the present application;
fig. 6 is a block diagram of a computing device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The terminology used in the one or more embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present application. As used in one or more embodiments of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments of the present application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first aspect may be termed a second aspect, and, similarly, a second aspect may be termed a first aspect, without departing from the scope of one or more embodiments of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
First, the noun terms to which one or more embodiments of the present application relate are explained.
canvas: an HTML canvas element; it has no own behavior, but defines an API to support scripted client drawing operation;
context: getcontext () returns an object;
gray value: that is, there is no color, the RGB color components are all equal color values;
in the present application, a color filling method is provided. One or more embodiments of the present application are also directed to a color filling apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
The color filling method provided by the embodiment of the application can be applied to any field needing color filling of the line drawing, such as color filling games in the game field, dolls in the E-commerce field, cartoon images or handheld color filling designs and the like; for convenience of understanding, the embodiment of the present application takes the application of the color filling method to color filling of a line drawing to be filled in the field of games as an example, but is not limited to this.
In specific implementation, the color filling interface of the embodiment of the present application may be presented on clients such as a large-scale image display device, a game machine, a desktop computer, a smart phone, a tablet computer, an MP3(Moving Picture Experts Group Audio Layer III, mpeg Audio Layer 3) player, an MP4(Moving Picture Experts Group Audio Layer IV, mpeg Audio Layer 4) player, a laptop computer, a reader, and other display terminals.
Referring to fig. 1, fig. 1 is a system architecture diagram illustrating a color filling method according to an embodiment of the present application.
In fig. 1, a user U1 submits a color filling instruction for an object to be processed through a client a, the client a obtains a template 1 to be filled of the object to be processed from a server, and displays the template 1 to be filled on a color filling interface of the client a, and the user U1 performs color filling on the template 1 to be filled through the client a to generate a corresponding color filling result; similarly, the user U2 and the user U3 may submit a color filling instruction for the object to be processed through the client B and the client C, respectively, the client B obtains the template 2 to be filled of the object to be processed from the server, the template 2 to be filled is displayed on the color filling interface of the client B, and the user U3 performs color filling on the template 2 to be filled through the client B to generate a corresponding color filling result; and the client C acquires the template 3 to be filled of the object to be processed from the server, the template 3 to be filled is displayed on a color filling interface of the client C, and the user U3 performs color filling on the template 3 to be filled through the client C to generate a corresponding color filling result.
The template 1 to be filled, the template 2 to be filled, and the template 3 to be filled may be different templates to be filled of the same object to be processed, or may be templates to be filled corresponding to different objects to be processed, respectively, without any limitation.
Referring to fig. 2, fig. 2 shows a flowchart of a color filling method according to an embodiment of the present application, including the following steps:
step 202, receiving a color filling instruction submitted by a user for an object to be processed.
Specifically, the color filling method provided in the embodiment of the present specification is applied to a service processing platform, where the object to be processed may be an uncolored initial product drawing designed by a service person of a service provider according to actual requirements, and after the initial product drawing is designed, the initial product drawing may be issued to a related service processing platform by the service provider, so that the service person or another user in the service processing platform performs color filling processing on the initial product drawing through the service processing platform, where the initial product drawing carries identification information of the initial product drawing when the initial product drawing is issued to the service processing platform.
Therefore, the service personnel or other users can submit the color filling instruction of the initial product drawing through the service processing platform according to the identification information of the initial product drawing so as to perform color filling on the initial product drawing.
After receiving a color filling instruction submitted by a user, the service processing platform can load and display a template to be filled of the object to be processed for the user according to the identification information of the object to be processed carried in the color filling instruction, and the user can perform color filling on the template to be filled.
And 204, responding to the color filling instruction, and loading the template to be filled of the object to be processed to a color filling interface.
Specifically, as described above, after receiving a color filling instruction submitted by a user, the service processing platform may determine a template to be filled of the object to be processed according to the identification information of the object to be processed carried in the color filling instruction, load the template to be filled to a color filling interface, and display the template for the user, so that the user may perform color filling on the template to be filled.
In specific implementation, the template to be filled may be a line drawing of the object to be processed, and when the object to be processed is an uncolored initial product drawing, the template to be filled may be the line drawing of the initial product drawing, so that when the service processing platform is implemented through a web page in a browser, the template to be filled of the object to be processed is loaded to a color filling interface, that is, a canvas is set on the color filling interface of the browser, and the line drawing of the object to be processed is loaded to the canvas as the template to be filled.
Wherein the canvas may be a canvas. The canvas is characterized in that a newly added tag in the HTML5 can be used for generating an image in real time on a webpage, and can operate image content, which is equivalent to a bitmap (bitmap) that can be operated by JavaScript, so that the canvas is used for realizing color filling of a template to be filled of an object to be processed, and a user can adjust attribute parameter values of different color parameters through a color parameter adjusting control displayed on a color filling interface of the webpage, so that the user can define filling colors.
In addition, after the template to be filled is loaded, the color filling interface may be initialized according to a preset interface display frame, for example, if the interface display frame includes a color parameter progress bar (a hue progress bar, a saturation progress bar, and a brightness progress bar), after the color filling interface is initialized according to the interface display frame, the color filling interface may also display the color parameter progress bar and an initial position of a color parameter adjustment control in each progress bar.
The schematic diagram of the color filling interface provided in the embodiment of the application is shown in fig. 3, the color filling interface shown in fig. 3 includes a template to be filled, a hue progress bar, a saturation progress bar, a brightness progress bar, and a target color obtained by performing color synthesis according to an attribute parameter value corresponding to a position where a color parameter adjusting control is located in three progress bars, and a user can adjust the position of the color parameter adjusting control in different progress bars to adjust the target color and achieve customization of the target color, so that the target color is used for performing color filling on the template to be filled, and an individualized filling result is obtained.
And step 206, determining the area to be filled based on the operation of the user on the template to be filled.
Specifically, under the condition that the user clicks the template to be filled, the area to be filled is determined according to the clicking operation.
In specific implementation, the area to be filled is determined based on the operation of the user on the template to be filled, and the method can be specifically implemented in the following manner:
determining a click position of the color filling interface corresponding to the click operation, and determining an interface coordinate of the click position in a color filling interface coordinate system;
converting the interface coordinate into a canvas coordinate according to the mapping relation between the color filling interface coordinate system and the canvas coordinate system;
determining the pixel value of a pixel point corresponding to the canvas coordinate in the canvas;
and under the condition that the pixel value is not equal to 0, determining a color filling grid to which the canvas coordinate belongs in the line drawing, and taking the color filling grid as a region to be filled.
Specifically, the canvas is arranged on the color filling interface, the template to be filled is loaded in the canvas, and the template to be filled is a gray scale image, so that each pixel point in the template to be filled corresponds to one pixel value. Under the condition that a user clicks a color filling interface, determining a clicking position of the color filling interface corresponding to a clicking operation, determining an interface coordinate of the clicking position in a color filling interface coordinate system, converting the interface coordinate into a canvas coordinate according to a mapping relation between the color filling interface coordinate system and the canvas coordinate system, and determining a pixel value of a pixel point corresponding to the canvas coordinate in the canvas; and under the condition that the pixel value is not equal to 0, determining a color filling grid to which the canvas coordinate belongs in the line drawing, and taking the color filling grid as a region to be filled.
Whether the template to be filled is selected or not is judged by judging whether the pixel value is equal to 0 or not, the condition that a user clicks a blank area and is identified as a click selection state by a computer is avoided, the judgment accuracy rate of the selection of the template to be filled in the color filling process is improved, and the processing efficiency of the color filling process is improved.
Step 208, determining the adjusted target color in response to the user operating on the color parameters of the color fill interface.
Specifically, the color filling interface includes a color parameter adjustment control, and therefore, the color parameter operation may specifically be that after a user clicks the color parameter adjustment control in the color filling interface, the user adjusts the color to be filled by adjusting the position of the color parameter adjustment control.
In specific implementation, the determining the adjusted target color in response to the color parameter operation of the user on the color filling interface includes:
responding to the clicking operation of the user on at least one color parameter adjusting control in the color filling interface to determine the position of the at least one color parameter adjusting control in the color parameter progress bar respectively corresponding to the at least one color parameter adjusting control;
and determining an attribute parameter value of at least one color parameter according to the position, and determining the adjusted target color according to the attribute parameter value.
Specifically, the ranges of the attribute parameter values corresponding to different color parameters are different, for example, if the color parameter is a hue, the range of the attribute parameter values of the hue is 256 × 3 values from [0,0,0] to [255,255 ]; if the color parameter is brightness, the attribute parameter value range of the brightness is 256 values in total from 0 to 255.
Because the length of the color parameter progress bar displayed in the color filling interface is limited, in order to ensure the accuracy of the result of determining the attribute parameter values of the color parameters, a mapping relationship between the display progress (the position of the color parameter adjustment control) of the color parameter progress bar and the attribute parameter values of the color parameters can be established in advance.
In addition, because different color parameter adjustment controls are used for adjusting the display progress of the color parameter progress bars of different color parameters, when a click operation of a user on the color parameter adjustment controls in the color filling interface is received, the position of each color parameter adjustment control in the color parameter progress bar to which the color parameter adjustment control belongs can be determined, then the attribute parameter value of the color parameter corresponding to the position of the color parameter adjustment control in the color parameter progress bar is determined according to the mapping relationship between the color parameter progress bar corresponding to the different color parameters and the attribute parameter value of the color parameter, and then the adjusted target color is determined according to the attribute parameter value of each color parameter.
In the embodiment of the application, the user adjusts the target color by clicking and adjusting the color parameter adjusting control in the color filling interface, so that the user-defined filling color is realized, and the individuation of the color filling result generated by filling the template to be filled according to the target color generated by the user-defined filling color is favorably ensured.
In specific implementation, color information can be represented by a color matrix, before color filling is performed on a certain pixel point or pixel region in a template to be filled, the color matrix corresponding to the pixel point or pixel region is an initial color matrix, and initial values of elements in the initial color matrix can be determined according to gray values of the pixel point or pixel region in the template to be filled.
After the clicking operation of a user on the color parameter adjusting control in the color filling interface is detected, a matrix parameter updating unit corresponding to the color parameter of the color parameter adjusting control can be determined according to the color parameter operation, and the initial color matrix of the template to be filled is updated according to the matrix parameter updating unit;
and determining the target color according to the matrix parameters in the updated color matrix.
Specifically, the initial color matrix is a 4 × 5 digital matrix, and the matrix parameters in the initial color matrix are the attribute parameter values of different color parameters.
With the initial color matrix as
Figure BDA0002948840840000111
For example, in a matrix of
Figure BDA0002948840840000112
The matrix unit is the attribute parameter value of the tone, and is composed of A02=[a41 a42 a43a44]The matrix unit is attribute parameter value of saturation degree, which is composed of
Figure BDA0002948840840000113
The formed matrix unit is the attribute parameter value of the brightness.
Under the condition that the clicking operation of the color parameter adjusting control in the color filling interface by the user is received, the position of each color parameter adjusting control in the color parameter progress bar to which the color parameter adjusting control belongs can be determined according to the clicking operation, then the attribute parameter value of the color parameter corresponding to the position of the color parameter adjusting control in the color parameter progress bar is determined according to the mapping relation between the color parameter progress bar corresponding to different color parameters and the attribute parameter value of the color parameter, then the matrix parameter in the initial color matrix is updated according to the attribute parameter value, and the target color is determined according to the matrix parameter in the updated color matrix.
In the embodiment of the application, the user adjusts the target color by clicking and adjusting the color parameter adjusting control in the color filling interface, so that the user-defined filling color is realized, and the individuation of the color filling result generated by filling the template to be filled according to the target color generated by the user-defined filling color is favorably ensured.
In specific implementation, the color parameter includes a hue, and thus, the color parameter adjustment control includes a hue adjustment control;
correspondingly, the determining the adjusted target color in response to the color parameter operation of the user on the color filling interface includes:
responding to the clicking operation of the user on the tone adjustment control in the color filling interface to determine a tone adjustment result, and generating a first matrix parameter updating unit according to the tone adjustment result;
updating the matrix parameters of the initial color matrix of the template to be filled according to the first matrix parameter updating unit to generate a first color matrix;
and determining the target color according to the matrix parameters in the first color matrix.
Specifically, as shown in fig. 3, a color filling interface displays a color tone progress bar and a slider (a color tone adjustment control) capable of being used to adjust a display progress of the color tone progress bar, a user can adjust the display progress of the color tone progress bar by adjusting a position of the slider in the color tone progress bar, and when a click operation (including a click operation, a sliding operation, and the like) of the user on the color tone adjustment control is detected, the color filling interface determines an adjusted color tone parameter value according to the position of the color tone adjustment control in the color tone progress bar after the click operation is completed, and generates the first matrix parameter updating unit according to the adjusted color tone parameter value. Wherein, the first matrix parameter updating unit is composed of RGB color parameters.
Then, the matrix parameters of the initial color matrix can be updated according to the first matrix parameter updating unit, that is, the first matrix parameter updating unit replaces A in the initial color matrix01And the matrix unit is used for generating a first color matrix and determining the target color according to the matrix parameters in the first color matrix.
Further, the color parameter further includes a saturation, and thus, the color parameter adjustment control further includes a saturation adjustment control;
correspondingly, the determining the adjusted target color in response to the color parameter operation of the user on the color filling interface includes:
responding to the click operation of the user on a saturation adjustment control in the color filling interface to determine a saturation adjustment result, and generating a second matrix parameter updating unit according to the saturation adjustment result;
updating the matrix parameters of the first color matrix according to the second matrix parameter updating unit to generate a second color matrix;
and determining the target color according to the matrix parameters in the second color matrix.
Specifically, as shown in fig. 3, a saturation progress bar and a slider (a saturation adjustment control) capable of being used for adjusting the display progress of the saturation progress bar are displayed in the color filling interface, a user can adjust the display progress of the saturation progress bar by adjusting the position of the slider in the saturation progress bar, and when the color filling interface detects a click operation (including a click operation, a slide operation, and the like) of the user on the saturation adjustment control, the color filling interface determines an adjusted saturation parameter value according to the position of the saturation adjustment control in the saturation progress bar after the click operation is finished, and generates the second matrix parameter updating unit according to the adjusted saturation parameter value.
Then, the matrix parameters of the first color matrix can be updated according to the second matrix parameter updating unit, that is, the second matrix parameter updating unit replaces A in the first color matrix02And the matrix unit is used for generating a second color matrix and determining the target color according to the matrix parameters in the second color matrix.
Furthermore, the color parameter further comprises brightness, and therefore, the color parameter adjusting control further comprises a brightness adjusting control;
correspondingly, the determining the adjusted target color in response to the color parameter operation of the user on the color filling interface includes:
responding to the click operation of the user on a brightness adjustment control in the color filling interface to determine a brightness adjustment result, and generating a third matrix parameter updating unit according to the brightness adjustment result;
updating the matrix parameters of the second color matrix according to the third matrix parameter updating unit to generate a third color matrix;
and determining the target color according to the matrix parameters in the third color matrix.
Specifically, as shown in fig. 3, a luminance progress bar and a slider (luminance adjustment control) capable of being used for adjusting the display progress of the luminance progress bar are displayed in the color filling interface, a user can adjust the display progress of the luminance progress bar by adjusting the position of the slider in the luminance progress bar, and when the color filling interface detects a click operation (including a click operation, a slide operation, and the like) of the user on the luminance adjustment control, the color filling interface determines an adjusted luminance parameter value according to the position of the luminance adjustment control in the luminance progress bar after the click operation is completed, and generates the third matrix parameter updating unit according to the adjusted luminance parameter value.
Then, the matrix parameters of the second color matrix can be updated according to the third matrix parameter updating unit, that is, the third matrix parameter updating unit replaces A in the second color matrix03The matrix unit is provided with a matrix unit,and generating a third color matrix, and determining the target color according to the matrix parameters in the third color matrix.
In the embodiment of the application, the user adjusts the target color by clicking and adjusting the color parameter adjusting control in the color filling interface, so that the user-defined filling color is realized, and the individuation of the color filling result generated by filling the template to be filled according to the target color generated by the user-defined filling color is favorably ensured.
In specific implementation, the updating the initial color matrix of the template to be filled according to the matrix parameter updating unit includes:
and updating the matrix parameters in the initial color matrix of the template to be filled through a matrix merging algorithm and the matrix parameter updating unit.
The color value can be stored in a color matrix cuesel rgbmrix by an algorithm colormatrix byrgb;
adding the saturation into the color matrix cuesel RGBMrix according to the algorithm mergeColor1Baohe, namely adjusting the color matrix cuesel RGBMrix according to the saturation;
the luminance offset is added to the color matrix cueselrgbatrix according to the algorithm mergeColor1liangdu, i.e. the color matrix cueselrgbatrix is adjusted according to the luminance offset.
In the embodiment of the present application, the color parameters include hue, saturation, and brightness, and the foregoing embodiment takes the implementation process of sequentially adjusting the hue adjustment control, the saturation adjustment control, and the brightness adjustment control as an example to perform adaptive explanation, but in practical application, the adjustment number or the adjustment order of the color adjustment controls may be determined according to actual requirements, that is, a user may adjust the position of the brightness adjustment control first, then adjust the position of the hue adjustment control, and finally adjust the position of the saturation adjustment control, or a user may only adjust the positions of any one or two of the three color adjustment controls, and no limitation is made herein.
In the embodiment of the application, the user adjusts the target color by clicking and adjusting the color parameter adjusting control in the color filling interface, so that the user-defined filling color is realized, and the individuation of the color filling result generated by filling the template to be filled according to the target color generated by the user-defined filling color is favorably ensured.
And step 210, filling the target color into the area to be filled.
Specifically, after determining the region to be filled and the target color, the target color may be filled into the region to be filled.
In addition, in this embodiment of the application, the user may adjust the color adjustment control first to determine the target color to be filled, and then click to select the target filling area, or click to select the target filling area first, and then adjust the color adjustment control to determine the target color to be filled, which is not limited herein.
In the embodiment of the application, the user adjusts the target color by clicking and adjusting the color parameter adjusting control in the color filling interface, so that the user-defined filling color is realized, and the individuation of the color filling result generated by filling the template to be filled according to the target color generated by the user-defined filling color is favorably ensured.
Referring to fig. 4, the color filling method provided in the embodiment of the present application is further described by taking an application of the color filling method in the field of games as an example. Fig. 4 shows a flowchart of a processing procedure of a color filling method according to an embodiment of the present application, which specifically includes the following steps:
step 402, setting a canvas on a color filling interface of a browser, and loading the line drawing of the object to be processed into the canvas as the template to be filled.
And 404, initializing the color filling interface according to a preset interface display frame.
Initializing a color filling interface, designating initial values of a hue scroll bar slider, a saturation scroll bar slider and a brightness scroll bar slider, and starting monitoring user operation.
And step 406, determining a hue adjustment result in response to the click operation of the user on the hue adjustment control in the color filling interface, and generating a first matrix parameter updating unit according to the hue adjustment result.
And 408, updating the matrix parameters of the initial color matrix of the template to be filled according to the first matrix parameter updating unit to generate a first color matrix.
Step 410, determining a target color according to the matrix parameters in the first color matrix.
Step 412, determining a saturation adjustment result in response to a click operation of a user on a saturation adjustment control in the color filling interface, and generating a second matrix parameter updating unit according to the saturation adjustment result.
And 414, updating the matrix parameters of the initial color matrix of the template to be filled according to the second matrix parameter updating unit, and generating a second color matrix.
Step 416, determining a target color according to the matrix parameters in the second color matrix.
And 418, determining a brightness adjustment result in response to the click operation of the user on the brightness adjustment control in the color filling interface, and generating a third matrix parameter updating unit according to the brightness adjustment result.
And step 420, updating the initial matrix parameters of the template to be filled according to the third matrix parameter updating unit to generate a third color matrix.
Step 422, determining the target color according to the matrix parameters in the third color matrix.
In this embodiment of the present application, step 406, step 412, and step 418 are executed in parallel, but in practical applications, the above three steps may also be executed sequentially, that is, the parameter adjustment controls for hue, saturation, and brightness are adjusted sequentially, and the target color is determined according to the adjustment results of the three controls, but the adjustment order of the parameter adjustment controls for hue, saturation, and brightness is not limited by a strict sequence, and may be determined specifically according to actual requirements.
Step 424, responding to the click operation of the template to be filled by the user, determining the click position of the color filling interface corresponding to the click operation, and determining the interface coordinate of the click position in the color filling interface coordinate system.
And 426, converting the interface coordinate into a canvas coordinate according to the mapping relation between the color filling interface coordinate system and the canvas coordinate system.
Step 428, determining whether the pixel value of the pixel point corresponding to the canvas coordinate in the canvas is 0.
If not, go to step 430; if yes, the color filling operation is not carried out.
Step 430, determining a color filling grid to which the canvas coordinate belongs in the template to be filled, taking the color filling grid as a region to be filled, and filling the target color into the region to be filled.
In the embodiment of the application, the user adjusts the target color by clicking and adjusting the color parameter adjusting control in the color filling interface, so that the user-defined filling color is realized, and the individuation of the color filling result generated by filling the template to be filled according to the target color generated by the user-defined filling color is favorably ensured.
Corresponding to the above method embodiment, the present application further provides an embodiment of a color filling apparatus, and fig. 5 shows a schematic structural diagram of a color filling apparatus provided in an embodiment of the present application. As shown in fig. 5, the apparatus includes:
an instruction receiving module 502 configured to receive a color filling instruction submitted by a user for an object to be processed;
a loading module 504 configured to load a template to be filled of the object to be processed to a color filling interface in response to the color filling instruction;
a first determining module 506, configured to determine a region to be filled based on an operation of a user on the template to be filled;
a second determination module 508 configured to determine an adjusted target color in response to the user operating on the color parameters of the color fill interface;
a filling module 510 configured to fill the target color into the region to be filled.
Optionally, the second determining module 508 includes:
the first updating submodule is configured to determine a matrix parameter updating unit corresponding to the color parameters of the color parameter adjusting control according to the color parameter operation, and update the initial color matrix of the template to be filled according to the matrix parameter updating unit;
a first determining submodule configured to determine the target color according to the matrix parameters in the updated color matrix.
Optionally, the color parameter comprises hue;
accordingly, the second determining module 508 includes:
the first generation submodule is configured to respond to the click operation of the user on a tone adjustment control in the color filling interface to determine a tone adjustment result, and generate a first matrix parameter updating unit according to the tone adjustment result;
the second updating submodule is configured to update the matrix parameters of the initial color matrix of the template to be filled according to the first matrix parameter updating unit to generate a first color matrix;
a second determination submodule configured to determine the target color according to matrix parameters in the first color matrix.
Optionally, the color parameters further include saturation;
accordingly, the second determining module 508 includes:
the second generation submodule is configured to respond to the click operation of the user on a saturation adjustment control in the color filling interface to determine a saturation adjustment result, and generate a second matrix parameter updating unit according to the saturation adjustment result;
a third updating submodule configured to update the matrix parameters of the first color matrix according to the second matrix parameter updating unit, and generate a second color matrix;
a third determination submodule configured to determine the target color according to the matrix parameters in the second color matrix.
Optionally, the color parameter further comprises a brightness;
accordingly, the second determining module 508 includes:
the third generation submodule is configured to respond to the click operation of the user on a brightness adjustment control in the color filling interface to determine a brightness adjustment result, and generate a third matrix parameter updating unit according to the brightness adjustment result;
a fourth updating submodule configured to update the matrix parameters of the second color matrix according to the third matrix parameter updating unit, and generate a third color matrix;
a fourth determination submodule configured to determine the target color according to the matrix parameters in the third color matrix.
Optionally, the loading module 504 includes:
and the loading sub-module is configured to set a canvas on a color filling interface of the browser and load the line drawing of the object to be processed into the canvas as the template to be filled.
Optionally, the first determining module 506 includes:
the coordinate determination submodule is configured to determine a click position of the color filling interface corresponding to the click operation and determine an interface coordinate of the click position in a color filling interface coordinate system;
the coordinate conversion sub-module is configured to convert the interface coordinate into a canvas coordinate according to the mapping relation between the color filling interface coordinate system and the canvas coordinate system;
the pixel value determining submodule is configured to determine the pixel value of a pixel point corresponding to the canvas coordinate in the canvas;
and the filling sub-module is configured to determine a color filling grid to which the canvas coordinates belong in the line drawing under the condition that the pixel value is not equal to 0, and take the color filling grid as an area to be filled.
Optionally, the first update sub-module includes:
and the updating unit is configured to update the matrix parameters in the initial color matrix of the template to be filled through a matrix merging algorithm and the matrix parameter updating unit.
Optionally, the second determining module 508 includes:
a fifth determining sub-module, configured to determine, in response to a click operation of the user on at least one color parameter adjustment control in the color filling interface, positions of the at least one color parameter adjustment control in color parameter progress bars respectively corresponding to the at least one color parameter adjustment control;
a sixth determining sub-module configured to determine an attribute parameter value of at least one color parameter according to the position, and determine an adjusted target color according to the attribute parameter value.
The above is a schematic scheme of a color filling apparatus of the present embodiment. It should be noted that the technical solution of the color filling apparatus and the technical solution of the color filling method belong to the same concept, and for details that are not described in detail in the technical solution of the color filling apparatus, reference may be made to the description of the technical solution of the color filling method.
FIG. 6 illustrates a block diagram of a computing device 600 provided according to an embodiment of the present application. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is coupled to the memory 610 via a bus 630 and a database 650 is used to store data.
Computing device 600 also includes access device 640, access device 640 enabling computing device 600 to communicate via one or more networks 660. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. Access device 640 may include one or more of any type of network interface (e.g., a Network Interface Card (NIC)) whether wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present application, the above-described components of computing device 600, as well as other components not shown in FIG. 6, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 6 is for purposes of example only and is not limiting as to the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 600 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smartphone), wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 600 may also be a mobile or stationary server.
Wherein the processor 620 is configured to execute computer-executable instructions for executing the computer-executable instructions, wherein the steps of the color filling method are implemented when the processor executes the computer-executable instructions.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the color filling method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the color filling method.
An embodiment of the present application also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the color filling method.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the above-mentioned color filling method, and for details that are not described in detail in the technical solution of the storage medium, reference may be made to the description of the technical solution of the above-mentioned color filling method.
The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application embodiment is not limited by the described acts or sequences, because some steps may be performed in other sequences or simultaneously according to the present application embodiment. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that acts and modules referred to are not necessarily required to implement the embodiments of the application.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the embodiments of the application and its practical application, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.

Claims (12)

1. A color filling method, comprising:
receiving a color filling instruction submitted by a user aiming at an object to be processed;
responding to the color filling instruction, and loading a template to be filled of the object to be processed to a color filling interface;
determining a region to be filled based on the operation of a user on the template to be filled;
responding to the color parameter operation of the user on the color filling interface, and determining an adjusted target color;
and filling the target color into the area to be filled.
2. The color filling method according to claim 1, wherein the determining the adjusted target color in response to the color parameter operation of the user at the color filling interface comprises:
determining a matrix parameter updating unit corresponding to the color parameters of the color parameter adjusting control according to the color parameter operation, and updating the initial color matrix of the template to be filled according to the matrix parameter updating unit;
and determining the target color according to the matrix parameters in the updated color matrix.
3. The color filling method according to claim 1 or 2, wherein the color parameter includes a hue;
correspondingly, the determining the adjusted target color in response to the color parameter operation of the user on the color filling interface includes:
responding to the clicking operation of the user on the tone adjustment control in the color filling interface to determine a tone adjustment result, and generating a first matrix parameter updating unit according to the tone adjustment result;
updating the matrix parameters of the initial color matrix of the template to be filled according to the first matrix parameter updating unit to generate a first color matrix;
and determining the target color according to the matrix parameters in the first color matrix.
4. A color filling method according to claim 3, wherein the color parameter further includes a saturation;
correspondingly, the determining the adjusted target color in response to the color parameter operation of the user on the color filling interface includes:
responding to the click operation of the user on a saturation adjustment control in the color filling interface to determine a saturation adjustment result, and generating a second matrix parameter updating unit according to the saturation adjustment result;
updating the matrix parameters of the first color matrix according to the second matrix parameter updating unit to generate a second color matrix;
and determining the target color according to the matrix parameters in the second color matrix.
5. The color filling method according to claim 4, wherein the color parameter further includes brightness;
correspondingly, the determining the adjusted target color in response to the color parameter operation of the user on the color filling interface includes:
responding to the click operation of the user on a brightness adjustment control in the color filling interface to determine a brightness adjustment result, and generating a third matrix parameter updating unit according to the brightness adjustment result;
updating the matrix parameters of the second color matrix according to the third matrix parameter updating unit to generate a third color matrix;
and determining the target color according to the matrix parameters in the third color matrix.
6. The color filling method according to claim 1, wherein the loading of the template to be filled of the object to be processed to the color filling interface comprises:
setting a canvas on a color filling interface of a browser, and loading the line drawing of the object to be processed into the canvas as the template to be filled.
7. The color filling method according to claim 6, wherein the determining a region to be filled based on an operation of a user on the template to be filled comprises:
determining a click position of the color filling interface corresponding to the click operation, and determining an interface coordinate of the click position in a color filling interface coordinate system;
converting the interface coordinate into a canvas coordinate according to the mapping relation between the color filling interface coordinate system and the canvas coordinate system;
determining the pixel value of a pixel point corresponding to the canvas coordinate in the canvas;
and under the condition that the pixel value is not equal to 0, determining a color filling grid to which the canvas coordinate belongs in the line drawing, and taking the color filling grid as a region to be filled.
8. The color filling method according to claim 2, wherein the updating the initial color matrix of the template to be filled according to the matrix parameter updating unit comprises:
and updating the matrix parameters in the initial color matrix of the template to be filled through a matrix merging algorithm and the matrix parameter updating unit.
9. The color filling method according to claim 1, wherein the determining the adjusted target color in response to the color parameter operation of the user at the color filling interface comprises:
responding to the clicking operation of the user on at least one color parameter adjusting control in the color filling interface to determine the position of the at least one color parameter adjusting control in the color parameter progress bar respectively corresponding to the at least one color parameter adjusting control;
and determining an attribute parameter value of at least one color parameter according to the position, and determining the adjusted target color according to the attribute parameter value.
10. A color filling apparatus, comprising:
the instruction receiving module is configured to receive a color filling instruction submitted by a user aiming at the object to be processed;
the loading module is configured to respond to the color filling instruction and load a template to be filled of the object to be processed to a color filling interface;
the first determination module is configured to determine a region to be filled based on the operation of a user on the template to be filled;
a second determination module configured to determine an adjusted target color in response to the user operating on the color parameters of the color fill interface;
a filling module configured to fill the target color into the region to be filled.
11. A computing device, comprising:
a memory and a processor;
the memory is configured to store computer-executable instructions and the processor is configured to execute the computer-executable instructions, wherein the processor when executing the computer-executable instructions implements the steps of the color filling method of claims 1-9.
12. A computer-readable storage medium, characterized in that it stores computer instructions which, when executed by a processor, implement the steps of the color filling method of claims 1-9.
CN202110200911.9A 2021-02-23 2021-02-23 Color filling method and device Pending CN112907700A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110200911.9A CN112907700A (en) 2021-02-23 2021-02-23 Color filling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110200911.9A CN112907700A (en) 2021-02-23 2021-02-23 Color filling method and device

Publications (1)

Publication Number Publication Date
CN112907700A true CN112907700A (en) 2021-06-04

Family

ID=76124369

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110200911.9A Pending CN112907700A (en) 2021-02-23 2021-02-23 Color filling method and device

Country Status (1)

Country Link
CN (1) CN112907700A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113797548A (en) * 2021-09-18 2021-12-17 珠海金山网络游戏科技有限公司 Object processing method and device
CN115129214A (en) * 2022-06-30 2022-09-30 海信视像科技股份有限公司 Display device and color filling method
CN118170371A (en) * 2024-01-22 2024-06-11 南京数睿数据科技有限公司 Page generation method and device based on drag page component and electronic equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070121180A1 (en) * 2005-11-30 2007-05-31 Kaoru Ogawa Color adjustment apparatus, display apparatus, printing apparatus, image processing apparatus, color adjustment method, graphical user interface displaying method and program
US20070176945A1 (en) * 2006-01-31 2007-08-02 Microsoft Corporation Color scheme-compatible color selection with hue preservation
CN104765614A (en) * 2015-04-24 2015-07-08 广东小天才科技有限公司 Color filling processing method and device
CN105279778A (en) * 2015-10-12 2016-01-27 深圳市金立通信设备有限公司 Method and terminal for picture color filling
CN109525901A (en) * 2018-11-27 2019-03-26 Oppo广东移动通信有限公司 Method for processing video frequency, device, electronic equipment and computer-readable medium
CN110276816A (en) * 2019-06-27 2019-09-24 北京金山安全软件有限公司 Regional color filling method and device, electronic equipment and computer readable storage medium
CN111095258A (en) * 2017-06-29 2020-05-01 最佳应用有限责任公司 Computer-assisted system and method for creating customized products
CN111833417A (en) * 2020-07-14 2020-10-27 广州探途网络技术有限公司 Method and system for realizing black and white mode of android application program

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070121180A1 (en) * 2005-11-30 2007-05-31 Kaoru Ogawa Color adjustment apparatus, display apparatus, printing apparatus, image processing apparatus, color adjustment method, graphical user interface displaying method and program
US20070176945A1 (en) * 2006-01-31 2007-08-02 Microsoft Corporation Color scheme-compatible color selection with hue preservation
CN104765614A (en) * 2015-04-24 2015-07-08 广东小天才科技有限公司 Color filling processing method and device
CN105279778A (en) * 2015-10-12 2016-01-27 深圳市金立通信设备有限公司 Method and terminal for picture color filling
CN111095258A (en) * 2017-06-29 2020-05-01 最佳应用有限责任公司 Computer-assisted system and method for creating customized products
CN109525901A (en) * 2018-11-27 2019-03-26 Oppo广东移动通信有限公司 Method for processing video frequency, device, electronic equipment and computer-readable medium
CN110276816A (en) * 2019-06-27 2019-09-24 北京金山安全软件有限公司 Regional color filling method and device, electronic equipment and computer readable storage medium
CN111833417A (en) * 2020-07-14 2020-10-27 广州探途网络技术有限公司 Method and system for realizing black and white mode of android application program

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
涤生_WOO: "Android:修图技术之滤镜效果实现及原理分析——ColorMatrix", 《HTTPS://WWW.JIANSHU.COM/P/9A44D04F39FC》 *
涤生_WOO: "Android:修图技术之滤镜效果实现及原理分析——ColorMatrix", 《HTTPS://WWW.JIANSHU.COM/P/9A44D04F39FC》, 21 June 2017 (2017-06-21), pages 1 - 15 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113797548A (en) * 2021-09-18 2021-12-17 珠海金山网络游戏科技有限公司 Object processing method and device
CN113797548B (en) * 2021-09-18 2024-02-27 珠海金山数字网络科技有限公司 Object processing method and device
CN115129214A (en) * 2022-06-30 2022-09-30 海信视像科技股份有限公司 Display device and color filling method
CN118170371A (en) * 2024-01-22 2024-06-11 南京数睿数据科技有限公司 Page generation method and device based on drag page component and electronic equipment
CN118170371B (en) * 2024-01-22 2024-10-01 南京数睿数据科技有限公司 Page generation method and device based on drag page component and electronic equipment

Similar Documents

Publication Publication Date Title
CN112907700A (en) Color filling method and device
CN106575158B (en) Environment mapping virtualization mechanism
CN112738627B (en) Play control method and device
JP7261732B2 (en) Method and apparatus for determining character color
JP7553211B2 (en) Two-dimensional code display method, apparatus, device and medium
CN108288296A (en) The picture batch coloring method of digital picture painting methods and digital publication
CN110647372A (en) Position adjusting method and device of page display module
CN114565707A (en) 3D object rendering method and device
CN112995533A (en) Video production method and device
CN111068314B (en) NGUI resource rendering processing method and device based on Unity
CN115512193A (en) Facial expression generation method and device
CN113282863B (en) Service page generation method and device
CN113344633B (en) Advertisement picture processing method and device
CN113127126B (en) Object display method and device
CN112614049A (en) Image processing method, image processing device, storage medium and terminal
CN109814977B (en) Character display method and device, computing equipment and storage medium
CN110975284A (en) Unity-based NGUI resource rendering processing method and device
CN116737133A (en) Layout generation method, design draft layout generation method and device
CN112800360B (en) Object control method and device
CN110298903B (en) Curve editing method and device, computing equipment and storage medium
CN112233015A (en) Picture style conversion method and device
CN114401423A (en) Data processing method and device
CN109816755A (en) A kind of production method of ink image, calculates equipment and storage medium at device
CN114512094A (en) Screen color adjusting method, device, terminal and computer readable storage medium
CN110990104A (en) Unity 3D-based texture rendering method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination