fyne: github.com/fyne-io/fyne/canvas Index | Files

package canvas

import "github.com/fyne-io/fyne/canvas"

Package canvas contains all of the primitive CanvasObjects that make up a Fyne GUI

Index

Package Files

circle.go image.go line.go options.go rectangle.go text.go

type Circle Uses

type Circle struct {
    Position1 fyne.Position // The current top-left position of the Circle
    Position2 fyne.Position // The current bottomright position of the Circle
    Options   Options       // Options to pass to the renderer

    FillColor   color.RGBA // The circle fill colour
    StrokeColor color.RGBA // The circle stroke colour
    StrokeWidth float32    // The stroke width of the circle
}

Circle describes a coloured circle primitive in a Fyne canvas

func NewCircle Uses

func NewCircle(color color.RGBA) *Circle

NewCircle returns a new Circle instance

func (*Circle) CurrentPosition Uses

func (l *Circle) CurrentPosition() fyne.Position

CurrentPosition gets the current top-left position of this circle object, relative to it's parent / canvas

func (*Circle) CurrentSize Uses

func (l *Circle) CurrentSize() fyne.Size

CurrentSize returns the current size of bounding box for this circle object

func (*Circle) MinSize Uses

func (l *Circle) MinSize() fyne.Size

MinSize for a Circle simply returns Size{1, 1} as there is no explicit content

func (*Circle) Move Uses

func (l *Circle) Move(pos fyne.Position)

Move the circle object to a new position, relative to it's parent / canvas

func (*Circle) Resize Uses

func (l *Circle) Resize(size fyne.Size)

Resize sets a new bottom-right position for the circle object

type Image Uses

type Image struct {
    Size     fyne.Size     // The current size of the Image
    Position fyne.Position // The current position of the Image
    Options  Options       // Options to pass to the renderer

    // one of the following sources will provide our image data
    PixelColor func(x, y, w, h int) color.RGBA // Render the image from code
    File       string                          // Load the image froma file
}

Image describes a raster image area that can render in a Fyne canvas

func NewImageFromFile Uses

func NewImageFromFile(file string) *Image

NewImageFromFile creates a new image from a local file. Images returned from this method will scale to fit the canvas object.

func NewImageFromImage Uses

func NewImageFromImage(img image.Image) *Image

NewImageFromImage returns a new Image instance that is rendered from the Go image.Image passed in. Images returned from this method will map pixel for pixel to the screen starting img.Bounds().Min pixels from the top left of the canvas object.

func NewImageFromResource Uses

func NewImageFromResource(res *fyne.Resource) *Image

NewImageFromResource creates a new image by loading the specified resource. Images returned from this method will scale to fit the canvas object.

func NewRaster Uses

func NewRaster(pixelColor func(x, y, w, h int) color.RGBA) *Image

NewRaster returns a new Image instance that is rendered dynamically using the specified pixelColor function. Images returned from this method should draw dynamically to fill the width and height parameters passed to pixelColor.

func (*Image) CurrentPosition Uses

func (r *Image) CurrentPosition() fyne.Position

CurrentPosition gets the current position of this image object, relative to it's parent / canvas

func (*Image) CurrentSize Uses

func (r *Image) CurrentSize() fyne.Size

CurrentSize returns the current size of this image object

func (*Image) MinSize Uses

func (r *Image) MinSize() fyne.Size

MinSize for a Image simply returns Size{1, 1} as there is no explicit content

func (*Image) Move Uses

func (r *Image) Move(pos fyne.Position)

Move the image object to a new position, relative to it's parent / canvas

func (*Image) Resize Uses

func (r *Image) Resize(size fyne.Size)

Resize sets a new size for the image object

type Line Uses

type Line struct {
    Position1 fyne.Position // The current top-left position of the Line
    Position2 fyne.Position // The current bottomright position of the Line
    Options   Options       // Options to pass to the renderer

    StrokeColor color.RGBA // The line stroke colour
    StrokeWidth float32    // The stroke width of the line
}

