DrawBuf

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

class DrawBuf : RefCountedObject {}

Constructors

this
this()
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

addAlpha
void addAlpha(uint alpha)

apply additional transparency to current drawbuf alpha value

afterDrawing
void afterDrawing()

reserved for hardware-accelerated drawing - ends drawing batch

applyAlpha
uint applyAlpha(uint argb)

applies current drawbuf alpha to argb color value

applyClipping
bool applyClipping(Rect rc)

apply clipRect and buffer bounds clipping to rectangle

applyClipping
bool applyClipping(Rect rc, Rect rc2)

apply clipRect and buffer bounds clipping to rectangle; if clippinup applied to first rectangle, reduce second rectangle bounds proportionally.

beforeDrawing
void beforeDrawing()

reserved for hardware-accelerated drawing - begins drawing batch

calcLineSegmentQuad
void calcLineSegmentQuad(PointF p0, PointF p1, PointF p2, PointF p3, float width, PointF[4] quad)
Undocumented in source. Be warned that the author may not have intended to support it.
clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
detectNinePatch
bool detectNinePatch()

override to detect nine patch using image 1-pixel border; returns true if 9-patch markup is found in image.

drawCustomOpenGLScene
void drawCustomOpenGLScene(Rect rc, OpenGLDrawableDelegate handler)

draw custom OpenGL scene

drawEllipseArcF
void drawEllipseArcF(float centerX, float centerY, float xRadius, float yRadius, float startAngle, float endAngle, float lineWidth, uint lineColor, uint fillColor)

draw ellipse arc or filled ellipse arc

drawEllipseF
void drawEllipseF(float centerX, float centerY, float xRadius, float yRadius, float lineWidth, uint lineColor, uint fillColor)

draw ellipse or filled ellipse

drawFocusRect
void drawFocusRect(Rect rc, uint[] colors)

draw focus rectangle; vertical gradient supported - colors[0] is top color, colors[1] is bottom color

drawFragment
void drawFragment(int x, int y, DrawBuf src, Rect srcrect)

draw source buffer rectangle contents to destination buffer

drawFrame
void drawFrame(Rect rc, uint frameColor, Rect frameSideWidths, uint innerAreaColor)

draws rectangle frame of specified color and widths (per side), and optinally fills inner area

drawGlyph
void drawGlyph(int x, int y, Glyph* glyph, uint color)

draw 8bit alpha image - usually font glyph using specified color (clipping is applied)

drawImage
void drawImage(int x, int y, DrawBuf src)

draw unscaled image at specified coordinates

drawLine
void drawLine(Point p1, Point p2, uint colour)

draw line from point p1 to p2 with specified color

drawLineF
void drawLineF(PointF p1, PointF p2, float width, uint colour)

draw line of arbitrary width in float coordinates

drawLineSegmentF
void drawLineSegmentF(PointF p0, PointF p1, PointF p2, PointF p3, float width, uint colour)

draw line of arbitrary width in float coordinates p1..p2 with angle based on previous (p0..p1) and next (p2..p3) segments

drawPixel
void drawPixel(int x, int y, uint color)

draw pixel at (x, y) with specified color

drawRescaled
void drawRescaled(Rect dstrect, DrawBuf src, Rect srcrect)

draw source buffer rectangle contents to destination buffer rectangle applying rescaling

drawRoundedRectF
void drawRoundedRectF(Rect rect, vec4 corners, bool keepSquareXY, float frameWidth, uint frameColor, uint fillColor)

draws rect with rounded corners

fill
void fill(uint color)

fill the whole buffer with solid color (no clipping applied)

fillGradientRect
void fillGradientRect(Rect rc, uint color1, uint color2, uint color3, uint color4)

fill rectangle with a gradient (clipping is applied)

fillPolyF
void fillPolyF(PointF[] points, uint colour)

draw filled polyline (vertexes must be in clockwise order)

fillQuadF
void fillQuadF(PointF p1, PointF p2, PointF p3, PointF p4, uint colour)

draw filled quad in float coordinates

fillRect
void fillRect(Rect rc, uint color)

fill rectangle with solid color (clipping is applied)

