gio

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gio

type Gio struct {
	// contains filtered or unexported fields
}

func New

func New(gtx layout.Context, width, height float64) *Gio

New returns a Gio renderer of fixed size.

func NewContain

func NewContain(gtx layout.Context, width, height float64) *Gio

NewContain returns a Gio renderer that fills the constraints either horizontally or vertically, whichever is met first.

func NewStretch

func NewStretch(gtx layout.Context, width, height float64) *Gio

NewStretch returns a Gio renderer that stretches the view to fit the constraints.

func (*Gio) CachePathClips added in v0.2.3

func (r *Gio) CachePathClips() func()

CachePathClips 仅在一次重放内复用掩模路径,避免跨 Ops.Reset 持有失效的宏。

func (*Gio) Dimensions

func (r *Gio) Dimensions() layout.Dimensions

Dimensions returns the dimensions for Gio.

func (*Gio) HasNativeGradients

func (r *Gio) HasNativeGradients() bool

HasNativeGradients 用于判断外层缩放变化时是否需要重建操作记录。

func (*Gio) PushPathClip added in v0.2.3

func (r *Gio) PushPathClip(path *canvas.Path, matrix canvas.Matrix) func()

PushPathClip 保持路径裁剪为 GPU 矢量操作,不生成掩模位图。

func (*Gio) RenderCanvasWithBlend added in v0.2.3

func (r *Gio) RenderCanvasWithBlend(scene *canvas.Canvas, view canvas.Matrix) bool

RenderCanvasWithBlend 为直接消费场景的调用方准备矢量叠底记录。 每次调用都重新准备,不缓存可变场景或源图片;重复显示应保存 scene.PrepareVectorDisplay() 并重放返回值。阅读器通过后台 PrepareDisplay 复用。

func (*Gio) RenderClippedImage

func (r *Gio) RenderClippedImage(img image.Image, m canvas.Matrix, path *canvas.Path)

RenderClippedImage 保留源图片局部、Y 向上的裁剪路径,不先生成整张掩模图片。

func (*Gio) RenderClippedPath added in v0.2.3

func (r *Gio) RenderClippedPath(path *canvas.Path, style canvas.Style, matrix canvas.Matrix, clip *canvas.Path)

func (*Gio) RenderClippedText

func (r *Gio) RenderClippedText(text *canvas.Text, m canvas.Matrix, path *canvas.Path)

RenderClippedText 与 canvas 的文字局部裁剪坐标保持一致。

func (*Gio) RenderImage

func (r *Gio) RenderImage(img image.Image, m canvas.Matrix)

RenderImage renders an image to the canvas using a transformation matrix.

func (*Gio) RenderPath

func (r *Gio) RenderPath(path *canvas.Path, style canvas.Style, m canvas.Matrix)

RenderPath renders a path to the canvas using a style and a transformation matrix.

func (*Gio) RenderText

func (r *Gio) RenderText(text *canvas.Text, m canvas.Matrix)

RenderText renders a text object to the canvas using a transformation matrix.

func (*Gio) RenderVectorDisplay added in v0.2.3

func (r *Gio) RenderVectorDisplay(display *canvas.VectorDisplay, view canvas.Matrix) bool

RenderVectorDisplay 处理高颜色数 Darken 图片的有界回退。路径显示记录仍 只保留一条图片记录;Gio 无法直接表达 Darken 的逐通道 min,因此在固定 分辨率下栅格化源场景,再作为一张普通图片上传。

func (*Gio) SetGradientScale

func (r *Gio) SetGradientScale(scale float32)

SetGradientScale 告知渲染器调用方在外层施加的等比缩放。Gio 当前 GPU 后端不会将该缩放自动应用到 LinearGradientOp 的色轴,须在记录时补偿。 外层平移使用整数像素;其他外层变换应合入 RenderPath 的矩阵。

func (*Gio) SetRasterResolution

func (r *Gio) SetRasterResolution(resolution canvas.Resolution)

SetRasterResolution 设置非原生画笔回退的页面像素密度(像素/毫米),须包含 内外层缩放。未设置或值无效时保留 150 DPI;单张回退图仍最多 2048×2048。 调用方若重放缓存操作,目标密度变化后须重新记录才能提高采样质量。

func (*Gio) Size

func (r *Gio) Size() (float64, float64)

Size returns the size of the canvas in millimeters.

Jump to

Keyboard shortcuts

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