Line describes a coloured line primitive in a Fyne canvas. Lines are special as they can have a negative width or height to indicate an inverse slope (i.e. slope up vs down).

func NewLine Uses

func NewLine(color color.RGBA) *Line

NewLine returns a new Line instance

func (*Line) CurrentPosition Uses

func (l *Line) CurrentPosition() fyne.Position

CurrentPosition gets the current top-left position of this line object, relative to it's parent / canvas

func (*Line) CurrentSize Uses

func (l *Line) CurrentSize() fyne.Size

CurrentSize returns the current size of bounding box for this line object

func (*Line) MinSize Uses

func (l *Line) MinSize() fyne.Size

MinSize for a Line simply returns Size{1, 1} as there is no explicit content

func (*Line) Move Uses

func (l *Line) Move(pos fyne.Position)

Move the line object to a new position, relative to it's parent / canvas

func (*Line) Resize Uses

func (l *Line) Resize(size fyne.Size)

Resize sets a new bottom-right position for the line object

type Options Uses

type Options struct {
    RepeatEvents bool // Repeat events on this object to the one below
}

Options collects various rendering hints that will be passed to the backend.

type Rectangle Uses

type Rectangle struct {
    Size     fyne.Size     // The current size of the Rectangle
    Position fyne.Position // The current position of the Rectangle
    Options  Options       // Options to pass to the renderer

    FillColor   color.RGBA // The rectangle fill colour
    StrokeColor color.RGBA // The rectangle stroke colour
    StrokeWidth float32    // The stroke width of the rectangle
}

Rectangle describes a coloured rectangle primitive in a Fyne canvas

func NewRectangle Uses

func NewRectangle(color color.RGBA) *Rectangle

NewRectangle returns a new Rectangle instance

func (*Rectangle) CurrentPosition Uses

func (r *Rectangle) CurrentPosition() fyne.Position

CurrentPosition gets the current position of this rectangle object, relative to it's parent / canvas

func (*Rectangle) CurrentSize Uses

func (r *Rectangle) CurrentSize() fyne.Size

CurrentSize returns the current size of this rectangle object

func (*Rectangle) MinSize Uses

func (r *Rectangle) MinSize() fyne.Size

MinSize for a Rectangle simply returns Size{1, 1} as there is no explicit content

func (*Rectangle) Move Uses

func (r *Rectangle) Move(pos fyne.Position)

Move the rectangle object to a new position, relative to it's parent / canvas

func (*Rectangle) Resize Uses

func (r *Rectangle) Resize(size fyne.Size)

Resize sets a new size for the rectangle object

type Text Uses

type Text struct {
    Size      fyne.Size      // The current size of the Text - the font will not scale to this Size
    Position  fyne.Position  // The current position of the Text
    Alignment fyne.TextAlign // The alignment of the text content
    Options   Options        // Options to pass to the renderer

    Color     color.RGBA     // The main text draw colour
    Text      string         // The string content of this Text
    TextSize  int            // Size of the text - if the Canvas scale is 1.0 this will be equivalent to point size
    TextStyle fyne.TextStyle // The style of the text content
}

Text describes a text primitive in a Fyne canvas

func NewText Uses

func NewText(text string, color color.RGBA) *Text

NewText returns a new Text implementation

func (*Text) CurrentPosition Uses

func (t *Text) CurrentPosition() fyne.Position

CurrentPosition gets the current position of this text object, relative to it's parent / canvas

func (*Text) CurrentSize Uses

func (t *Text) CurrentSize() fyne.Size

CurrentSize gets the current size of this text object

func (*Text) MinSize Uses

func (t *Text) MinSize() fyne.Size

MinSize returns the minimum size of this text objet based on it's font size and content. This is normally determined by the render implementation.

func (*Text) Move Uses

func (t *Text) Move(pos fyne.Position)

Move the text object to a new position, relative to it's parent / canvas

func (*Text) Resize Uses

func (t *Text) Resize(size fyne.Size)

Resize sets a new size for the text object

Package canvas imports 5 packages (graph) and is imported by 5 packages. Updated 2018-07-18. Refresh now. Tools for package owners.