Class DrawBuf
drawing buffer - image container which allows to perform some drawing operations
Constructors
| Name | Description |
|---|---|
this
()
|
Fields
| Name | Type | Description |
|---|---|---|
_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[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 |
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 function(uint) | |
width[get]
|
int | returns current width |
refCount[get]
|
int | returns current value of reference counter |
Methods
| Name | Description |
|---|---|
addAlpha
(alpha)
|
apply additional transparency to current drawbuf alpha value |
afterDrawing
()
|
reserved for hardware-accelerated drawing - ends drawing batch |
applyAlpha
(argb)
|
applies current drawbuf alpha to argb color value |
applyClipping
(rc)
|
apply clipRect and buffer bounds clipping to rectangle |
applyClipping
(rc, rc2)
|
apply clipRect and buffer bounds clipping to rectangle; if clippinup applied to first rectangle, reduce second rectangle bounds proportionally. |
beforeDrawing
()
|
reserved for hardware-accelerated drawing - begins drawing batch |
calcRectRoundedCornerRadius
(corners, w, h, keepSquareXY)
|
|
clear
()
|
|
detectNinePatch
()
|
override to detect nine patch using image 1-pixel border; returns true if 9-patch markup is found in image. |
drawCustomOpenGLScene
(rc, handler)
|
draw custom OpenGL scene |
drawEllipseArcF
(centerX, centerY, xRadius, yRadius, startAngle, endAngle, lineWidth, lineColor, fillColor)
|
draw ellipse arc or filled ellipse arc |
drawEllipseF
(centerX, centerY, xRadius, yRadius, lineWidth, lineColor, fillColor)
|
draw ellipse or filled ellipse |
drawFocusRect
(rc, colors)
|
draw focus rectangle; vertical gradient supported - colors[0] is top color, colors[1] is bottom color |
drawFragment
(x, y, src, srcrect)
|
draw source buffer rectangle contents to destination buffer |
drawFrame
(rc, frameColor, frameSideWidths, innerAreaColor)
|
draws rectangle frame of specified color and widths (per side), and optinally fills inner area |
drawGlyph
(x, y, glyph, color)
|
draw 8bit alpha image - usually font glyph using specified color (clipping is applied) |
drawImage
(x, y, src)
|
draw unscaled image at specified coordinates |
drawLine
(p1, p2, colour)
|
draw line from point p1 to p2 with specified color |
drawLineF
(p1, p2, width, colour)
|
draw line of arbitrary width in float coordinates |
drawLineSegmentF
(p0, p1, p2, p3, width, colour)
|
draw line of arbitrary width in float coordinates p1..p2 with angle based on previous (p0..p1) and next (p2..p3) segments |
drawPixel
(x, y, color)
|
draw pixel at (x, y) with specified color |
drawRescaled
(dstrect, src, srcrect)
|
draw source buffer rectangle contents to destination buffer rectangle applying rescaling |
drawRoundedRectF
(rect, corners, keepSquareXY, frameWidth, frameColor, fillColor)
|
draws rect with rounded corners |
fill
(color)
|
fill the whole buffer with solid color (no clipping applied) |
fillGradientRect
(rc, color1, color2, color3, color4)
|
fill rectangle with a gradient (clipping is applied) |
fillPolyF
(points, colour)
|
draw filled polyline (vertexes must be in clockwise order) |
fillQuadF
(p1, p2, p3, p4, colour)
|
draw filled quad in float coordinates |
fillRect
(rc, color)
|
fill rectangle with solid color (clipping is applied) |
fillRectPattern
(rc, color, pattern)
|
fill rectangle with solid color and pattern (clipping is applied) 0=solid fill, 1 = dotted |
fillTriangleF
(p1, p2, p3, colour)
|
draw filled triangle in float coordinates |
invalidate
()
|
Call to remove this image from OpenGL cache when image is updated. |
makeArcPath
(center, radiusX, radiusY, startAngle, endAngle)
|
|
makeRoundedRectPath
(rect, corners, keepSquareXY, outCornerSegmentsStart)
|
builds outer rounded rect path the last parameter optionally writes out indices of first segment of corners excluding top-left |
onDestroyCallback
()
|
|
polyLine
(points, colour, cycled)
|
draw poly line of width == 1px; when cycled is true, connect first and last point |
polyLineF
(points, width, colour, cycled, innerAreaColour)
|
draw poly line of arbitrary width in float coordinates; when cycled is true, connect first and last point (optionally fill inner area) |
resetClipping
()
|
init clip rectangle to full buffer size |
resize
(width, height)
|
resize buffer |
transformColors
(transform)
|
create drawbuf with copy of current buffer with changed colors (returns this if not supported) |
addRef
()
|
increments reference counter |
releaseRef
()
|
decrement reference counter, destroy object if no more references left |
calcLineSegmentQuad
(p0, p1, p2, p3, width, quad)
|
|
fillTriangleFClipped
(p1, p2, p3, colour)
|
draw filled triangle in float coordinates; clipping is already applied |
intersectClipF
(p1, p2, p1moved, p2moved)
|
find intersection of line p1..p2 with clip rectangle |
intersectVectors
(p1, dir1, p2, dir2)
|
Aliases
| Name | Description |
|---|---|
~this
|