Documentation
¶
Overview ¶
Example (ColorImageWinOp) ¶
fmt.Println(Color(colornames.Red, Image(nil, "IMap")).String())
Output: Color {255 0 0 255}: Image "IMap"
Example (ImdOpSequence) ¶
circle := Circle(25, px.V(50, 100), 2) smallCircle := Circle(3, px.V(1, 2), 4) fmt.Println(ImdOpSequence(circle, smallCircle).String()) fmt.Println(ImdOpSequence(smallCircle, circle).String())
Output: ImdOp Sequence: Circle radius 25 center Vec(50, 100) thickness 2 Circle radius 3 center Vec(1, 2) thickness 4 ImdOp Sequence: Circle radius 3 center Vec(1, 2) thickness 4 Circle radius 25 center Vec(50, 100) thickness 2
Example (LiftImdOp) ¶
fmt.Println(ToWinOp(Circle(5, px.V(0, 4), 1)).String()) fmt.Println(ToWinOp(Line(px.V(0, 4), px.V(0, 4), 1)).String())
Output: WinOp from ImdOp: Circle radius 5 center Vec(0, 4) thickness 1 WinOp from ImdOp: Line from Vec(0, 4) to Vec(0, 4) thickness 1
Example (MovedImageWinOp) ¶
fmt.Println(Moved(px.V(55, -88), Image(nil, "IMap")).String())
Output: Moved 55 pixels right 88 pixels down: Image "IMap"
Example (MovedLineWinOp) ¶
fmt.Print(Moved(px.V(50, 100.41001), ToWinOp(Line(px.V(0, 4), px.V(5, 6), 10))).String())
Output: Moved 50 pixels right 100 pixels up: WinOp from ImdOp: Line from Vec(0, 4) to Vec(5, 6) thickness 10
Example (MovedRectangleWinOp) ¶
fmt.Println(Moved(px.V(-1, -2), ToWinOp(Rectangle(px.V(0, 4), px.V(5, 6), 10))).String())
Output: Moved 1 pixels left 2 pixels down: WinOp from ImdOp: Rectangle from Vec(0, 4) to Vec(5, 6) thickness 10
Example (MovedTileLayerWinOp) ¶
fmt.Println(Moved(px.V(100, -80), TileLayer(nil, "Foreground")).String())
Output: Moved 100 pixels right 80 pixels down: TileLayer "Foreground"
Example (NestedSequence) ¶
circle := Circle(25, px.V(50, 100), 2) smallCircle := Circle(3, px.V(1, 2), 4) fmt.Println(ImdOpSequence(ImdOpSequence(smallCircle, circle)).String())
Output: ImdOp Sequence: ImdOp Sequence: Circle radius 3 center Vec(1, 2) thickness 4 Circle radius 25 center Vec(50, 100) thickness 2
Example (SequencedWinOps) ¶
mapImage := Color(colornames.Red, Image(nil, "IMap")) ghostImage := Color(colornames.Yellow, Image(nil, "IGhost")) sequence := OpSequence(mapImage, ghostImage) fmt.Println(sequence.String())
Output: WinOp Sequence: Color {255 0 0 255}: Image "IMap" Color {255 255 0 255}: Image "IGhost"
Example (ThenSequence) ¶
sequence := ImdOpSequence(). Then(Circle(25, px.V(50, 100), 2)). Then(Circle(3, px.V(1, 2), 4)) fmt.Println(sequence.String())
Output: ImdOp Sequence: Circle radius 25 center Vec(50, 100) thickness 2 Circle radius 3 center Vec(1, 2) thickness 4
Index ¶
- type ColorOp
- type Context
- type ImageOp
- type ImdCircle
- type ImdColor
- type ImdLine
- type ImdOp
- type ImdRectangle
- type ImdSequence
- type OpMirrored
- type Paragraph
- type TextOp
- type TileLayerOp
- type WinImdOp
- type WinMoved
- type WinOp
- func Color(color color.RGBA, winOp WinOp) WinOp
- func Image(image *px.Sprite, name string) WinOp
- func Mirrored(winOp WinOp) WinOp
- func Moved(translation px.Vec, winOp WinOp) WinOp
- func OpSequence(ops ...WinOp) WinOp
- func TileLayer(tileMap *tilepix.Map, layerName string) WinOp
- func ToWinOp(imdOp ImdOp) WinOp
- type WinOpSequence
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImdOp ¶
func Circle ¶
Example ¶
circle := Circle(25, px.V(50, 100), 2) smallCircle := Circle(3, px.V(1, 2), 4) fmt.Println(circle.String()) fmt.Println(smallCircle.String())
Output: Circle radius 25 center Vec(50, 100) thickness 2 Circle radius 3 center Vec(1, 2) thickness 4
func Line ¶
Example ¶
line := Line(px.V(50, 100), px.V(101, 202), 2) fmt.Println(line.String()) fmt.Println(Line(px.V(1, 2), px.V(3, 4), 5).String())
Output: Line from Vec(50, 100) to Vec(101, 202) thickness 2 Line from Vec(1, 2) to Vec(3, 4) thickness 5
type ImdRectangle ¶
type ImdRectangle struct {
// contains filtered or unexported fields
}
func (ImdRectangle) Lines ¶
func (rectangle ImdRectangle) Lines() []string
func (ImdRectangle) Render ¶
func (rectangle ImdRectangle) Render(imd *imdraw.IMDraw)
func (ImdRectangle) String ¶
func (rectangle ImdRectangle) String() string
type ImdSequence ¶
type ImdSequence struct {
// contains filtered or unexported fields
}
func ImdOpSequence ¶
func ImdOpSequence(imdOps ...ImdOp) ImdSequence
func (ImdSequence) Lines ¶
func (sequence ImdSequence) Lines() []string
func (ImdSequence) Render ¶
func (sequence ImdSequence) Render(imd *imdraw.IMDraw)
func (ImdSequence) String ¶
func (sequence ImdSequence) String() string
func (ImdSequence) Then ¶
func (sequence ImdSequence) Then(imdOp ImdOp) ImdSequence
type OpMirrored ¶
type OpMirrored struct {
// contains filtered or unexported fields
}
func (OpMirrored) DrawTo ¶
func (mirrored OpMirrored) DrawTo(canvas *pixelgl.Canvas, context Context)
func (OpMirrored) Lines ¶
func (mirrored OpMirrored) Lines() []string
func (OpMirrored) String ¶
func (mirrored OpMirrored) String() string
type Paragraph ¶
type Paragraph struct {
// contains filtered or unexported fields
}
type TileLayerOp ¶
type TileLayerOp struct {
// contains filtered or unexported fields
}
func (TileLayerOp) DrawTo ¶
func (tileLayerOp TileLayerOp) DrawTo(canvas *pixelgl.Canvas, _ Context)
func (TileLayerOp) Lines ¶
func (tileLayerOp TileLayerOp) Lines() []string
func (TileLayerOp) Render ¶
func (tileLayerOp TileLayerOp) Render(_ px.Matrix, canvas *pixelgl.Canvas)
func (TileLayerOp) String ¶
func (tileLayerOp TileLayerOp) String() string
type WinOp ¶
type WinOp interface { String() string Lines() []string // Render TODO: should take a Context with matrix and color Render(mx pixel.Matrix, canvas *pixelgl.Canvas) DrawTo(canvas *pixelgl.Canvas, context Context) }
func Color ¶
Example ¶
circle := Circle(25, px.V(50, 100), 2) smallCircle := Circle(3, px.V(1, 2), 4) green := color.RGBA{R: 0, G: 1, B: 0} fmt.Println(Colored(green, circle)) white := color.RGBA{R: 1, G: 1, B: 1} fmt.Println(Colored(white, smallCircle))
Output: Color {0 1 0 0}: Circle radius 25 center Vec(50, 100) thickness 2 Color {1 1 1 0}: Circle radius 3 center Vec(1, 2) thickness 4
func Mirrored ¶
Example ¶
mapImage := Image(nil, "IMap") ghostImage := Color(colornames.Yellow, Image(nil, "IGhost")) seq := OpSequence(mapImage, ghostImage) mirrored := Mirrored(seq) fmt.Println(mirrored.String())
Output: Mirrored around Y axis: WinOp Sequence: Image "IMap" Color {255 255 0 255}: Image "IGhost"
func OpSequence ¶
type WinOpSequence ¶
type WinOpSequence struct {
// contains filtered or unexported fields
}
func (WinOpSequence) DrawTo ¶
func (sequence WinOpSequence) DrawTo(canvas *pixelgl.Canvas, context Context)
func (WinOpSequence) Lines ¶
func (sequence WinOpSequence) Lines() []string
func (WinOpSequence) Render ¶
func (sequence WinOpSequence) Render(mx px.Matrix, canvas *pixelgl.Canvas)
func (WinOpSequence) String ¶
func (sequence WinOpSequence) String() string
Click to show internal directories.
Click to hide internal directories.