Documentation
¶
Index ¶
- Constants
- Variables
- func Clamp(v, min, max float32) float32
- func DevSquared(a, b, c mgl32.Vec2) float32
- func Lerp(t float32, p, q mgl32.Vec2) mgl32.Vec2
- func Mixing(to, a, b HardwareResult)
- func Use(c Context)
- func Vec2(x, y float32) mgl32.Vec2
- func Vec4(x, y, z, w float32) mgl32.Vec4
- type ColorFiller
- type Context
- type Driver
- type Filler
- type FillerWithBound
- type Hardware
- type HardwareBound
- type HardwareColor
- type HardwareContext
- type HardwareFiller
- type HardwareProgram
- type HardwareResult
- type HardwareWorkspace
- type ImageFillerMode
- type Options
- func (s *Options) Clone() Options
- func (s *Options) DefaultOption()
- func (s *Options) GetFiller() Filler
- func (s *Options) GetStrokeCap() StrokeCap
- func (s *Options) GetStrokeColor() color.Color
- func (s *Options) GetStrokeJoin() StrokeJoin
- func (s *Options) GetStrokeWidth() float32
- func (s *Options) Restore(opt Options)
- func (s *Options) SetFiller(f Filler)
- func (s *Options) SetStrokeCap(c StrokeCap)
- func (s *Options) SetStrokeColor(c color.Color)
- func (s *Options) SetStrokeJoin(j StrokeJoin)
- func (s *Options) SetStrokeWidth(w float32)
- type Path
- type Rasterizer
- type StrokeCap
- type StrokeJoin
- type SubHardware
- func (s *SubHardware) Bound() image.Rectangle
- func (s *SubHardware) Clear()
- func (s *SubHardware) CloseTo()
- func (s *SubHardware) CubeTo(pivot1, pivot2, to mgl32.Vec2)
- func (s *SubHardware) Fill()
- func (s *SubHardware) FillStroke()
- func (s *SubHardware) LineTo(to mgl32.Vec2)
- func (s *SubHardware) MoveTo(to mgl32.Vec2)
- func (s *SubHardware) Point() mgl32.Vec2
- func (s *SubHardware) PreviousPoint() mgl32.Vec2
- func (s *SubHardware) QuadTo(pivot, to mgl32.Vec2)
- func (s *SubHardware) Reset()
- func (s *SubHardware) Root() Rasterizer
- func (s *SubHardware) Size() (w, h float32)
- func (s *SubHardware) Stroke()
- func (s *SubHardware) SubRasterizer(r image.Rectangle) SubRasterizer
- type SubRasterizer
- type VectorDrawer
- type VectorOptions
Constants ¶
View Source
const (
HARDWAREPOINTMINCAPACITY = 64
)
Variables ¶
Functions ¶
func DevSquared ¶
func Mixing ¶
func Mixing(to, a, b HardwareResult)
Types ¶
type ColorFiller ¶
func NewColorFiller ¶
func NewColorFiller(c color.Color) ColorFiller
func (ColorFiller) RGBA ¶
func (s ColorFiller) RGBA() (r, g, b, a uint32)
type Context ¶
type Context interface {
Driver() Driver
LoadStroker() HardwareProgram
LoadFiller() HardwareProgram
LoadColor() HardwareProgram
LoadFixed() HardwareProgram
LoadGaussian() HardwareProgram
LoadNearest() HardwareProgram
LoadNearestNeighbor() HardwareProgram
LoadRepeat() HardwareProgram
LoadRepeatHorizontal() HardwareProgram
LoadRepeatVertical() HardwareProgram
UnloadStroker(p HardwareProgram)
UnloadFiller(p HardwareProgram)
UnloadColor(p HardwareProgram)
UnloadFixed(p HardwareProgram)
UnloadGaussian(p HardwareProgram)
UnloadNearest(p HardwareProgram)
UnloadNearestNeighbor(p HardwareProgram)
UnloadRepeat(p HardwareProgram)
UnloadRepeatHorizontal(p HardwareProgram)
UnloadRepeatVertical(p HardwareProgram)
// utils
UtilLoadMixing() HardwareProgram
UtilUnloadMixing(p HardwareProgram)
// delete
Delete()
}
func CreateSimpleContext ¶
type Driver ¶
type Driver interface {
Init() error
Version() (major int, minor int)
ComputeProgram(source io.Reader) (HardwareProgram, error)
WorkSpace(w, h int) HardwareWorkspace
Result(w, h int) HardwareResult
Bound() HardwareBound
Color() HardwareColor
Context() HardwareContext
Filler(rgba *image.RGBA) HardwareFiller
}
type Filler ¶
type Filler interface {
// contains filtered or unexported methods
}
func NewImageFiller ¶
func NewImageFiller(i image.Image, mode ImageFillerMode) Filler
type FillerWithBound ¶
type FillerWithBound interface {
Filler
// contains filtered or unexported methods
}
type Hardware ¶
type Hardware struct {
SubHardware
// contains filtered or unexported fields
}
func NewHardware ¶
func NewHardware(to HardwareResult) *Hardware
type HardwareBound ¶
type HardwareColor ¶
type HardwareContext ¶
type HardwareFiller ¶
type HardwareFiller interface {
Delete()
}
type HardwareProgram ¶
type HardwareProgram interface {
Use()
BindWorkspace(i int, o HardwareWorkspace)
BindResult(i int, o HardwareResult)
BindContext(i int, o HardwareContext)
BindBound(i int, o HardwareBound)
BindColor(i int, o HardwareColor)
BindFiller(i int, o HardwareFiller)
Compute(x, y, z int)
Delete()
}
type HardwareResult ¶
type HardwareWorkspace ¶
type ImageFillerMode ¶
type ImageFillerMode uint8
const ( ImageFillerFixed ImageFillerMode = iota ImageFillerNearest ImageFillerMode = iota ImageFillerNearestNeighbor ImageFillerMode = iota ImageFillerGausian ImageFillerMode = iota ImageFillerRepeat ImageFillerMode = iota ImageFillerVerticalRepeat ImageFillerMode = iota ImageFillerHorizontalRepeat ImageFillerMode = iota )
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func (*Options) DefaultOption ¶
func (s *Options) DefaultOption()
func (*Options) GetStrokeCap ¶
func (*Options) GetStrokeColor ¶
func (*Options) GetStrokeJoin ¶
func (s *Options) GetStrokeJoin() StrokeJoin
func (*Options) GetStrokeWidth ¶
func (*Options) SetStrokeCap ¶
func (*Options) SetStrokeColor ¶
func (*Options) SetStrokeJoin ¶
func (s *Options) SetStrokeJoin(j StrokeJoin)
func (*Options) SetStrokeWidth ¶
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
import (
"golang.org/vecx/image/math/fixed" "image/Color"
)
type Rasterizer ¶
type Rasterizer interface {
Setup(w, h int)
SubRasterizer
}
type StrokeJoin ¶
type StrokeJoin uint8
const ( StrokeJoinBevel StrokeJoin = iota StrokeJoinRound StrokeJoin = iota StrokeJoinMiter StrokeJoin = iota )
type SubHardware ¶
type SubHardware struct {
Options
// contains filtered or unexported fields
}
func (*SubHardware) Bound ¶
func (s *SubHardware) Bound() image.Rectangle
func (*SubHardware) Clear ¶
func (s *SubHardware) Clear()
func (*SubHardware) CloseTo ¶
func (s *SubHardware) CloseTo()
func (*SubHardware) CubeTo ¶
func (s *SubHardware) CubeTo(pivot1, pivot2, to mgl32.Vec2)
func (*SubHardware) Fill ¶
func (s *SubHardware) Fill()
func (*SubHardware) FillStroke ¶
func (s *SubHardware) FillStroke()
func (*SubHardware) LineTo ¶
func (s *SubHardware) LineTo(to mgl32.Vec2)
func (*SubHardware) MoveTo ¶
func (s *SubHardware) MoveTo(to mgl32.Vec2)
func (*SubHardware) Point ¶
func (s *SubHardware) Point() mgl32.Vec2
func (*SubHardware) PreviousPoint ¶
func (s *SubHardware) PreviousPoint() mgl32.Vec2
func (*SubHardware) QuadTo ¶
func (s *SubHardware) QuadTo(pivot, to mgl32.Vec2)
func (*SubHardware) Reset ¶
func (s *SubHardware) Reset()
func (*SubHardware) Stroke ¶
func (s *SubHardware) Stroke()
func (*SubHardware) SubRasterizer ¶
func (s *SubHardware) SubRasterizer(r image.Rectangle) SubRasterizer
type SubRasterizer ¶
type SubRasterizer interface {
Root() Rasterizer
Bound() image.Rectangle
SubRasterizer(r image.Rectangle) SubRasterizer
VectorDrawer
}
type VectorDrawer ¶
type VectorDrawer interface {
// Infomation
Size() (w, h float32)
PreviousPoint() mgl32.Vec2
Point() mgl32.Vec2
// Path
Reset()
MoveTo(to mgl32.Vec2)
LineTo(to mgl32.Vec2)
QuadTo(pivot, to mgl32.Vec2)
CubeTo(pivot1, pivot2, to mgl32.Vec2)
CloseTo()
// Draw
Clear()
Stroke()
Fill()
FillStroke()
//
// Options
VectorOptions
}
type VectorOptions ¶
type VectorOptions interface {
DefaultOption()
Restore(opt Options)
Clone() Options
// getter
GetFiller() Filler
GetStrokeWidth() float32
GetStrokeJoin() StrokeJoin
GetStrokeCap() StrokeCap
GetStrokeColor() color.Color
// setter
SetFiller(f Filler)
SetStrokeWidth(w float32)
SetStrokeJoin(j StrokeJoin)
SetStrokeCap(c StrokeCap)
SetStrokeColor(c color.Color)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.