Versions in this module Expand all Collapse all v0 v0.0.2 Sep 5, 2026 v0.0.1 Aug 25, 2026 Changes in this version + const DefaultOffscreenFormat + var ColorBlack = RGBA(0, 0, 0, 1) + var ColorBlue = RGBA(0, 0, 1, 1) + var ColorCyan = RGBA(0, 1, 1, 1) + var ColorGray = RGBA(0.5, 0.5, 0.5, 1) + var ColorGreen = RGBA(0, 1, 0, 1) + var ColorMagenta = RGBA(1, 0, 1, 1) + var ColorOrange = RGBA(1, 0.5, 0, 1) + var ColorPink = RGBA(1, 0.75, 0.8, 1) + var ColorPurple = RGBA(0.5, 0, 0.5, 1) + var ColorRed = RGBA(1, 0, 0, 1) + var ColorTransparent = RGBA(0, 0, 0, 0) + var ColorWhite = RGBA(1, 1, 1, 1) + var ColorYellow = RGBA(1, 1, 0, 1) + func DefaultFontName() (name string) + type ClipMode int + const ClipModeDifference + const ClipModeIntersect + const ClipModeReplace + type Color struct + A float32 + B float32 + G float32 + R float32 + func RGBA(r, g, b, a float32) Color + type Context struct + func NewContext(device *wgpu.Device, targetFormat gputypes.TextureFormat) (renderer *Context, err error) + func (r *Context) Arc(cx, cy, radius, startAngle, endAngle float32, counterClockwise bool) + func (r *Context) Begin(width, height int) + func (r *Context) BeginPath() + func (r *Context) BeginTarget(width, height, targetWidth, targetHeight int) + func (r *Context) BezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y float32) + func (r *Context) Circle(cx, cy, radius float32) + func (r *Context) Clip(modes ...ClipMode) + func (r *Context) ClosePath() + func (r *Context) CubicCurveTo(cp1x, cp1y, cp2x, cp2y, x, y float32) + func (r *Context) DrawImage(img *gimage.Image, x, y float32) + func (r *Context) DrawImageBounds(img *gimage.Image, x, y, width, height float32) + func (r *Context) DrawImageBoundsTransformed(img *gimage.Image, transform Matrix, x, y, width, height float32) + func (r *Context) DrawImageClipBounds(img *gimage.Image, x, y, width, height, x1, y1, x2, y2 float32) + func (r *Context) DrawImageClipBoundsTransformed(img *gimage.Image, transform Matrix, ...) + func (r *Context) Ellipse(cx, cy, radiusX, radiusY, rotation, startAngle, endAngle float32, ...) + func (r *Context) Fill() + func (r *Context) FillCircle(cx, cy, radius float32) + func (r *Context) FillRoundedRect(x, y, width, height, radius float32) + func (r *Context) FillText(s string, x, y float32) + func (r *Context) Flush(target *wgpu.TextureView, clearColor *gputypes.Color) (err error) + func (r *Context) GetTransform() Matrix + func (r *Context) Line(x0, y0, x1, y1 float32) + func (r *Context) LineTo(x, y float32) + func (r *Context) MeasureTextLine(s string, caretPositions []float32) (metrics TextLineMetrics, positions []float32) + func (r *Context) MoveTo(x, y float32) + func (r *Context) Polygon(points []Point) + func (r *Context) Polyline(points []Point) + func (r *Context) QuadraticCurveTo(cpx, cpy, x, y float32) + func (r *Context) Rect(x, y, w, h float32) + func (r *Context) Release() + func (r *Context) ResetImageEffect() + func (r *Context) ResetImageShader() + func (r *Context) ResetTransform() + func (r *Context) Restore() + func (r *Context) RoundedRect(x, y, w, h, radius float32) + func (r *Context) Save() + func (r *Context) SetEdgeAAMode(mode EdgeAAMode) + func (r *Context) SetEffectTime(seconds float32) + func (r *Context) SetFillStyle(color Color) + func (r *Context) SetFont(size float64, handle *FontHandle, weights ...FontWeight) (err error) + func (r *Context) SetGlobalAlpha(alpha float32) + func (r *Context) SetImageEffect(effect ImageEffect) + func (r *Context) SetImageShader(shader ImageShaderBinding) + func (r *Context) SetImageSmoothingMode(mode ImageSmoothingMode) + func (r *Context) SetLineCap(cap LineCap) + func (r *Context) SetLineJoin(join LineJoin) + func (r *Context) SetLineWidth(width float32) + func (r *Context) SetMatrixTransform(transform Matrix) + func (r *Context) SetMiterLimit(limit float32) + func (r *Context) SetObjectTransform(x, y, size, rotation float32) + func (r *Context) SetShadowBlur(blur float32) + func (r *Context) SetShadowColor(color Color) + func (r *Context) SetStrokeStyle(color Color) + func (r *Context) SetTextAlign(align TextAlign) + func (r *Context) SetTextBaseline(baseline TextBaseline) + func (r *Context) SetTextKerning(enabled bool) + func (r *Context) SetTransform(a, b, c, d, e, f float32) + func (r *Context) SetTransformPolite(x, y, size, rotation float32) + func (r *Context) Stroke() + func (r *Context) StrokeCircle(cx, cy, radius float32) + func (r *Context) StrokeRoundedRect(x, y, width, height, radius float32) + func (r *Context) StrokeText(s string, x, y float32) + func (r *Context) Transform(a, b, c, d, e, f float32) + func (r *Context) TransformMatrix(transform Matrix) + type EdgeAAMode int + const EdgeAAModeDefault + const EdgeAAModeOff + const EdgeAAModeOn + type FontHandle struct + func LoadFont(filePath string) (handle *FontHandle, err error) + func LoadFontByName(name string) (handle *FontHandle, err error) + func (h *FontHandle) Path() string + type FontWeight int + const FontWeightBlack + const FontWeightBold + const FontWeightExtraBold + const FontWeightExtraLight + const FontWeightLight + const FontWeightMedium + const FontWeightNormal + const FontWeightRegular + const FontWeightSemiBold + const FontWeightThin + type ImageEffect int + const ImageEffectElectric + const ImageEffectNone + type ImageShader struct + func NewImageShader[T any](ctx *Context, desc ImageShaderDescriptor, uniforms T) (shader *ImageShader[T], err error) + func (s *ImageShader[T]) Release() + func (s *ImageShader[T]) SetUniforms(uniforms T) (err error) + type ImageShaderBinding interface + type ImageShaderDescriptor struct + Label string + WGSL string + type ImageShaderProgram struct + func NewImageShaderProgram[T any](ctx *Context, desc ImageShaderDescriptor) (program *ImageShaderProgram[T], err error) + func (p *ImageShaderProgram[T]) NewInstance(uniforms T) (shader *ImageShader[T], err error) + func (p *ImageShaderProgram[T]) Release() + type ImageSmoothingMode int + const ImageSmoothingModeDefault + const ImageSmoothingModeLinear + const ImageSmoothingModeNearest + type LineCap int + const LineCapButt + const LineCapRound + const LineCapSquare + type LineJoin int + const LineJoinBevel + const LineJoinMiter + const LineJoinRound + type Matrix struct + A float32 + B float32 + C float32 + D float32 + E float32 + F float32 + func IdentityMatrix() Matrix + func NewTransformMatrix(x, y, scaleX, scaleY, rotation float32) Matrix + func NewUniformTransformMatrix(x, y, scale, rotation float32) Matrix + func (m Matrix) Apply(x, y float32) Point + func (m Matrix) Mul(next Matrix) Matrix + type OffscreenCanvas struct + Height int + Width int + func NewOffscreenCanvas(device *wgpu.Device, width, height int, formats ...gputypes.TextureFormat) (canvas *OffscreenCanvas, err error) + func (c *OffscreenCanvas) Flush(clearColor *gputypes.Color) (err error) + func (c *OffscreenCanvas) Format() gputypes.TextureFormat + func (c *OffscreenCanvas) GetContext() (ctx *Context, err error) + func (c *OffscreenCanvas) Image(name string) *gimage.Image + func (c *OffscreenCanvas) Release() + func (c *OffscreenCanvas) Sampler() *wgpu.Sampler + func (c *OffscreenCanvas) Texture() *wgpu.Texture + func (c *OffscreenCanvas) View() *wgpu.TextureView + type Point struct + X float32 + Y float32 + type TextAlign int + const TextAlignCenter + const TextAlignLeft + const TextAlignRight + type TextBaseline int + const TextBaselineAlphabetic + const TextBaselineBottom + const TextBaselineMiddle + const TextBaselineTop + type TextLineMetrics struct + Ascent float32 + Descent float32 + LineHeight float32 + Width float32