Documentation
¶
Overview ¶
Package gfx provides different kinds of functions and graphic primitives that bring life onto the screen.
Index ¶
- Variables
- func CanvasAvailable() bool
- func Clear()
- func Render(r renderer, p *Params)
- func SetCamera(c *Camera)
- func SetClearColor(r, g, b float64)
- func SetDefaultFilterMode(fm FilterMode)
- func SetPixelSize(size int32)
- type Camera
- type Canvas
- type Circle
- type FilterMode
- type FlipBook
- type Font
- type Image
- type Line
- type LineMode
- type OnFlip
- type Page
- type Params
- type Polygon
- type Rectangle
- type Rotation
- type Scale
Constants ¶
This section is empty.
Variables ¶
var Fullscreen bool
Fullscreen indicates whether the graphics are in fullscreen mode or not.
var Height int32
Height is the height in pixels of the complete drawing area.
var Width int32
Width is the width in pixels of the complete drawing area.
Functions ¶
func CanvasAvailable ¶
func CanvasAvailable() bool
CanvasAvailable returns if the hardware supports a canvas.
func Render ¶
func Render(r renderer, p *Params)
Render uses a renderer to put pixels onto the screen directly.
func SetClearColor ¶
func SetClearColor(r, g, b float64)
SetClearColor sets the color with which the screen will be filled when calling Clear().
func SetDefaultFilterMode ¶
func SetDefaultFilterMode(fm FilterMode)
SetDefaultFilterMode sets the filter mode which will be used by default when creating a new Image or Canvas.
func SetPixelSize ¶
func SetPixelSize(size int32)
SetPixelSize scales all graphics by the given factor.
Types ¶
type Camera ¶
Camera represents an area on the screen.
func (*Camera) SetPixelSize ¶
SetPixelSize scales all graphics by the given factor.
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
Canvas is an offscreen area which can be rendered to and rendered on to the screen.
type Circle ¶
type Circle struct { Radius float64 Filled bool Mode *LineMode // contains filtered or unexported fields }
Circle is a geometric shape that can be rendered with gfx.Render.
type FilterMode ¶
type FilterMode int
FilterMode represents the interpolation mode for texture rendering.
const ( // NearestFilter scales images with nearest neighbor interpolation. NearestFilter FilterMode = iota // LinearFilter scales image with linear interpolation. LinearFilter )
type FlipBook ¶
type FlipBook struct {
// contains filtered or unexported fields
}
FlipBook represents a timed sequence of renderers.
func NewFlipBook ¶
NewFlipBook returns a pointer to a new FlipBook.
func (*FlipBook) AddPageListener ¶
AddPageListener adds a callback that will be called when the page is changed.
func (*FlipBook) ClearPageListeners ¶
func (fb *FlipBook) ClearPageListeners()
ClearPageListeners removes all callback functions.
type Font ¶
type Font struct { Bold bool Italic bool Underline bool Strikethrough bool AntiAliased bool // contains filtered or unexported fields }
Font represents a ttf font which can convert a string into an image.
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image represents an image and can be rendered on the screen.
type LineMode ¶
LineMode defines the way how (out)lines are rendered.
func NewLineMode ¶
func NewLineMode() *LineMode
NewLineMode returns a pointer to a new LineMode with width 1.0 and not smooth.
type OnFlip ¶
type OnFlip func(page int)
OnFlip is a callback that gets triggered when a page is changed. The param page is the page number of the new page.
type Page ¶
Page represents one part of a FlipBook animation. May have nil as renderer for empty pages.
type Params ¶
type Params struct { X float64 Y float64 R float64 G float64 B float64 A float64 Rot Rotation Scale Scale }
Params encompasses all transformations that can be done while rendering an Image.