fillRectPattern
void fillRectPattern(Rect rc, uint color, int pattern)

fill rectangle with solid color and pattern (clipping is applied) 0=solid fill, 1 = dotted

fillTriangleF
void fillTriangleF(PointF p1, PointF p2, PointF p3, uint colour)

draw filled triangle in float coordinates

fillTriangleFClipped
void fillTriangleFClipped(PointF p1, PointF p2, PointF p3, uint colour)

draw filled triangle in float coordinates; clipping is already applied

intersectClipF
bool intersectClipF(PointF p1, PointF p2, bool p1moved, bool p2moved)

find intersection of line p1..p2 with clip rectangle

invalidate
void invalidate()

Call to remove this image from OpenGL cache when image is updated.

polyLine
void polyLine(Point[] points, uint colour, bool cycled)

draw poly line of width == 1px; when cycled is true, connect first and last point

polyLineF
void polyLineF(PointF[] points, float width, uint colour, bool cycled, uint innerAreaColour)

draw poly line of arbitrary width in float coordinates; when cycled is true, connect first and last point (optionally fill inner area)

resetClipping
void resetClipping()

init clip rectangle to full buffer size

resize
void resize(int width, int height)

resize buffer

transformColors
DrawBuf transformColors(ColorTransform transform)

create drawbuf with copy of current buffer with changed colors (returns this if not supported)

Properties

alpha
uint alpha [@property getter]

get current alpha setting (to be applied to all drawing operations)

alpha
uint alpha [@property setter]

set new alpha setting (to be applied to all drawing operations)

bpp
int bpp [@property getter]

returns buffer bits per pixel

clipRect
Rect clipRect [@property getter]

returns clipping rectangle, when clipRect.isEmpty == true -- means no clipping.

clipRect
Rect clipRect [@property setter]

returns clipping rectangle, or (0,0,dx,dy) when no clipping. sets new clipping rectangle, when clipRect.isEmpty == true -- means no clipping.

hasClipping
bool hasClipping [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
hasNinePatch
bool hasNinePatch [@property getter]

check whether there is nine-patch information available for drawing buffer

height
int height [@property getter]

returns current height

id
uint id [@property getter]

unique ID of drawbug instance, for using with hardware accelerated rendering for caching

instanceCount
int instanceCount [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
intersectClipRect
Rect intersectClipRect [@property setter]

sets new clipping rectangle, intersect with previous one.

isClippedOut
Rect isClippedOut [@property setter]

returns true if rectangle is completely clipped out and cannot be drawn.

ninePatch
const(NinePatch)* ninePatch [@property getter]

get nine patch information pointer, null if this is not a nine patch image buffer

ninePatch
NinePatch* ninePatch [@property setter]

set nine patch information pointer, null if this is not a nine patch image buffer

onDestroyCallback
void function(uint) onDestroyCallback [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
onDestroyCallback
void function(uint) onDestroyCallback [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
width
int width [@property getter]

returns current width

Static functions

calcRectRoundedCornerRadius
PointF[4] calcRectRoundedCornerRadius(vec4 corners, float w, float h, bool keepSquareXY)
Undocumented in source. Be warned that the author may not have intended to support it.
intersectVectors
PointF intersectVectors(PointF p1, PointF dir1, PointF p2, PointF dir2)
Undocumented in source. Be warned that the author may not have intended to support it.
makeArcPath
PointF[] makeArcPath(PointF center, float radiusX, float radiusY, float startAngle, float endAngle)
Undocumented in source. Be warned that the author may not have intended to support it.
makeRoundedRectPath
PointF[] makeRoundedRectPath(Rect rect, vec4 corners, bool keepSquareXY, size_t[] outCornerSegmentsStart)

builds outer rounded rect path the last parameter optionally writes out indices of first segment of corners excluding top-left

Variables

_alpha
uint _alpha;
Undocumented in source.
_clipRect
Rect _clipRect;
Undocumented in source.
_id
uint _id;
Undocumented in source.
_ninePatch
NinePatch* _ninePatch;
Undocumented in source.
_onDestroyCallback
void function(uint) _onDestroyCallback;
Undocumented in source.

Meta