Class GLDrawBuf

drawing buffer - image container which allows to perform some drawing operations

Inherits from

Constructors

Name Description
this

Fields

Name Type Description
_dx int
_dy int
_framebuffer bool
_framebufferId uint
_scene Scene
_alpha uint
_clipRect Rect
_id uint
_ninePatch NinePatch*
_onDestroyCallback void function(uint)
_refCount int count of references to this object from Ref

Properties

Name Type Description
height [get] int returns current height
scene [get] Scene get current scene (exists only between beforeDrawing() and afterDrawing() calls)
width [get] int returns current width
alpha [get] uint get current alpha setting (to be applied to all drawing operations)
alpha [set] uint set new alpha setting (to be applied to all drawing operations)
bpp [get] int returns buffer bits per pixel
clipRect [get] Rect returns clipping rectangle, when clipRect.isEmpty == true -- means no clipping.
clipRect [set] const(Rect) returns clipping rectangle, or (0,0,dx,dy) when no clipping.
hasClipping [get] bool
hasNinePatch [get] bool check whether there is nine-patch information available for drawing buffer
id [get] uint unique ID of drawbug instance, for using with hardware accelerated rendering for caching
intersectClipRect [set] const(Rect) sets new clipping rectangle, intersect with previous one.
isClippedOut [set] bool returns true if rectangle is completely clipped out and cannot be drawn.
ninePatch [get] const(NinePatch)* get nine patch information pointer, null if this is not a nine patch image buffer
ninePatch [set] NinePatch* set nine patch information pointer, null if this is not a nine patch image buffer
onDestroyCallback [set] void function(uint)
onDestroyCallback [set] void
refCount [get] int returns current value of reference counter

Methods

Name Description
afterDrawing reserved for hardware-accelerated drawing - ends drawing batch
beforeDrawing reserved for hardware-accelerated drawing - begins drawing batch
clear cleanup resources
drawCustomOpenGLScene draw custom OpenGL scene
drawFragment draw source buffer rectangle contents to destination buffer
drawGlyph draw 8bit alpha image - usually font glyph using specified color (clipping is applied)
drawLine draw line from point p1 to p2 with specified color
drawPixel draw pixel at (x, y) with specified color
drawRescaled draw source buffer rectangle contents to destination buffer rectangle applying rescaling
fill fill the whole buffer with solid color (no clipping applied)
fillRect fill rectangle with solid color (clipping is applied)
resize resize buffer
restoreConfiguration
saveConfiguration
addAlpha apply additional transparency to current drawbuf alpha value
addRef increments reference counter
applyAlpha applies current drawbuf alpha to argb color value
applyClipping apply clipRect and buffer bounds clipping to rectangle; if clippinup applied to first rectangle, reduce second rectangle bounds proportionally.
applyClipping apply clipRect and buffer bounds clipping to rectangle
detectNinePatch override to detect nine patch using image 1-pixel border; returns true if 9-patch markup is found in image.
drawFocusRect draw focus rectangle; vertical gradient supported - colors[0] is top color, colors[1] is bottom color
drawFrame draws rectangle frame of specified color and widths (per side), and optinally fills inner area
drawImage draw unscaled image at specified coordinates
releaseRef decrement reference counter, destroy object if no more references left
resetClipping init clip rectangle to full buffer size
transformColors create drawbuf with copy of current buffer with changed colors (returns this if not supported)

Authors

Vadim Lopatin, coolreader.org@gmail.com

Copyright

Vadim Lopatin, 2014

License

Boost License 1.0