Class ColorDrawBuf

Inherits from

Constructors

Name Description
this create ARGB8888 draw buf of specified width and height
this create copy of ColorDrawBuf
this create resized copy of ColorDrawBuf

Fields

Name Type Description
_buf uint[]
_dx int
_dy int
_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
alpha [set] uint set new alpha setting (to be applied to all drawing operations)
alpha [get] uint get current alpha setting (to be applied to all drawing operations)
bpp [get] int returns buffer bits per pixel
clipRect [set] const(Rect) returns clipping rectangle, or (0,0,dx,dy) when no clipping.
clipRect [get] Rect returns clipping rectangle, when clipRect.isEmpty == true -- means no clipping.
hasClipping [get] bool
hasNinePatch [get] bool check whether there is nine-patch information available for drawing buffer
height [get] int returns current height
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
onDestroyCallback [set] void function(uint)
refCount [get] int returns current value of reference counter
width [get] int returns current width

Methods

Name Description
fill fill the whole buffer with solid color (no clipping applied)
invertAlpha
invertByteOrder
resize resize buffer
scanLine returns pointer to ARGB scanline, null if y is out of range or buffer doesn't provide access to its memory
transformColors create drawbuf with copy of current buffer with changed colors (returns this if not supported)
addAlpha apply additional transparency to current drawbuf alpha value
addRef increments reference counter
afterDrawing reserved for hardware-accelerated drawing - ends drawing batch
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
beforeDrawing reserved for hardware-accelerated drawing - begins drawing batch
clear
detectNinePatch detect nine patch using image 1-pixel border (see Android documentation)
drawCustomOpenGLScene draw custom OpenGL scene
drawFocusRect draw focus rectangle; vertical gradient supported - colors[0] is top color, colors[1] is bottom color
drawFragment draw source buffer rectangle contents to destination buffer
drawFrame draws rectangle frame of specified color and widths (per side), and optinally fills inner area
drawGlyph draw 8bit alpha image - usually font glyph using specified color (clipping is applied)
drawGlyphToTexture
drawImage draw unscaled image at specified coordinates
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
fillRect fill rectangle with solid color (clipping is applied)
isBlackPixel
releaseRef decrement reference counter, destroy object if no more references left
resetClipping init clip rectangle to full buffer size

Authors

Vadim Lopatin, coolreader.org@gmail.com

Copyright

Vadim Lopatin, 2014

License

Boost License 1.0