# dlangui.graphics.drawbuf

DLANGUI library.
This module contains drawing buffer implementation.
Synopsis:

    import dlangui.graphics.drawbuf;

License:
Boost License 1.0
Authors:
Vadim Lopatin, coolreader.org@gmail.com

uint blendARGB(uint dst, uint src, uint alpha);
  blend two RGB pixels using alpha
uint blendAlpha(uint a1, uint a2);
  blend two alpha values 0..255 (255 is fully transparent, 0 is opaque)
ubyte blendGray(ubyte dst, ubyte src, uint alpha);
  blend two RGB pixels using alpha
pure nothrow bool isFullyTransparentColor(uint color);
  returns true if color is #FFxxxxxx (color alpha is 255)
struct NinePatch;
  9-patch image scaling information (see Android documentation).
  Rect frame;
    frame (non-scalable) part size for left, top, right, bottom edges.
  Rect padding;
    padding (distance to content area) for left, top, right, bottom edges.
abstract class DrawBuf: dlangui.core.types.RefCountedObject;
  drawing buffer - image container which allows to perform some drawing operations
  @property uint alpha();
    get current alpha setting (to be applied to all drawing operations)
  @property void alpha(uint alpha);
    set new alpha setting (to be applied to all drawing operations)
  void addAlpha(uint alpha);
    apply additional transparency to current drawbuf alpha value
  uint applyAlpha(uint argb);
    applies current drawbuf alpha to argb color value
  @property uint id();
    unique ID of drawbug instance, for using with hardware accelerated rendering for caching
  const @property const(NinePatch)* ninePatch();
    get nine patch information pointer, null if this is not a nine patch image buffer
  @property void ninePatch(NinePatch* ninePatch);
    set nine patch information pointer, null if this is not a nine patch image buffer
  @property bool hasNinePatch();
    check whether there is nine-patch information available for drawing buffer
  bool detectNinePatch();
    override to detect nine patch using image 1-pixel border; returns true if 9-patch markup is found in image.
  @property int width();
    returns current width
  @property int height();
    returns current height
  @property ref Rect clipRect();
    returns clipping rectangle, when clipRect.isEmpty == true -- means no clipping.
  @property Rect clipOrFullRect();
    returns clipping rectangle, or (0,0,dx,dy) when no clipping.
  @property void clipRect(ref const Rect rect);
    sets new clipping rectangle, when clipRect.isEmpty == true -- means no clipping.
  @property void intersectClipRect(ref const Rect rect);
    sets new clipping rectangle, when clipRect.isEmpty == true -- means no clipping.
  bool applyClipping(ref Rect rc);
    apply clipRect and buffer bounds clipping to rectangle
  bool applyClipping(ref Rect rc, ref Rect rc2);
    apply clipRect and buffer bounds clipping to rectangle; if clippinup applied to first rectangle, reduce second rectangle bounds proportionally.
  void beforeDrawing();
    reserved for hardware-accelerated drawing - begins drawing batch
  void afterDrawing();
    reserved for hardware-accelerated drawing - ends drawing batch
  @property int bpp();
    returns buffer bits per pixel
  abstract void resize(int width, int height);
    resize buffer
  abstract void fill(uint color);
    fill the whole buffer with solid color (no clipping applied)
  abstract void fillRect(Rect rc, uint color);
    fill rectangle with solid color (clipping is applied)
  abstract void drawGlyph(int x, int y, Glyph* glyph, uint color);
    draw 8bit alpha image - usually font glyph using specified color (clipping is applied)
  abstract void drawFragment(int x, int y, DrawBuf src, Rect srcrect);
    draw source buffer rectangle contents to destination buffer
  abstract void drawRescaled(Rect dstrect, DrawBuf src, Rect srcrect);
    draw source buffer rectangle contents to destination buffer rectangle applying rescaling
  void drawImage(int x, int y, DrawBuf src);
    draw unscaled image at specified coordinates
  void drawFrame(Rect rc, uint frameColor, Rect frameSideWidths, uint innerAreaColor = 4294967295u);
    draws rectangle frame of specified color and widths (per side), and optinally fills inner area
  DrawBuf transformColors(ref ColorTransform transform);
    create drawbuf with copy of current buffer with changed colors (returns this if not supported)
struct ClipRectSaver;
  RAII setting/restoring of clip rectangle

Page generated by Ddoc. Vadim Lopatin, 2014