gio

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2025 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MinInf = float32(math.Inf(-1))
	MaxInf = float32(math.Inf(1))
)

Functions

func GioPaint

func GioPaint(ops *op.Ops, data []byte, rect image.Rectangle, opts ...decode.DecodeOption)

func ImagePaint

func ImagePaint(ops *op.Ops, data []byte, rect image.Rectangle, opts ...decode.DecodeOption)

func Widget added in v0.1.2

func Widget(data []byte, width, height unit.Dp, options ...Option) (layout.Widget, error)

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 WithColors(colors ...color.Color) Option

func WithImageBackend

func WithImageBackend() Option

type PaintFunc

type PaintFunc func(*op.Ops, []byte, image.Rectangle, ...decode.DecodeOption)

type Rasterizer

type Rasterizer struct {
	Ops *op.Ops
	// contains filtered or unexported fields
}

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) Draw

func (v *Rasterizer) Draw(r image.Rectangle, src image.Image, sp image.Point)

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

func (*Rasterizer) To

func (v *Rasterizer) To(x, y float32) f32.Point

Directories

Path Synopsis
example
arrow command
blend command
cowbell command
favicon command
gradients command
icons command
info command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL