类型 IconPart

API 文档由 Go 源码生成,内容为英文。

type IconPart struct {
	// Contour is the index of the contour this part moves.
	Contour int
	// Rotate turns the part clockwise, in radians, about the center of its own
	// bounds rather than the glyph's, so a part turned in place stays put.
	Rotate float32
	// Scale grows the part about the center of its own bounds. Zero is 1.
	Scale float32
	// ScaleX stretches the part horizontally, on top of Scale, about the same
	// point. Zero is 1 and a negative value mirrors it: passing through zero is
	// the halfway point of a page turning over, or of a meridian crossing a globe.
	ScaleX float32
	// Offset moves the part in logical pixels: x to the right and y down.
	Offset Point
	// Anchor is the point of the glyph a part turns and scales about, in the
	// icon's own view-box units. Nil means the centre of the part's own bounds,
	// so a part turned in place stays put; an anchor is how a page turns over a
	// book's spine rather than twisting around itself.
	Anchor *Point
}

IconPart moves one contour of an icon on its own. Contours are numbered in drawing order from zero; Icon.Contours yields them as icons, which is how a caller finds out which contour is which.

The number is a handle on a particular drawing, not a name: regenerating a glyph may insert, merge or reorder its contours, and the same index then moves a different part. An index that no contour has, or a second part on the same contour, is ignored rather than reported. A component that addresses contours must therefore pin which one it means with a test that paints the glyph and checks the part moves where it should.