blob: a3b7fc51c36def381a02d8e898be9b5465b84334 [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>pp::ImageData Class Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="pp::ImageData" --><!-- doxytag: inherits="pp::Resource" --><div class="dynheader">
Inheritance diagram for pp::ImageData:</div>
<div class="dyncontent">
<div class="center"><img src="classpp_1_1_image_data__inherit__graph.png" border="0" usemap="#pp_1_1_image_data_inherit__map" alt="Inheritance graph" /></div>
<map name="pp_1_1_image_data_inherit__map" id="pp_1_1_image_data_inherit__map">
<area shape="rect" id="node2" href="classpp_1_1_resource.html" title="A reference counted module resource." alt="" coords="11,5,115,32"></area></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<p><a href="classpp_1_1_image_data-members.html">List of all members.</a></p>
<h2>
Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a2ef5c9156701868eede2c839309a04f9">ImageData</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#ae8a198b71756afbeb745beeadec032f9">ImageData</a> (<a class="el" href="namespacepp.html#a339083c1beec620267bf8b3c55decaa5">PassRef</a>, PP_Resource resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a9943421a80760f3de284ae9d7ce9e431">ImageData</a> (const <a class="el" href="classpp_1_1_image_data.html">ImageData</a> &amp;other)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a9c2c26e4130e33d9d7ad7c72e32cea1d">ImageData</a> (const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;instance, PP_ImageDataFormat <a class="el" href="classpp_1_1_image_data.html#a0985d86289358e1f4298c176818b9a91">format</a>, const <a class="el" href="classpp_1_1_size.html">Size</a> &amp;<a class="el" href="classpp_1_1_image_data.html#a2c5e0060b4227c0c9dd28287bc2e4961">size</a>, bool init_to_zero)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_image_data.html">ImageData</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a35b7e23dbb14817eacca3967dc4ef6b7">operator=</a> (const <a class="el" href="classpp_1_1_image_data.html">ImageData</a> &amp;other)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">PP_ImageDataFormat&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a0985d86289358e1f4298c176818b9a91">format</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_size.html">pp::Size</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a2c5e0060b4227c0c9dd28287bc2e4961">size</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a3c107aead77cea8ba1adcbc5654078b7">stride</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a545dece2d1350ab9ecea5592a665b78c">data</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const uint32_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#af646177d375e11d77eec52e9324fc076">GetAddr32</a> (const <a class="el" href="classpp_1_1_point.html">Point</a> &amp;coord) const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a8aaf07d11584a06313cf03ca2440bb12">GetAddr32</a> (const <a class="el" href="classpp_1_1_point.html">Point</a> &amp;coord)</td></tr>
</table><h2>
Static Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a9be445247d64ddaad4b6623021db7232">IsImageDataFormatSupported</a> (PP_ImageDataFormat <a class="el" href="classpp_1_1_image_data.html#a0985d86289358e1f4298c176818b9a91">format</a>)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static PP_ImageDataFormat&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_image_data.html#a4208e7eabf98df7b91c01ed6fcd92425">GetNativeImageDataFormat</a> ()</td></tr>
</table>
<hr /><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a2ef5c9156701868eede2c839309a04f9"></a><!-- doxytag: member="pp::ImageData::ImageData" ref="a2ef5c9156701868eede2c839309a04f9" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_image_data.html#a2ef5c9156701868eede2c839309a04f9">pp::ImageData::ImageData</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default constructor for creating an <a class="el" href="classpp_1_1_resource.html#a859068e34cdc2dc0b78754c255323aa9" title="This functions determines if this resource is invalid or uninitialized.">is_null()</a> <code><a class="el" href="classpp_1_1_image_data.html">ImageData</a></code> object. </p>
</div>
</div>
<a class="anchor" id="ae8a198b71756afbeb745beeadec032f9"></a><!-- doxytag: member="pp::ImageData::ImageData" ref="ae8a198b71756afbeb745beeadec032f9" args="(PassRef, PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_image_data.html#a2ef5c9156701868eede2c839309a04f9">pp::ImageData::ImageData</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespacepp.html#a339083c1beec620267bf8b3c55decaa5">PassRef</a>&#160;</td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PP_Resource&#160;</td>
<td class="paramname"><em>resource</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A constructor used when you have received a <code>PP_Resource</code> as a return value that has already been reference counted. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A PP_Resource corresponding to image data. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9943421a80760f3de284ae9d7ce9e431"></a><!-- doxytag: member="pp::ImageData::ImageData" ref="a9943421a80760f3de284ae9d7ce9e431" args="(const ImageData &amp;other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_image_data.html#a2ef5c9156701868eede2c839309a04f9">pp::ImageData::ImageData</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_image_data.html">ImageData</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The copy constructor for <code><a class="el" href="classpp_1_1_image_data.html">ImageData</a></code>. </p>
<p>This constructor produces an <code><a class="el" href="classpp_1_1_image_data.html">ImageData</a></code> object that shares the underlying <code>Image</code> resource with <code>other</code>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">other</td><td>A pointer to an image data. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9c2c26e4130e33d9d7ad7c72e32cea1d"></a><!-- doxytag: member="pp::ImageData::ImageData" ref="a9c2c26e4130e33d9d7ad7c72e32cea1d" args="(const InstanceHandle &amp;instance, PP_ImageDataFormat format, const Size &amp;size, bool init_to_zero)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_image_data.html#a2ef5c9156701868eede2c839309a04f9">pp::ImageData::ImageData</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;&#160;</td>
<td class="paramname"><em>instance</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PP_ImageDataFormat&#160;</td>
<td class="paramname"><em>format</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_size.html">Size</a> &amp;&#160;</td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>init_to_zero</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A constructor that allocates a new <code><a class="el" href="classpp_1_1_image_data.html">ImageData</a></code> in the browser with the provided parameters. </p>
<p>The resulting object will be <a class="el" href="classpp_1_1_resource.html#a859068e34cdc2dc0b78754c255323aa9" title="This functions determines if this resource is invalid or uninitialized.">is_null()</a> if the allocation failed.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance with which this resource will be associated.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">format</td><td>A PP_ImageDataFormat containing desired image format. PP_ImageDataFormat is an enumeration of the different types of image data formats. Refer to <a href="../c/ppb__image__data_8h.html"><code>ppb_image_data.h</code></a> for further information.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>A pointer to a <code><a class="el" href="classpp_1_1_size.html" title="A size of an object based on width and height.">Size</a></code> containing the image size.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">init_to_zero</td><td>A bool used to determine transparency at creation. Set the <code>init_to_zero</code> flag if you want the bitmap initialized to transparent during the creation process. If this flag is not set, the current contents of the bitmap will be undefined, and the module should be sure to set all the pixels. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr /><h2>Member Function Documentation</h2>
<a class="anchor" id="a545dece2d1350ab9ecea5592a665b78c"></a><!-- doxytag: member="pp::ImageData::data" ref="a545dece2d1350ab9ecea5592a665b78c" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* <a class="el" href="classpp_1_1_image_data.html#a545dece2d1350ab9ecea5592a665b78c">pp::ImageData::data</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A getter function for returning a raw pointer to the image pixels. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A raw pointer to the image pixels. </dd></dl>
</div>
</div>
<a class="anchor" id="a0985d86289358e1f4298c176818b9a91"></a><!-- doxytag: member="pp::ImageData::format" ref="a0985d86289358e1f4298c176818b9a91" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">PP_ImageDataFormat <a class="el" href="classpp_1_1_image_data.html#a0985d86289358e1f4298c176818b9a91">pp::ImageData::format</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A getter function for returning the current format for images. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_ImageDataFormat</code> containing the preferred format. </dd></dl>
</div>
</div>
<a class="anchor" id="af646177d375e11d77eec52e9324fc076"></a><!-- doxytag: member="pp::ImageData::GetAddr32" ref="af646177d375e11d77eec52e9324fc076" args="(const Point &amp;coord) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint32_t* <a class="el" href="classpp_1_1_image_data.html#af646177d375e11d77eec52e9324fc076">pp::ImageData::GetAddr32</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_point.html">Point</a> &amp;&#160;</td>
<td class="paramname"><em>coord</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function is used retrieve the address of the given pixel for 32-bit pixel formats. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">coord</td><td>A <code><a class="el" href="classpp_1_1_point.html" title="A 2 dimensional point with 0,0 being the upper-left starting coordinate.">Point</a></code> representing the x and y coordinates for a specific pixel.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The address for the pixel. </dd></dl>
</div>
</div>
<a class="anchor" id="a8aaf07d11584a06313cf03ca2440bb12"></a><!-- doxytag: member="pp::ImageData::GetAddr32" ref="a8aaf07d11584a06313cf03ca2440bb12" args="(const Point &amp;coord)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t* <a class="el" href="classpp_1_1_image_data.html#af646177d375e11d77eec52e9324fc076">pp::ImageData::GetAddr32</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_point.html">Point</a> &amp;&#160;</td>
<td class="paramname"><em>coord</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function is used retrieve the address of the given pixel for 32-bit pixel formats. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">coord</td><td>A <code><a class="el" href="classpp_1_1_point.html" title="A 2 dimensional point with 0,0 being the upper-left starting coordinate.">Point</a></code> representing the x and y coordinates for a specific pixel.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The address for the pixel. </dd></dl>
</div>
</div>
<a class="anchor" id="a4208e7eabf98df7b91c01ed6fcd92425"></a><!-- doxytag: member="pp::ImageData::GetNativeImageDataFormat" ref="a4208e7eabf98df7b91c01ed6fcd92425" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static PP_ImageDataFormat <a class="el" href="classpp_1_1_image_data.html#a4208e7eabf98df7b91c01ed6fcd92425">pp::ImageData::GetNativeImageDataFormat</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_image_data.html#a4208e7eabf98df7b91c01ed6fcd92425" title="GetNativeImageDataFormat() determines the browser's preferred format for images.">GetNativeImageDataFormat()</a> determines the browser's preferred format for images. </p>
<p>Using this format guarantees no extra conversions will occur when painting.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>PP_ImageDataFormat</code> containing the preferred format. </dd></dl>
</div>
</div>
<a class="anchor" id="a9be445247d64ddaad4b6623021db7232"></a><!-- doxytag: member="pp::ImageData::IsImageDataFormatSupported" ref="a9be445247d64ddaad4b6623021db7232" args="(PP_ImageDataFormat format)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static bool <a class="el" href="classpp_1_1_image_data.html#a9be445247d64ddaad4b6623021db7232">pp::ImageData::IsImageDataFormatSupported</a> </td>
<td>(</td>
<td class="paramtype">PP_ImageDataFormat&#160;</td>
<td class="paramname"><em>format</em></td><td>)</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="classpp_1_1_image_data.html#a9be445247d64ddaad4b6623021db7232" title="IsImageDataFormatSupported() returns true if the supplied format is supported by the browser...">IsImageDataFormatSupported()</a> returns <code>true</code> if the supplied format is supported by the browser. </p>
<p>Note: <code>PP_IMAGEDATAFORMAT_BGRA_PREMUL</code> and <code>PP_IMAGEDATAFORMAT_RGBA_PREMUL</code> formats are always supported. Other image formats do not make this guarantee, and should be checked first with <a class="el" href="classpp_1_1_image_data.html#a9be445247d64ddaad4b6623021db7232" title="IsImageDataFormatSupported() returns true if the supplied format is supported by the browser...">IsImageDataFormatSupported()</a> before using.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">format</td><td>Image data format.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if the format is supported by the browser. </dd></dl>
</div>
</div>
<a class="anchor" id="a35b7e23dbb14817eacca3967dc4ef6b7"></a><!-- doxytag: member="pp::ImageData::operator=" ref="a35b7e23dbb14817eacca3967dc4ef6b7" args="(const ImageData &amp;other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_image_data.html">ImageData</a>&amp; pp::ImageData::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_image_data.html">ImageData</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function decrements the reference count of this <code><a class="el" href="classpp_1_1_image_data.html">ImageData</a></code> and increments the reference count of the <code>other</code> <code><a class="el" href="classpp_1_1_image_data.html">ImageData</a></code>. </p>
<p>This <code><a class="el" href="classpp_1_1_image_data.html">ImageData</a></code> shares the underlying image resource with <code>other</code>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">other</td><td>An other image data.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A new image data context. </dd></dl>
</div>
</div>
<a class="anchor" id="a2c5e0060b4227c0c9dd28287bc2e4961"></a><!-- doxytag: member="pp::ImageData::size" ref="a2c5e0060b4227c0c9dd28287bc2e4961" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_size.html">pp::Size</a> <a class="el" href="classpp_1_1_image_data.html#a2c5e0060b4227c0c9dd28287bc2e4961">pp::ImageData::size</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A getter function for returning the image size. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The image size in pixels. </dd></dl>
</div>
</div>
<a class="anchor" id="a3c107aead77cea8ba1adcbc5654078b7"></a><!-- doxytag: member="pp::ImageData::stride" ref="a3c107aead77cea8ba1adcbc5654078b7" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_image_data.html#a3c107aead77cea8ba1adcbc5654078b7">pp::ImageData::stride</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A getter function for returning the row width in bytes. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The row width in bytes. </dd></dl>
</div>
</div>
<hr />The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="image__data_8h.html">image_data.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}