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

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

Index

Package Files

base.go 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
    Hidden    bool          // Is this circle currently hidden

    FillColor   color.Color // The circle fill colour
    StrokeColor color.Color // 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.Color) *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) Hide Uses

func (l *Circle) Hide()

Hide will set this circle to not be visible

func (*Circle) IsVisible Uses

func (l *Circle) IsVisible() bool

IsVisible returns true if this circle is visible, false otherwise

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

func (*Circle) Show Uses

func (l *Circle) Show()

Show will set this circle to be visible

type Image Uses

type Image struct {

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

    Translucency float64 // Set a translucency value > 0.0 to fade the image
    // contains filtered or unexported fields
}

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.Color) *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) Alpha Uses

func (i *Image) Alpha() float64

Alpha is a convenience function that returns the alpha value for an image based on it's Translucency value. The result is 1.0 - Translucency.

func (*Image) CurrentPosition Uses

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

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

func (*Image) CurrentSize Uses

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

CurrentSize returns the current size of this rectangle object

func (*Image) Hide Uses

func (r *Image) Hide()

Hide will set this object to not be visible

func (*Image) IsVisible Uses

func (r *Image) IsVisible() bool

IsVisible returns true if this object is visible, false otherwise

func (*Image) MinSize Uses

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

MinSize returns the specified minimum size, if set, or {1, 1} otherwise

func (*Image) Move Uses

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

Move the rectangle 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 rectangle object

func (*Image) SetMinSize Uses

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

SetMinSize specifies the smallest size this object should be

func (*Image) Show Uses

func (r *Image) Show()

Show will set this object to be visible

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
    Hidden    bool          // Is this Line currently hidden

    StrokeColor color.Color // 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.Color) *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) Hide Uses

func (l *Line) Hide()

Hide will set this line to not be visible

func (*Line) IsVisible Uses

func (l *Line) IsVisible() bool

IsVisible returns true if this line// Show will set this circle to be visible is visible, false otherwise

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

func (*Line) Show Uses

func (l *Line) Show()

Show will set this line to be visible

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 {
    FillColor   color.Color // The rectangle fill colour
    StrokeColor color.Color // The rectangle stroke colour
    StrokeWidth float32     // The stroke width of the rectangle
    // contains filtered or unexported fields
}

Rectangle describes a coloured rectangle primitive in a Fyne canvas

func NewRectangle Uses

func NewRectangle(color color.Color) *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) Hide Uses

func (r *Rectangle) Hide()

Hide will set this object to not be visible

func (*Rectangle) IsVisible Uses

func (r *Rectangle) IsVisible() bool

IsVisible returns true if this object is visible, false otherwise

func (*Rectangle) MinSize Uses

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

MinSize returns the specified minimum size, if set, or {1, 1} otherwise

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

func (*Rectangle) SetMinSize Uses

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

SetMinSize specifies the smallest size this object should be

func (*Rectangle) Show Uses

func (r *Rectangle) Show()

Show will set this object to be visible

type Text Uses

type Text struct {
    Alignment fyne.TextAlign // The alignment of the text content

    Color     color.Color    // 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
    // contains filtered or unexported fields
}

Text describes a text primitive in a Fyne canvas. A text object can have a style set which will apply to the whole string. No formatting or text parsing will be performed

func NewText Uses

func NewText(text string, color color.Color) *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) Hide Uses

func (r *Text) Hide()

Hide will set this object to not be visible

func (*Text) IsVisible Uses

func (r *Text) IsVisible() bool

IsVisible returns true if this object is visible, false otherwise

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

func (*Text) SetMinSize Uses

func (r *Text) SetMinSize(size fyne.Size)

SetMinSize specifies the smallest size this object should be

func (*Text) Show Uses

func (r *Text) Show()

Show will set this object to be visible

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