glrender

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

meui-render-gl

OpenGL/OpenGL ES renderer for MeUI, extracted from mobilegles.

The package is glrender. It contains the canvas, glyph atlas, SDF batch, offscreen renderer and GL state cache. Window/input code lives in meui-sdl; the public adapter remains meui-gl.

mobilegles v0.2.1 remains published as the compatibility module for older imports; new code should use this module.

Generated GLSL

shaders_generated/ embeds the GLSL 330 artifacts from meui-shaders. CompileGeneratedGLSL compiles and links them, and the test suite draws a generated rect program with UBOs and verifies the pixel under a GL 3.3 compatibility context.

The production renderer still uses the legacy GLSL 120/ES 100 programs; the generated path is the migration target.

When the context is GL 3.3+, DrawColor automatically uses the generated GLSL rect program with UBOs. The rest of the canvas still uses the legacy programs.

Documentation

Overview

Package mobilegles provides an OpenGL ES 2.0 backend for MeUi using purego.

Package mobilegles provides an OpenGL ES 2.0/3.0 backend for MeUi using purego. This enables mobile platform support without CGO dependencies.

FFI: purego is the binding layer today, but the planned replacement is pureffi (purego's API on go-webgpu/goffi) - architecture decision D7 in meui-migration/design/meui-platform-architecture.md, with the measured trial in MIGRATION.md P6a/P6b. Two consequences for anyone touching this package:

  • pureffi works only under CGO_ENABLED=0, and the race detector needs CGO_ENABLED=1; that is why the switch is deferred rather than done; and
  • do not add a cgo dependency to this module (or to meui) without checking D7 - a third-party cgo package in the graph is what forces that mode.

purego already needs CGO_ENABLED=1 on Android and iOS, and has no Windows Dlopen/Dlsym; that gap is what D7 plans to close.

Index

Constants

View Source
const (
	EGL_DEFAULT_DISPLAY         = 0
	EGL_PLATFORM_X11_KHR        = 0x31D6
	EGL_PLATFORM_X11_SCREEN_EXT = 0x31D6
	EGL_OPENGL_ES_API           = 0x30A0
	EGL_OPENGL_ES2_BIT          = 4
	EGL_WINDOW_BIT              = 4
	EGL_RENDERABLE_TYPE         = 0x3040
	EGL_SURFACE_TYPE            = 0x3033
	EGL_RED_SIZE                = 0x3021
	EGL_GREEN_SIZE              = 0x3022
	EGL_BLUE_SIZE               = 0x3023
	EGL_ALPHA_SIZE              = 0x3024
	EGL_DEPTH_SIZE              = 0x3025
	EGL_NONE                    = 0x3038
	EGL_CONTEXT_CLIENT_VERSION  = 0x3098
	EGL_SUCCESS                 = 0x3000
)
View Source
const (
	GL_VERTEX_SHADER          = 0x8B31
	GL_FRAGMENT_SHADER        = 0x8B30
	GL_TRIANGLES              = 0x0004
	GL_FLOAT                  = 0x1406
	GL_ARRAY_BUFFER           = 0x8892
	GL_ELEMENT_ARRAY_BUFFER   = 0x8893
	GL_UNSIGNED_INT           = 0x1405
	GL_STATIC_DRAW            = 0x88E4
	GL_STREAM_DRAW            = 0x88E0
	GL_COLOR_BUFFER_BIT       = 0x00004000
	GL_SCISSOR_TEST           = 0x0C11
	GL_TEXTURE_2D             = 0x0DE1
	GL_ALPHA                  = 0x1906
	GL_RGBA                   = 0x1908
	GL_UNSIGNED_BYTE          = 0x1401
	GL_LINEAR                 = 0x2601
	GL_LINEAR_MIPMAP_LINEAR   = 0x2703
	GL_CLAMP_TO_EDGE          = 0x812F
	GL_TEXTURE_MIN_FILTER     = 0x2801
	GL_TEXTURE_MAG_FILTER     = 0x2800
	GL_TEXTURE_WRAP_S         = 0x2802
	GL_TEXTURE_WRAP_T         = 0x2803
	GL_DEPTH_TEST             = 0x0B71
	GL_DEPTH_BUFFER_BIT       = 0x00000100
	GL_STENCIL_TEST           = 0x0B90
	GL_STENCIL_BUFFER_BIT     = 0x00000400
	GL_ALWAYS                 = 0x0207
	GL_NOTEQUAL               = 0x0205
	GL_KEEP                   = 0x1E00
	GL_INCR                   = 0x1E02
	GL_LEQUAL                 = 0x0203
	GL_BLEND                  = 0x0BE2
	GL_SRC_ALPHA              = 0x0302
	GL_ONE_MINUS_SRC_ALPHA    = 0x0303
	GL_ONE_MINUS_SRC_COLOR    = 0x0301
	GL_ZERO                   = 0x0000
	GL_SRC_COLOR              = 0x0300
	GL_DST_COLOR              = 0x0306
	GL_ONE                    = 0x0001
	GL_FRAMEBUFFER            = 0x8D40
	GL_COLOR_ATTACHMENT0      = 0x8CE0
	GL_FRAMEBUFFER_COMPLETE   = 0x8CD5
	GL_TIME_ELAPSED           = 0x88BF
	GL_QUERY_RESULT           = 0x8866
	GL_QUERY_RESULT_AVAILABLE = 0x8867
)
View Source
const (
	ButtonLeft              = sdl.ButtonLeft
	ButtonMiddle            = sdl.ButtonMiddle
	ButtonRight             = sdl.ButtonRight
	EventNone               = sdl.EventNone
	Key0                    = sdl.Key0
	Key1                    = sdl.Key1
	Key2                    = sdl.Key2
	Key3                    = sdl.Key3
	Key4                    = sdl.Key4
	Key5                    = sdl.Key5
	Key6                    = sdl.Key6
	Key7                    = sdl.Key7
	Key8                    = sdl.Key8
	Key9                    = sdl.Key9
	KeyA                    = sdl.KeyA
	KeyApostrophe           = sdl.KeyApostrophe
	KeyB                    = sdl.KeyB
	KeyBackslash            = sdl.KeyBackslash
	KeyBackspace            = sdl.KeyBackspace
	KeyC                    = sdl.KeyC
	KeyCloseBracket         = sdl.KeyCloseBracket
	KeyComma                = sdl.KeyComma
	KeyD                    = sdl.KeyD
	KeyDelete               = sdl.KeyDelete
	KeyDown                 = sdl.KeyDown
	KeyE                    = sdl.KeyE
	KeyEnd                  = sdl.KeyEnd
	KeyEnter                = sdl.KeyEnter
	KeyEqual                = sdl.KeyEqual
	KeyEscape               = sdl.KeyEscape
	KeyF                    = sdl.KeyF
	KeyF1                   = sdl.KeyF1
	KeyF10                  = sdl.KeyF10
	KeyF11                  = sdl.KeyF11
	KeyF12                  = sdl.KeyF12
	KeyF2                   = sdl.KeyF2
	KeyF3                   = sdl.KeyF3
	KeyF4                   = sdl.KeyF4
	KeyF5                   = sdl.KeyF5
	KeyF6                   = sdl.KeyF6
	KeyF7                   = sdl.KeyF7
	KeyF8                   = sdl.KeyF8
	KeyF9                   = sdl.KeyF9
	KeyG                    = sdl.KeyG
	KeyGrave                = sdl.KeyGrave
	KeyH                    = sdl.KeyH
	KeyHome                 = sdl.KeyHome
	KeyI                    = sdl.KeyI
	KeyInsert               = sdl.KeyInsert
	KeyJ                    = sdl.KeyJ
	KeyK                    = sdl.KeyK
	KeyL                    = sdl.KeyL
	KeyLeft                 = sdl.KeyLeft
	KeyLeftAlt              = sdl.KeyLeftAlt
	KeyLeftCtrl             = sdl.KeyLeftCtrl
	KeyLeftMeta             = sdl.KeyLeftMeta
	KeyLeftShift            = sdl.KeyLeftShift
	KeyM                    = sdl.KeyM
	KeyMinus                = sdl.KeyMinus
	KeyN                    = sdl.KeyN
	KeyO                    = sdl.KeyO
	KeyOpenBracket          = sdl.KeyOpenBracket
	KeyP                    = sdl.KeyP
	KeyPageDown             = sdl.KeyPageDown
	KeyPageUp               = sdl.KeyPageUp
	KeyPause                = sdl.KeyPause
	KeyPeriod               = sdl.KeyPeriod
	KeyQ                    = sdl.KeyQ
	KeyR                    = sdl.KeyR
	KeyRight                = sdl.KeyRight
	KeyRightAlt             = sdl.KeyRightAlt
	KeyRightCtrl            = sdl.KeyRightCtrl
	KeyRightMeta            = sdl.KeyRightMeta
	KeyRightShift           = sdl.KeyRightShift
	KeyS                    = sdl.KeyS
	KeySemicolon            = sdl.KeySemicolon
	KeySlash                = sdl.KeySlash
	KeySpace                = sdl.KeySpace
	KeyT                    = sdl.KeyT
	KeyTab                  = sdl.KeyTab
	KeyU                    = sdl.KeyU
	KeyUnknown              = sdl.KeyUnknown
	KeyUp                   = sdl.KeyUp
	KeyV                    = sdl.KeyV
	KeyW                    = sdl.KeyW
	KeyX                    = sdl.KeyX
	KeyY                    = sdl.KeyY
	KeyZ                    = sdl.KeyZ
	Keypad0                 = sdl.Keypad0
	Keypad1                 = sdl.Keypad1
	Keypad2                 = sdl.Keypad2
	Keypad3                 = sdl.Keypad3
	Keypad4                 = sdl.Keypad4
	Keypad5                 = sdl.Keypad5
	Keypad6                 = sdl.Keypad6
	Keypad7                 = sdl.Keypad7
	Keypad8                 = sdl.Keypad8
	Keypad9                 = sdl.Keypad9
	KeypadAsterisk          = sdl.KeypadAsterisk
	KeypadComma             = sdl.KeypadComma
	KeypadDot               = sdl.KeypadDot
	KeypadEnter             = sdl.KeypadEnter
	KeypadEquals            = sdl.KeypadEquals
	KeypadMinus             = sdl.KeypadMinus
	KeypadPercent           = sdl.KeypadPercent
	KeypadPlus              = sdl.KeypadPlus
	KeypadSlash             = sdl.KeypadSlash
	ModAlt                  = sdl.ModAlt
	ModCaps                 = sdl.ModCaps
	ModCtrl                 = sdl.ModCtrl
	ModMeta                 = sdl.ModMeta
	ModNone                 = sdl.ModNone
	ModNum                  = sdl.ModNum
	ModScroll               = sdl.ModScroll
	ModShift                = sdl.ModShift
	EventAppLowMemory       = sdl.EventAppLowMemory
	EventAppPause           = sdl.EventAppPause
	EventAppResume          = sdl.EventAppResume
	EventAppTerminating     = sdl.EventAppTerminating
	EventBack               = sdl.EventBack
	EventFileDrop           = sdl.EventFileDrop
	EventFocusGained        = sdl.EventFocusGained
	EventFocusLost          = sdl.EventFocusLost
	EventJoystickAxis       = sdl.EventJoystickAxis
	EventJoystickButtonDown = sdl.EventJoystickButtonDown
	EventJoystickButtonUp   = sdl.EventJoystickButtonUp
	EventJoystickHat        = sdl.EventJoystickHat
	EventKeyDown            = sdl.EventKeyDown
	EventKeyUp              = sdl.EventKeyUp
	EventMouseDown          = sdl.EventMouseDown
	EventMouseMove          = sdl.EventMouseMove
	EventMouseUp            = sdl.EventMouseUp
	EventMouseWheel         = sdl.EventMouseWheel
	EventOrientationChanged = sdl.EventOrientationChanged
	EventQuit               = sdl.EventQuit
	EventResize             = sdl.EventResize
	EventTextEditing        = sdl.EventTextEditing
	EventTextInput          = sdl.EventTextInput
	EventTouchCancel        = sdl.EventTouchCancel
	EventTouchDown          = sdl.EventTouchDown
	EventTouchMove          = sdl.EventTouchMove
	EventTouchUp            = sdl.EventTouchUp
)
View Source
const (
	EdgeBot                                 = sdl.EdgeBot
	EdgeLeft                                = sdl.EdgeLeft
	EdgeNone                                = sdl.EdgeNone
	EdgeRight                               = sdl.EdgeRight
	EdgeTop                                 = sdl.EdgeTop
	SDL3_EVENT_APP_DID_BACKGROUND           = sdl.SDL3_EVENT_APP_DID_BACKGROUND
	SDL3_EVENT_APP_DID_FOREGROUND           = sdl.SDL3_EVENT_APP_DID_FOREGROUND
	SDL3_EVENT_APP_LOW_MEMORY               = sdl.SDL3_EVENT_APP_LOW_MEMORY
	SDL3_EVENT_APP_TERMINATING              = sdl.SDL3_EVENT_APP_TERMINATING
	SDL3_EVENT_APP_WILL_BACKGROUND          = sdl.SDL3_EVENT_APP_WILL_BACKGROUND
	SDL3_EVENT_APP_WILL_FOREGROUND          = sdl.SDL3_EVENT_APP_WILL_FOREGROUND
	SDL3_EVENT_DISPLAY_ORIENTATION          = sdl.SDL3_EVENT_DISPLAY_ORIENTATION
	SDL3_EVENT_DROP_BEGIN                   = sdl.SDL3_EVENT_DROP_BEGIN
	SDL3_EVENT_DROP_COMPLETE                = sdl.SDL3_EVENT_DROP_COMPLETE
	SDL3_EVENT_DROP_FILE                    = sdl.SDL3_EVENT_DROP_FILE
	SDL3_EVENT_DROP_POSITION                = sdl.SDL3_EVENT_DROP_POSITION
	SDL3_EVENT_DROP_TEXT                    = sdl.SDL3_EVENT_DROP_TEXT
	SDL3_EVENT_FINGER_CANCELED              = sdl.SDL3_EVENT_FINGER_CANCELED
	SDL3_EVENT_FINGER_DOWN                  = sdl.SDL3_EVENT_FINGER_DOWN
	SDL3_EVENT_FINGER_MOTION                = sdl.SDL3_EVENT_FINGER_MOTION
	SDL3_EVENT_FINGER_UP                    = sdl.SDL3_EVENT_FINGER_UP
	SDL3_EVENT_JOYSTICK_AXIS                = sdl.SDL3_EVENT_JOYSTICK_AXIS
	SDL3_EVENT_JOYSTICK_BALL                = sdl.SDL3_EVENT_JOYSTICK_BALL
	SDL3_EVENT_JOYSTICK_BUTTON_DOWN         = sdl.SDL3_EVENT_JOYSTICK_BUTTON_DOWN
	SDL3_EVENT_JOYSTICK_BUTTON_UP           = sdl.SDL3_EVENT_JOYSTICK_BUTTON_UP
	SDL3_EVENT_JOYSTICK_HAT                 = sdl.SDL3_EVENT_JOYSTICK_HAT
	SDL3_EVENT_KEYBOARD_ADDED               = sdl.SDL3_EVENT_KEYBOARD_ADDED
	SDL3_EVENT_KEYBOARD_REMOVED             = sdl.SDL3_EVENT_KEYBOARD_REMOVED
	SDL3_EVENT_KEYMAP_CHANGED               = sdl.SDL3_EVENT_KEYMAP_CHANGED
	SDL3_EVENT_KEY_DOWN                     = sdl.SDL3_EVENT_KEY_DOWN
	SDL3_EVENT_KEY_UP                       = sdl.SDL3_EVENT_KEY_UP
	SDL3_EVENT_MOUSE_ADDED                  = sdl.SDL3_EVENT_MOUSE_ADDED
	SDL3_EVENT_MOUSE_BUTTON_DOWN            = sdl.SDL3_EVENT_MOUSE_BUTTON_DOWN
	SDL3_EVENT_MOUSE_BUTTON_UP              = sdl.SDL3_EVENT_MOUSE_BUTTON_UP
	SDL3_EVENT_MOUSE_MOTION                 = sdl.SDL3_EVENT_MOUSE_MOTION
	SDL3_EVENT_MOUSE_REMOVED                = sdl.SDL3_EVENT_MOUSE_REMOVED
	SDL3_EVENT_MOUSE_WHEEL                  = sdl.SDL3_EVENT_MOUSE_WHEEL
	SDL3_EVENT_QUIT                         = sdl.SDL3_EVENT_QUIT
	SDL3_EVENT_SCREEN_KEYBOARD_HIDDEN       = sdl.SDL3_EVENT_SCREEN_KEYBOARD_HIDDEN
	SDL3_EVENT_SCREEN_KEYBOARD_SHOWN        = sdl.SDL3_EVENT_SCREEN_KEYBOARD_SHOWN
	SDL3_EVENT_SENSOR_UPDATE                = sdl.SDL3_EVENT_SENSOR_UPDATE
	SDL3_EVENT_TEXT_EDITING                 = sdl.SDL3_EVENT_TEXT_EDITING
	SDL3_EVENT_TEXT_EDITING_CANDIDATES      = sdl.SDL3_EVENT_TEXT_EDITING_CANDIDATES
	SDL3_EVENT_TEXT_INPUT                   = sdl.SDL3_EVENT_TEXT_INPUT
	SDL3_EVENT_WINDOW_CLOSE_REQUESTED       = sdl.SDL3_EVENT_WINDOW_CLOSE_REQUESTED
	SDL3_EVENT_WINDOW_DESTROYED             = sdl.SDL3_EVENT_WINDOW_DESTROYED
	SDL3_EVENT_WINDOW_DISPLAY_CHANGED       = sdl.SDL3_EVENT_WINDOW_DISPLAY_CHANGED
	SDL3_EVENT_WINDOW_DISPLAY_SCALE_CHANGED = sdl.SDL3_EVENT_WINDOW_DISPLAY_SCALE_CHANGED
	SDL3_EVENT_WINDOW_ENTER_FULLSCREEN      = sdl.SDL3_EVENT_WINDOW_ENTER_FULLSCREEN
	SDL3_EVENT_WINDOW_EXPOSED               = sdl.SDL3_EVENT_WINDOW_EXPOSED
	SDL3_EVENT_WINDOW_FOCUS_GAINED          = sdl.SDL3_EVENT_WINDOW_FOCUS_GAINED
	SDL3_EVENT_WINDOW_FOCUS_LOST            = sdl.SDL3_EVENT_WINDOW_FOCUS_LOST
	SDL3_EVENT_WINDOW_HDR_STATE_CHANGED     = sdl.SDL3_EVENT_WINDOW_HDR_STATE_CHANGED
	SDL3_EVENT_WINDOW_HIDDEN                = sdl.SDL3_EVENT_WINDOW_HIDDEN
	SDL3_EVENT_WINDOW_HIT_TEST              = sdl.SDL3_EVENT_WINDOW_HIT_TEST
	SDL3_EVENT_WINDOW_ICCPROF_CHANGED       = sdl.SDL3_EVENT_WINDOW_ICCPROF_CHANGED
	SDL3_EVENT_WINDOW_LEAVE_FULLSCREEN      = sdl.SDL3_EVENT_WINDOW_LEAVE_FULLSCREEN
	SDL3_EVENT_WINDOW_MAXIMIZED             = sdl.SDL3_EVENT_WINDOW_MAXIMIZED
	SDL3_EVENT_WINDOW_METAL_VIEW_RESIZED    = sdl.SDL3_EVENT_WINDOW_METAL_VIEW_RESIZED
	SDL3_EVENT_WINDOW_MINIMIZED             = sdl.SDL3_EVENT_WINDOW_MINIMIZED
	SDL3_EVENT_WINDOW_MOUSE_ENTER           = sdl.SDL3_EVENT_WINDOW_MOUSE_ENTER
	SDL3_EVENT_WINDOW_MOUSE_LEAVE           = sdl.SDL3_EVENT_WINDOW_MOUSE_LEAVE
	SDL3_EVENT_WINDOW_MOVED                 = sdl.SDL3_EVENT_WINDOW_MOVED
	SDL3_EVENT_WINDOW_OCCLUDED              = sdl.SDL3_EVENT_WINDOW_OCCLUDED
	SDL3_EVENT_WINDOW_PIXEL_SIZE_CHANGED    = sdl.SDL3_EVENT_WINDOW_PIXEL_SIZE_CHANGED
	SDL3_EVENT_WINDOW_RESIZED               = sdl.SDL3_EVENT_WINDOW_RESIZED
	SDL3_EVENT_WINDOW_RESTORED              = sdl.SDL3_EVENT_WINDOW_RESTORED
	SDL3_EVENT_WINDOW_SAFE_AREA_CHANGED     = sdl.SDL3_EVENT_WINDOW_SAFE_AREA_CHANGED
	SDL3_EVENT_WINDOW_SHOWN                 = sdl.SDL3_EVENT_WINDOW_SHOWN
	SDL3_GL_CONTEXT_MAJOR_VERSION           = sdl.SDL3_GL_CONTEXT_MAJOR_VERSION
	SDL3_GL_CONTEXT_MINOR_VERSION           = sdl.SDL3_GL_CONTEXT_MINOR_VERSION
	SDL3_GL_CONTEXT_PROFILE_ES              = sdl.SDL3_GL_CONTEXT_PROFILE_ES
	SDL3_GL_CONTEXT_PROFILE_MASK            = sdl.SDL3_GL_CONTEXT_PROFILE_MASK
	SDL3_GL_MULTISAMPLEBUFFERS              = sdl.SDL3_GL_MULTISAMPLEBUFFERS
	SDL3_GL_MULTISAMPLESAMPLES              = sdl.SDL3_GL_MULTISAMPLESAMPLES
	SDL3_GL_SHARE_WITH_CURRENT_CONTEXT      = sdl.SDL3_GL_SHARE_WITH_CURRENT_CONTEXT
	SDL3_INIT_VIDEO                         = sdl.SDL3_INIT_VIDEO
	SDL3_KMOD_CAPS                          = sdl.SDL3_KMOD_CAPS
	SDL3_KMOD_LALT                          = sdl.SDL3_KMOD_LALT
	SDL3_KMOD_LCTRL                         = sdl.SDL3_KMOD_LCTRL
	SDL3_KMOD_LGUI                          = sdl.SDL3_KMOD_LGUI
	SDL3_KMOD_LSHIFT                        = sdl.SDL3_KMOD_LSHIFT
	SDL3_KMOD_NUM                           = sdl.SDL3_KMOD_NUM
	SDL3_KMOD_RALT                          = sdl.SDL3_KMOD_RALT
	SDL3_KMOD_RCTRL                         = sdl.SDL3_KMOD_RCTRL
	SDL3_KMOD_RGUI                          = sdl.SDL3_KMOD_RGUI
	SDL3_KMOD_RSHIFT                        = sdl.SDL3_KMOD_RSHIFT
	SDL3_KMOD_SCROLL                        = sdl.SDL3_KMOD_SCROLL
	SDL3_SCANCODE_0                         = sdl.SDL3_SCANCODE_0
	SDL3_SCANCODE_1                         = sdl.SDL3_SCANCODE_1
	SDL3_SCANCODE_2                         = sdl.SDL3_SCANCODE_2
	SDL3_SCANCODE_3                         = sdl.SDL3_SCANCODE_3
	SDL3_SCANCODE_4                         = sdl.SDL3_SCANCODE_4
	SDL3_SCANCODE_5                         = sdl.SDL3_SCANCODE_5
	SDL3_SCANCODE_6                         = sdl.SDL3_SCANCODE_6
	SDL3_SCANCODE_7                         = sdl.SDL3_SCANCODE_7
	SDL3_SCANCODE_8                         = sdl.SDL3_SCANCODE_8
	SDL3_SCANCODE_9                         = sdl.SDL3_SCANCODE_9
	SDL3_SCANCODE_A                         = sdl.SDL3_SCANCODE_A
	SDL3_SCANCODE_APOSTROPHE                = sdl.SDL3_SCANCODE_APOSTROPHE
	SDL3_SCANCODE_B                         = sdl.SDL3_SCANCODE_B
	SDL3_SCANCODE_BACKSLASH                 = sdl.SDL3_SCANCODE_BACKSLASH
	SDL3_SCANCODE_BACKSPACE                 = sdl.SDL3_SCANCODE_BACKSPACE
	SDL3_SCANCODE_C                         = sdl.SDL3_SCANCODE_C
	SDL3_SCANCODE_COMMA                     = sdl.SDL3_SCANCODE_COMMA
	SDL3_SCANCODE_D                         = sdl.SDL3_SCANCODE_D
	SDL3_SCANCODE_DELETE                    = sdl.SDL3_SCANCODE_DELETE
	SDL3_SCANCODE_DOWN                      = sdl.SDL3_SCANCODE_DOWN
	SDL3_SCANCODE_E                         = sdl.SDL3_SCANCODE_E
	SDL3_SCANCODE_END                       = sdl.SDL3_SCANCODE_END
	SDL3_SCANCODE_EQUAL                     = sdl.SDL3_SCANCODE_EQUAL
	SDL3_SCANCODE_ESCAPE                    = sdl.SDL3_SCANCODE_ESCAPE
	SDL3_SCANCODE_F                         = sdl.SDL3_SCANCODE_F
	SDL3_SCANCODE_F1                        = sdl.SDL3_SCANCODE_F1
	SDL3_SCANCODE_F10                       = sdl.SDL3_SCANCODE_F10
	SDL3_SCANCODE_F11                       = sdl.SDL3_SCANCODE_F11
	SDL3_SCANCODE_F12                       = sdl.SDL3_SCANCODE_F12
	SDL3_SCANCODE_F2                        = sdl.SDL3_SCANCODE_F2
	SDL3_SCANCODE_F3                        = sdl.SDL3_SCANCODE_F3
	SDL3_SCANCODE_F4                        = sdl.SDL3_SCANCODE_F4
	SDL3_SCANCODE_F5                        = sdl.SDL3_SCANCODE_F5
	SDL3_SCANCODE_F6                        = sdl.SDL3_SCANCODE_F6
	SDL3_SCANCODE_F7                        = sdl.SDL3_SCANCODE_F7
	SDL3_SCANCODE_F8                        = sdl.SDL3_SCANCODE_F8
	SDL3_SCANCODE_F9                        = sdl.SDL3_SCANCODE_F9
	SDL3_SCANCODE_G                         = sdl.SDL3_SCANCODE_G
	SDL3_SCANCODE_GRAVE                     = sdl.SDL3_SCANCODE_GRAVE
	SDL3_SCANCODE_H                         = sdl.SDL3_SCANCODE_H
	SDL3_SCANCODE_HOME                      = sdl.SDL3_SCANCODE_HOME
	SDL3_SCANCODE_I                         = sdl.SDL3_SCANCODE_I
	SDL3_SCANCODE_INSERT                    = sdl.SDL3_SCANCODE_INSERT
	SDL3_SCANCODE_J                         = sdl.SDL3_SCANCODE_J
	SDL3_SCANCODE_K                         = sdl.SDL3_SCANCODE_K
	SDL3_SCANCODE_KP_0                      = sdl.SDL3_SCANCODE_KP_0
	SDL3_SCANCODE_KP_1                      = sdl.SDL3_SCANCODE_KP_1
	SDL3_SCANCODE_KP_2                      = sdl.SDL3_SCANCODE_KP_2
	SDL3_SCANCODE_KP_3                      = sdl.SDL3_SCANCODE_KP_3
	SDL3_SCANCODE_KP_4                      = sdl.SDL3_SCANCODE_KP_4
	SDL3_SCANCODE_KP_5                      = sdl.SDL3_SCANCODE_KP_5
	SDL3_SCANCODE_KP_6                      = sdl.SDL3_SCANCODE_KP_6
	SDL3_SCANCODE_KP_7                      = sdl.SDL3_SCANCODE_KP_7
	SDL3_SCANCODE_KP_8                      = sdl.SDL3_SCANCODE_KP_8
	SDL3_SCANCODE_KP_9                      = sdl.SDL3_SCANCODE_KP_9
	SDL3_SCANCODE_KP_COMMA                  = sdl.SDL3_SCANCODE_KP_COMMA
	SDL3_SCANCODE_KP_DIVIDE                 = sdl.SDL3_SCANCODE_KP_DIVIDE
	SDL3_SCANCODE_KP_ENTER                  = sdl.SDL3_SCANCODE_KP_ENTER
	SDL3_SCANCODE_KP_EQUALS                 = sdl.SDL3_SCANCODE_KP_EQUALS
	SDL3_SCANCODE_KP_MINUS                  = sdl.SDL3_SCANCODE_KP_MINUS
	SDL3_SCANCODE_KP_MULTIPLY               = sdl.SDL3_SCANCODE_KP_MULTIPLY
	SDL3_SCANCODE_KP_PERIOD                 = sdl.SDL3_SCANCODE_KP_PERIOD
	SDL3_SCANCODE_KP_PLUS                   = sdl.SDL3_SCANCODE_KP_PLUS
	SDL3_SCANCODE_L                         = sdl.SDL3_SCANCODE_L
	SDL3_SCANCODE_LALT                      = sdl.SDL3_SCANCODE_LALT
	SDL3_SCANCODE_LCTRL                     = sdl.SDL3_SCANCODE_LCTRL
	SDL3_SCANCODE_LEFT                      = sdl.SDL3_SCANCODE_LEFT
	SDL3_SCANCODE_LEFTBRACKET               = sdl.SDL3_SCANCODE_LEFTBRACKET
	SDL3_SCANCODE_LGUI                      = sdl.SDL3_SCANCODE_LGUI
	SDL3_SCANCODE_LSHIFT                    = sdl.SDL3_SCANCODE_LSHIFT
	SDL3_SCANCODE_M                         = sdl.SDL3_SCANCODE_M
	SDL3_SCANCODE_MINUS                     = sdl.SDL3_SCANCODE_MINUS
	SDL3_SCANCODE_N                         = sdl.SDL3_SCANCODE_N
	SDL3_SCANCODE_O                         = sdl.SDL3_SCANCODE_O
	SDL3_SCANCODE_P                         = sdl.SDL3_SCANCODE_P
	SDL3_SCANCODE_PAGEDOWN                  = sdl.SDL3_SCANCODE_PAGEDOWN
	SDL3_SCANCODE_PAGEUP                    = sdl.SDL3_SCANCODE_PAGEUP
	SDL3_SCANCODE_PAUSE                     = sdl.SDL3_SCANCODE_PAUSE
	SDL3_SCANCODE_PERIOD                    = sdl.SDL3_SCANCODE_PERIOD
	SDL3_SCANCODE_Q                         = sdl.SDL3_SCANCODE_Q
	SDL3_SCANCODE_R                         = sdl.SDL3_SCANCODE_R
	SDL3_SCANCODE_RALT                      = sdl.SDL3_SCANCODE_RALT
	SDL3_SCANCODE_RCTRL                     = sdl.SDL3_SCANCODE_RCTRL
	SDL3_SCANCODE_RETURN                    = sdl.SDL3_SCANCODE_RETURN
	SDL3_SCANCODE_RGUI                      = sdl.SDL3_SCANCODE_RGUI
	SDL3_SCANCODE_RIGHT                     = sdl.SDL3_SCANCODE_RIGHT
	SDL3_SCANCODE_RIGHTBRACKET              = sdl.SDL3_SCANCODE_RIGHTBRACKET
	SDL3_SCANCODE_RSHIFT                    = sdl.SDL3_SCANCODE_RSHIFT
	SDL3_SCANCODE_S                         = sdl.SDL3_SCANCODE_S
	SDL3_SCANCODE_SEMICOLON                 = sdl.SDL3_SCANCODE_SEMICOLON
	SDL3_SCANCODE_SLASH                     = sdl.SDL3_SCANCODE_SLASH
	SDL3_SCANCODE_SPACE                     = sdl.SDL3_SCANCODE_SPACE
	SDL3_SCANCODE_T                         = sdl.SDL3_SCANCODE_T
	SDL3_SCANCODE_TAB                       = sdl.SDL3_SCANCODE_TAB
	SDL3_SCANCODE_U                         = sdl.SDL3_SCANCODE_U
	SDL3_SCANCODE_UP                        = sdl.SDL3_SCANCODE_UP
	SDL3_SCANCODE_V                         = sdl.SDL3_SCANCODE_V
	SDL3_SCANCODE_W                         = sdl.SDL3_SCANCODE_W
	SDL3_SCANCODE_X                         = sdl.SDL3_SCANCODE_X
	SDL3_SCANCODE_Y                         = sdl.SDL3_SCANCODE_Y
	SDL3_SCANCODE_Z                         = sdl.SDL3_SCANCODE_Z
	SDL3_WINDOW_BORDERLESS                  = sdl.SDL3_WINDOW_BORDERLESS
	SDL3_WINDOW_FULLSCREEN                  = sdl.SDL3_WINDOW_FULLSCREEN
	SDL3_WINDOW_HIDDEN                      = sdl.SDL3_WINDOW_HIDDEN
	SDL3_WINDOW_OCCLUDED                    = sdl.SDL3_WINDOW_OCCLUDED
	SDL3_WINDOW_OPENGL                      = sdl.SDL3_WINDOW_OPENGL
	SDL3_WINDOW_RESIZABLE                   = sdl.SDL3_WINDOW_RESIZABLE
	SDL3_WINDOW_TRANSPARENT                 = sdl.SDL3_WINDOW_TRANSPARENT
	SDL_GL_CONTEXT_MAJOR_VERSION            = sdl.SDL_GL_CONTEXT_MAJOR_VERSION
	SDL_GL_CONTEXT_MINOR_VERSION            = sdl.SDL_GL_CONTEXT_MINOR_VERSION
	SDL_GL_CONTEXT_PROFILE_ES               = sdl.SDL_GL_CONTEXT_PROFILE_ES
	SDL_GL_CONTEXT_PROFILE_MASK             = sdl.SDL_GL_CONTEXT_PROFILE_MASK
	SDL_HITTEST_DRAGGABLE                   = sdl.SDL_HITTEST_DRAGGABLE
	SDL_HITTEST_NORMAL                      = sdl.SDL_HITTEST_NORMAL
	SDL_HITTEST_RESIZE_LEFT                 = sdl.SDL_HITTEST_RESIZE_LEFT
	SDL_HITTEST_RESIZE_TOPLEFT              = sdl.SDL_HITTEST_RESIZE_TOPLEFT
	SDL_INIT_VIDEO                          = sdl.SDL_INIT_VIDEO
	SDL_KEYDOWN                             = sdl.SDL_KEYDOWN
	SDL_KEYUP                               = sdl.SDL_KEYUP
	SDL_MOUSEBUTTONDOWN                     = sdl.SDL_MOUSEBUTTONDOWN
	SDL_MOUSEBUTTONUP                       = sdl.SDL_MOUSEBUTTONUP
	SDL_MOUSEMOTION                         = sdl.SDL_MOUSEMOTION
	SDL_QUIT                                = sdl.SDL_QUIT
	SDL_WINDOWEVENT                         = sdl.SDL_WINDOWEVENT
	SDL_WINDOW_OPENGL                       = sdl.SDL_WINDOW_OPENGL
	SDL_WINDOW_SHOWN                        = sdl.SDL_WINDOW_SHOWN
)
View Source
const GL_UNSIGNED_SHORT = 0x1403

GL constant used by the indexed batch path.

View Source
const MaxGradientStops = 16

MaxGradientStops caps a gradient's stops. The ramp is rasterised into a 256-wide LUT row, so more stops than that would not be resolvable anyway.

Variables

This section is empty.

Functions

func AcquireRenderer

func AcquireRenderer()

AcquireRenderer locks the global render pipeline. Call before any batch accumulation and hold through Swap/flush. See renderMu.

func AntialiasPreference

func AntialiasPreference() bool

AntialiasPreference reports the current preference.

func AppEventWatchAvailable

func AppEventWatchAvailable() bool

func AppEventWatchInstalled

func AppEventWatchInstalled() bool

func BeginBlur

func BeginBlur()

BeginBlur redirects rendering to the FBO texture for offscreen capture.

func Blur

func Blur(radius float32)

Blur applies a separable Gaussian blur to the current framebuffer contents

func CapHeightPx

func CapHeightPx(f *truetype.Font, size float32) float32

CapHeightPx measures the 'H' cap height in px for a truetype font at the given em size. Returns 0 if it cannot be measured.

func ClearScissor

func ClearScissor()

func ClearScreen

func ClearScreen(col uint32)

func CompileGeneratedGLSL added in v0.2.0

func CompileGeneratedGLSL(vert, frag string) (uint32, error)

CompileGeneratedGLSL compiles and links one generated GLSL 330 program from meui-shaders. It is the probe used before the renderer migrates a pipeline.

func CreateOffscreenFBO

func CreateOffscreenFBO(w, h int32) (uint32, uint32)

func CurClipQuad

func CurClipQuad() (float32, float32, float32, float32)

curClipQuad returns the active clip as (minX, minY, maxX, maxY) in GL window coords for stamping into per-vertex clip attributes. CurClipQuad exposes the per-vertex clip stamp for diagnostics — the same value appendWithClip and SDFBatchTexturedQuads put on every vertex. Exported like DefaultReadFBO, for probes that need to see what a draw was stamped with.

func DefaultReadFBO

func DefaultReadFBO() int32

DefaultReadFBO reports the framebuffer binding captured at package init, which the offscreen helpers rebind as "the default framebuffer". It is exposed so a probe can confirm what it actually holds: 0 is each context's own drawable (per-context-correct), while any other value would be a binding captured in some other context and would be wrong to rebind here.

func DeleteOffscreenFBO

func DeleteOffscreenFBO(fbo, tex uint32)

func DescentPx

func DescentPx(f *truetype.Font, size float32) float32

DescentPx returns the font's descent (distance below baseline) in px at the given em size. Prefers hhea metrics (what skia reports to unison); falls back to the global glyph bounding box.

func DrawCircleGL

func DrawCircleGL(cx, cy, radius float32, color Color)

func DrawLineGL

func DrawLineGL(x1, y1, x2, y2 float32, color Color, strokeW float32)

func DrawOvalGL

func DrawOvalGL(x, y, w, h float32, color Color)

func DrawRectGL

func DrawRectGL(x, y, w, h float32, color Color, angle float32)

Drawing helpers for platform backends.

func DrawTexturedQuadsBatch

func DrawTexturedQuadsBatch(verts []float32, texID uint32, color Color, isImage bool)

DrawTexturedQuadsBatch appends textured quads to the frame batch.

func DrawTrianglesBatch

func DrawTrianglesBatch(verts []float32, color Color)

DrawTrianglesBatch appends triangles to the frame batch (for AndroidRenderer).

func DumpRenderState

func DumpRenderState(where string)

DumpRenderState prints the process-global render state that is neither per-context GL state nor covered by InvalidateGLStateCache: the screen-size uniforms, the FBO currently bound, and the clip-discard flag and plane table.

The offscreen pass (RenderOffscreen) runs in the middle of a window's frame and mutates all of these; the window that performed it then looks fine while the windows painted after it break, which points at state consumed at the START of the next frame. Comparing this line across an offscreen pass and the next ClearWithViewport is how that state is found. Gated by MEUI_STATE_TRACE.

func EdgeZone

func EdgeZone(x, y, w, h float32) uint32

func EffectiveSize

func EffectiveSize(w *Window) (int32, int32)

func EmbeddedRobotoFace

func EmbeddedRobotoFace(style string) *truetype.Font

EmbeddedRobotoFace returns the embedded Roboto face for a style suffix ("Light", "Bold", "Bold Italic", …) with "Regular" fallback.

func EndBlur

func EndBlur(radius float32)

EndBlur unbinds the FBO and blurs the result to the screen.

func EraseRoundedCorners

func EraseRoundedCorners(x, y, w, h, radius float32, topOnly bool)

EraseRoundedCorners zeroes the framebuffer alpha outside the rounded rect (x, y, w, h) at the given radius. topOnly extends the shape below the window so only the top corners round. Call after all content for the frame has been batched; the pending batches are flushed first, then the erase quad is drawn with erase blending.

func ErrOffscreenFailed

func ErrOffscreenFailed() error

func FlushBatches

func FlushBatches()

func FontMetricsRatios

func FontMetricsRatios(f *truetype.Font) fontMetricsRatios

FontMetricsRatios returns the hhea-derived ascent/descent ratios for a parsed font (0 values if unknown).

func GLClearDepth

func GLClearDepth()

func GLDepthTest

func GLDepthTest(enabled bool)

func GLDepthWrite

func GLDepthWrite(enabled bool)

func GLInfo

func GLInfo() (vendor, renderer, version string)

GLInfo returns the driver's vendor, renderer and version strings.

func GLXDrawableSize

func GLXDrawableSize() (int32, int32, bool)

GLXDrawableSize reports the size of the GLX drawable current on this thread, as the X server sees it. ok is false when the probe is unavailable (no GLX symbol, no current context, or the server refuses the query) - never silently (0,0,true).

func Gaussian

func Gaussian(x, sigma float32) float32

Gaussian calculates a Gaussian weight for the given distance and sigma

func GaussianWeights

func GaussianWeights(radius int, sigma float32) []float32

GaussianWeights calculates normalized Gaussian weights for blur kernel

func GetClipboardText

func GetClipboardText() string

func GetError

func GetError() uint32

GetError returns the current OpenGL error (0 means no error).

func GetGL3ProcAddress

func GetGL3ProcAddress(name string) uintptr

Compatibility helpers for the renderer's existing call sites.

func GlobalAlphaPreference

func GlobalAlphaPreference() float32

GlobalAlphaPreference reports the current alpha multiplier.

func GlobalMousePos

func GlobalMousePos() (float32, float32)

func HasEGLSupport

func HasEGLSupport() bool

HasEGLSupport returns true if EGL/GLES libraries were loaded successfully

func HasGLSupport

func HasGLSupport() bool

HasGLSupport returns true if desktop OpenGL is available

func Init

func Init() error

Init loads OpenGL ES symbols from the system libraries using purego. This must be called before any GLES functions are used.

func InitEGLForAndroid

func InitEGLForAndroid(window unsafe.Pointer, width, height int32) error

InitEGLForAndroid initializes EGL for an Android ANativeWindow. window is the ANativeWindow pointer passed from JNI. After success, GL function pointers are loaded via eglGetProcAddress.

func InitRenderer

func InitRenderer() error

func InitWindowError

func InitWindowError() error

func InvalidateGLStateCache

func InvalidateGLStateCache()

InvalidateGLStateCache resets every cached GL binding after a context switch. GL state is PER-CONTEXT: the caches describe the previous context — a flush after MakeCurrent(otherCtx) would skip re-binding program/VBO/IBO/attribs and draw with this context's defaults (null attrib pointers → driver SIGSEGV).

func KnownCursorNames

func KnownCursorNames() []string

func LoadGLESFromLib

func LoadGLESFromLib(lib uintptr)

LoadGLESFromLib registers all GLES function pointers from a loaded library handle. Used by platform backends (e.g. Android) to load GL functions after EGL init.

func LoadSystemFont

func LoadSystemFont(path string) (*truetype.Font, error)

func LoadTTFFromBytes

func LoadTTFFromBytes(data []byte) (*truetype.Font, error)

func LoadTTFFromFile

func LoadTTFFromFile(path string) (*truetype.Font, error)

func MaxTextureUnits

func MaxTextureUnits() int

MaxTextureUnits reports GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, which bounds how many distinct textures one batch can sample.

func MaxTexturesPerBatch

func MaxTexturesPerBatch() int

MaxTexturesPerBatch reports how many distinct textures one unified batch can sample before it flushes and starts a new sampler-unit table.

func MaxVertexAttribs

func MaxVertexAttribs() int

MaxVertexAttribs reports GL_MAX_VERTEX_ATTRIBS, or 0 when it cannot be read. The unified SDF batch uses 16 attributes, so on a driver reporting fewer the gradient attributes would silently not bind.

func MouseLeftDown

func MouseLeftDown() bool

func MoveResizeSDLWin

func MoveResizeSDLWin(w *Window, x, y, width, height int32) bool

func MoveSDLWinBy

func MoveSDLWinBy(w *Window, x, y int32)

func NoteResizeAck

func NoteResizeAck(w *Window, width, height int32)

func PendingBatchVerts

func PendingBatchVerts() int

PendingBatchVerts reports how many vertices are still queued in ANY of the process-global batches (SDF shapes/text/images, triangles, immediate shapes) and therefore not yet submitted to GL.

The batches are process-global and their vertices are stamped with the CURRENT window's projection and clip, so a non-zero count at a frame boundary means work that belongs to the window that just drew: presenting the buffer with a non-empty batch defers that work into whatever frame (usually another window) flushes next. It must be 0 before every Swap.

func PrimarySDLWindowPointer

func PrimarySDLWindowPointer() unsafe.Pointer

func ProbeFullClear

func ProbeFullClear(w, h int32) (top, bottom uint32, ok bool)

ProbeFullClear paints the ENTIRE claimed surface (viewport w x h, scissor and stencil off) a distinctive colour, then reads one pixel near the top row and one near the bottom. If a 520x620 window's back buffer is really 520x380, the clear fills only the bottom 380 rows and the read at y=610 is outside it. This separates "the surface is smaller than the window" from "the surface is fine and the fragments are being rejected", which no existing instrument could tell apart because every one of them reads through the same glReadPixels.

func ProcessEvents

func ProcessEvents(w *Window)

func ProcessEventsAndDispatch

func ProcessEventsAndDispatch(w *Window)

func PumpAll

func PumpAll()

func ReadOffscreenPixels

func ReadOffscreenPixels(fbo uint32, w, h int32) []uint32

func ReadScreenPixels

func ReadScreenPixels(w, h int32) []uint32

ReadScreenPixels reads the default framebuffer (back buffer) as 0xAARRGGBB pixels, bottom-up as GL delivers them. Call while the GL context is current and after FlushBatches() (e.g. inside the draw callback, before the swap).

func ReleaseRenderer

func ReleaseRenderer()

ReleaseRenderer unlocks the global render pipeline.

func RenderOffscreen

func RenderOffscreen(w, h int32, renderFn func()) []uint32

func ResetClipState

func ResetClipState()

ResetClipState clears the Go-side clip mirror at the start of a window's frame. scissorState is process-global and is stamped into every batched vertex (clipMin/clipMax); without a per-frame reset a window's early draws (title bar, panel background) inherit the PREVIOUS window's last clip rect — everything outside it is shader-discarded and edge primitives clip into garbage shapes (observed: window 2 rendered exactly one triangle — the stale rect).

func ResetGLCache

func ResetGLCache()

ResetGLCache resets all cached GL state (call after any external GL code).

func ResetSizeProbe

func ResetSizeProbe()

func ResizeWindow

func ResizeWindow(w *Window, width, height int32)

func RunHeadlessDemo

func RunHeadlessDemo(w *Window)

func SDFBatchRect

func SDFBatchRect(x, y, w, h, radius float32, color Color, style int32, strokeW, angle float32)

SDFBatchRect appends an axis-aligned rect / rounded rect / circle to the batch. x,y,w,h are SCREEN pixels; radius 0 = sharp box, radius = min(w,h)/2 = circle/oval. Call on the GL thread.

func SDFBatchTexturedQuads

func SDFBatchTexturedQuads(verts []float32, texID uint32, isImage bool)

SDFBatchTexturedQuads appends glyph (mode 1) or image (mode 2) quads to the unified SDF batch. verts holds 4 indexed vertices per quad, 8 floats each: pos2 uv2 color4. Blending is unified to premultiplied (ONE, ONE_MINUS_SRC_ALPHA) — the glyph/image shader paths output premultiplied color, and the SDF shape path premultiplies in the fragment shader, so one batch can interleave shapes, text and images in exact draw order with a single draw call.

func SDFBatchTriangles

func SDFBatchTriangles(verts []float32)

SDFBatchTriangles appends barycentric-AA triangles to the unified batch (mode 3). verts holds 9 floats per vertex: pos2 bary3 color4. Each triangle is padded to a 4-vertex quad so the shared quad index buffer applies: (v0,v1,v2) + degenerate (v1,v3,v2) with v3=v2 — the original triangle rasterizes unchanged and the degenerate half covers nothing.

func SetAntialiasPreference

func SetAntialiasPreference(on bool)

SetAntialiasPreference sets the antialiasing stamped into subsequently batched primitives. Text and image quads ignore it: they sample a texture and have no edge ramp of their own.

func SetAppEventHandler

func SetAppEventHandler(fn func(Event))

func SetBlendModeCached

func SetBlendModeCached(mode int32)

SetBlendModeCached sets the blend mode only if it has changed.

func SetClipDiscardEnabled

func SetClipDiscardEnabled(on bool)

SetClipDiscardEnabled toggles the batch shaders' per-vertex clip discard. Offscreen rendering turns it off.

func SetClipPlanes

func SetClipPlanes(planes []ClipPlane)

SetClipPlanes replaces the path clip. It is the renderer-side mirror the batched shaders read; the toolkit updates it whenever the effective clip changes.

func SetClipboardText

func SetClipboardText(s string)

func SetCurrentGradient

func SetCurrentGradient(g Gradient)

SetCurrentGradient publishes the gradient for subsequently batched primitives; the zero Gradient means solid colour.

func SetCursorByName

func SetCursorByName(s string)

func SetFullscreen

func SetFullscreen(w *Window, fullscreen bool)

func SetGlobalAlphaPreference

func SetGlobalAlphaPreference(a float32)

SetGlobalAlphaPreference sets the alpha multiplier applied to subsequently batched primitives. The legacy immediate paths (gradient rects) ignore it.

func SetRendererFactory

func SetRendererFactory(f func() Renderer)

SetRendererFactory installs the constructor used for the process renderer. Call it before InitRenderer.

func SetScissor

func SetScissor(x, y, w, h int32)

func SetScreenSize

func SetScreenSize(w, h float32)

func SetSensorHandler

func SetSensorHandler(fn func(uint32, [6]float32))

func SetSwapInterval0

func SetSwapInterval0()

func SetSystemFont

func SetSystemFont(face *truetype.Font)

func SetWindowHitHandler

func SetWindowHitHandler(w *Window, fn func(x, y int32) uint32)

func SetWindowSizeSDLWin

func SetWindowSizeSDLWin(w *Window, width, height int32) bool

func Shutdown

func Shutdown()

func SizeProbe

func SizeProbe(w *Window)

func SwapEGLBuffers

func SwapEGLBuffers()

SwapEGLBuffers swaps the EGL buffers (call after rendering)

func SwapWindow

func SwapWindow()

func SystemTTF

func SystemTTF() *truetype.Font

func TerminateEGL

func TerminateEGL()

TerminateEGL cleans up EGL resources

func UseProgramCached

func UseProgramCached(program uint32)

UseProgramCached calls glUseProgram only if the program has changed.

func VideoDriver

func VideoDriver() string

func WindowMaximized

func WindowMaximized(w *Window) bool

func WindowPos

func WindowPos(w *Window) (int32, int32)

func WindowSize

func WindowSize(w *Window) (int32, int32)

Types

type BlendMode

type BlendMode int

BlendMode defines blend modes

const (
	BlendModeNormal BlendMode = iota
	BlendModeMultiply
	BlendModeScreen
	BlendModeOverlay
	BlendModeDarken
	BlendModeLighten
	BlendModeColorDodge
	BlendModeColorBurn
	BlendModeHardLight
	BlendModeSoftLight
	BlendModeDifference
	BlendModeExclusion
	BlendModeHue
	BlendModeSaturation
	BlendModeColor
	BlendModeLuminosity
)

type BlurRenderer

type BlurRenderer struct {
	// contains filtered or unexported fields
}

type Canvas

type Canvas struct {
	// contains filtered or unexported fields
}

Canvas is a simplified drawing surface for OpenGL ES. This is a subset of unison.Canvas methods needed for MeUi.

func NewCanvas

func NewCanvas(width, height float32) *Canvas

NewCanvas creates a new canvas for the given dimensions.

func (*Canvas) Clear

func (c *Canvas) Clear(col uint32)

Clear clears the canvas with a color.

func (*Canvas) ClearWithViewport

func (c *Canvas) ClearWithViewport(col uint32, x, y, w, h int32)

ClearWithViewport clears the canvas with a color and sets viewport

func (*Canvas) ClipBounds

func (c *Canvas) ClipBounds() Rect

ClipBounds returns the current clip bounds.

func (*Canvas) ClipDepth

func (c *Canvas) ClipDepth() int

ClipDepth returns the current clip-stack depth. Debug aid for hunting widgets that push a clip without popping it.

func (*Canvas) ClipPath

func (c *Canvas) ClipPath(path *Path) bool

ClipPath intersects the clip with the interior of path, transformed by the current matrix.

It reports whether the clip is EXACT. Clipping is applied as per-vertex half-planes, which express any convex outline; a concave outline is clipped to its convex hull, and an outline needing more than maxClipPlanes edges is clipped to its bounding rectangle instead. Both fallbacks are supersets of the requested region, so content the caller asked to keep is never hidden — the clip can only ever show a little more than asked, never less — but both report false.

func (*Canvas) ClipRect

func (c *Canvas) ClipRect(r Rect)

ClipRect sets the clipping rectangle using scissor test.

func (*Canvas) DrawArc

func (c *Canvas) DrawArc(x, y, w, h, startAngle, sweepAngle float32, p *Paint)

DrawArc draws an arc within the given oval bounds

func (*Canvas) DrawCircle

func (c *Canvas) DrawCircle(cx, cy, r float32, p *Paint)

DrawCircle draws a filled circle at (cx, cy) with radius r.

func (*Canvas) DrawCirclePath

func (c *Canvas) DrawCirclePath(cx, cy, r float32, p *Paint)

func (*Canvas) DrawColor

func (c *Canvas) DrawColor(col uint32, mode BlendMode)

DrawColor fills the entire canvas with a color using the specified blend mode.

func (*Canvas) DrawImage

func (c *Canvas) DrawImage(img *Image, x, y float32, p *Paint)

DrawImage draws an image at the given position DrawImage draws an image at the given position (no scaling).

func (*Canvas) DrawImageInRect

func (c *Canvas) DrawImageInRect(img *Image, rect Rect, p *Paint)

DrawImageInRect draws an image scaled to fit the given rectangle. Uploads the image as a GL_RGBA texture and renders via textured quads.

func (*Canvas) DrawImageNine

func (c *Canvas) DrawImageNine(img *Image, centerRect Rect, dest Rect, p *Paint)

DrawImageNine draws a 9-patch image. The source image is divided into 9 regions by centerRect (in pixel coordinates). The four corners are drawn at their natural size, edges stretch along one axis, and the center stretches in both directions.

func (*Canvas) DrawLine

func (c *Canvas) DrawLine(x1, y1, x2, y2 float32, p *Paint)

DrawLine draws a line from (x1, y1) to (x2, y2)

func (*Canvas) DrawLineRotated

func (c *Canvas) DrawLineRotated(x, y, length, thickness, angle float32, p *Paint)

DrawLineRotated draws a rotated line starting at (x, y)

func (*Canvas) DrawOval

func (c *Canvas) DrawOval(x, y, w, h float32, p *Paint)

DrawOval draws an oval (ellipse) within the given bounds

func (*Canvas) DrawPath

func (c *Canvas) DrawPath(path *Path, p *Paint)

DrawPath draws a path by splitting into contours, flattening curves, triangulating each contour with earcut, and submitting triangles to the GPU.

func (*Canvas) DrawPoints

func (c *Canvas) DrawPoints(verts []float32, p *Paint)

QuickRejectPath returns true if the path bounds are entirely outside the current clip. DrawPoints renders a batch of points as filled circles.

func (*Canvas) DrawRect

func (c *Canvas) DrawRect(x, y, w, h float32, p *Paint)

DrawRect draws a rectangle at (x, y) with given width and height. Triangulated into 2 triangles and accumulated in the frame batch.

func (*Canvas) DrawRoundedRect

func (c *Canvas) DrawRoundedRect(rect Rect, radiusX, radiusY float32, p *Paint)

DrawRoundedRect draws a rectangle with rounded corners DrawRoundedRect draws a rounded rectangle using a path with corner arcs. Reuses the existing path rendering pipeline for proper edge AA.

func (*Canvas) DrawSimpleString

func (c *Canvas) DrawSimpleString(text string, x, y float32, p *Paint)

DrawSimpleString draws simple text using the system font

func (*Canvas) DrawText

func (c *Canvas) DrawText(text string, x, y float32, font *Font, p *Paint)

DrawText renders text using a bitmap font atlas.

func (*Canvas) DrawTriangleFilled

func (c *Canvas) DrawTriangleFilled(p1, p2, p3 Point, p *Paint)

DrawTriangleFilled fills one triangle. Like every other Canvas entry point it takes LOCAL coordinates and applies the canvas transform itself — the stroke walk's joins pass the same local points it hands to DrawLine, and a triangle that skipped the transform landed a whole view offset away from its own stroke (visible as flecks of cable colour on the canvas).

func (*Canvas) DropShadow

func (c *Canvas) DropShadow(rect Rect, p *Paint, offsetX, offsetY, radius float32)

DropShadow draws a blurred drop shadow using the FBO pipeline. The shadow shape is rendered offset, then blurred, composited back to screen. Call between BeginBlur/EndBlur for the blurred background shape. Uses the 2-pass separable Gaussian blur for smooth edges.

func (*Canvas) GetMatrix

func (c *Canvas) GetMatrix() Matrix

GetMatrix returns the current transform matrix.

func (*Canvas) Height

func (c *Canvas) Height() float32

Height returns the canvas height in pixels.

func (*Canvas) IsClipEmpty

func (c *Canvas) IsClipEmpty() bool

IsClipEmpty returns true if the current clip is empty.

func (*Canvas) QuickRejectRect

func (c *Canvas) QuickRejectRect(rect Rect) bool

QuickRejectRect returns true if the rect is entirely outside the current clip.

func (*Canvas) ResetClip

func (c *Canvas) ResetClip()

ResetClip drops any active clip and returns the canvas to an unclipped state: the clip stack is cleared and the process-global scissor mirror (stamped into every batched vertex) is reset. Used by callers that draw OUTSIDE a content tree — window title bars — so a leaked content clip (a widget's ClipRect without a matching Restore) cannot discard the bar's primitives.

func (*Canvas) Restore

func (c *Canvas) Restore()

Restore restores the state to the most recent Save: the matrix/paint stacks pop one entry and the clip stack pops back to the length recorded at that Save (removing every ClipRect pushed since).

func (*Canvas) RestoreToCount

func (c *Canvas) RestoreToCount(count int)

RestoreToCount restores to a specific save count.

func (*Canvas) Rotate

func (c *Canvas) Rotate(degrees float32)

Rotate rotates the coordinate system (degrees).

func (*Canvas) Save

func (c *Canvas) Save() int

Save saves the current state (matrix, clip).

func (*Canvas) SaveAndRestore

func (c *Canvas) SaveAndRestore(f func(c *Canvas))

SaveAndRestore runs f inside a Save/Restore pair — the transaction form of Save: every state change f makes (clips, transforms) is rolled back when it returns, even on early paths. Prefer this over bare Save/Restore in widget paints; it cannot leak stack entries.

func (*Canvas) Scale

func (c *Canvas) Scale(sx, sy float32)

Scale scales the coordinate system.

func (*Canvas) Skew

func (c *Canvas) Skew(kx, ky float32)

Skew skews the coordinate system (kx, ky in degrees).

func (*Canvas) TransformRect

func (c *Canvas) TransformRect(x, y, w, h float32) (float32, float32, float32, float32)

TransformRect is the public version of transformRect, used by meuishim.

func (*Canvas) Translate

func (c *Canvas) Translate(dx, dy float32)

Translate translates the coordinate system.

func (*Canvas) Width

func (c *Canvas) Width() float32

Width returns the canvas width in pixels. Clip reset bounds derive from it, so a canvas must be recreated when its window resizes.

func (*Canvas) WithClip

func (c *Canvas) WithClip(r Rect, f func(c *Canvas))

WithClip intersects the clip with r (top-down canvas coords) for the duration of f, then restores the previous clip. The transaction form of ClipRect: drawing with a clip can no longer leak stack entries (the historic TextField bug — every paint pushed a clip that was never popped, poisoning everything painted after it).

type ClipPlane

type ClipPlane struct {
	NX, NY, D float32
}

ClipPlane is one half-plane of a convex clip, in DEVICE space (GL window coordinates, y increasing upward). A pixel is kept when

NX*x + NY*y + D >= 0

Planes are always combined by intersection.

func ClipPlanes

func ClipPlanes() []ClipPlane

ClipPlanes returns the current path clip (nil when only the rect applies).

type Color

type Color uint32

Color is ARGB packed color

func RGB

func RGB(r, g, b uint8) Color

RGB creates a Color from RGB values

func RGBA

func RGBA(r, g, b, a uint8) Color

RGBA creates a Color from RGBA values

func (Color) Paint

func (c Color) Paint(_ *Canvas, _ Rect, style int32) *Paint

Paint returns a Paint for this Color. Here to satisfy the Ink interface in the shim so a Color can be used wherever an Ink is expected.

type DesktopRenderer

type DesktopRenderer struct{}

DesktopRenderer implements Renderer using the existing OpenGL globals.

func (*DesktopRenderer) ClearScissor

func (d *DesktopRenderer) ClearScissor()

func (*DesktopRenderer) ClearWithViewport

func (d *DesktopRenderer) ClearWithViewport(col uint32, x, y, w, h int32)

ClearWithViewport clears the surface and sets the viewport. Clears must never be scissored: batch flushes leave the scissor enabled, and on a fresh context the scissor box is stale, which would leave the rest of the buffer showing uninitialized surface garbage.

func (*DesktopRenderer) DrainErrors

func (d *DesktopRenderer) DrainErrors()

func (*DesktopRenderer) DrawCircle

func (d *DesktopRenderer) DrawCircle(cx, cy, radius float32, color Color)

func (*DesktopRenderer) DrawColor

func (d *DesktopRenderer) DrawColor(col uint32, mode BlendMode)

DrawColor fills the whole surface with col using the given blend mode. It is the legacy immediate path (the rect program), kept behind the interface so Canvas owns no GL state of its own.

func (*DesktopRenderer) DrawLine

func (d *DesktopRenderer) DrawLine(x1, y1, x2, y2 float32, color Color, strokeW float32)

func (*DesktopRenderer) DrawOval

func (d *DesktopRenderer) DrawOval(x, y, w, h float32, color Color)

func (*DesktopRenderer) DrawPathFill

func (d *DesktopRenderer) DrawPathFill(tris []float32, color Color, bounds Rect)

func (*DesktopRenderer) DrawRect

func (d *DesktopRenderer) DrawRect(x, y, w, h float32, color Color, angle float32)

func (*DesktopRenderer) DrawRectStyled

func (d *DesktopRenderer) DrawRectStyled(x, y, w, h, radius, strokeW float32, color Color, style int32, angle float32)

func (*DesktopRenderer) DrawTexturedQuads

func (d *DesktopRenderer) DrawTexturedQuads(verts []float32, texID uint32, color Color, isImage bool)

func (*DesktopRenderer) DrawTriangles

func (d *DesktopRenderer) DrawTriangles(verts []float32, color Color)

func (*DesktopRenderer) Flush

func (d *DesktopRenderer) Flush()

func (*DesktopRenderer) Present

func (d *DesktopRenderer) Present()

func (*DesktopRenderer) ScissorState

func (d *DesktopRenderer) ScissorState() (int32, int32, int32, int32, bool)

func (*DesktopRenderer) ScreenSize

func (d *DesktopRenderer) ScreenSize() (float32, float32)

func (*DesktopRenderer) SetBlendMode

func (d *DesktopRenderer) SetBlendMode(mode BlendMode)

SetBlendMode selects how subsequent draws composite. The GL blend state is global while draws are batched, so a mode change is a batch boundary: the pending batch is flushed under the old mode first.

func (*DesktopRenderer) SetScissor

func (d *DesktopRenderer) SetScissor(x, y, w, h int32)

func (*DesktopRenderer) SetScreenSize

func (d *DesktopRenderer) SetScreenSize(w, h float32)

func (*DesktopRenderer) SetViewport

func (d *DesktopRenderer) SetViewport(x, y, w, h int32)

type EGLContext

type EGLContext struct {
	// contains filtered or unexported fields
}

EGLContext holds EGL display, context, and surface

type ErrNotSupported

type ErrNotSupported struct {
	Platform string
}

ErrNotSupported indicates a backend is not available on this platform.

func (*ErrNotSupported) Error

func (e *ErrNotSupported) Error() string

type Event

type Event = sdl.Event

Compatibility aliases while the GL backend switches to meui-sdl.

type EventQueue

type EventQueue = sdl.EventQueue

Compatibility aliases while the GL backend switches to meui-sdl.

type EventSource

type EventSource = sdl.EventSource

Compatibility aliases while the GL backend switches to meui-sdl.

type EventType

type EventType = sdl.EventType

Compatibility aliases while the GL backend switches to meui-sdl.

type Font

type Font struct {
	// contains filtered or unexported fields
}

Font holds font data for GPU-accelerated text rendering

func NewFont

func NewFont(family string, size float32, face *truetype.Font) *Font

NewFont delegates to NewFontStyled with no synthetic styles.

func NewFontStyled

func NewFontStyled(family string, size float32, face *truetype.Font, fakeBold, fakeItalic bool) *Font

NewFontStyled creates a font, optionally with synthetic bold/italic (rasterized emboldening/shear for faces lacking real companions — Skia-style synthesis). Styled variants get their own atlas.

func SystemFont

func SystemFont() *Font

SystemFont returns the default system font

func (*Font) Baseline

func (f *Font) Baseline() float32

Baseline returns the baseline that vertically centers text optically. Widget code centers with (h - LineHeight)/2 + Baseline; using the font bbox ascent here (bounds.Max.Y ≈ 1.23em — accent headroom over ALL glyphs) pushed every centered label ~3.5px below the box center. The correct value is the line-box midpoint plus half the cap height, with cap height measured from the rasterized 'H' glyph.

func (*Font) Descender

func (f *Font) Descender() float32

func (*Font) Descriptor

func (f *Font) Descriptor() FontDescriptor

Descriptor returns the font descriptor

func (*Font) Face

func (f *Font) Face() *truetype.Font

Face returns the underlying truetype font face

func (*Font) Family

func (f *Font) Family() string

Family returns the font family name

func (*Font) LineHeight

func (f *Font) LineHeight() float32

LineHeight returns the font line height

func (*Font) Size

func (f *Font) Size() float32

Size returns the font size in points

func (*Font) TextWidth

func (f *Font) TextWidth(text string) float32

TextWidth measures with the SAME engine that draws: the glyph atlas. It mirrors DrawText's pen walk exactly (kern + whole-pixel atlas advance per glyph, same skips and same nil fallback) so measurement can never drift from rendering — synthetic styles included, since their advance adjustments live in the atlas itself. Returns the widest line.

type FontDescriptor

type FontDescriptor struct {
	Family string
	Size   float32
}

FontDescriptor describes a font

type FrameStats

type FrameStats struct {
	Primitives int64
	DrawCalls  int64
	Flushes    int64
}

FrameStats is a snapshot of renderer activity counters.

func GetFrameStats

func GetFrameStats() FrameStats

GetFrameStats returns and resets the counters.

type GPUTimer

type GPUTimer struct {
	// contains filtered or unexported fields
}

GPUTimer provides GPU-side timing for profiling shader performance.

func NewGPUTimer

func NewGPUTimer() *GPUTimer

NewGPUTimer creates a new GPU timer query.

func (*GPUTimer) Begin

func (t *GPUTimer) Begin()

Begin starts the GPU timing measurement.

func (*GPUTimer) End

func (t *GPUTimer) End()

End stops the GPU timing measurement.

func (*GPUTimer) Nanoseconds

func (t *GPUTimer) Nanoseconds() int64

Nanoseconds returns the elapsed GPU time in nanoseconds. Returns 0 if the result is not yet available.

type Gradient

type Gradient struct {
	Type       GradientType
	Stops      [MaxGradientStops]GradientStop
	StopCount  int
	Start, End Point
	Center     Point
	Radius     float32
	StartAngle float32
}

Gradient describes a multi-stop colour gradient for fills and strokes.

Linear: ramp runs from Start to End.
Radial: ramp runs from Center out to Radius.
Conic:  ramp sweeps around Center, starting at StartAngle degrees.

Stops are kept sorted by Offset so sampleGradientStops can walk them.

func CurrentGradient

func CurrentGradient() Gradient

CurrentGradient returns the published gradient.

func (*Gradient) SetStops

func (g *Gradient) SetStops(stops []GradientStop)

SetStops replaces the gradient's stops, sorted by offset so the ramp is well defined. Fewer than two stops leaves it a flat fill of the first.

type GradientStop

type GradientStop struct {
	Offset float32
	Color  Color
}

GradientStop is one colour stop at Offset (0..1) along the gradient.

type GradientType

type GradientType int

GradientType defines gradient shape

const (
	GradientNone GradientType = iota
	GradientLinear
	GradientRadial
	GradientConic
)

type Image

type Image struct {
	// contains filtered or unexported fields
}

Image represents an image with texture

func NewImage

func NewImage(rgba []uint32, w, h int32) *Image

NewImage creates a new image from raw ARGB data. Pixels are assumed premultiplied (the case for framebuffer readbacks); use NewImageFromPNG for straight-alpha sources.

func NewImageFromPNG

func NewImageFromPNG(data []byte) (*Image, error)

NewImageFromPNG decodes a PNG from bytes

func (*Image) Dirty

func (img *Image) Dirty() bool

Dirty reports whether the texture is behind the pixel buffer.

func (*Image) Height

func (img *Image) Height() int32

Height returns image height

func (*Image) LogicalSize

func (i *Image) LogicalSize() Size

LogicalSize returns the image's dimensions as a Size. Used by meui for layout.

func (*Image) MarkPixelsDirty

func (img *Image) MarkPixelsDirty()

MarkPixelsDirty flags the CPU pixel buffer as modified so the next draw re-uploads the texture. Safe to call off the GL thread.

func (*Image) Pixels

func (img *Image) Pixels() []uint32

Pixels returns the decoded pixel data

func (*Image) SetPixels

func (img *Image) SetPixels(pix []uint32)

SetPixels replaces the pixel buffer, for a caller that re-renders into the same surface. The buffer must be the same size as the image: this image keeps one texture, and a different extent would be uploaded under the old shape.

func (*Image) TextureID

func (img *Image) TextureID() uint32

TextureID returns the GPU texture handle (0 = not uploaded).

func (*Image) ToPNG

func (img *Image) ToPNG(compressionLevel int) ([]byte, error)

ToPNG encodes the image as a PNG and returns the bytes. compressionLevel: 0 = default, 1-9 = higher compression.

func (*Image) Upload

func (img *Image) Upload()

Upload creates or updates the GPU texture for this image. Must be called from the GL thread (inside LockOSThread). With no GL context loaded (headless unit tests) it is a no-op, leaving texture == 0 so callers fall back instead of panicking.

func (*Image) Width

func (img *Image) Width() int32

Width returns image width

type InstanceData

type InstanceData struct {
	PosX, PosY     float32
	SizeX, SizeY   float32
	Angle          float32
	ColorR, ColorG float32
	ColorB, ColorA float32
	BlendMode      int32
	// contains filtered or unexported fields
}

InstanceData holds per-instance attributes for batched rendering

type KeyMod

type KeyMod = sdl.KeyMod

Compatibility aliases while the GL backend switches to meui-sdl.

type Keycode

type Keycode = sdl.Keycode

Compatibility aliases while the GL backend switches to meui-sdl.

type Mat4

type Mat4 [16]float32

Mat4 is a 4x4 column-major matrix for 3D transforms. Layout: [col0, col1, col2, col3] where each col is 4 float32s. Index: row r, col c = m[c*4+r]

func Identity

func Identity() Mat4

Identity returns a 4x4 identity matrix

func LookAt

func LookAt(eye, center, up Vec3) Mat4

LookAt creates a view matrix (camera looking at target)

func Ortho

func Ortho(left, right, bottom, top, near, far float32) Mat4

Ortho creates an orthographic projection matrix

func Perspective

func Perspective(fov, aspect, near, far float32) Mat4

Perspective creates a perspective projection matrix (fov in degrees)

func (Mat4) Inverse

func (m Mat4) Inverse() Mat4

Inverse returns the inverse of a 4x4 matrix using Gauss-Jordan elimination

func (Mat4) Multiply

func (m Mat4) Multiply(b Mat4) Mat4

Multiply returns the matrix product a * b

func (Mat4) Rotate

func (m Mat4) Rotate(angle float32, axis Vec3) Mat4

Rotate returns m * rotation(angle, axis) — angle in degrees, axis normalized

func (Mat4) Scale

func (m Mat4) Scale(v Vec3) Mat4

Scale returns m * scale(sx, sy, sz)

func (Mat4) Transform

func (m Mat4) Transform(v Vec3) Vec3

Transform applies the matrix to a Vec3 (treats as position, w=1)

func (Mat4) Translate

func (m Mat4) Translate(v Vec3) Mat4

Translate returns m * translation(tx, ty, tz)

type Matrix

type Matrix [9]float32

Matrix is a 3x3 affine transformation matrix (row-major) [sx, kx, tx, ky, sy, ty, 0, 0, 1]

func NewMatrix

func NewMatrix() Matrix

NewMatrix creates an identity matrix

func RotateMatrix

func RotateMatrix(degrees float32) Matrix

RotateMatrix creates a rotation matrix (degrees)

func ScaleMatrix

func ScaleMatrix(sx, sy float32) Matrix

ScaleMatrix creates a scale matrix

func SkewMatrix

func SkewMatrix(kx, ky float32) Matrix

SkewMatrix creates a skew matrix (degrees for both axes)

func TranslateMatrix

func TranslateMatrix(tx, ty float32) Matrix

Translate creates a translation matrix

func (Matrix) Concat

func (m Matrix) Concat(other Matrix) Matrix

Concat returns the concatenation of this matrix with another (this * other)

func (Matrix) Multiply

func (m Matrix) Multiply(other Matrix) Matrix

Multiply returns this * other

func (Matrix) Transform

func (m Matrix) Transform(pt Point) Point

Transform transforms a point by this matrix

type Paint

type Paint struct {
	// contains filtered or unexported fields
}

Paint holds drawing style (subset of unison.Paint)

func NewPaint

func NewPaint() *Paint

NewPaint creates a new Paint

func (*Paint) Antialias

func (p *Paint) Antialias() bool

Antialias reports the antialiasing preference (on by default).

func (*Paint) BlendMode

func (p *Paint) BlendMode() BlendMode

BlendMode returns the blend mode

func (*Paint) ClearGradient

func (p *Paint) ClearGradient()

ClearGradient removes any gradient from this paint.

func (*Paint) Color

func (p *Paint) Color() Color

Color returns the paint color

func (*Paint) GlobalAlpha

func (p *Paint) GlobalAlpha() float32

GlobalAlpha returns the alpha multiplier (1 when unset).

func (*Paint) Gradient

func (p *Paint) Gradient() Gradient

Gradient returns the paint's gradient.

func (*Paint) MiterLimit

func (p *Paint) MiterLimit() float32

MiterLimit returns the miter limit (4 when unset).

func (*Paint) SetAntialias

func (p *Paint) SetAntialias(on bool)

SetAntialias turns the SDF pipeline's analytic edge ramp on or off.

func (*Paint) SetBlendMode

func (p *Paint) SetBlendMode(mode BlendMode)

SetBlendMode sets the blend mode

func (*Paint) SetColor

func (p *Paint) SetColor(c Color)

SetColor sets the paint color

func (*Paint) SetConicGradient

func (p *Paint) SetConicGradient(center Point, startAngle float32, stops []GradientStop)

SetConicGradient sets a multi-stop conic gradient sweeping around center from startAngle degrees.

func (*Paint) SetGlobalAlpha

func (p *Paint) SetGlobalAlpha(a float32)

SetGlobalAlpha sets the alpha multiplier applied to everything this paint draws, on top of the colour's own alpha. Values outside 0..1 are clamped; 1 means no modulation.

func (*Paint) SetGradient

func (p *Paint) SetGradient(g Gradient)

SetGradient replaces the paint's gradient wholesale.

func (*Paint) SetLinearGradient

func (p *Paint) SetLinearGradient(start, end Point, stops []GradientStop)

SetLinearGradient sets a multi-stop linear gradient running start→end.

func (*Paint) SetMiterLimit

func (p *Paint) SetMiterLimit(limit float32)

SetMiterLimit sets the miter limit: the longest miter allowed, as a multiple of half the stroke width, before a miter join falls back to a bevel. Values <= 0 mean the conventional default of 4.

func (*Paint) SetRadialGradient

func (p *Paint) SetRadialGradient(center Point, radius float32, stops []GradientStop)

SetRadialGradient sets a multi-stop radial gradient centred at center.

func (*Paint) SetStrokeCap

func (p *Paint) SetStrokeCap(cap StrokeCap)

SetStrokeCap sets the stroke cap

func (*Paint) SetStrokeJoin

func (p *Paint) SetStrokeJoin(join StrokeJoin)

SetStrokeJoin sets the stroke join

func (*Paint) SetStrokeWidth

func (p *Paint) SetStrokeWidth(w float32)

SetStrokeWidth sets the stroke width

func (*Paint) SetStyle

func (p *Paint) SetStyle(style int32)

SetStyle sets the paint style

func (*Paint) StrokeCap

func (p *Paint) StrokeCap() StrokeCap

StrokeCap returns the stroke cap

func (*Paint) StrokeJoin

func (p *Paint) StrokeJoin() StrokeJoin

StrokeJoin returns the stroke join

func (*Paint) StrokeWidth

func (p *Paint) StrokeWidth() float32

StrokeWidth returns the stroke width

func (*Paint) Style

func (p *Paint) Style() PaintStyle

Style returns the paint style

type PaintStyle

type PaintStyle int

PaintStyle defines fill/stroke style

const (
	Fill PaintStyle = iota
	Stroke
	FillStroke
)

type Path

type Path struct {
	// contains filtered or unexported fields
}

Path represents a path with points and verbs

func NewPath

func NewPath() *Path

NewPath creates a new empty path

func (*Path) Bounds

func (p *Path) Bounds() Rect

Bounds returns the path bounds

func (*Path) Close

func (p *Path) Close()

Close closes the current contour

func (*Path) LineTo

func (p *Path) LineTo(pt Point)

LineTo adds a line to the given point

func (*Path) MoveTo

func (p *Path) MoveTo(pt Point)

MoveTo moves to a point (starts new contour)

func (*Path) QuadTo

func (p *Path) QuadTo(ctrl, end Point)

QuadTo adds a quadratic bezier curve

func (*Path) Reset

func (p *Path) Reset()

Reset clears the path

type PathPt

type PathPt struct {
	Verb PathVerb
	Pt   Point
}

PathPt represents a point in a path along with verb

type PathVerb

type PathVerb int

PathVerb represents a path command

const (
	PathMove PathVerb = iota
	PathLine
	PathQuad
	PathCubic
	PathClose
)

type Point

type Point struct {
	X, Y float32
}

Point represents a 2D point (compatible with toolbox/geom.Point)

func NewPoint

func NewPoint(x, y float32) Point

NewPoint creates a new Point

type Rect

type Rect struct {
	X, Y          float32
	Width, Height float32
}

Rect represents a rectangle (compatible with toolbox/geom.Rect)

func NewRect

func NewRect(x, y, w, h float32) Rect

NewRect creates a new Rect

func (Rect) Contains

func (r Rect) Contains(x, y float32) bool

Contains returns true if the point (x, y) is inside the rectangle.

func (Rect) Intersects

func (r Rect) Intersects(other Rect) bool

Intersects returns true if this rectangle overlaps with other.

type RectRenderer

type RectRenderer struct {
	// contains filtered or unexported fields
}

type Renderer

type Renderer interface {
	// Lifecycle
	SetScreenSize(w, h float32)
	ScreenSize() (float32, float32)

	// Frame control
	Present()

	// Surface state
	ClearWithViewport(col uint32, x, y, w, h int32)
	SetViewport(x, y, w, h int32)
	// ScissorState reports the GL scissor box and whether the test is on.
	ScissorState() (x, y, w, h int32, test bool)
	// DrainErrors clears any pending GL error flags.
	DrainErrors()

	// State
	SetBlendMode(mode BlendMode)
	SetScissor(x, y, w, h int32)
	ClearScissor()

	// 2D drawing
	DrawRect(x, y, w, h float32, color Color, angle float32)
	DrawCircle(cx, cy, r float32, color Color)
	DrawOval(x, y, w, h float32, color Color)
	DrawLine(x1, y1, x2, y2 float32, color Color, strokeW float32)
	DrawTriangles(verts []float32, color Color)
	DrawTexturedQuads(verts []float32, texID uint32, color Color, isImage bool)
	// DrawColor fills the whole surface with col, composited with mode.
	DrawColor(col uint32, mode BlendMode)
	// DrawRectStyled is the shaped-rect primitive: fill or stroke, with a
	// corner radius and stroke width. It is the primitive the toolkit's rect
	// drawing actually uses, so it belongs in the contract.
	DrawRectStyled(x, y, w, h, radius, strokeW float32, color Color, style int32, angle float32)
	// Flush emits any pending batched draws, preserving strict draw order.
	Flush()
}

Renderer is the interface that Canvas uses for all GPU operations. Each platform (desktop, Android, iOS) provides its own implementation.

func NewRenderer

func NewRenderer() Renderer

NewRenderer builds the process renderer from the installed factory.

type ShapeRenderer

type ShapeRenderer struct {
	// contains filtered or unexported fields
}

type Size

type Size struct {
	Width, Height float32
}

Size represents width and height

func NewSize

func NewSize(w, h float32) Size

NewSize creates a new Size

type StrokeCap

type StrokeCap int

StrokeCap defines line end style

const (
	StrokeCapButt StrokeCap = iota
	StrokeCapRound
	StrokeCapSquare
)

type StrokeJoin

type StrokeJoin int

StrokeJoin defines line join style

const (
	StrokeJoinMiter StrokeJoin = iota
	StrokeJoinRound
	StrokeJoinBevel
)

type TextRenderer

type TextRenderer struct {
	// contains filtered or unexported fields
}

type Touch

type Touch = sdl.Touch

Compatibility aliases while the GL backend switches to meui-sdl.

type Vec3

type Vec3 struct {
	X, Y, Z float32
}

Vec3 is a 3D vector/point

func (Vec3) Add

func (v Vec3) Add(o Vec3) Vec3

func (Vec3) Cross

func (v Vec3) Cross(o Vec3) Vec3

func (Vec3) Dot

func (v Vec3) Dot(o Vec3) float32

func (Vec3) Length

func (v Vec3) Length() float32

func (Vec3) Negate

func (v Vec3) Negate() Vec3

func (Vec3) Normalize

func (v Vec3) Normalize() Vec3

func (Vec3) Scale

func (v Vec3) Scale(s float32) Vec3

func (Vec3) Sub

func (v Vec3) Sub(o Vec3) Vec3

type Window

type Window = sdl.Window

Compatibility aliases while the GL backend switches to meui-sdl.

func GetMainWindow

func GetMainWindow() *Window

func InitWindow

func InitWindow(w, h int32) *Window

func OpenWindowNamed

func OpenWindowNamed(title string, w, h int32) (*Window, error)

func OpenWindowNamedInline

func OpenWindowNamedInline(title string, w, h int32) (*Window, error)

Jump to

Keyboard shortcuts

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