Generalized primitives for smooth coloring of vector graphics artwork in constant time
View Patent ↗Diffusion coloring of vector graphics artwork is performed in constant time based on the number of color channels in a specified color space. In some examples, a method may include establishing color handles within an artwork, and defining mesh vertices distributed throughout the artwork. The method may also include determining a resultant color at each mesh vertex by solving the Laplacian equation for each of i color channels in a color space, wherein solving the Laplacian equation for each of the i color channels produces a corresponding i color values that collectively define the resultant color. A color for a pixel in the artwork can be determined by interpolating between the resultant colors at the mesh vertices.
1. A computer-implemented method to color a vector graphics artwork, the method comprising:
receiving input defining a plurality of color handles within an artwork, wherein each of the color handles defines a particular color at a particular location in the artwork, and wherein the particular color is represented by i color channels, wherein i≥1;
defining a plurality of vertices distributed throughout the artwork;
modeling color in the artwork using a Laplacian equation, wherein the color handles are boundary conditions on the Laplacian equation;
determining a resultant color at each vertex of the plurality of vertices by solving the Laplacian equation for each of the i color channels, wherein solving the Laplacian equation for each of the i color channels produces a corresponding i color values that collectively define the resultant color;
determining a color for each pixel of a plurality of pixels in the artwork by interpolating between the resultant colors at the plurality of vertices; and
causing display of a rendered colored artwork, the rendered colored artwork including the determined color for the one or more pixels.
2. The method of claim 1 , wherein the input includes a quality parameter, and wherein the Laplacian equation is one of a harmonic, biharmonic, or triharmonic equation as determined by the quality parameter.
3. The method of claim 1 , wherein the boundary conditions include a plurality of weights, each weight of the plurality of weights corresponding to a color channel of the i color channels.
4. The method of claim 1 , wherein the color channels are in a RGB color space.
5. The method of claim 1 , wherein the color channels are in a CMYK color space.
6. The method of claim 1 , wherein the color channels include an alpha channel for opacity, and a weight is assigned to the alpha channel.
7. The method of claim 1 , wherein the plurality of color handles includes at least one of a point color handle, a line color handle, and a curve color handle.
8. The method of claim 1 , wherein the plurality of vertices corresponds to points in a triangular mesh corresponding to the artwork, wherein the triangle mesh is generated using Delaunay triangulation.
9. The method of claim 8 , wherein the plurality of color handles includes at least one sampled mesh vertex, the mesh vertex being in a line segment or a curve segment.
10. A computer program product including one or more non-transitory machine-readable mediums encoded with instructions that when executed by one or more processors cause a process to be carried out to color a vector graphics artwork, the process comprising:
receiving input defining a plurality of color handles within an artwork, wherein each of the color handles defines a particular color at a particular location in the artwork, and wherein the particular color is represented by i color channels, wherein i≥1;
defining a plurality of mesh vertices distributed throughout the artwork;
modeling color in the artwork using a Laplacian equation, wherein the color handles are boundary conditions on the Laplacian equation;
determining a resultant color at each vertex of the plurality of vertices by solving the Laplacian equation for each of the i color channels, wherein solving the Laplacian equation for each of the i color channels produces a corresponding i color values that collectively define the resultant color;
determining a color for each pixel of a plurality of pixels in the artwork by interpolating between the resultant colors at the plurality of mesh vertices; and
causing display of a rendered colored artwork, the rendered colored artwork including the determined color for the one or more pixels.
11. The computer program product of claim 10 , wherein the input includes a quality parameter, and wherein the Laplacian equation is one of a harmonic, biharmonic, or triharmonic equation as determined by the quality parameter.
12. The computer program product of claim 10 , wherein the boundary conditions include a plurality of weights, each weight of the plurality of weights corresponding to a color channel of the i color channels.
13. The computer program product of claim 10 , wherein the plurality of color handles includes a point color handle and an associated color corresponding to the point color handle, wherein the color diffuses along a radial direction from the point color handle.
14. The computer program product of claim 10 , wherein the plurality of color handles includes a line color handle and an associated color corresponding to the line color handle, wherein the color diffuses along a direction of a line segment connecting the line color handle.
15. The computer program product of claim 10 , wherein the plurality of color handles includes a curve color handle and an associated color corresponding to the curve color handle, wherein the color diffuses along a shape of a curve segment connecting the curve color handle.
16. The computer program product of claim 10 , wherein the color channels are in one of a RGB color space or a CMYK color space.
17. The computer program product of claim 10 , wherein at least one color handle of the plurality of color handles is associated with an opacity value.
18. A system to color a vector graphics artwork, the system comprising:
one or more non-transitory machine-readable mediums configured to store instructions; and
one or more processors configured to execute the instructions stored on the one or more non-transitory machine-readable mediums, wherein execution of the instructions causes the one or more processors to
receive input defining a plurality of color handles within an artwork, wherein each of the color handles defines a particular color at a particular location in the artwork, and wherein the particular color is represented by i color channels, wherein i≥1;
define a plurality of mesh vertices distributed throughout the artwork;
model color in the artwork using a Laplacian equation, wherein the color handles are boundary conditions on the Laplacian equation;
determine a resultant color at each vertex of the plurality of vertices by solving the Laplacian equation for each of the i color channels, wherein solving the Laplacian equation for each of the i color channels produces a corresponding i color values that collectively define the resultant color;
determine a color for each pixel of a plurality of pixels in the artwork by interpolating between the resultant colors at the plurality of mesh vertices; and
cause display of a rendered colored artwork, the rendered colored artwork including the determined color for the one or more pixels.
19. The system of claim 18 , wherein the input includes a quality parameter, and wherein the Laplacian equation is one of a harmonic, biharmonic, or triharmonic equation as determined by the quality parameter.
20. The system of claim 18 , wherein the color channels are in one of a RGB color space or a CMYK color space.