dlangui/docs/resources.html

128 lines
4.3 KiB
HTML

<html><head>
<META http-equiv="content-type" content="text/html; charset=utf-8">
<title>dlangui.graphics.resources</title>
</head><body>
<h1>dlangui.graphics.resources</h1>
<!-- Generated by Ddoc from src/dlangui/graphics/resources.d -->
DLANGUI library.
<br><br>
This module contains resource management and drawables implementation.
<br><br>
imageCache is RAM cache of decoded images (as DrawBuf).
<br><br>
drawableCache is cache of Drawables.
<br><br>
Supports nine-patch PNG images in .9.png files (like in Android).
<br><br>
Supports state drawables using XML files similar to ones in Android.
<br><br>
<b>Synopsis:</b><br>
<pre class="d_code"><font color=blue>import</font> dlangui.graphics.<u>resources</u>;
</pre>
<br><br>
<b>License:</b><br>
Boost License 1.0
<br><br>
<b>Authors:</b><br>
Vadim Lopatin, coolreader.org@gmail.com<br><br>
<dl><dt><big><a name="FrameDrawable"></a>class <u>FrameDrawable</u>: dlangui.graphics.resources.Drawable;
</big></dt>
<dd>solid borders (may be of different width) and, optionally, solid inner area<br><br>
</dd>
<dt><big><a name="decodeHexColor"></a>static uint <u>decodeHexColor</u>(string <i>s</i>);
</big></dt>
<dd>decode color string #AARRGGBB, e.g. #5599AA<br><br>
</dd>
<dt><big><a name="decodeDimension"></a>static uint <u>decodeDimension</u>(string <i>s</i>);
</big></dt>
<dd>decode size string, e.g. 1px or 2 or 3pt<br><br>
</dd>
<dt><big><a name="createColorDrawable"></a>static Drawable <u>createColorDrawable</u>(string <i>s</i>);
</big></dt>
<dd>decode solid color / gradient / frame drawable from string like #AARRGGBB, e.g. #5599AA
<br><br>
<b>SolidFillDrawable:</b><br>
#AARRGGBB - e.g. #8090A0 or #80ffffff
<br><br>
<b>FrameDrawable:</b><br>
#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<br><br>
</dd>
<dt><big><a name="extractStateFlags"></a>void <u>extractStateFlags</u>(ref string[string] <i>attr</i>, ref uint <i>stateMask</i>, ref uint <i>stateValue</i>);
</big></dt>
<dd>converts XML attribute name to State (see http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList)<br><br>
</dd>
<dt><big><a name="StateDrawable"></a>class <u>StateDrawable</u>: dlangui.graphics.resources.Drawable;
</big></dt>
<dd>Drawable which is drawn depending on state (see http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList)<br><br>
<dl><dt><big><a name="StateDrawable.parseList4"></a>bool <u>parseList4</u>(T)(string <i>value</i>, ref T[4] <i>items</i>);
</big></dt>
<dd>parse 4 comma delimited integers<br><br>
</dd>
<dt><big><a name="StateDrawable.load"></a>bool <u>load</u>(string <i>filename</i>);
</big></dt>
<dd><u>load</u> from XML file<br><br>
</dd>
</dl>
</dd>
<dt><big><a name="ImageCache"></a>class <u>ImageCache</u>;
</big></dt>
<dd>decoded raster images cache (png, jpeg) -- access by filenames<br><br>
<dl><dt><big><a name="ImageCache.get"></a>ref DrawBufRef <u>get</u>(string <i>filename</i>);
</big></dt>
<dd><u>get</u> and cache image<br><br>
</dd>
<dt><big><a name="ImageCache.get"></a>ref DrawBufRef <u>get</u>(string <i>filename</i>, ref ColorTransform <i>transform</i>);
</big></dt>
<dd><u>get</u> and cache color transformed image<br><br>
</dd>
</dl>
</dd>
<dt><big><a name="imageCache"></a>@property ImageCache <u>imageCache</u>();
</big></dt>
<dd>image cache singleton<br><br>
</dd>
<dt><big><a name="imageCache"></a>@property void <u>imageCache</u>(ImageCache <i>cache</i>);
</big></dt>
<dd>image <i>cache</i> singleton<br><br>
</dd>
<dt><big><a name="drawableCache"></a>@property DrawableCache <u>drawableCache</u>();
</big></dt>
<dd>drawable cache singleton<br><br>
</dd>
<dt><big><a name="drawableCache"></a>@property void <u>drawableCache</u>(DrawableCache <i>cache</i>);
</big></dt>
<dd>drawable <i>cache</i> singleton<br><br>
</dd>
</dl>
<hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. Vadim Lopatin, 2014
</small>
</body></html>