Back to godoc.org
gioui.org / op / paint

Package paint

v0.0.0 (83673ec)
Latest Go to latest
Published: Jul 26, 2020 | Licenses: MIT , Unlicense | Module: gioui.org

Overview

Package paint provides drawing operations for 2D graphics.

The PaintOp operation draws the current brush into a rectangular area, taking the current clip path and transformation into account.

The current brush is set by either a ColorOp for a constant color, or ImageOp for an image.

Index

Package Files

type ColorOp

type ColorOp struct {
	Color color.RGBA
}

ColorOp sets the brush to a constant color.

func (ColorOp) Add

func (c ColorOp) Add(o *op.Ops)

type ImageOp

type ImageOp struct {
	// Rect is the section if the backing image to use.
	Rect image.Rectangle
	// contains filtered or unexported fields
}

ImageOp sets the brush to an image.

Note: the ImageOp may keep a reference to the backing image. See NewImageOp for details.

func NewImageOp

func NewImageOp(src image.Image) ImageOp

NewImageOp creates an ImageOp backed by src. See gioui.org/io/system.FrameEvent for a description of when data referenced by operations is safe to re-use.

NewImageOp assumes the backing image is immutable, and may cache a copy of its contents in a GPU-friendly way. Create new ImageOps to ensure that changes to an image is reflected in the display of it.

func (ImageOp) Add

func (i ImageOp) Add(o *op.Ops)

func (ImageOp) Size

func (i ImageOp) Size() image.Point

type PaintOp

type PaintOp struct {
	// Rect is the destination area to paint. If necessary, the brush is
	// scaled to cover the rectangle area.
	Rect f32.Rectangle
}

PaintOp fills an area with the current brush, respecting the current clip path and transformation.

func (PaintOp) Add

func (d PaintOp) Add(o *op.Ops)
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier