blob: d1bb61774522aeab683a33fcf84dfd1b8686444e [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Skia: SkColorTable Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>SkColorTable Class Reference</h1><!-- doxytag: class="SkColorTable" --><!-- doxytag: inherits="SkRefCnt" -->
<p><code>#include &lt;<a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a>&gt;</code></p>
<p>Inherits <a class="el" href="class_sk_ref_cnt.html">SkRefCnt</a>.</p>
<div class="dynheader">
Collaboration diagram for SkColorTable:</div>
<div class="dynsection">
<div class="center"><img src="class_sk_color_table__coll__graph.png" border="0" usemap="#_sk_color_table_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<p><a href="class_sk_color_table-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#aaacbf46624dfab99367a064c6395eac0">Flags</a> { <a class="el" href="class_sk_color_table.html#aaacbf46624dfab99367a064c6395eac0ad731c6a629212d3be9013614519acb8c">kColorsAreOpaque_Flag</a> = 0x01
}</td></tr>
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a99616e28af2da8333c86b4f2c78fcda5">SkColorTable</a> (const <a class="el" href="class_sk_color_table.html">SkColorTable</a> &amp;src)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a4b9ff7e948440fe8a9b6a2fd3ad75df7">SkColorTable</a> (int count)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a56bd076b6589c905de7ef158d6627989">SkColorTable</a> (<a class="el" href="class_sk_flattenable_read_buffer.html">SkFlattenableReadBuffer</a> &amp;)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a817f8f7eb97b58cc9783a9b2b7a2fd98">SkColorTable</a> (const <a class="el" href="_sk_color_8h.html#a9ec12bd74c4b63b5da802b419106b8ea">SkPMColor</a> colors[], int count)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#abcb3f75ee497eb12a64a3cda34204cdc">~SkColorTable</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a3a4d6395bc7deeec3b53eedf159819c1">getFlags</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a549f2adc70ecb3caac2ce018cfac64fc">setFlags</a> (unsigned flags)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#af54c170e24211db62e0b24be80e86d4a">isOpaque</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#ab93a2e01d91b3c3cb2975743e5d831a7">setIsOpaque</a> (bool isOpaque)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a65ed1cf75b4afe4afd995c23c7a09a7f">count</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="_sk_color_8h.html#a9ec12bd74c4b63b5da802b419106b8ea">SkPMColor</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a9ef987348b5daaf3f1b42be014dc2d9e">operator[]</a> (int index) const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="_sk_color_8h.html#a9ec12bd74c4b63b5da802b419106b8ea">SkPMColor</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a5e59f36e0f81702aa3de49fc493aa50f">lockColors</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#a8d185755a1dd2bbaad1acba170e1509a">unlockColors</a> (bool changed)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const uint16_t *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#af9dee472a4ffba69ed7b45838a3bba9f">lock16BitCache</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#ae15209047daec1ce57848028faa8b4fc">unlock16BitCache</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sk_color_table.html#ac8f1034dd024a90f591221ec25159b47">flatten</a> (<a class="el" href="class_sk_flattenable_write_buffer.html">SkFlattenableWriteBuffer</a> &amp;) const </td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p><a class="el" href="class_sk_color_table.html">SkColorTable</a> holds an array SkPMColors (premultiplied 32-bit colors) used by 8-bit bitmaps, where the bitmap bytes are interpreted as indices into the colortable. </p>
<p>Definition at line <a class="el" href="_sk_bitmap_8h_source.html#l00488">488</a> of file <a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a>.</p>
<hr/><h2>Member Enumeration Documentation</h2>
<a class="anchor" id="aaacbf46624dfab99367a064c6395eac0"></a><!-- doxytag: member="SkColorTable::Flags" ref="aaacbf46624dfab99367a064c6395eac0" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="class_sk_color_table.html#aaacbf46624dfab99367a064c6395eac0">SkColorTable::Flags</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="aaacbf46624dfab99367a064c6395eac0ad731c6a629212d3be9013614519acb8c"></a><!-- doxytag: member="kColorsAreOpaque_Flag" ref="aaacbf46624dfab99367a064c6395eac0ad731c6a629212d3be9013614519acb8c" args="" -->kColorsAreOpaque_Flag</em>&nbsp;</td><td>
<p>if set, all of the colors in the table are opaque (alpha==0xFF) </p>
</td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_sk_bitmap_8h_source.html#l00501">501</a> of file <a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a>.</p>
</div>
</div>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a99616e28af2da8333c86b4f2c78fcda5"></a><!-- doxytag: member="SkColorTable::SkColorTable" ref="a99616e28af2da8333c86b4f2c78fcda5" args="(const SkColorTable &amp;src)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SkColorTable::SkColorTable </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_sk_color_table.html">SkColorTable</a> &amp;&nbsp;</td>
<td class="paramname"> <em>src</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Makes a deep copy of colors. </p>
</div>
</div>
<a class="anchor" id="a4b9ff7e948440fe8a9b6a2fd3ad75df7"></a><!-- doxytag: member="SkColorTable::SkColorTable" ref="a4b9ff7e948440fe8a9b6a2fd3ad75df7" args="(int count)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SkColorTable::SkColorTable </td>
<td>(</td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>count</em></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Preallocates the colortable to have 'count' colors, which are initially set to 0. </p>
</div>
</div>
<a class="anchor" id="a56bd076b6589c905de7ef158d6627989"></a><!-- doxytag: member="SkColorTable::SkColorTable" ref="a56bd076b6589c905de7ef158d6627989" args="(SkFlattenableReadBuffer &amp;)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SkColorTable::SkColorTable </td>
<td>(</td>
<td class="paramtype"><a class="el" href="class_sk_flattenable_read_buffer.html">SkFlattenableReadBuffer</a> &amp;&nbsp;</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="a817f8f7eb97b58cc9783a9b2b7a2fd98"></a><!-- doxytag: member="SkColorTable::SkColorTable" ref="a817f8f7eb97b58cc9783a9b2b7a2fd98" args="(const SkPMColor colors[], int count)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SkColorTable::SkColorTable </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="_sk_color_8h.html#a9ec12bd74c4b63b5da802b419106b8ea">SkPMColor</a>&nbsp;</td>
<td class="paramname"> <em>colors</em>[], </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>count</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="abcb3f75ee497eb12a64a3cda34204cdc"></a><!-- doxytag: member="SkColorTable::~SkColorTable" ref="abcb3f75ee497eb12a64a3cda34204cdc" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual SkColorTable::~SkColorTable </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a65ed1cf75b4afe4afd995c23c7a09a7f"></a><!-- doxytag: member="SkColorTable::count" ref="a65ed1cf75b4afe4afd995c23c7a09a7f" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int SkColorTable::count </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the number of colors in the table. </p>
<p>Definition at line <a class="el" href="_sk_bitmap_8h_source.html#l00516">516</a> of file <a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a>.</p>
</div>
</div>
<a class="anchor" id="ac8f1034dd024a90f591221ec25159b47"></a><!-- doxytag: member="SkColorTable::flatten" ref="ac8f1034dd024a90f591221ec25159b47" args="(SkFlattenableWriteBuffer &amp;) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SkColorTable::flatten </td>
<td>(</td>
<td class="paramtype"><a class="el" href="class_sk_flattenable_write_buffer.html">SkFlattenableWriteBuffer</a> &amp;&nbsp;</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="a3a4d6395bc7deeec3b53eedf159819c1"></a><!-- doxytag: member="SkColorTable::getFlags" ref="a3a4d6395bc7deeec3b53eedf159819c1" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned SkColorTable::getFlags </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the flag bits for the color table. These can be changed with <a class="el" href="class_sk_color_table.html#a549f2adc70ecb3caac2ce018cfac64fc">setFlags()</a>. </p>
<p>Definition at line <a class="el" href="_sk_bitmap_8h_source.html#l00506">506</a> of file <a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a>.</p>
</div>
</div>
<a class="anchor" id="af54c170e24211db62e0b24be80e86d4a"></a><!-- doxytag: member="SkColorTable::isOpaque" ref="af54c170e24211db62e0b24be80e86d4a" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool SkColorTable::isOpaque </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_sk_bitmap_8h_source.html#l00511">511</a> of file <a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a>.</p>
</div>
</div>
<a class="anchor" id="af9dee472a4ffba69ed7b45838a3bba9f"></a><!-- doxytag: member="SkColorTable::lock16BitCache" ref="af9dee472a4ffba69ed7b45838a3bba9f" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint16_t* SkColorTable::lock16BitCache </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Similar to <a class="el" href="class_sk_color_table.html#a5e59f36e0f81702aa3de49fc493aa50f">lockColors()</a>, <a class="el" href="class_sk_color_table.html#af9dee472a4ffba69ed7b45838a3bba9f">lock16BitCache()</a> returns the array of RGB16 colors that mirror the 32bit colors. However, this function will return null if kColorsAreOpaque_Flag is not set. Also, unlike <a class="el" href="class_sk_color_table.html#a5e59f36e0f81702aa3de49fc493aa50f">lockColors()</a>, the returned array here cannot be modified. </p>
</div>
</div>
<a class="anchor" id="a5e59f36e0f81702aa3de49fc493aa50f"></a><!-- doxytag: member="SkColorTable::lockColors" ref="a5e59f36e0f81702aa3de49fc493aa50f" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_sk_color_8h.html#a9ec12bd74c4b63b5da802b419106b8ea">SkPMColor</a>* SkColorTable::lockColors </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Specify the number of colors in the color table. This does not initialize the colors to any value, just allocates memory for them. To initialize the values, either call setColors(array, count), or follow setCount(count) with a call to <a class="el" href="class_sk_color_table.html#a5e59f36e0f81702aa3de49fc493aa50f">lockColors()</a>/{set the values}/unlockColors(true). Return the array of colors for reading and/or writing. This must be balanced by a call to unlockColors(changed?), telling the colortable if the colors were changed during the lock. </p>
<p>Definition at line <a class="el" href="_sk_bitmap_8h_source.html#l00538">538</a> of file <a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a>.</p>
</div>
</div>
<a class="anchor" id="a9ef987348b5daaf3f1b42be014dc2d9e"></a><!-- doxytag: member="SkColorTable::operator[]" ref="a9ef987348b5daaf3f1b42be014dc2d9e" args="(int index) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_sk_color_8h.html#a9ec12bd74c4b63b5da802b419106b8ea">SkPMColor</a> SkColorTable::operator[] </td>
<td>(</td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>index</em></td>
<td>&nbsp;)&nbsp;</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the specified color from the table. In the debug build, this asserts that the index is in range (0 &lt;= index &lt; count). </p>
<p>Definition at line <a class="el" href="_sk_bitmap_8h_source.html#l00521">521</a> of file <a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a>.</p>
</div>
</div>
<a class="anchor" id="a549f2adc70ecb3caac2ce018cfac64fc"></a><!-- doxytag: member="SkColorTable::setFlags" ref="a549f2adc70ecb3caac2ce018cfac64fc" args="(unsigned flags)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SkColorTable::setFlags </td>
<td>(</td>
<td class="paramtype">unsigned&nbsp;</td>
<td class="paramname"> <em>flags</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Set the flags for the color table. See the Flags enum for possible values. </p>
</div>
</div>
<a class="anchor" id="ab93a2e01d91b3c3cb2975743e5d831a7"></a><!-- doxytag: member="SkColorTable::setIsOpaque" ref="ab93a2e01d91b3c3cb2975743e5d831a7" args="(bool isOpaque)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SkColorTable::setIsOpaque </td>
<td>(</td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"> <em>isOpaque</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="ae15209047daec1ce57848028faa8b4fc"></a><!-- doxytag: member="SkColorTable::unlock16BitCache" ref="ae15209047daec1ce57848028faa8b4fc" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SkColorTable::unlock16BitCache </td>
<td>(</td>
<td class="paramname"></td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Balancing call to <a class="el" href="class_sk_color_table.html#af9dee472a4ffba69ed7b45838a3bba9f">lock16BitCache()</a>. </p>
<p>Definition at line <a class="el" href="_sk_bitmap_8h_source.html#l00554">554</a> of file <a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a>.</p>
</div>
</div>
<a class="anchor" id="a8d185755a1dd2bbaad1acba170e1509a"></a><!-- doxytag: member="SkColorTable::unlockColors" ref="a8d185755a1dd2bbaad1acba170e1509a" args="(bool changed)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SkColorTable::unlockColors </td>
<td>(</td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"> <em>changed</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Balancing call to <a class="el" href="class_sk_color_table.html#a5e59f36e0f81702aa3de49fc493aa50f">lockColors()</a>. If the colors have been changed, pass true. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/core/<a class="el" href="_sk_bitmap_8h_source.html">SkBitmap.h</a></li>
</ul>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Tue Oct 20 11:03:42 2009 for Skia by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>