Index | Files

package paint

import ""

Package paint provides drawing operations for 2D graphics.

The PaintOp operation fills the current clip with the current brush, taking the current transformation into account.

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

All color.NRGBA values are in the sRGB color space.


Package Files

doc.go paint.go

func Fill Uses

func Fill(ops *op.Ops, c color.NRGBA)

Fill paints an infinitely large plane with the provided color. It is intended to be used with a clip.Op already in place to limit the painted area. Use FillShape unless you need to paint several times within the same clip.Op.

func FillShape Uses

func FillShape(ops *op.Ops, c color.NRGBA, shape clip.Op)

FillShape fills the clip shape with a color.

type ColorOp Uses

type ColorOp struct {
    Color color.NRGBA

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 {
    // 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 LinearGradientOp Uses

type LinearGradientOp struct {
    Stop1  f32.Point
    Color1 color.NRGBA
    Stop2  f32.Point
    Color2 color.NRGBA

LinearGradientOp sets the brush to a gradient starting at stop1 with color1 and ending at stop2 with color2.

func (LinearGradientOp) Add Uses

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

type PaintOp Uses

type PaintOp struct {

PaintOp fills fills the current clip area with the current brush.

func (PaintOp) Add Uses

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

Package paint imports 9 packages (graph) and is imported by 46 packages. Updated 2020-11-27. Refresh now. Tools for package owners.