dlangui/drawbuf.html

262 lines
10 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link href='https://fonts.googleapis.com/css?family=Chivo:900' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>DlangUI - cross platform GUI library for D programming language - dlangui.graphics.drawbuf</title>
</head>
<body>
<div id="container">
<div class="inner">
<header>
<h1>DlangUI</h1>
<h2>Cross Platform GUI for D programming language</h2>
</header>
<section id="downloads" class="clearfix">
<a href="index.html" id="home" class="button"><span>Home</span></a>
<a href="api.html" id="home" class="button"><span>API Docs</span></a>
<a href="screenshots.html" id="home" class="button"><span>Screenshots</span></a>
<a href="https://github.com/buggins/dlangui/zipball/master" id="download-zip" class="button"><span>Download .zip</span></a>
<!--a href="https://github.com/buggins/dlangui/tarball/master" id="download-tar-gz" class="button"><span>Download .tar.gz</span></a-->
<a href="https://github.com/buggins/dlangui" id="view-on-github" class="button"><span>View on GitHub</span></a>
</section>
<hr>
<section id="main_content">
<h1>dlangui.graphics.drawbuf</h1>
<!-- Generated by Ddoc from src\dlangui\graphics\drawbuf.d -->
This module contains drawing buffer implementation.
<br><br>
<b>Synopsis:</b><br>
<pre class="d_code"><font color=blue>import</font> dlangui.graphics.<u>drawbuf</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="blendARGB"></a>uint <u>blendARGB</u>(uint <i>dst</i>, uint <i>src</i>, uint <i>alpha</i>);
</big></dt>
<dd>blend two RGB pixels using <i>alpha</i><br><br>
</dd>
<dt><big><a name="blendAlpha"></a>uint <u>blendAlpha</u>(uint <i>a1</i>, uint <i>a2</i>);
</big></dt>
<dd>blend two alpha values 0..255 (255 is fully transparent, 0 is opaque)<br><br>
</dd>
<dt><big><a name="blendGray"></a>ubyte <u>blendGray</u>(ubyte <i>dst</i>, ubyte <i>src</i>, uint <i>alpha</i>);
</big></dt>
<dd>blend two RGB pixels using <i>alpha</i><br><br>
</dd>
<dt><big><a name="isFullyTransparentColor"></a>pure nothrow bool <u>isFullyTransparentColor</u>(uint <i>color</i>);
</big></dt>
<dd>returns <b>true</b> if <i>color</i> is #FFxxxxxx (<i>color</i> alpha is 255)<br><br>
</dd>
<dt><big><a name="NinePatch"></a>struct <u>NinePatch</u>;
</big></dt>
<dd>9-patch image scaling information (see Android documentation).
<br><br>
<dl><dt><big><a name="NinePatch.frame"></a>Rect <u>frame</u>;
</big></dt>
<dd><u>frame</u> (non-scalable) part size for left, top, right, bottom edges.<br><br>
</dd>
<dt><big><a name="NinePatch.padding"></a>Rect <u>padding</u>;
</big></dt>
<dd><u>padding</u> (distance to content area) for left, top, right, bottom edges.<br><br>
</dd>
</dl>
</dd>
<dt><big><a name="DrawBuf"></a>abstract class <u>DrawBuf</u>: <u>dlangui.core.types.RefCountedObject</u>;
</big></dt>
<dd>drawing buffer - image container which allows to perform some drawing operations<br><br>
<dl><dt><big><a name="DrawBuf.alpha"></a>@property uint <u>alpha</u>();
</big></dt>
<dd>get current <u>alpha</u> setting (to be applied to all drawing operations)<br><br>
</dd>
<dt><big><a name="DrawBuf.alpha"></a>@property void <u>alpha</u>(uint <u>alpha</u>);
</big></dt>
<dd>set new <u>alpha</u> setting (to be applied to all drawing operations)<br><br>
</dd>
<dt><big><a name="DrawBuf.addAlpha"></a>void <u>addAlpha</u>(uint <i>alpha</i>);
</big></dt>
<dd>apply additional transparency to current drawbuf <i>alpha</i> value<br><br>
</dd>
<dt><big><a name="DrawBuf.applyAlpha"></a>uint <u>applyAlpha</u>(uint <i>argb</i>);
</big></dt>
<dd>applies current drawbuf alpha to <i>argb</i> color value<br><br>
</dd>
<dt><big><a name="DrawBuf.ninePatch"></a>const @property const(NinePatch)* <u>ninePatch</u>();
</big></dt>
<dd>get nine patch information pointer, <b>null</b> if this is not a nine patch image buffer<br><br>
</dd>
<dt><big><a name="DrawBuf.ninePatch"></a>@property void <u>ninePatch</u>(NinePatch* <u>ninePatch</u>);
</big></dt>
<dd>set nine patch information pointer, <b>null</b> if this is not a nine patch image buffer<br><br>
</dd>
<dt><big><a name="DrawBuf.hasNinePatch"></a>@property bool <u>hasNinePatch</u>();
</big></dt>
<dd>check whether there is nine-patch information available for drawing buffer<br><br>
</dd>
<dt><big><a name="DrawBuf.detectNinePatch"></a>bool <u>detectNinePatch</u>();
</big></dt>
<dd>override to detect nine patch using image 1-pixel border; returns <b>true</b> if 9-patch markup is found in image.<br><br>
</dd>
<dt><big><a name="DrawBuf.width"></a>@property int <u>width</u>();
</big></dt>
<dd>returns current <u>width</u><br><br>
</dd>
<dt><big><a name="DrawBuf.height"></a>@property int <u>height</u>();
</big></dt>
<dd>returns current <u>height</u><br><br>
</dd>
<dt><big><a name="DrawBuf.resetClipping"></a>void <u>resetClipping</u>();
</big></dt>
<dd>init clip rectangle to full buffer size<br><br>
</dd>
<dt><big><a name="DrawBuf.clipRect"></a>@property ref Rect <u>clipRect</u>();
</big></dt>
<dd>returns clipping rectangle, when <u>clipRect</u>.isEmpty == <b>true</b> -- means no clipping.<br><br>
</dd>
<dt><big><a name="DrawBuf.clipRect"></a>@property void <u>clipRect</u>(ref const Rect <i>rect</i>);
</big></dt>
<dd>returns clipping rectangle, or (0,0,dx,dy) when no clipping.
<br><br>
sets new clipping rectangle, when <u>clipRect</u>.isEmpty == <b>true</b> -- means no clipping.<br><br>
</dd>
<dt><big><a name="DrawBuf.intersectClipRect"></a>@property void <u>intersectClipRect</u>(ref const Rect <i>rect</i>);
</big></dt>
<dd>sets new clipping rectangle, intersect with previous one.<br><br>
</dd>
<dt><big><a name="DrawBuf.isClippedOut"></a>@property bool <u>isClippedOut</u>(ref const Rect <i>rect</i>);
</big></dt>
<dd>returns <b>true</b> if rectangle is completely clipped out and cannot be drawn.<br><br>
</dd>
<dt><big><a name="DrawBuf.applyClipping"></a>bool <u>applyClipping</u>(ref Rect <i>rc</i>);
</big></dt>
<dd>apply clipRect and buffer bounds clipping to rectangle<br><br>
</dd>
<dt><big><a name="DrawBuf.applyClipping"></a>bool <u>applyClipping</u>(ref Rect <i>rc</i>, ref Rect <i>rc2</i>);
</big></dt>
<dd>apply clipRect and buffer bounds clipping to rectangle; if clippinup applied to first rectangle, reduce second rectangle bounds proportionally.<br><br>
</dd>
<dt><big><a name="DrawBuf.beforeDrawing"></a>void <u>beforeDrawing</u>();
</big></dt>
<dd>reserved for hardware-accelerated drawing - begins drawing batch<br><br>
</dd>
<dt><big><a name="DrawBuf.afterDrawing"></a>void <u>afterDrawing</u>();
</big></dt>
<dd>reserved for hardware-accelerated drawing - ends drawing batch<br><br>
</dd>
<dt><big><a name="DrawBuf.bpp"></a>@property int <u>bpp</u>();
</big></dt>
<dd>returns buffer bits per pixel<br><br>
</dd>
<dt><big><a name="DrawBuf.resize"></a>abstract void <u>resize</u>(int <i>width</i>, int <i>height</i>);
</big></dt>
<dd><u>resize</u> buffer<br><br>
</dd>
<dt><big><a name="DrawBuf.fill"></a>abstract void <u>fill</u>(uint <i>color</i>);
</big></dt>
<dd><u>fill</u> the whole buffer with solid <i>color</i> (no clipping applied)<br><br>
</dd>
<dt><big><a name="DrawBuf.fillRect"></a>abstract void <u>fillRect</u>(Rect <i>rc</i>, uint <i>color</i>);
</big></dt>
<dd>fill rectangle with solid <i>color</i> (clipping is applied)<br><br>
</dd>
<dt><big><a name="DrawBuf.drawGlyph"></a>abstract void <u>drawGlyph</u>(int <i>x</i>, int <i>y</i>, Glyph* <i>glyph</i>, uint <i>color</i>);
</big></dt>
<dd>draw 8bit alpha image - usually font <i>glyph</i> using specified <i>color</i> (clipping is applied)<br><br>
</dd>
<dt><big><a name="DrawBuf.drawFragment"></a>abstract void <u>drawFragment</u>(int <i>x</i>, int <i>y</i>, DrawBuf <i>src</i>, Rect <i>srcrect</i>);
</big></dt>
<dd>draw source buffer rectangle contents to destination buffer<br><br>
</dd>
<dt><big><a name="DrawBuf.drawRescaled"></a>abstract void <u>drawRescaled</u>(Rect <i>dstrect</i>, DrawBuf <i>src</i>, Rect <i>srcrect</i>);
</big></dt>
<dd>draw source buffer rectangle contents to destination buffer rectangle applying rescaling<br><br>
</dd>
<dt><big><a name="DrawBuf.drawImage"></a>void <u>drawImage</u>(int <i>x</i>, int <i>y</i>, DrawBuf <i>src</i>);
</big></dt>
<dd>draw unscaled image at specified coordinates<br><br>
</dd>
<dt><big><a name="DrawBuf.drawFrame"></a>void <u>drawFrame</u>(Rect <i>rc</i>, uint <i>frameColor</i>, Rect <i>frameSideWidths</i>, uint <i>innerAreaColor</i> = 4294967295u);
</big></dt>
<dd>draws rectangle frame of specified color and widths (per side), and optinally fills inner area<br><br>
</dd>
<dt><big><a name="DrawBuf.transformColors"></a>DrawBuf <u>transformColors</u>(ref ColorTransform <i>transform</i>);
</big></dt>
<dd>create drawbuf with copy of current buffer with changed colors (returns this if not supported)<br><br>
</dd>
</dl>
</dd>
<dt><big><a name="ClipRectSaver"></a>struct <u>ClipRectSaver</u>;
</big></dt>
<dd>RAII setting/restoring of clip rectangle<br><br>
<dl><dt><big><a name="ClipRectSaver.this"></a>this(DrawBuf <i>buf</i>, ref Rect <i>newClipRect</i>, uint <i>newAlpha</i> = 0);
</big></dt>
<dd>apply (intersect) new clip rectangle and alpha to draw <i>buf</i>; restore<br><br>
</dd>
</dl>
</dd>
</dl>
</section>
<footer>
Dlangui is maintained by <a href="https://github.com/buggins">buggins</a><br>
This page was generated by <a href="http://pages.github.com">GitHub Pages</a>. Tactile theme by <a href="https://twitter.com/jasonlong">Jason Long</a>.
</footer>
</div>
</div>
</body>
</html>