Documentation ¶
Index ¶
- Constants
- Variables
- func CheckError()
- func StartDriver(appThread AppThread)
- type AppThread
- type Blitter
- func (b *Blitter) Blit(ctx *Context, ss SamplerSource, srcRect, dstRect math.Rect, ds *DrawState)
- func (b *Blitter) BlitGlyph(ctx *Context, ss SamplerSource, c gxui.Color, srcRect, dstRect math.Rect, ...)
- func (b *Blitter) BlitRect(ctx *Context, dstRect math.Rect, color gxui.Color, ds *DrawState)
- func (b *Blitter) BlitShape(ctx *Context, shape Shape, color gxui.Color, ds *DrawState)
- func (b *Blitter) Commit(ctx *Context)
- func (b *Blitter) CommitGlyphs(ctx *Context)
- func (b *Blitter) Destroy(ctx *Context)
- type Canvas
- func (c *Canvas) AddClip(r math.Rect)
- func (r *Canvas) AddRef()
- func (r *Canvas) Alive() bool
- func (r *Canvas) AssertAlive(funcName string)
- func (c *Canvas) Clear(color gxui.Color)
- func (c *Canvas) Complete()
- func (c *Canvas) DrawCanvas(canvas gxui.Canvas, offsetDips math.Point)
- func (c *Canvas) DrawLines(lines gxui.Polygon, pen gxui.Pen)
- func (c *Canvas) DrawPolygon(poly gxui.Polygon, pen gxui.Pen, brush gxui.Brush)
- func (c *Canvas) DrawRect(r math.Rect, brush gxui.Brush)
- func (c *Canvas) DrawRoundedRect(r math.Rect, tl, tr, bl, br float32, pen gxui.Pen, brush gxui.Brush)
- func (c *Canvas) DrawRunes(f gxui.Font, r []rune, col gxui.Color, p []math.Point, o math.Point)
- func (c *Canvas) DrawText(f gxui.Font, s string, col gxui.Color, r math.Rect, h gxui.HorizontalAlignment, ...)
- func (c *Canvas) DrawTexture(t gxui.Texture, r math.Rect)
- func (c *Canvas) Pop()
- func (c *Canvas) Push()
- func (c *Canvas) Release()
- func (c *Canvas) Size() math.Size
- type CanvasOp
- type Context
- func (c *Context) Apply(ds *DrawState)
- func (c *Context) BeginDraw(sizeDips, sizePixels math.Size)
- func (c *Context) Destroy()
- func (c *Context) DipsToPixels() float32
- func (c *Context) EndDraw()
- func (c *Context) GetOrCreateIndexBufferContext(ib *IndexBuffer) IndexBufferContext
- func (c *Context) GetOrCreateTextureContext(t *Texture) TextureContext
- func (c *Context) GetOrCreateVertexStreamContext(vs *VertexStream) VertexStreamContext
- func (c *Context) LastStats() Stats
- func (c *Context) PointDipsToPixels(dips math.Point) math.Point
- func (c *Context) RectDipsToPixels(dips math.Rect) math.Rect
- func (c *Context) RenderTargetSizePixels() math.Size
- func (c *Context) Resolution() Resolution
- func (c *Context) SizeDipsToPixels(dips math.Size) math.Size
- func (c *Context) SizePixelsToDips(dips math.Size) math.Size
- func (c *Context) Stats() *Stats
- type DrawMode
- type DrawState
- type DrawStateStack
- type Driver
- func (d *Driver) CreateCanvas(s math.Size) gxui.Canvas
- func (d *Driver) CreateFont(data []byte, size int) (gxui.Font, error)
- func (d *Driver) CreateTexture(img image.Image, pixelsPerDip float32) gxui.Texture
- func (d *Driver) CreateViewport(width, height int, name string) gxui.Viewport
- func (d *Driver) EnableDebug(enabled bool)
- func (d *Driver) Events() chan func()
- func (d *Driver) GetClipboard() (str string, err error)
- func (d *Driver) SetClipboard(str string)
- func (d *Driver) Terminate()
- type Font
- func (f *Font) Draw(ctx *Context, str string, col gxui.Color, alignRectDips math.Rect, ...)
- func (f *Font) DrawRunes(ctx *Context, runes []rune, col gxui.Color, points []math.Point, ...)
- func (f *Font) GlyphMaxSize() math.Size
- func (f *Font) LayoutRunes(points []math.Point, runes []rune, alignRectDips math.Rect, ...)
- func (f *Font) LoadGlyphs(first, last rune)
- func (f *Font) Measure(s string) math.Size
- func (f *Font) MeasureRunes(runes []rune) math.Size
- func (f *Font) Size() int
- type Framebuffer
- type FramebufferPool
- type GlobalStats
- type GlyphBatch
- type IndexBuffer
- type IndexBufferContext
- type PrimitiveType
- type Quad
- type RefCounted
- type Resolution
- type SamplerSource
- type ShaderDataType
- type ShaderProgram
- type Shape
- type Stats
- type Texture
- func (r *Texture) AddRef()
- func (r *Texture) Alive() bool
- func (r *Texture) AssertAlive(funcName string)
- func (t *Texture) CreateContext() TextureContext
- func (t *Texture) FlipY() bool
- func (t *Texture) Image() image.Image
- func (r *Texture) Release()
- func (t *Texture) SetFlipY(flipY bool)
- func (t *Texture) Size() math.Size
- func (t *Texture) SizePixels() math.Size
- type TextureContext
- type Timer
- type UniformBindings
- type VertexBuffer
- type VertexStream
- func (r *VertexStream) AddRef()
- func (r *VertexStream) Alive() bool
- func (r *VertexStream) AssertAlive(funcName string)
- func (s VertexStream) CreateContext() VertexStreamContext
- func (s VertexStream) Name() string
- func (s *VertexStream) Release()
- func (s VertexStream) Type() ShaderDataType
- func (s VertexStream) VertexCount() int
- type VertexStreamContext
- type Viewport
- func (v *Viewport) Close()
- func (v *Viewport) Destroy()
- func (v *Viewport) Hide()
- func (v *Viewport) OnClose(f func()) gxui.EventSubscription
- func (v *Viewport) OnKeyDown(f func(gxui.KeyboardEvent)) gxui.EventSubscription
- func (v *Viewport) OnKeyRepeat(f func(gxui.KeyboardEvent)) gxui.EventSubscription
- func (v *Viewport) OnKeyStroke(f func(gxui.KeyStrokeEvent)) gxui.EventSubscription
- func (v *Viewport) OnKeyUp(f func(gxui.KeyboardEvent)) gxui.EventSubscription
- func (v *Viewport) OnMouseDown(f func(gxui.MouseEvent)) gxui.EventSubscription
- func (v *Viewport) OnMouseEnter(f func(gxui.MouseEvent)) gxui.EventSubscription
- func (v *Viewport) OnMouseExit(f func(gxui.MouseEvent)) gxui.EventSubscription
- func (v *Viewport) OnMouseMove(f func(gxui.MouseEvent)) gxui.EventSubscription
- func (v *Viewport) OnMouseScroll(f func(gxui.MouseEvent)) gxui.EventSubscription
- func (v *Viewport) OnMouseUp(f func(gxui.MouseEvent)) gxui.EventSubscription
- func (v *Viewport) OnResize(f func()) gxui.EventSubscription
- func (v *Viewport) SetCanvas(canvas gxui.Canvas)
- func (v *Viewport) SetTitle(title string)
- func (v *Viewport) Show()
- func (v *Viewport) SizeDips() math.Size
- func (v *Viewport) SizePixels() math.Size
- func (v *Viewport) Stats() string
- func (v *Viewport) Title() string
Constants ¶
View Source
const HistorySize = 100
Variables ¶
View Source
var COLOR_FS_SOURCE = `
uniform vec4 Color;
void main() {
gl_FragColor = Color;
gl_FragColor *= gl_FragColor.a; // PMA
}
`
View Source
var COLOR_VS_SOURCE = `` /* 159-byte string literal not displayed */
View Source
var COPY_FS_SOURCE = `` /* 126-byte string literal not displayed */
View Source
var COPY_VS_SOURCE = `` /* 230-byte string literal not displayed */
View Source
var FONT_FS_SOURCE = `` /* 291-byte string literal not displayed */
View Source
var FONT_VS_SOURCE = `` /* 496-byte string literal not displayed */
Functions ¶
func CheckError ¶
func CheckError()
func StartDriver ¶
func StartDriver(appThread AppThread)
Types ¶
type Blitter ¶
type Blitter struct {
// contains filtered or unexported fields
}
func CreateBlitter ¶
func (*Blitter) CommitGlyphs ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
func CreateCanvas ¶
func (*Canvas) AssertAlive ¶
func (r *Canvas) AssertAlive(funcName string)
func (*Canvas) DrawPolygon ¶
func (*Canvas) DrawRoundedRect ¶
type CanvasOp ¶
type CanvasOp func(ctx *Context, dss *DrawStateStack)
type Context ¶
type Context struct { Blitter *Blitter // contains filtered or unexported fields }
func CreateContext ¶
func CreateContext() *Context
func (*Context) DipsToPixels ¶
func (*Context) GetOrCreateIndexBufferContext ¶
func (c *Context) GetOrCreateIndexBufferContext(ib *IndexBuffer) IndexBufferContext
func (*Context) GetOrCreateTextureContext ¶
func (c *Context) GetOrCreateTextureContext(t *Texture) TextureContext
func (*Context) GetOrCreateVertexStreamContext ¶
func (c *Context) GetOrCreateVertexStreamContext(vs *VertexStream) VertexStreamContext
func (*Context) RenderTargetSizePixels ¶
func (*Context) Resolution ¶
func (c *Context) Resolution() Resolution
type DrawStateStack ¶
type DrawStateStack []DrawState
func (*DrawStateStack) Head ¶
func (s *DrawStateStack) Head() *DrawState
func (*DrawStateStack) Pop ¶
func (s *DrawStateStack) Pop()
func (*DrawStateStack) Push ¶
func (s *DrawStateStack) Push(ds DrawState)
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func (*Driver) CreateTexture ¶
func (*Driver) CreateViewport ¶
func (*Driver) EnableDebug ¶
func (*Driver) GetClipboard ¶
func (*Driver) SetClipboard ¶
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
func (*Font) GlyphMaxSize ¶
func (*Font) LayoutRunes ¶
func (f *Font) LayoutRunes(points []math.Point, runes []rune, alignRectDips math.Rect, h gxui.HorizontalAlignment, v gxui.VerticalAlignment)
func (*Font) LoadGlyphs ¶
type Framebuffer ¶
type Framebuffer struct {
// contains filtered or unexported fields
}
func CreateFramebuffer ¶
func CreateFramebuffer(dimensions math.Size) *Framebuffer
func (Framebuffer) Delete ¶
func (f Framebuffer) Delete()
func (Framebuffer) SizeBytes ¶
func (f Framebuffer) SizeBytes() int
type FramebufferPool ¶
type FramebufferPool struct {
// contains filtered or unexported fields
}
func CreateFramebufferPool ¶
func CreateFramebufferPool(targetBytesAllocated int, stats *Stats) *FramebufferPool
func (*FramebufferPool) Acquire ¶
func (p *FramebufferPool) Acquire(dimensions math.Size) *Framebuffer
func (*FramebufferPool) Release ¶
func (p *FramebufferPool) Release(framebuffer *Framebuffer)
type GlobalStats ¶
type GlobalStats struct { CanvasCount int ShapeCount int VertexBufferCount int VertexStreamCount int IndexBufferCount int }
func (GlobalStats) String ¶
func (s GlobalStats) String() string
type GlyphBatch ¶
type IndexBuffer ¶
type IndexBuffer struct {
// contains filtered or unexported fields
}
func CreateIndexBuffer ¶
func CreateIndexBuffer(ty PrimitiveType, data interface{}) *IndexBuffer
func (*IndexBuffer) AssertAlive ¶
func (r *IndexBuffer) AssertAlive(funcName string)
func (IndexBuffer) CreateContext ¶
func (b IndexBuffer) CreateContext() IndexBufferContext
func (*IndexBuffer) Release ¶
func (b *IndexBuffer) Release()
type IndexBufferContext ¶
type IndexBufferContext struct {
// contains filtered or unexported fields
}
func (*IndexBufferContext) Destroy ¶
func (c *IndexBufferContext) Destroy()
func (IndexBufferContext) Render ¶
func (c IndexBufferContext) Render(drawMode DrawMode)
type PrimitiveType ¶
type PrimitiveType int
const ( FLOAT PrimitiveType = gl.FLOAT INT PrimitiveType = gl.INT UINT PrimitiveType = gl.UNSIGNED_INT USHORT PrimitiveType = gl.UNSIGNED_SHORT UBYTE PrimitiveType = gl.UNSIGNED_BYTE )
func (PrimitiveType) IsArrayOfType ¶
func (p PrimitiveType) IsArrayOfType(array interface{}) bool
func (PrimitiveType) SizeInBytes ¶
func (p PrimitiveType) SizeInBytes() int
type RefCounted ¶
type RefCounted interface { AddRef() Release() }
type Resolution ¶
type Resolution uint32
16:16 fixed point ratio of DIPs to pixels
func (Resolution) IntDipsToPixels ¶
func (r Resolution) IntDipsToPixels(s int) int
func (Resolution) PointDipsToPixels ¶
func (r Resolution) PointDipsToPixels(s math.Point) math.Point
func (Resolution) RectDipsToPixels ¶
func (r Resolution) RectDipsToPixels(s math.Rect) math.Rect
func (Resolution) SizeDipsToPixels ¶
func (r Resolution) SizeDipsToPixels(s math.Size) math.Size
type SamplerSource ¶
type ShaderDataType ¶
type ShaderDataType int
const ( FLOAT_MAT2x3 ShaderDataType = gl.FLOAT_MAT2x3 FLOAT_MAT2x4 ShaderDataType = gl.FLOAT_MAT2x4 FLOAT_MAT2 ShaderDataType = gl.FLOAT_MAT2 FLOAT_MAT3x2 ShaderDataType = gl.FLOAT_MAT3x2 FLOAT_MAT3x4 ShaderDataType = gl.FLOAT_MAT3x4 FLOAT_MAT3 ShaderDataType = gl.FLOAT_MAT3 FLOAT_MAT4x2 ShaderDataType = gl.FLOAT_MAT4x2 FLOAT_MAT4x3 ShaderDataType = gl.FLOAT_MAT4x3 FLOAT_MAT4 ShaderDataType = gl.FLOAT_MAT4 FLOAT_VEC1 ShaderDataType = gl.FLOAT FLOAT_VEC2 ShaderDataType = gl.FLOAT_VEC2 FLOAT_VEC3 ShaderDataType = gl.FLOAT_VEC3 FLOAT_VEC4 ShaderDataType = gl.FLOAT_VEC4 SAMPLER_2D ShaderDataType = gl.SAMPLER_2D )
func (ShaderDataType) SizeInBytes ¶
func (s ShaderDataType) SizeInBytes() int
func (ShaderDataType) String ¶
func (s ShaderDataType) String() string
func (ShaderDataType) VectorElementCount ¶
func (s ShaderDataType) VectorElementCount() int
func (ShaderDataType) VectorElementType ¶
func (s ShaderDataType) VectorElementType() PrimitiveType
type ShaderProgram ¶
type ShaderProgram struct { Program uint32 Uniforms []shaderUniform Attributes []shaderAttribute }
func CreateShaderProgram ¶
func CreateShaderProgram(ctx *Context, vsSource, fsSource string) *ShaderProgram
func (*ShaderProgram) Bind ¶
func (s *ShaderProgram) Bind(ctx *Context, vb *VertexBuffer, uniforms UniformBindings)
func (*ShaderProgram) Destroy ¶
func (s *ShaderProgram) Destroy(ctx *Context)
func (*ShaderProgram) Unbind ¶
func (s *ShaderProgram) Unbind(ctx *Context)
type Shape ¶
type Shape struct {
// contains filtered or unexported fields
}
func CreateQuadShape ¶
func CreateQuadShape() *Shape
func CreateShape ¶
func CreateShape(vb *VertexBuffer, ib *IndexBuffer, drawMode DrawMode) *Shape
func (*Shape) AssertAlive ¶
func (r *Shape) AssertAlive(funcName string)
func (Shape) Draw ¶
func (s Shape) Draw(ctx *Context, shader *ShaderProgram, ub UniformBindings)
type Stats ¶
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
func (*Texture) AssertAlive ¶
func (r *Texture) AssertAlive(funcName string)
func (*Texture) CreateContext ¶
func (t *Texture) CreateContext() TextureContext
func (*Texture) SizePixels ¶
type TextureContext ¶
type TextureContext struct {
// contains filtered or unexported fields
}
func (*TextureContext) Destroy ¶
func (c *TextureContext) Destroy()
func (TextureContext) FlipY ¶
func (c TextureContext) FlipY() bool
func (TextureContext) PremultipliedAlpha ¶
func (c TextureContext) PremultipliedAlpha() bool
func (TextureContext) SizePixels ¶
func (c TextureContext) SizePixels() math.Size
func (TextureContext) Texture ¶
func (c TextureContext) Texture() uint32
type UniformBindings ¶
type UniformBindings map[string]interface{}
type VertexBuffer ¶
type VertexBuffer struct { Streams map[string]*VertexStream VertexCount int // contains filtered or unexported fields }
func CreateVertexBuffer ¶
func CreateVertexBuffer(streams ...*VertexStream) *VertexBuffer
func (*VertexBuffer) AssertAlive ¶
func (r *VertexBuffer) AssertAlive(funcName string)
func (*VertexBuffer) Release ¶
func (vb *VertexBuffer) Release()
type VertexStream ¶
type VertexStream struct {
// contains filtered or unexported fields
}
func CreateVertexStream ¶
func CreateVertexStream(name string, ty ShaderDataType, data interface{}) *VertexStream
func (*VertexStream) AssertAlive ¶
func (r *VertexStream) AssertAlive(funcName string)
func (VertexStream) CreateContext ¶
func (s VertexStream) CreateContext() VertexStreamContext
func (VertexStream) Name ¶
func (s VertexStream) Name() string
func (*VertexStream) Release ¶
func (s *VertexStream) Release()
func (VertexStream) Type ¶
func (s VertexStream) Type() ShaderDataType
func (VertexStream) VertexCount ¶
func (s VertexStream) VertexCount() int
type VertexStreamContext ¶
type VertexStreamContext struct {
// contains filtered or unexported fields
}
func (VertexStreamContext) Bind ¶
func (c VertexStreamContext) Bind()
func (*VertexStreamContext) Destroy ¶
func (c *VertexStreamContext) Destroy()
type Viewport ¶
func CreateViewport ¶
func (*Viewport) OnClose ¶
func (v *Viewport) OnClose(f func()) gxui.EventSubscription
func (*Viewport) OnKeyDown ¶
func (v *Viewport) OnKeyDown(f func(gxui.KeyboardEvent)) gxui.EventSubscription
func (*Viewport) OnKeyRepeat ¶
func (v *Viewport) OnKeyRepeat(f func(gxui.KeyboardEvent)) gxui.EventSubscription
func (*Viewport) OnKeyStroke ¶
func (v *Viewport) OnKeyStroke(f func(gxui.KeyStrokeEvent)) gxui.EventSubscription
func (*Viewport) OnKeyUp ¶
func (v *Viewport) OnKeyUp(f func(gxui.KeyboardEvent)) gxui.EventSubscription
func (*Viewport) OnMouseDown ¶
func (v *Viewport) OnMouseDown(f func(gxui.MouseEvent)) gxui.EventSubscription
func (*Viewport) OnMouseEnter ¶
func (v *Viewport) OnMouseEnter(f func(gxui.MouseEvent)) gxui.EventSubscription
func (*Viewport) OnMouseExit ¶
func (v *Viewport) OnMouseExit(f func(gxui.MouseEvent)) gxui.EventSubscription
func (*Viewport) OnMouseMove ¶
func (v *Viewport) OnMouseMove(f func(gxui.MouseEvent)) gxui.EventSubscription
func (*Viewport) OnMouseScroll ¶
func (v *Viewport) OnMouseScroll(f func(gxui.MouseEvent)) gxui.EventSubscription
func (*Viewport) OnMouseUp ¶
func (v *Viewport) OnMouseUp(f func(gxui.MouseEvent)) gxui.EventSubscription
func (*Viewport) OnResize ¶
func (v *Viewport) OnResize(f func()) gxui.EventSubscription
func (*Viewport) SetCanvas ¶
gxui.Viewport compliance These methods are all called on the application routine
func (*Viewport) SizePixels ¶
Source Files ¶
- blitter.go
- canvas.go
- check_error.go
- context.go
- draw_mode.go
- driver.go
- font.go
- framebuffer_pool.go
- glyph.go
- glyph_page.go
- glyph_table.go
- index_buffer.go
- keyboard_translate.go
- polygon.go
- primitive_type.go
- refcounted.go
- resolution.go
- shader_attribute.go
- shader_data_type.go
- shader_program.go
- shader_uniform.go
- shape.go
- stats.go
- texture.go
- triangulate.go
- vertex_buffer.go
- vertex_steam.go
- viewport.go
Click to show internal directories.
Click to hide internal directories.