blob: 85fcb768f2352873cefb0bf29677424fd235ff91 [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>PPB_Compositor Struct 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="PPB_Compositor" --><h2>
Data Fields</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___compositor__0__1.html#a22fb77daabd3894db97ab1111d111a92">IsCompositor</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___compositor__0__1.html#a3b479b946dcec4b3315c5f3cdccba5ce">Create</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___compositor__0__1.html#a54fc4ef7119d18446a836aef08384da6">AddLayer</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> compositor)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___compositor__0__1.html#a5082b0dce4a58032439bc3dd4ff741fd">CommitLayers</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> compositor, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> cc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_b___compositor__0__1.html#a9a0e4e7aed4b13dbea426a75a8311172">ResetLayers</a> )(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> compositor)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Defines the <code>PPB_Compositor</code> interface. </p>
<p>Used for setting <code>PPB_CompositorLayer</code> layers to the Chromium compositor for compositing. This allows a plugin to combine different sources of visual data efficiently, such as <code>PPB_ImageData</code> images and OpenGL textures. See also <code>PPB_CompositorLayer</code> for more information. This interface is still in development (Dev API status) and may change, so is only supported on Dev channel and Canary currently.</p>
<p><b>Example usage from plugin code:</b></p>
<p><b>Setup:</b> </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7" title="This typedef represents an opaque handle assigned by the browser to the resource.">PP_Resource</a> compositor;
compositor = compositor_if-&gt;Create(instance);
instance_if-&gt;BindGraphics(instance, compositor);
</pre></div><p><b>Setup layer stack:</b> </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7" title="This typedef represents an opaque handle assigned by the browser to the resource.">PP_Resource</a> color_layer = compositor_if-&gt;AddLayer(compositor);
<a class="code" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7" title="This typedef represents an opaque handle assigned by the browser to the resource.">PP_Resource</a> texture_layer = compositor_if-&gt;AddLayer(compositor);
</pre></div><p><b> Present one frame:</b> layer_if-&gt;SetColor(color_layer, 255, 255, 0, 255, PP_MakeSize(400, 400)); <a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a> release_callback = { TextureReleasedCallback, 0, PP_COMPLETIONCALLBACK_FLAG_NONE, }; layer_if-&gt;SetTexture(texture_layer, graphics3d, texture_id, PP_MakeSize(300, 300), release_callback);</p>
<p><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a> callback = { DidFinishCommitLayersCallback, (void*) texture_id, PP_COMPLETIONCALLBACK_FLAG_NONE, }; compositor_if-&gt;CommitLayers(compositor, callback); </p>
<p><b>release callback</b> void ReleaseCallback(int32_t result, void* user_data) { if (result == PP_OK) { uint32_t texture_id = (uint32_t) user_data; // reuse the texture or delete it. } }</p>
<p><b>Shutdown:</b> </p>
<div class="fragment"><pre class="fragment"> core-&gt;ReleaseResource(color_layer);
core-&gt;ReleaseResource(texture_layer);
core-&gt;ReleaseResource(compositor);
</pre></div> </div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="a54fc4ef7119d18446a836aef08384da6"></a><!-- doxytag: member="PPB_Compositor::AddLayer" ref="a54fc4ef7119d18446a836aef08384da6" args=")(PP_Resource compositor)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* <a class="el" href="struct_p_p_b___compositor__0__1.html#a54fc4ef7119d18446a836aef08384da6">PPB_Compositor::AddLayer</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> compositor)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a new <code>PPB_CompositorLayer</code> and adds it to the end of the layer stack. </p>
<p>A <code>PP_Resource</code> containing the layer is returned. It is uninitialized, <code>SetColor()</code>, <code>SetTexture</code> or <code>SetImage</code> should be used to initialize it. The layer will appear above other pre-existing layers. If <code>ResetLayers</code> is called or the <code>PPB_Compositor</code> is released, the returned layer will be invalidated, and any further calls on the layer will return <code>PP_ERROR_BADRESOURCE</code>.</p>
<p>param[in] compositor A <code>PP_Resource</code> corresponding to a compositor layer resource.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> containing the compositor layer resource if sucessful or 0 otherwise. </dd></dl>
</div>
</div>
<a class="anchor" id="a5082b0dce4a58032439bc3dd4ff741fd"></a><!-- doxytag: member="PPB_Compositor::CommitLayers" ref="a5082b0dce4a58032439bc3dd4ff741fd" args=")(PP_Resource compositor, struct PP_CompletionCallback cc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___compositor__0__1.html#a5082b0dce4a58032439bc3dd4ff741fd">PPB_Compositor::CommitLayers</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> compositor, struct <a class="el" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a> cc)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Commits layers added by <code><a class="el" href="struct_p_p_b___compositor__0__1.html#a54fc4ef7119d18446a836aef08384da6" title="Creates a new PPB_CompositorLayer and adds it to the end of the layer stack.">AddLayer()</a></code> to the chromium compositor. </p>
<p>param[in] compositor A <code>PP_Resource</code> corresponding to a compositor layer resource. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">cc</td><td>A <code><a class="el" href="struct_p_p___completion_callback.html" title="PP_CompletionCallback is a common mechanism for supporting potentially asynchronous calls in browser ...">PP_CompletionCallback</a></code> to be called when layers have been represented on screen.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing a result code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a3b479b946dcec4b3315c5f3cdccba5ce"></a><!-- doxytag: member="PPB_Compositor::Create" ref="a3b479b946dcec4b3315c5f3cdccba5ce" args=")(PP_Instance instance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a>(* <a class="el" href="struct_p_p_b___compositor__0__1.html#a3b479b946dcec4b3315c5f3cdccba5ce">PPB_Compositor::Create</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a Compositor resource. </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>A <code>PP_Instance</code> identifying one instance of a module.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Resource</code> containing the compositor resource if sucessful or 0 otherwise. </dd></dl>
</div>
</div>
<a class="anchor" id="a22fb77daabd3894db97ab1111d111a92"></a><!-- doxytag: member="PPB_Compositor::IsCompositor" ref="a22fb77daabd3894db97ab1111d111a92" args=")(PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group___enums.html#ga4f272d99be14aacafe08dfd4ef830918">PP_Bool</a>(* <a class="el" href="struct_p_p_b___compositor__0__1.html#a22fb77daabd3894db97ab1111d111a92">PPB_Compositor::IsCompositor</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> resource)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Determines if a resource is a compositor resource. </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>The <code>PP_Resource</code> to test.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given resource is a compositor resource or <code>PP_FALSE</code> otherwise. </dd></dl>
</div>
</div>
<a class="anchor" id="a9a0e4e7aed4b13dbea426a75a8311172"></a><!-- doxytag: member="PPB_Compositor::ResetLayers" ref="a9a0e4e7aed4b13dbea426a75a8311172" args=")(PP_Resource compositor)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* <a class="el" href="struct_p_p_b___compositor__0__1.html#a9a0e4e7aed4b13dbea426a75a8311172">PPB_Compositor::ResetLayers</a>)(<a class="el" href="group___typedefs.html#gafdc3895ee80f4750d0d95ae1b677e9b7">PP_Resource</a> compositor)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Resets layers added by <code><a class="el" href="struct_p_p_b___compositor__0__1.html#a54fc4ef7119d18446a836aef08384da6" title="Creates a new PPB_CompositorLayer and adds it to the end of the layer stack.">AddLayer()</a></code>. </p>
<p>param[in] compositor A <code>PP_Resource</code> corresponding to a compositor layer resource.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing a result code from <code><a class="el" href="pp__errors_8h.html" title="This file defines an enumeration of all PPAPI error codes.">pp_errors.h</a></code>. </dd></dl>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppb__compositor_8h.html">ppb_compositor.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}