Source File
paint.go
Belonging Package
github.com/pancsta/d2/d2renderers/d2scene
package d2sceneimport// Paint is a closed set of renderer-neutral D2 paints. A nil Paint means no// paint. The closed interface makes unsupported paint kinds fail at compile// time instead of disappearing in a renderer.type Paint interface {isPaint()}type SolidPaint struct {Color color.NRGBA}func (SolidPaint) () {}type GradientStop struct {Offset float64Color color.NRGBA}type PaintUnits uint8const (ObjectBoundingBox PaintUnits = iotaUserSpaceOnUse)type SpreadMethod uint8const (SpreadPad SpreadMethod = iotaSpreadReflectSpreadRepeat)type LinearGradient struct {Start PointEnd PointStops []GradientStopUnits PaintUnitsTransform MatrixSpread SpreadMethod}func (LinearGradient) () {}type RadialGradient struct {Center PointRadius float64Focal PointFocalRadius float64Stops []GradientStopUnits PaintUnitsTransform MatrixSpread SpreadMethod}func (RadialGradient) () {}// PatternPaint repeats Root over Tile. Root is in Tile's local coordinate// system and is subject to Transform before the pattern is sampled.type PatternPaint struct {Tile BoxRoot *NodeUnits PaintUnitsTransform Matrix}func (PatternPaint) () {}type LineCap uint8const (CapButt LineCap = iotaCapRoundCapSquare)type LineJoin uint8const (JoinMiter LineJoin = iotaJoinRoundJoinBevel)// Stroke describes path stroking in logical coordinates. Dashes alternate on// and off lengths and are interpreted before DashOffset, as in SVG.type Stroke struct {Paint PaintWidth float64Cap LineCapJoin LineJoinMiterLimit float64Dashes []float64DashOffset float64}func ( *Stroke) () bool {return != nil && .Paint != nil && .Width > 0}// expansion is a conservative local-coordinate expansion around centerline// geometry. Exact stroked bounds are the stroker's responsibility. Square caps// can extend along and across a diagonal tangent; miters use the declared SVG// miter limit.func ( *Stroke) () float64 {if !.visible() {return 0}:= .Width / 2:= 1.0if .Cap == CapSquare {= 1.4142135623730951 // sqrt(2)}if .Join == JoinMiter {:= .MiterLimitif <= 0 {= 4}if > {=}}return *}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |