image

package
v0.0.0-...-c134eb5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2012 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clip

type Clip struct {
	image.Rectangle
	Image *Image
}

func NewClip

func NewClip(img *Image, x, y, w, h int) *Clip

func (*Clip) Draw

func (c *Clip) Draw()

func (*Clip) DrawAt

func (c *Clip) DrawAt(x, y int)

type Image

type Image struct {
	image.Image
	FilePath string
	W, H     int
	// contains filtered or unexported fields
}

func New

func New(path string) *Image

New initializes a new image from the given file path.

func (*Image) Draw

func (img *Image) Draw()

Draw is DrawAt(0, 0)

func (*Image) DrawAt

func (img *Image) DrawAt(x, y int)

DrawAt draws the image at the specified position.

func (*Image) DrawRectAt

func (img *Image) DrawRectAt(rx, ry, rw, rh, x, y int)

DrawRectAt draws a portion of the image specified w at the specified position.

func (*Image) DrawRectangle

func (img *Image) DrawRectangle(rect image.Rectangle)

DrawRectangle is DrawRectangleAt with a zero position.

func (*Image) DrawRectangleAt

func (img *Image) DrawRectangleAt(rect image.Rectangle, x, y int)

DrawRectangleAt draws a portion of the image defined by an image.Rectangle, at the specified position.

func (*Image) Gen

func (img *Image) Gen()

func (*Image) Sprite

func (img *Image) Sprite(w, h int) *Sprite

Sprite creates a sprite from the image, with the specified grid.

type Sequence

type Sequence struct {
	Sprite              *Sprite
	Speed               float64
	StartTime, StopTime time.Time
	From, To, Curr      int
	IsPlaying           bool
}

func NewSequence

func NewSequence(s *Sprite, from, to int) *Sequence

func (*Sequence) DrawFrameAt

func (s *Sequence) DrawFrameAt(x, y int)

func (*Sequence) Pause

func (s *Sequence) Pause()

func (*Sequence) Play

func (s *Sequence) Play(speed float64)

func (*Sequence) Toggle

func (s *Sequence) Toggle()

type Sprite

type Sprite struct {
	Clips        []*Clip
	ClipW, ClipH int
}

func NewSprite

func NewSprite(img *Image, w, h int) *Sprite

func (*Sprite) DrawClip

func (s *Sprite) DrawClip(index int)

func (*Sprite) DrawClipAt

func (s *Sprite) DrawClipAt(index, x, y int)

func (*Sprite) Sequence

func (s *Sprite) Sequence(from, to int) *Sequence

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL