pixie/paints

Types

PaintKind = enum
  pkSolid, pkImage, pkImageTiled, pkGradientLinear, pkGradientRadial,
  pkGradientAngular
Paint = ref object
  case kind*: PaintKind
  of pkSolid:
      color*: ColorRGBX      ## Color to fill with.
    
  of pkImage, pkImageTiled:
      image*: Image          ## Image to fill with.
      imageMat*: Mat3        ## Matrix of the filled image.
    
  of pkGradientLinear, pkGradientRadial, pkGradientAngular:
      gradientHandlePositions*: seq[Vec2] ## Gradient positions (image space).
      gradientStops*: seq[ColorStop] ## Color stops (gradient space).
    
  blendMode*: BlendMode      ## Blend mode.
  
Paint used to fill paths.
ColorStop = object
  color*: ColorRGBX          ## Color of the stop
  position*: float32         ## Gradient Stop position 0..1.
  
Color stop on a gradient curve.

Procs

proc fillLinearGradient(image: Image; at, to: Vec2; stops: seq[ColorStop]) {...}{.
    raises: [], tags: [].}
Fills a linear gradient.
proc fillRadialGradient(image: Image; center, edge, skew: Vec2;
                        stops: seq[ColorStop]) {...}{.raises: [], tags: [].}
Fills a radial gradient.
proc fillAngularGradient(image: Image; center, edge, skew: Vec2;
                         stops: seq[ColorStop]) {...}{.raises: [], tags: [].}
Angular gradient.