CN110276816A - Regional color filling method and device, electronic equipment and computer readable storage medium - Google Patents
Regional color filling method and device, electronic equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN110276816A CN110276816A CN201910573473.3A CN201910573473A CN110276816A CN 110276816 A CN110276816 A CN 110276816A CN 201910573473 A CN201910573473 A CN 201910573473A CN 110276816 A CN110276816 A CN 110276816A
- Authority
- CN
- China
- Prior art keywords
- filled
- region
- pixel
- colors
- coordinate
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/001—Texturing; Colouring; Generation of texture or colour
Abstract
The embodiment of the invention discloses a regional color filling method, a regional color filling device and electronic equipment, which are invented for enriching the effect of regional color filling and color filling. The method comprises the following steps: displaying a picture to be filled with area color filling, wherein the picture to be filled is provided with at least one area to be filled; receiving a region filling click operation; determining a click position coordinate of the click operation in the picture to be filled and a region to be filled selected by the click operation; calculating the distance between a first pixel point in the selected area to be filled and the click position coordinate; calculating a gradient color value of the first pixel point according to the distance and a preset gradient color calculation rule; and coloring the first pixel point according to the gradually changed color value of the first pixel point. The apparatus and electronic device include modules for performing the methods. The invention is suitable for color filling of the area.
Description
Technical field
It colors in method, apparatus, electronic equipment, computer-readable the present invention relates to drawing field more particularly to a kind of region
Storage medium and application program.
Background technique
With computer communication and the continuous development of Internet technology, electronic equipment, for example, intelligent mobile phone, a
The application such as personal digital assistant, palm PC, laptop is more more and more universal, colors in more so that carrying out region using electronic equipment
It is more convenient to come, but existing when coloring in region, is that a region is filled only with a kind of color, so that the effect mistake that colors in
In single, poor user experience.
Summary of the invention
In view of this, the embodiment of the present invention provide a kind of region color in method, apparatus, electronic equipment, computer-readable deposit
Storage media and application program can make when progress region colors in, and the effect of Fill Color is more abundant.
It colors in method in a first aspect, the embodiment of the present invention provides a kind of region, comprising: the figure to be filled that display area colors in
Piece has at least one region to be filled in the picture to be filled;Fill clicking operation in receiving area;Determine the click
Operate the click location coordinate in the picture to be filled and the selected region to be filled of the single-click operation;Calculate choosing
The distance between first pixel and the click location coordinate in fixed region to be filled;According to the distance, and in advance
The graduated colors computation rule of setting calculates the graduated colors value of the first pixel;According to the graduated colors value of the first pixel
First pixel is coloured.
A kind of specific implementation according to an embodiment of the present invention, it is described to calculate first in the selected region to be filled
The distance between pixel and the click location coordinate, comprising: calculate the first pixel in the selected region to be filled
Coordinate difference between coordinate in the picture to be filled, with the click location coordinate;According to the coordinate difference, meter
Calculate the distance between the first pixel and the click location coordinate in the selected region to be filled.
A kind of specific implementation according to an embodiment of the present invention, it is described according to the distance and it is preset gradually
Become color computation rule, calculate the graduated colors value of the first pixel, comprising: according to the distance, described selected to be filled
The vertex color value in region and preset color value calculate the gradual change face of the first pixel based on linear interpolation function
Color value;Wherein, preset color value is different from the vertex color value in the selected region to be filled.
A kind of specific implementation according to an embodiment of the present invention, it is described according to the distance and it is preset gradually
Become color computation rule, calculate the first pixel graduated colors value, comprising: according to the distance, with it is described selected wait fill out
Fill the first adjacent region to be filled of region vertex color value and preset color value, be based on linear interpolation function
Calculate the graduated colors value of the first pixel;Wherein, preset color value is different from the selected region to be filled
Vertex color value;Wherein, the first adjacent region to be filled of the selected region to be filled, to be originated from the click location
By the ray of first pixel, the region to be filled that passes through for the first time.
A kind of specific implementation according to an embodiment of the present invention is determining the selected area to be filled of the single-click operation
After domain, the method also includes: calculate texture coordinate corresponding to each apex coordinate in the selected region to be filled;Root
According to the texture coordinate, using previously selected texture, texture mapping is carried out to the selected region to be filled.
A kind of specific implementation according to an embodiment of the present invention, before the picture to be filled that display area colors in, institute
The method of stating includes: to parse to source vector artwork, obtains the attribute data of at least one shape, and the attribute data includes institute
State the apex coordinate, triangle index and vertex color of shape;The attribute data is filled into grid assembly;According to described
Attribute data in grid assembly draws picture to be filled.
Second aspect, the embodiment of the present invention provide a kind of region and color in device, comprising: display module, clicking operation receive
Module, determining module, the first computing module, the second computing module, staining module, wherein
Display module has at least one in the picture to be filled for the picture to be filled that display area colors in
Region to be filled;
Clicking operation receiving module fills clicking operation for receiving area;
Determining module.For determining click location coordinate of the clicking operation in the picture to be filled and described
The selected region to be filled of single-click operation;
First computing module, for calculate in selected region to be filled first pixel and the click location coordinate it
Between distance;
Second computing module, for calculating first according to the distance and preset graduated colors computation rule
The graduated colors value of pixel;
Staining module, for being coloured according to the graduated colors value of the first pixel to the first pixel.
A kind of specific implementation according to an embodiment of the present invention, first computing module, comprising: coordinate difference calculates son
Module, apart from computational submodule, wherein
Coordinate difference computational submodule, for calculating in the selected region to be filled first pixel described to be filled
Coordinate difference between coordinate in picture, with the click location coordinate;
Apart from computational submodule, for calculating the first picture in the selected region to be filled according to the coordinate difference
The distance between vegetarian refreshments and the click location coordinate.
A kind of specific implementation according to an embodiment of the present invention, second computing module, is specifically used for:
According to the distance, the vertex color value in the selected region to be filled and preset color value, base
The graduated colors value of the first pixel is calculated in linear interpolation function;Wherein, preset color value is different from described selected
Region to be filled vertex color value.
A kind of specific implementation according to an embodiment of the present invention, second computing module, is specifically used for:
According to the distance, the vertex color value in the first to be filled region adjacent with the selected region to be filled,
And preset color value, the graduated colors value of the first pixel is calculated based on linear interpolation function;Wherein, it presets
Color value be different from the selected region to be filled vertex color value;Wherein, the selected region to be filled is adjacent
The first region to be filled, for from the click location originate by first pixel ray, pass through for the first time to
Filling region.
A kind of specific implementation according to an embodiment of the present invention, further includes: third computing module, textures module, wherein
Third computing module is sat for calculating texture corresponding to each apex coordinate in the selected region to be filled
Mark;
Textures module is used for according to the texture coordinate, using previously selected texture, to the selected area to be filled
Domain carries out texture mapping.
A kind of specific implementation according to an embodiment of the present invention, further includes: parsing module, conversion module,
Parsing module obtains the attribute data of at least one shape, the attribute for parsing to source vector artwork
Data include the apex coordinate of the shape, triangle index and vertex color;
Conversion module, for according to the attribute data, the shape to be filled into grid assembly.
The third aspect, the embodiment of the present invention provide a kind of electronic equipment, and the electronic equipment includes: shell, processor, deposits
Reservoir, circuit board and power circuit, wherein circuit board is placed in the space interior that shell surrounds, processor and memory setting
On circuit boards;Power circuit, for each circuit or the device power supply for above-mentioned electronic equipment;Memory is for storing and can hold
Line program code;Processor is run and executable program code pair by reading the executable program code stored in memory
The program answered, for executing method described in aforementioned any implementation.
Fourth aspect, the embodiment of the present invention also provide a kind of computer readable storage medium, described computer-readable to deposit
Storage media is stored with one or more program, and one or more of programs can be executed by one or more processor,
To realize method described in any embodiment of the present invention.
5th aspect, the embodiment of the present invention also provide a kind of application program, and the application program is performed to realize this
Method described in invention any embodiment.
A kind of region provided in an embodiment of the present invention color in method, apparatus, electronic equipment, computer readable storage medium and
Application program is treated the area filling clicking operation in the region to be filled in filling picture by user, determines that clicking operation exists
Click location coordinate and selected region to be filled in picture to be filled;According in the selected region to be filled being calculated
The distance between first pixel and the click location coordinate and preset graduated colors computation rule, calculate
To the graduated colors value of the first pixel, the first pixel is coloured further according to the graduated colors value of the first pixel, this
Sample can click all pixels Point Coloring in selected region to be filled to user.Since user clicks selected area to be filled
The distance between each pixel in domain and click location coordinate are not quite similar, in this way, being sat by pixel and click location
The distance between mark and preset graduated colors computation rule, the graduated colors value for each pixel being calculated
Understand the increase with pixel with the distance between click location coordinate and gradually change, in this way, being selected in user to be filled
The color filled in region generates fade effect, so that the effect of area filling color is more abundant, to provide user experience.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
Other attached drawings are obtained according to these attached drawings.
Fig. 1 be region provided by the invention color in method embodiment one flow diagram;
Fig. 2 is to calculate the first pixel and the click location in selected region to be filled in one embodiment of the invention
The flow diagram of the distance between coordinate;
Fig. 3 be region provided by the invention color in method embodiment two flow diagram;
Fig. 4 be region provided by the invention color in method embodiment three flow diagram;
Fig. 5 be region provided by the invention color in device embodiment one structural schematic diagram;
Fig. 6 is the structural schematic diagram of the first computing module in an embodiment provided by the invention;
Fig. 7 be region provided by the invention color in device embodiment two structural schematic diagram;
Fig. 8 be region provided by the invention color in device embodiment three structural schematic diagram;
Fig. 9 is the structural schematic diagram of electronic equipment one embodiment of the present invention.
Specific embodiment
The embodiment of the present invention is described in detail with reference to the accompanying drawing.
It will be appreciated that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Base
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts it is all its
Its embodiment, shall fall within the protection scope of the present invention.
Region of the present invention colors in method suitable for platforms such as unity, Cocos.
When describing specific embodiment, by taking unity platform as an example, illustrate that region colors in the realization process of method.
It colors in method in a first aspect, the embodiment of the present invention provides a kind of region, enables to the effect of area filling color
It is more abundant, improve user experience.Unity be by Unity Technologies is developed one allow player easily to create such as
The multi-platform comprehensive development of games work of the types interaction contents such as 3 D video game, building visualization, realtime three dimensional animation
Tool, is the professional game engine integrated comprehensively.
Fig. 1 be region provided by the invention color in method embodiment one flow diagram, as shown in Figure 1, this implementation
Example method may include:
The picture to be filled that step 101, display area color in, the picture to be filled have at least one area to be filled
Domain.
In the present embodiment, picture to be filled can be shown on the screen of the electronic equipments such as mobile phone, tablet computer;Area to be filled
Domain is to be closed the region that lines surround by black;At least there is a region to be filled to fill face for user in picture to be filled
Color.
Clicking operation is filled in step 102, receiving area.
In the present embodiment, when user is intended to color in some region, the region that colors in can be treated and carry out clicking operation;It clicks
Operation can be the touch operation realized by the finger or paintbrush of user, can also realize clicking operation by mouse, wherein paintbrush
It can be the stylus or screen touch pen or electronic palette pen etc. of electric terminal screen.
Step 103 determines click location coordinate of the clicking operation in the picture to be filled and described clicks behaviour
Make selected region to be filled.
In the present embodiment, after receiving area filling clicking operation, it may be determined that user's clicking operation is in electronic equipment screen
The position of curtain, according to the transforming relationship of screen coordinate and Picture Coordinate, it may be determined that the clicking operation of user is specifically in figure to be filled
Position coordinates in piece, user region to be filled belonging to the click location in picture to be filled is selected area to be filled
Domain.
Step 104 calculates the distance between the first pixel and the click location coordinate in selected region to be filled.
In the present embodiment, any pixel point and click location coordinate can be separately converted to corresponding texture coordinate, passed through
Calculate the distance between texture, obtain in selected region to be filled between first pixel and the click location coordinate away from
From;Numerical value of the value range of each component between 0-1 in texture coordinate can calculate in (shader) selected in tinter
The distance between first pixel and the click location coordinate in region to be filled.
Step 105, according to the distance and preset graduated colors computation rule, calculate the first pixel
Graduated colors value.
In the present embodiment, according to the distance between the first pixel and the click location coordinate and preset
Graduated colors computation rule can pass through film source shader computations graduated colors value.
Preset graduated colors computation rule can be preset distance and color value corresponding relationship, such as with
The increase of distance, color value become larger or with distance increase, color value gradually becomes smaller;Preset distance with
In the corresponding relationship of color value, minimum range can be that 0,0 corresponding color value can be that the corresponding color value of white or black are corresponding
Color value can also be certainly the corresponding color value of other colors.
It is described according to the distance and preset graduated colors computation rule in one embodiment of the invention, it calculates
The graduated colors value of first pixel may include:
According to the distance, the vertex color value in the selected region to be filled and preset color value, base
The graduated colors value of the first pixel is calculated in linear interpolation function;Wherein, preset color value is different from described selected
Region to be filled vertex color value.
In the present embodiment, when calculating the graduated colors value of each pixel in selected region to be filled, it is selected to
All vertex color values of filling region can select the same color value.
The vertex color value in selected region to be filled and preset color value can be indicated with RGB color mode;Line
Property interpolating function concretely lerp (a, b, value), wherein a is preset color value, and b be the area to be filled selected
The vertex color value in domain, value are smooth transition value, and for value range between 0-1, value can specifically pass through smoothstep
(0.f, 0.05f, distance) method obtains, wherein distance is the first picture in region to be filled that step 104 obtains
The distance between vegetarian refreshments and the click location coordinate, the f in 0.f and 0.05f indicate 0 and 0.05 data type for floating-point
Type.
In the present embodiment, preset color value is different from the vertex color value in the selected region to be filled, such as
Preset color value is the corresponding numerical value of blue, and the vertex color value in selected region to be filled can be red corresponding number
Value.
The present embodiment, according to the distance, the vertex color value in the selected region to be filled and preset
Color value calculates the graduated colors value of the first pixel based on linear interpolation function, and preset color value is different from
The vertex color value in the selected region to be filled, can make the pixel being calculated by linear interpolation function in this way
Color value of the graduated colors value between the vertex color value and preset color value in selected region to be filled, just
In when to selected region Fill Color to be filled, fade effect is formed.
As an alternative embodiment, the preset optional white of color value.
The present embodiment, according to the vertex color value in selected region to be filled, the selected region to be filled that is calculated
The graduated colors value of interior pixel, in this way, the color value filled in selected region to be filled is between preset
Between color value and the vertex color value in selected region to be filled.
It is described according to the distance and preset graduated colors computation rule in another embodiment of the present invention, meter
The graduated colors value for calculating the first pixel may include:
According to the distance, the vertex color value in the first to be filled region adjacent with the selected region to be filled,
And preset color value, the graduated colors value of the first pixel is calculated based on linear interpolation function;Wherein, it presets
Color value be different from the selected region to be filled vertex color value;Wherein, the selected region to be filled is adjacent
The first region to be filled, to originate the ray by first pixel from the click location, first pass through
Region to be filled.
In the present embodiment, the first adjacent region to be filled of selected region to be filled, to be originated from the click location
By the ray of first pixel, first region to be filled passed through, thus can determine that unique first wait fill out
Region is filled, so that it is determined that the vertex color value in the first region to be filled.
The present embodiment, according to the vertex color value in the first to be filled region adjacent with the selected region to be filled,
The graduated colors value of the pixel in the selected region to be filled being calculated, in this way, being filled out in selected region to be filled
The color that the color filled region to be filled adjacent thereto is filled is close, so that the color of two adjacent area fillings to be filled
Whole fade effect is more preferable.
Step 106 colours the first pixel according to the graduated colors value of the first pixel.
In the present embodiment, by the graduated colors value of the first pixel, pass through graphics processor (Graphics
Processing Unit, GPU) pixel in picture is rendered, specific render process is the prior art, herein no longer
It repeats.
The present embodiment treats the area filling clicking operation in the region to be filled in filling picture by user, it is determined that
Click location coordinate of the clicking operation in picture to be filled and selected region to be filled;According to be calculated it is selected to
The distance between the first pixel and the click location coordinate and preset graduated colors calculate rule in filling region
Then, the graduated colors value of the first pixel is calculated, the first pixel is clicked through further according to the graduated colors value of the first pixel
Row coloring, in this way, all pixels Point Coloring in selected region to be filled can be clicked to user.It is selected since user clicks
Region to be filled in the distance between each pixel and click location coordinate be not quite similar, in this way, by pixel with
The distance between click location coordinate and preset graduated colors computation rule, each pixel being calculated
Graduated colors value can be gradually changed with the increase of pixel and the distance between click location coordinate, in this way, selecting in user
The color filled in fixed region to be filled generates fade effect, so that the effect of area filling color is more abundant, to mention
Rise user experience.
Fig. 2 is to calculate the first pixel and the click location in selected region to be filled in one embodiment of the invention
The flow diagram of the distance between coordinate, as shown in Fig. 2, described calculate the first pixel in the selected region to be filled
The distance between the click location coordinate (step 104) may include:
Step 1041 calculates seat of first pixel in the picture to be filled in the selected region to be filled
Mark, with the coordinate difference between the click location coordinate.
In the present embodiment, corresponding texture coordinate can be converted by pixel and click location coordinate, specific conversion is closed
System is shown below:
Vector2 uv=new Vector2 (vertice.x/width, vertice.y/height)
Wherein, vertice.x and vertice.y is respectively cross, the ordinate of some position vertice in picture, width
For picture width, height is picture height, and Vector2uv is the bivector of texture coordinate.
According to formula above, corresponding texture coordinate can be converted by any pixel point and click location coordinate.
Further according to a certain pixel and the corresponding texture coordinate of click location coordinate, click location coordinate is calculated
The difference and the corresponding line of click location coordinate of the U in U texture coordinate corresponding with the pixel in corresponding texture coordinate
Manage the difference of the V in the V texture coordinate corresponding with the pixel in coordinate.
Step 1042, according to the coordinate difference, calculate in the selected region to be filled first pixel with it is described
The distance between click location coordinate.
In the present embodiment, according to coordinate of the pixel in the picture to be filled, between the click location coordinate
Coordinate difference, the distance between the pixel and click location coordinate can be calculated, can specifically be calculated by length algorithm
It arrives.
The present embodiment, the first pixel is in the picture to be filled in selected region to be filled obtained by calculation
Coordinate and the click location coordinate between coordinate difference can be calculated selected wait fill out further according to the coordinate difference
Fill the distance between the first pixel and the click location coordinate in region.
Fig. 3 be region provided by the invention color in method embodiment two flow diagram, as shown in figure 3, this implementation
The method of example on the basis of embodiment of the method shown in Fig. 1, after step 103, before step 104, may also include step
It is rapid:
Step 107 calculates texture coordinate corresponding to each apex coordinate in the selected region to be filled.
In the present embodiment, each apex coordinate is the position coordinates in picture, and correspondence can be calculated according to the following formula
Texture coordinate:
Vector2 uv=new Vector2 (vertice.x/width, vertice.y/height)
Wherein, vertice.x and vertice.y is respectively cross, ordinate of any vertex in picture, and width is figure
Piece width, height are picture height, and Vector2uv is the bivector of texture coordinate.
Step 108, according to the texture coordinate, using previously selected texture, to the selected region to be filled into
Row texture mapping.
In the present embodiment, according to texture coordinate corresponding to each apex coordinate in the region to be filled being calculated, pasting
Corresponding region is found in figure, by the zone rendering into region to be filled.
The present embodiment, by the texture coordinate according to corresponding to each apex coordinate in selected region to be filled, using pre-
First selected texture carries out texture mapping to the selected region to be filled, in this way, there is texture in region to be filled,
So that display effect is more abundant, user experience is further enhanced.
As an alternative embodiment, on the basis of embodiment of the method shown in Fig. 1, above-mentioned steps 107- step 108 is in step
After rapid 106.
Fig. 4 be region provided by the invention color in method embodiment three flow diagram, as shown in figure 4, this implementation
The method of example on the basis of embodiment of the method shown in Fig. 1, before step 101, may further comprise the step of:
Step 1001 parses source vector artwork, obtains the attribute data of at least one shape, the attribute data
Apex coordinate, triangle index and vertex color including the shape.
In the present embodiment, source vector artwork is the two-dimension vector graphics of a color image, concretely SVG format,
Which includes the information of picture, such as: length, width, resolution ratio, color, scenery profile;Shape can be expression scenery
Region in profile and profile.
Specifically the usable library Unity.VectorGraphics parses source vector artwork, produces one group
The corresponding shape of VectorUtils.Geometry, each Geometry, the vertex that shape is contained in Geometry are sat
The attribute datas such as mark, triangle index and vertex color.
The attribute data is filled into grid assembly by step 1002.
In the present embodiment, attribute data of different shapes is filled into respectively in different grid assemblies, a shape obtains
To corresponding grid data.Attribute data can be specifically filled by VectorUtils.FillMesh () method
In the grid assembly mesh of Unity.
Step 1003, according to the attribute data in the grid assembly, draw picture to be filled.
In the present embodiment, according to the attribute data for including in grid assembly, by the corresponding region to be filled of attribute data
Figure renders on the screen;When in picture to be filled include multiple regions to be filled when, can using screen center as datum mark incite somebody to action
Different regions to be filled are displayed on the screen, to obtain a complete picture.
The present embodiment obtains the attribute data of at least one shape, the attribute by parsing to source vector artwork
Data include the apex coordinate of the shape, triangle index and vertex color, and the attribute data is filled into grid assembly
In, and according to the attribute data of grid assembly, picture to be filled is drawn, so as to which picture to be filled is displayed on the screen, with
Filling region, which is treated, for user is filled color.
Second aspect, the embodiment of the present invention provide region and color in device, enable to the effect of area filling color more
It is abundant, improve user experience.
Fig. 5 be region provided by the invention color in device embodiment one structural schematic diagram, as shown in figure 5, this implementation
The device of example may include: display module 11, clicking operation receiving module 12, determining module 13, the first computing module 14, and second
Computing module 15, staining module 16, wherein
Display module 11 has at least one for the picture to be filled that display area colors in the picture to be filled
A region to be filled;
Clicking operation receiving module 12 fills clicking operation for receiving area;
Determining module 13, for determining click location coordinate and institute of the clicking operation in the picture to be filled
State the selected region to be filled of single-click operation;
First computing module 14, for calculating the first pixel and the click location coordinate in selected region to be filled
The distance between;
Second computing module 15, for according to the distance and preset graduated colors computation rule, calculating the
The graduated colors value of one pixel;
Staining module 16, for being coloured according to the graduated colors value of the first pixel to the first pixel.
The device of the present embodiment can be used for executing the technical solution of embodiment of the method shown in Fig. 1, realization principle and skill
Art effect is similar, and details are not described herein again.
In an embodiment of the present invention, the second computing module 15, is specifically used for: according to the distance, it is described it is selected to
The vertex color value of filling region and preset color value calculate the first pixel gradually based on linear interpolation function
Become color value;Wherein, preset color value is different from the vertex color value in the selected region to be filled.
In still another embodiment of the process, the second computing module 15, is specifically used for:
According to the distance, the vertex color value in the first to be filled region adjacent with the selected region to be filled,
And preset color value, the graduated colors value of the first pixel is calculated based on linear interpolation function;Wherein, it presets
Color value be different from the selected region to be filled vertex color value;Wherein, the selected region to be filled is adjacent
The first region to be filled, for from the click location originate by first pixel ray, pass through for the first time to
Filling region.
Fig. 6 is the structural schematic diagram of the first computing module in an embodiment provided by the invention, as shown in fig. 6, first
Computing module, comprising: coordinate difference computational submodule 141, apart from computational submodule 142, wherein
Coordinate difference computational submodule 141, for calculate in the selected region to be filled first pixel it is described to
The coordinate in picture is filled, with the coordinate difference between the click location coordinate;
Apart from computational submodule 142, for calculating first in the selected region to be filled according to the coordinate difference
The distance between pixel and the click location coordinate.
The device of the present embodiment can be used for executing the technical solution of embodiment of the method shown in Fig. 2, realization principle and skill
Art effect is similar, and details are not described herein again.
Fig. 7 be region provided by the invention color in device embodiment two structural schematic diagram, as shown in fig. 7, this implementation
On the basis of the device apparatus structure shown in Fig. 5 of example, further, it may also include that third computing module 17, textures module
18, wherein
Third computing module 17 is sat for calculating texture corresponding to each apex coordinate in the selected region to be filled
Mark;
Textures module 18, for according to the texture coordinate, using previously selected texture, to described selected to be filled
Region carries out texture mapping.
The device of the present embodiment can be used for executing the technical solution of embodiment of the method shown in Fig. 3, realization principle and skill
Art effect is similar, and details are not described herein again.
Fig. 8 be region provided by the invention color in device embodiment three structural schematic diagram, as shown in figure 8, this implementation
On the basis of the device apparatus structure shown in Fig. 5 of example, further, it may also include that parsing module 19, conversion module 20,
Parsing module 19 obtains the attribute data of at least one shape, the category for parsing to source vector artwork
Property data include the apex coordinate of the shape, triangle index and vertex color;
Conversion module 20, for according to the attribute data, the shape to be filled into grid assembly.
The device of the present embodiment can be used for executing the technical solution of embodiment of the method shown in Fig. 4, realization principle and skill
Art effect is similar, and details are not described herein again.
The third aspect, the embodiment of the present invention also provide a kind of electronic equipment, and the electronic equipment includes aforementioned any implementation
Device described in example.
Fig. 9 is the structural schematic diagram of electronic equipment one embodiment of the present invention, may be implemented to implement shown in Fig. 1-4 of the present invention
The process of example, as shown in figure 9, above-mentioned electronic equipment may include: shell 41, processor 42, memory 43, circuit board 44 and electricity
Source circuit 45, wherein circuit board 44 is placed in the space interior that shell 41 surrounds, and processor 42 and memory 43 are arranged in circuit
On plate 44;Power circuit 45, for each circuit or the device power supply for above-mentioned electronic equipment;Memory 43 is for storing and can hold
Line program code;Processor 42 is run and executable program generation by reading the executable program code stored in memory 43
The corresponding program of code colors in method for executing region described in aforementioned any embodiment.
Processor 42 to the specific implementation procedures of above-mentioned steps and processor 42 by operation executable program code come
The step of further executing may refer to the description of Fig. 1-3 illustrated embodiment of the present invention, and details are not described herein.
The electronic equipment exists in a variety of forms, including but not limited to:
(1) mobile communication equipment: the characteristics of this kind of equipment is that have mobile communication function, and to provide speech, data
Communication is main target.This Terminal Type includes: smart phone (such as iPhone), multimedia handset, functional mobile phone and low
Hold mobile phone etc..
(2) super mobile personal computer equipment: this kind of equipment belongs to the scope of personal computer, there is calculating and processing function
Can, generally also have mobile Internet access characteristic.This Terminal Type includes: PDA, MID and UMPC equipment etc., such as iPad.
(3) portable entertainment device: this kind of equipment can show and play multimedia content.Such equipment include: audio,
Video player (such as iPod), handheld device, e-book and intelligent toy and portable car-mounted navigation equipment.
(4) server: providing the equipment of the service of calculating, and the composition of server includes that processor, hard disk, memory, system are total
Line etc., server is similar with general computer architecture, but due to needing to provide highly reliable service, in processing energy
Power, stability, reliability, safety, scalability, manageability etc. are more demanding.
(5) other electronic equipments with data interaction function.
Fourth aspect, the embodiment of the present invention also provide a kind of computer readable storage medium, described computer-readable to deposit
Storage media is stored with one or more program, and one or more of programs can be executed by one or more processor,
To realize that the region of any embodiment of the present invention offer colors in method.
5th aspect, the embodiment of the present invention also provide a kind of application program, and the application program is performed to realize this
The region that invention any embodiment provides colors in method.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence " including one ... ", it is not excluded that
There is also other identical elements in the process, method, article or apparatus that includes the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.
For Installation practice, since it is substantially similar to the method embodiment, so the comparison of description is simple
Single, the relevent part can refer to the partial explaination of embodiments of method.
For convenience of description, description apparatus above is to be divided into various units/modules with function to describe respectively.Certainly, exist
Implement to realize each unit/module function in the same or multiple software and or hardware when the present invention.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the program can be stored in a computer-readable storage medium
In, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic
Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access
Memory, RAM) etc..
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
In the technical scope disclosed by the present invention, any changes or substitutions that can be easily thought of by those familiar with the art, all answers
It is included within the scope of the present invention.Therefore, protection scope of the present invention should be subject to the protection scope in claims.
Claims (10)
- A kind of method 1. region colors in characterized by comprisingThe picture to be filled that display area colors in, the picture to be filled have at least one region to be filled;Fill clicking operation in receiving area;Determine click location coordinate and the single-click operation of the clicking operation in the picture to be filled it is selected to Filling region;Calculate the distance between the first pixel and the click location coordinate in the selected region to be filled;According to the distance and preset graduated colors computation rule, the graduated colors value of the first pixel is calculated;The first pixel is coloured according to the graduated colors value of the first pixel.
- The method 2. region according to claim 1 colors in, which is characterized in that described to calculate the selected region to be filled In the distance between the first pixel and the click location coordinate, comprising:Calculate coordinate of first pixel in the picture to be filled and the click position in the selected region to be filled Set the coordinate difference between coordinate;According to the coordinate difference, calculate in the selected region to be filled first pixel and the click location coordinate it Between distance.
- The method 3. region according to claim 1 colors in, which is characterized in that it is described according to the distance, and set in advance Fixed graduated colors computation rule calculates the graduated colors value of the first pixel, comprising:According to the distance, the vertex color value in the selected region to be filled and preset color value, it is based on line Property interpolating function calculate the first pixel graduated colors value;Wherein, preset color value be different from it is described it is selected to The vertex color value of filling region.
- The method 4. region according to claim 1 colors in, which is characterized in that it is described according to the distance, and set in advance Fixed graduated colors computation rule calculates the graduated colors value of the first pixel, comprising:According to the distance, the vertex color value in the first to be filled region adjacent with the selected region to be filled and Preset color value calculates the graduated colors value of the first pixel based on linear interpolation function;Wherein, preset face Color value is different from the vertex color value in the selected region to be filled;Wherein, the selected region to be filled it is adjacent One region to be filled, for from the click location originate by first pixel ray, first pass through wait fill out Fill region.
- The method 5. region according to claim 1 colors in, which is characterized in that determine the single-click operation it is selected to After filling region, the method also includes:Calculate texture coordinate corresponding to each apex coordinate in the selected region to be filled;According to the texture coordinate, using previously selected texture, texture mapping is carried out to the selected region to be filled.
- The method 6. region according to claim 1 colors in, which is characterized in that the picture to be filled that display area colors in it Before, which comprisesSource vector artwork is parsed, the attribute data of at least one shape is obtained, the attribute data includes the shape Apex coordinate, triangle index and vertex color;The attribute data is filled into grid assembly;According to the attribute data in the grid assembly, picture to be filled is drawn.
- The device 7. a kind of region colors in, which is characterized in that including;Display module in the picture to be filled there is at least one to wait filling out for the picture to be filled that display area colors in Fill region;Clicking operation receiving module fills clicking operation for receiving area;Determining module, for determining click location coordinate of the clicking operation in the picture to be filled and described clicking Operate selected region to be filled;First computing module, for calculating in selected region to be filled between first pixel and the click location coordinate Distance;Second computing module, for calculating the first pixel according to the distance and preset graduated colors computation rule The graduated colors value of point;Staining module, for being coloured according to the graduated colors value of the first pixel to the first pixel.
- The device 8. region according to claim 7 colors in, which is characterized in that first computing module, comprising:Coordinate difference computational submodule, for calculating in the selected region to be filled first pixel in the picture to be filled In coordinate, with the coordinate difference between the click location coordinate;Apart from computational submodule, for calculating the first pixel in the selected region to be filled according to the coordinate difference The distance between described click location coordinate.
- The device 9. region according to claim 7 colors in, which is characterized in that second computing module is specifically used for:According to the distance, the vertex color value in the selected region to be filled and preset color value, it is based on line Property interpolating function calculate the first pixel graduated colors value;Wherein, preset color value be different from it is described it is selected to The vertex color value of filling region.
- The device 10. region according to claim 7 colors in, which is characterized in that second computing module is specifically used for:According to the distance, the vertex color value in the first to be filled region adjacent with the selected region to be filled and Preset color value calculates the graduated colors value of the first pixel based on linear interpolation function;Wherein, preset face Color value is different from the vertex color value in the selected region to be filled;Wherein, the selected region to be filled it is adjacent One region to be filled, to originate the ray by first pixel from the click location, what is passed through for the first time is to be filled Region.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910573473.3A CN110276816A (en) | 2019-06-27 | 2019-06-27 | Regional color filling method and device, electronic equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910573473.3A CN110276816A (en) | 2019-06-27 | 2019-06-27 | Regional color filling method and device, electronic equipment and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110276816A true CN110276816A (en) | 2019-09-24 |
Family
ID=67963719
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910573473.3A Pending CN110276816A (en) | 2019-06-27 | 2019-06-27 | Regional color filling method and device, electronic equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110276816A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110851050A (en) * | 2019-10-17 | 2020-02-28 | 稿定(厦门)科技有限公司 | Method and device for testing clicking of page elements |
CN112907700A (en) * | 2021-02-23 | 2021-06-04 | 上海哔哩哔哩科技有限公司 | Color filling method and device |
CN113238692A (en) * | 2021-06-08 | 2021-08-10 | 北京字跳网络技术有限公司 | Region selection method, map division method, device and computer equipment |
CN114019209A (en) * | 2022-01-05 | 2022-02-08 | 广东海洋大学 | Method and system for measuring electric polarization induction of magnetoelectric composite material |
WO2022105182A1 (en) * | 2020-11-23 | 2022-05-27 | 上海莉莉丝科技股份有限公司 | Coloring method for pixel point in three-dimensional virtual space, system, device, and medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160140737A1 (en) * | 2014-11-19 | 2016-05-19 | Qualcomm Innovation Center, Inc. | Bandwidth reduction using vertex shader |
CN105719230A (en) * | 2016-01-11 | 2016-06-29 | 南京师范大学 | GPU-based color gradual change linear map symbol drafting method |
CN109741420A (en) * | 2018-12-29 | 2019-05-10 | 北京金山安全软件有限公司 | Region filling method and device, electronic equipment and storage medium |
CN109785408A (en) * | 2018-12-29 | 2019-05-21 | 北京金山安全软件有限公司 | Map filling method and device and electronic equipment |
-
2019
- 2019-06-27 CN CN201910573473.3A patent/CN110276816A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160140737A1 (en) * | 2014-11-19 | 2016-05-19 | Qualcomm Innovation Center, Inc. | Bandwidth reduction using vertex shader |
CN105719230A (en) * | 2016-01-11 | 2016-06-29 | 南京师范大学 | GPU-based color gradual change linear map symbol drafting method |
CN109741420A (en) * | 2018-12-29 | 2019-05-10 | 北京金山安全软件有限公司 | Region filling method and device, electronic equipment and storage medium |
CN109785408A (en) * | 2018-12-29 | 2019-05-21 | 北京金山安全软件有限公司 | Map filling method and device and electronic equipment |
Non-Patent Citations (1)
Title |
---|
韩李涛等: "三维地形颜色渐变渲染的光滑过渡方法研究", 《地球信息科学学报》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110851050A (en) * | 2019-10-17 | 2020-02-28 | 稿定(厦门)科技有限公司 | Method and device for testing clicking of page elements |
WO2022105182A1 (en) * | 2020-11-23 | 2022-05-27 | 上海莉莉丝科技股份有限公司 | Coloring method for pixel point in three-dimensional virtual space, system, device, and medium |
CN112907700A (en) * | 2021-02-23 | 2021-06-04 | 上海哔哩哔哩科技有限公司 | Color filling method and device |
CN113238692A (en) * | 2021-06-08 | 2021-08-10 | 北京字跳网络技术有限公司 | Region selection method, map division method, device and computer equipment |
CN114019209A (en) * | 2022-01-05 | 2022-02-08 | 广东海洋大学 | Method and system for measuring electric polarization induction of magnetoelectric composite material |
CN114019209B (en) * | 2022-01-05 | 2022-03-18 | 广东海洋大学 | Method and system for measuring electric polarization induction of magnetoelectric composite material |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110276816A (en) | Regional color filling method and device, electronic equipment and computer readable storage medium | |
Haber | Visualization techniques for engineering mechanics | |
KR100612890B1 (en) | Multi-effect expression method and apparatus in 3-dimension graphic image | |
Lin et al. | Virtual geographic environments: a primer | |
CN101116111B (en) | 2d/3d line rendering using 3d rasterization algorithms | |
CN105204988B (en) | The method of testing and system of electronic equipment game performance | |
US20190304141A1 (en) | Interactive color palette interface for digital painting | |
CN109308734B (en) | 3D character generation method and device, equipment and storage medium thereof | |
US10733793B2 (en) | Indexed value blending for use in image rendering | |
US20090157366A1 (en) | System for simulating digital watercolor image and method therefor | |
CN109308394A (en) | A kind of pre-buried map generalization method, apparatus of three-dimensional water power, equipment and storage medium | |
CN107330209B (en) | Modeling wall intelligent template implementation method based on parametric design | |
CN112860839A (en) | Water environment quality real-time monitoring method and device based on Unity3D | |
Everts et al. | Interactive illustrative line styles and line style transfer functions for flow visualization | |
US8952968B1 (en) | Wave modeling for computer-generated imagery using intersection prevention on water surfaces | |
CN112580213A (en) | Method and apparatus for generating display image of electric field lines, and storage medium | |
CN109598672A (en) | A kind of map road rendering method and device | |
Talgorn et al. | Real-time sketch-based terrain generation | |
Everts et al. | Illustrative line styles for flow visualization | |
KR100684558B1 (en) | Texture mipmapping device and the same method | |
CN109325991A (en) | A kind of pre-buried map generalization method, apparatus of three-dimensional water power, equipment and storage medium | |
CN113487708B (en) | Flow animation implementation method based on graphics, storage medium and terminal equipment | |
Pointecker et al. | Visual coherence for cross-virtuality analytics | |
US11954802B2 (en) | Method and system for generating polygon meshes approximating surfaces using iteration for mesh vertex positions | |
US20230394767A1 (en) | Method and system for generating polygon meshes approximating surfaces using root-finding and iteration for mesh vertex positions |
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 |