Documentation

Overview

    Package vggio provides a vg.Canvas implementation backed by Gioui.

    Index

    Examples

    Constants

    View Source
    const DefaultDPI = 96

      DefaultDPI is the default dot resolution for image drawing in dots per inch.

      Variables

      This section is empty.

      Functions

      func UseBackgroundColor

      func UseBackgroundColor(c color.Color) option

        UseBackgroundColor specifies the image background color. Without UseBackgroundColor, the default color is white.

        func UseDPI

        func UseDPI(dpi int) option

          UseDPI sets the dots per inch of a canvas. It should only be used as an option argument when initializing a new canvas.

          Types

          type Canvas

          type Canvas struct {
          	*vgimg.Canvas
          	// contains filtered or unexported fields
          }

            Canvas implements the vg.Canvas interface, drawing to an image.Image using vgimg and painting that image into a Gioui context.

            Example
            Output:
            
            

            func New

            func New(gtx layout.Context, w, h vg.Length, opts ...option) *Canvas

              New returns a new image canvas with the provided dimensions and options. The currently accepted options are UseDPI and UseBackgroundColor. If the resolution or background color are not specified, defaults are used.

              func (*Canvas) Paint

              func (c *Canvas) Paint(e system.FrameEvent)

                Paint paints the canvas' content on the screen.

                Source Files