Documentation
¶
Index ¶
- Constants
- type DrawTag
- type Encoding
- func (enc *Encoding) Append(other *Encoding, transform jmath.Transform)
- func (enc *Encoding) ApplyTransform(transform jmath.Transform)
- func (enc *Encoding) EncodeBeginClip(blendMode gfx.BlendMode, alpha float32)
- func (enc *Encoding) EncodeBrush(b gfx.Brush, alpha float32)
- func (enc *Encoding) EncodeColor(color drawColor)
- func (enc *Encoding) EncodeEmptyShape()
- func (enc *Encoding) EncodeEndClip()
- func (enc *Encoding) EncodeFillStyle(fill gfx.Fill)
- func (enc *Encoding) EncodeImage(img gfx.Image, alpha float32)
- func (enc *Encoding) EncodeLinearGradient(gradient drawLinearGradient, colorStops []gfx.ColorStop, alpha float32, ...)
- func (enc *Encoding) EncodePath(path curve.BezPath, isFill bool) bool
- func (enc *Encoding) EncodeRadialGradient(gradient drawRadialGradient, colorStops []gfx.ColorStop, alpha float32, ...)
- func (enc *Encoding) EncodeStrokeStyle(stroke curve.Stroke)
- func (enc *Encoding) EncodeStyle(style Style)
- func (enc *Encoding) EncodeSweepGradient(gradient drawSweepGradient, colorStops []gfx.ColorStop, alpha float32, ...)
- func (enc *Encoding) EncodeTransform(transform jmath.Transform) bool
- func (enc *Encoding) ForceNextTransformAndStyle()
- func (enc *Encoding) IsEmpty() bool
- func (enc *Encoding) Reset()
- func (enc *Encoding) StreamOffsets() StreamOffsets
- func (enc *Encoding) SwapLastPathTags()
- type ImagePatch
- type Patch
- type PathTag
- type RampPatch
- type Resources
- type StreamOffsets
- type Style
Constants ¶
View Source
const ( // 0 for a fill, 1 for a stroke FlagsStyleBit uint32 = 0x8000_0000 // 0 for non-zero, 1 for even-odd FlagsFillBit uint32 = 0x4000_0000 // Encodings for join style: // - 0b00 -> bevel // - 0b01 -> miter // - 0b10 -> round FlagsJoinBitsBevel uint32 = 0 FlagsJoinBitsMiter uint32 = 0x1000_0000 FlagsJoinBitsRound uint32 = 0x2000_0000 FlagsJoinMask uint32 = 0x3000_0000 FlagsCapBitsSquare uint32 = 0x0100_0000 FlagsCapBitsRound uint32 = 0x0200_0000 FlagsStartCapMask uint32 = 0x0C00_0000 FlagsEndCapMask uint32 = 0x0300_0000 MiterLimitMask uint32 = 0xFFFF )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DrawTag ¶
type DrawTag uint32
const ( // No operation. DrawTagNop DrawTag = 0 // Color fill. DrawTagColor DrawTag = 0x50 // Linear gradient fill. DrawTagLinearGradient DrawTag = 0x114 // Radial gradient fill. DrawTagRadialGradient DrawTag = 0x29c // Sweep gradient fill. DrawTagSweepGradient DrawTag = 0x254 // Image fill. DrawTagImage DrawTag = 0x248 // Begin layer/clip. DrawTagBeginClip DrawTag = 0x9 // End layer/clip. DrawTagEndClip DrawTag = 0x21 )
type Encoding ¶
type Encoding struct { PathTags []PathTag PathData []byte DrawTags []DrawTag DrawData []byte Transforms []jmath.Transform Styles []Style Resources Resources NumPaths uint32 NumPathSegments uint32 NumClips uint32 NumOpenClips uint32 Flags uint32 }
func (*Encoding) ApplyTransform ¶
func (*Encoding) EncodeBeginClip ¶
func (*Encoding) EncodeColor ¶
func (enc *Encoding) EncodeColor(color drawColor)
func (*Encoding) EncodeEmptyShape ¶
func (enc *Encoding) EncodeEmptyShape()
EncodeEmptyShape encodes an empty path.
This is useful for bookkeeping when a path is absolutely required (for example in pushing a clip layer). It is almost always the case, however, that an application can be optimized to not use this method.
func (*Encoding) EncodeEndClip ¶
func (enc *Encoding) EncodeEndClip()
func (*Encoding) EncodeFillStyle ¶
func (*Encoding) EncodeLinearGradient ¶
func (*Encoding) EncodeRadialGradient ¶
func (*Encoding) EncodeStrokeStyle ¶
func (*Encoding) EncodeStyle ¶
func (*Encoding) EncodeSweepGradient ¶
func (*Encoding) EncodeTransform ¶
func (*Encoding) ForceNextTransformAndStyle ¶
func (enc *Encoding) ForceNextTransformAndStyle()
func (*Encoding) StreamOffsets ¶
func (enc *Encoding) StreamOffsets() StreamOffsets
func (*Encoding) SwapLastPathTags ¶
func (enc *Encoding) SwapLastPathTags()
type ImagePatch ¶
type PathTag ¶
type PathTag uint8
const ( // 32-bit floating point line segment. // // This is equivalent to `(PathSegmentType::LineTo | PathTag::F32_BIT)`. PathTagLineToF32 PathTag = 0x9 // 32-bit floating point quadratic segment. // // This is equivalent to `(PathSegmentType::QUAD_TO | PathTag::F32_BIT)`. PathTagQuadToF32 PathTag = 0xa // 32-bit floating point cubic segment. // // This is equivalent to `(PathSegmentType::CUBIC_TO | PathTag::F32_BIT)`. PathTagCubicToF32 PathTag = 0xb // 16-bit integral line segment. PathTagLineToI16 PathTag = 0x1 // 16-bit integral quadratic segment. PathTagQuadToI16 PathTag = 0x2 // 16-bit integral cubic segment. PathTagCubicToI16 PathTag = 0x3 // Transform marker. PathTagTransform PathTag = 0x20 // Path marker. PathTagPath PathTag = 0x10 // Style setting. PathTagStyle PathTag = 0x40 // Bit that marks a segment that is the end of a subpath. PathTagSubpathEndBit PathTag = 0x4 // Bit for path segments that are represented as f32 values. If unset // they are represented as i16. PathTagF32Bit PathTag = 0x8 // Mask for bottom 3 bits that contain the [`PathSegmentType`]. PathTagSegmentMask PathTag = 0x3 )
type StreamOffsets ¶
type StreamOffsets struct { // Current length of path tag stream. PathTags int // Current length of path data stream. PathData int // Current length of draw tag stream. DrawTags int // Current length of draw data stream. DrawData int // Current length of transform stream. Transforms int // Current length of style stream. Styles int }
func (StreamOffsets) Add ¶
func (so StreamOffsets) Add(oso StreamOffsets) StreamOffsets
type Style ¶
type Style struct { // Encodes the stroke and fill style parameters. This field is split into two 16-bit // parts: // // - `flags: u16` - encodes fill vs stroke, even-odd vs non-zero fill mode for fills and cap // and join style for strokes. See the FLAGS_* constants below for more // information. // “`text // flags: |style|fill|join|start cap|end cap|reserved| // bits: 0 1 2-3 4-5 6-7 8-15 // “` // // - `miter_limit: u16` - The miter limit for a stroke, encoded in binary16 (half) floating // point representation. This field is only meaningful for the // `Join::Miter` join style. It's ignored for other stroke styles and // fills. FlagsAndMiterLimits uint32 LineWidth float32 // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.