dlangui.graphics.resources
This module contains resource management and drawables implementation.imageCache is RAM cache of decoded images (as DrawBuf).
drawableCache is cache of Drawables.
Supports nine-patch PNG images in .9.png files (like in Android).
Supports state drawables using XML files similar to ones in Android.
Synopsis:
import dlangui.graphics.resources;
License:
Boost License 1.0
Authors:
Vadim Lopatin, coolreader.org@gmail.com
- class FrameDrawable: dlangui.graphics.resources.Drawable;
- solid borders (may be of different width) and, optionally, solid inner area
- static uint decodeHexColor(string s);
- decode color string #AARRGGBB, e.g. #5599AA
- static uint decodeDimension(string s);
- decode size string, e.g. 1px or 2 or 3pt
- static Drawable createColorDrawable(string s);
- decode solid color / gradient / frame drawable from string like #AARRGGBB, e.g. #5599AA
SolidFillDrawable:
#AARRGGBB - e.g. #8090A0 or #80ffffff
FrameDrawable:
#frameColor,frameWidth[,#middleColor]
or #frameColor,leftBorderWidth,topBorderWidth,rightBorderWidth,bottomBorderWidth[,#middleColor]
e.g. #000000,2,#C0FFFFFF - black frame of width 2 with 75% transparent white middle
e.g. #0000FF,2,3,4,5,#FFFFFF - blue frame with left,top,right,bottom borders of width 2,3,4,5 and white inner area
- void extractStateFlags(ref string[string] attr, ref uint stateMask, ref uint stateValue);
- converts XML attribute name to State (see http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList)
- class StateDrawable: dlangui.graphics.resources.Drawable;
- Drawable which is drawn depending on state (see http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList)
- class ImageCache;
- decoded raster images cache (png, jpeg) -- access by filenames
- @property ImageCache imageCache();
- image cache singleton
- @property void imageCache(ImageCache cache);
- image cache singleton
- @property DrawableCache drawableCache();
- drawable cache singleton
- @property void drawableCache(DrawableCache cache);
- drawable cache singleton