Source File
scene.go
Belonging Package
github.com/pancsta/d2/d2renderers/d2scene
package d2sceneimport ()type AssetID string// Asset is a closed set of fully resolved, network-free scene resources.// Asset byte slices are retained by the Document and must not be mutated after// construction. Builders copy mutable caller data before retention; immutable// process-owned resources may be shared across Documents.type Asset interface {isAsset()}type FontAsset struct {MIMEType stringData []byte// FaceIndex selects one face from an OpenType collection. It is zero for a// single-face TTF/OTF and for the first face of a TTC. Keeping the index in// the resolved asset lets a scene retain host fallback fonts without asking// the network-free rasterizer to rediscover which collection face was used.FaceIndex uint16}func (FontAsset) () {}// RasterAsset retains one encoded raster resource. Native rendering uses the// first animation frame of GIF, APNG, and WebP data on its logical canvas and// normalizes JPEG pixels and dimensions using EXIF Orientation.type RasterAsset struct {MIMEType stringData []bytePixelWidth intPixelHeight int// DecodedBytes is the resolver-proven decoded first-frame canvas footprint.// A zero value uses a conservative 4-byte-per-pixel estimate for callers// that have already normalized the asset to 8-bit RGBA. Values below that// minimum are invalid.DecodedBytes int64}func (RasterAsset) () {}type VectorAsset struct {ViewBox BoxRoot *Node}func (VectorAsset) () {}type LinkRegion struct {// Box is expressed in the same logical coordinate space as Document.ViewBox.Box Box// URL is an external or opaque link destination. Target instead names a// D2 board destination. At most one of URL and Target may be set; a region// with neither is valid when it carries tooltip-only metadata.URL stringTooltip stringTarget string}type BlendMode uint8const (BlendNormal BlendMode = iotaBlendMultiplyBlendDarkenBlendColorBurnBlendOverlayBlendLighten)type Clip struct {Path PathTransform Matrix}type MaskType uint8const (MaskAlpha MaskType = iotaMaskLuminance)type Mask struct {Type MaskTypeRoot *NodeTransform Matrix}type Filter interface {isFilter()}type GaussianBlur struct {SigmaX float64SigmaY float64}func (GaussianBlur) () {}type DropShadow struct {OffsetX float64OffsetY float64SigmaX float64SigmaY float64Color color.NRGBA}func (DropShadow) () {}// Node is one immutable-ish scene layer. Transform maps node-local coordinates// into its parent's coordinates. Callers constructing nodes directly must use// Identity for an untransformed node; NewNode supplies that default.type Node struct {ID stringClasses []stringTransform MatrixOpacity float64Blend BlendModeClip *ClipMask *MaskFilters []FilterPrimitive PrimitiveChildren []*NodeAnimations []Track}func ( Primitive) *Node {return &Node{Transform: Identity(),Opacity: 1,Primitive: ,}}// ViewportFit controls how a document viewbox maps into its output viewport.// The zero value selects independent-axis stretching.type ViewportFit uint8const (ViewportStretch ViewportFit = iotaViewportMeet)// ViewportAlign controls placement when a uniform viewport fit leaves// letterbox space. The zero value anchors content at the viewport origin.type ViewportAlign uint8const (ViewportAlignXMinYMin ViewportAlign = iotaViewportAlignXMidYMid)type Document struct {ViewBox BoxLogicalWidth float64LogicalHeight float64ViewportFit ViewportFitViewportAlign ViewportAlignRoot *NodeAssets map[AssetID]AssetLinks []LinkRegion}func ( Box, *Node) *Document {return &Document{ViewBox: ,LogicalWidth: .Width,LogicalHeight: .Height,Root: ,Assets: make(map[AssetID]Asset),}}
![]() |
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. |