Module dcanvas.graphics.colors

Declaration of useful color related operations.

In dcanvas, colors are represented as 32 bit uint AARRGGBB values.

Synopsis

import dcanvas.graphics.colors;

Functions

NameDescription
addAlpha(color, alpha) applies additional alpha to color
blendAlpha(a1, a2) blend two alpha values 0..255 (255 is fully transparent, 0 is opaque)
blendARGB(dst, src, alpha) blend two RGB pixels using alpha
blendGray(dst, src, alpha) blend two RGB pixels using alpha
blendSubpixel(dst, src, alpha, x0, mode) blend subpixel using alpha
decodeCSSColor(s, defValue)
decodeHexColor(s, defValue) decode color string supported formats: #RGB, #ARGB, #RRGGBB, #AARRGGBB, rgb(r,g,b), rgba(r,g,b,a), rgba(r,g,b,a%)
isFullyTransparentColor(color) returns true if color is #FFxxxxxx (color alpha is 255)
makeRGBA(r, g, b, a)
rgbToGray(color)
subpixelComponentIndex(x0, mode)
transformComponent(src, addBefore, multiply, addAfter)
transformRGBA(src, addBefore, multiply, addAfter)

Structs

NameDescription
ColorTransform
ColorTransformHandler

Enums

NameDescription
Color Color constants enum, contributed by zhaopuming refer to http://rapidtables.com/web/color/RGB_Color.htm#color%20table #275

Global variables

NameTypeDescription
COLOR_DRAWABLE immutable(char[])
COLOR_TRANSFORM_MULTIPLY_NONE immutable(uint)
COLOR_TRANSFORM_OFFSET_NONE immutable(uint)
COLOR_TRANSPARENT immutable(uint) transparent color constant
COLOR_UNSPECIFIED immutable(uint) special color constant to identify value as not a color (to use default/parent value instead)
COMPONENT_OFFSET_ALPHA immutable(int)
COMPONENT_OFFSET_BGR immutable(int[3])
COMPONENT_OFFSET_RGB immutable(int[3])