Documentation ¶
Index ¶
- type Aff3
- type Gradient
- func (g *Gradient) At(x, y int) color.Color
- func (g *Gradient) Bounds() image.Rectangle
- func (g *Gradient) ColorModel() color.Model
- func (g *Gradient) GradientShape() int
- func (g *Gradient) Init(shape Shape, spread Spread, pix2Grad Aff3, stops []Stop) bool
- func (g *Gradient) SpreadMethod() int
- func (g *Gradient) StopColors() []color.RGBA
- func (g *Gradient) StopOffsets() []float64
- func (g *Gradient) Transform() (a, b, c, d, e, f float64)
- type Range
- type Renderer
- func (z *Renderer) AbsArcTo(rx, ry, xAxisRotation float32, largeArc, sweep bool, x, y float32)
- func (z *Renderer) AbsCubeTo(x1, y1, x2, y2, x, y float32)
- func (z *Renderer) AbsHLineTo(x float32)
- func (z *Renderer) AbsLineTo(x, y float32)
- func (z *Renderer) AbsQuadTo(x1, y1, x, y float32)
- func (z *Renderer) AbsSmoothCubeTo(x2, y2, x, y float32)
- func (z *Renderer) AbsSmoothQuadTo(x, y float32)
- func (z *Renderer) AbsVLineTo(y float32)
- func (z *Renderer) CSel() uint8
- func (z *Renderer) ClosePathAbsMoveTo(x, y float32)
- func (z *Renderer) ClosePathEndPath()
- func (z *Renderer) ClosePathRelMoveTo(x, y float32)
- func (z *Renderer) NSel() uint8
- func (z *Renderer) RelArcTo(rx, ry, xAxisRotation float32, largeArc, sweep bool, x, y float32)
- func (z *Renderer) RelCubeTo(x1, y1, x2, y2, x, y float32)
- func (z *Renderer) RelHLineTo(x float32)
- func (z *Renderer) RelLineTo(x, y float32)
- func (z *Renderer) RelQuadTo(x1, y1, x, y float32)
- func (z *Renderer) RelSmoothCubeTo(x2, y2, x, y float32)
- func (z *Renderer) RelSmoothQuadTo(x, y float32)
- func (z *Renderer) RelVLineTo(y float32)
- func (z *Renderer) Reset(viewbox ivg.ViewBox, palette [64]color.RGBA)
- func (z *Renderer) SetCReg(adj uint8, incr bool, c ivg.Color)
- func (z *Renderer) SetCSel(cSel uint8)
- func (z *Renderer) SetLOD(lod0, lod1 float32)
- func (z *Renderer) SetNReg(adj uint8, incr bool, f float32)
- func (z *Renderer) SetNSel(nSel uint8)
- func (z *Renderer) SetRasterizer(dst raster.Rasterizer, r image.Rectangle)
- func (z *Renderer) StartPath(adj uint8, x, y float32)
- type Shape
- type Spread
- type Stop
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aff3 ¶
type Aff3 [6]float64
Aff3 is a 3x3 affine transformation matrix in row major order, where the bottom row is implicitly [0 0 1].
m[3*r + c] is the element in the r'th row and c'th column.
type Gradient ¶
type Gradient struct { Shape Shape Spread Spread // Pix2Grad transforms coordinates from pixel space (the arguments to the // Image.At method) to gradient space. Gradient space is where a linear // gradient ranges from x == 0 to x == 1, and a radial gradient has center // (0, 0) and radius 1. // // This is an affine transform, so it can represent elliptical gradients in // pixel space, including non-axis-aligned ellipses. // // For a linear gradient, the bottom row is ignored. Pix2Grad Aff3 Ranges []Range // First and Last are the first and last stop's colors. First, Last color.RGBA64 }
Gradient is a very large image.Image (the same size as an image.Uniform) whose colors form a gradient.
func (*Gradient) ColorModel ¶
ColorModel satisfies the image.Image interface.
func (*Gradient) GradientShape ¶
GradientShape returns 0 for a linear gradient and 1 for a radial gradient.
func (*Gradient) Init ¶
Init initializes g to a gradient whose geometry is defined by shape and pix2Grad and whose colors are defined by spread and stops.
func (*Gradient) SpreadMethod ¶
SpreadMethod returns 0 for 'none', 1 for 'pad', 2 for 'reflect', 3 for 'repeat'.
func (*Gradient) StopColors ¶
StopColors returns as a slice the colors of the gradient stops.
func (*Gradient) StopOffsets ¶
StopOffsets returns as a slice the offsets of the gradient stops.
type Range ¶
type Range struct { Offset0 float64 Offset1 float64 Width float64 R0 float64 R1 float64 G0 float64 G1 float64 B0 float64 B1 float64 A0 float64 A1 float64 }
Range is the range between two stops.
func AppendRanges ¶
AppendRanges appends to a the ranges defined by a's implicit final stop (if any exist) and stops.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer implements the ivg.Destination interface to render an IconVG graphic onto a ivg/raster.Rasterizer.
Call SetRasterizer to change the rasterizer, before calling Decode or between calls to Decode.
func (*Renderer) AbsHLineTo ¶
func (*Renderer) AbsSmoothCubeTo ¶
func (*Renderer) AbsSmoothQuadTo ¶
func (*Renderer) AbsVLineTo ¶
func (*Renderer) ClosePathAbsMoveTo ¶
func (*Renderer) ClosePathEndPath ¶
func (z *Renderer) ClosePathEndPath()
func (*Renderer) ClosePathRelMoveTo ¶
func (*Renderer) RelHLineTo ¶
func (*Renderer) RelSmoothCubeTo ¶
func (*Renderer) RelSmoothQuadTo ¶
func (*Renderer) RelVLineTo ¶
func (*Renderer) SetRasterizer ¶
func (z *Renderer) SetRasterizer(dst raster.Rasterizer, r image.Rectangle)
SetRasterizer sets the rasterizer to draw into. The IconVG graphic (which does not have a fixed size in pixels) will be scaled in the X and Y dimensions to fit the rectangle r. The scaling factors may differ in the two dimensions.
type Spread ¶
type Spread uint8
Spread is the gradient spread, or how to spread a gradient past its nominal bounds (from offset being 0.0 to offset being 1.0).
const ( // SpreadNone means that offsets outside of the [0, 1] range map to // transparent black. SpreadNone Spread = iota // SpreadPad means that offsets below 0 and above 1 map to the colors that // 0 and 1 would map to. SpreadPad // SpreadReflect means that the offset mapping is reflected start-to-end, // end-to-start, start-to-end, etc. SpreadReflect // SpreadRepeat means that the offset mapping is repeated start-to-end, // start-to-end, start-to-end, etc. SpreadRepeat )