Documentation
¶
Index ¶
- Variables
- func GioPaint(ops *op.Ops, data []byte, rect image.Rectangle, opts ...decode.DecodeOption)
- func ImagePaint(ops *op.Ops, data []byte, rect image.Rectangle, opts ...decode.DecodeOption)
- func Widget(data []byte, width, height unit.Dp, options ...Option) (layout.Widget, error)
- type Option
- type PaintFunc
- type Rasterizer
- func (v *Rasterizer) Bounds() image.Rectangle
- func (v *Rasterizer) ClosePath()
- func (v *Rasterizer) CubeTo(bx, by, cx, cy, dx, dy float32)
- func (v *Rasterizer) Draw(r image.Rectangle, src image.Image, sp image.Point)
- func (v *Rasterizer) LineTo(bx, by float32)
- func (v *Rasterizer) MoveTo(ax, ay float32)
- func (v *Rasterizer) Op() clip.Op
- func (v *Rasterizer) Path() *clip.Path
- func (v *Rasterizer) Pen() (x, y float32)
- func (v *Rasterizer) QuadTo(bx, by, cx, cy float32)
- func (v *Rasterizer) Reset(w, h int)
- func (v *Rasterizer) Size() image.Point
- func (v *Rasterizer) To(x, y float32) f32.Point
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ImagePaint ¶
func Widget ¶ added in v0.1.2
Widget creates a layout widget for rendering IconVG vector graphics data. It supports two rendering backends: a default Gio clip.Path implementation and an optional image-based raster backend (enabled via WithImageBackend()). The widget handles aspect ratio preservation following the SVG specification's "xMidYMid meet" behavior, which scales the image to fit the viewport while maintaining proportions and centering it both horizontally and vertically.
The data parameter accepts the raw IconVG bytes, while width and height specify the desired dimensions in device-independent pixels (Dp). Additional rendering options can be provided through the variadic options parameter.
Types ¶
type Option ¶
type Option = func(*option)
func WithColors ¶
func WithImageBackend ¶
func WithImageBackend() Option
type Rasterizer ¶
func NewRasterizer ¶
func NewRasterizer(ops *op.Ops, w, h int) *Rasterizer
func (*Rasterizer) Bounds ¶
func (v *Rasterizer) Bounds() image.Rectangle
func (*Rasterizer) ClosePath ¶
func (v *Rasterizer) ClosePath()
func (*Rasterizer) CubeTo ¶
func (v *Rasterizer) CubeTo(bx, by, cx, cy, dx, dy float32)
func (*Rasterizer) LineTo ¶
func (v *Rasterizer) LineTo(bx, by float32)
func (*Rasterizer) MoveTo ¶
func (v *Rasterizer) MoveTo(ax, ay float32)
func (*Rasterizer) Op ¶
func (v *Rasterizer) Op() clip.Op
func (*Rasterizer) Path ¶
func (v *Rasterizer) Path() *clip.Path
func (*Rasterizer) Pen ¶
func (v *Rasterizer) Pen() (x, y float32)
func (*Rasterizer) QuadTo ¶
func (v *Rasterizer) QuadTo(bx, by, cx, cy float32)
func (*Rasterizer) Reset ¶
func (v *Rasterizer) Reset(w, h int)
func (*Rasterizer) Size ¶
func (v *Rasterizer) Size() image.Point