Index | Files

package paint

import ""

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.


Package Files

doc.go paint.go

type ColorOp Uses

type ColorOp struct {
    Color color.RGBA

ColorOp sets the brush to a constant color.

func (ColorOp) Add Uses

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

type ImageOp Uses

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 Uses

func NewImageOp(src image.Image) ImageOp

NewImageOp creates an ImageOp backed by src. See 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 Uses

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

func (ImageOp) Size Uses

func (i ImageOp) Size() image.Point

type PaintOp Uses

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 Uses

func (d PaintOp) Add(o *op.Ops)

Package paint imports 8 packages (graph) and is imported by 35 packages. Updated 2020-09-30. Refresh now. Tools for package owners.