NPAPI:AsyncDrawing: Difference between revisions

Jump to navigation Jump to search
Line 43: Line 43:
   /* These formats describe the format in the memory byte-order. This means if
   /* These formats describe the format in the memory byte-order. This means if
   * a 32-bit value of a pixel is viewed on a little-endian system the layout will
   * a 32-bit value of a pixel is viewed on a little-endian system the layout will
   * be 0xAARRGGBB. Since the Alpha channel will be stored in the most significant
   * be 0xAARRGGBB. The Alpha channel will be stored in the most significant
   * bits */
   * bits. */
   typedef enum {
   typedef enum {
     /* 32-bit per pixel 8-bit per channel - premultiplied alpha */
     /* 32-bit per pixel 8-bit per channel - premultiplied alpha */
Line 81: Line 81:
</pre>
</pre>


What exactly this means depends on the drawing model's ownership policy and the implementation. If the finalized surface is current, its contents will be drawn until another surface is set current or the plugin goes away.
What exactly this means depends on the drawing model's ownership policy and the implementation. If the finalized surface is current, this function will return an error.


The currently displayed surface can be set via a new function called <code>NPN_SetCurrentAsyncSurface</code>:
The currently displayed surface can be set via a new function called <code>NPN_SetCurrentAsyncSurface</code>:


<pre>
<pre>
   NPError NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface* surface);
   void NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface* surface);
</pre>
</pre>


Surfaces cannot be modified while they are current.
Surfaces cannot be modified while they are current.


All three functions (init, finalize, set current) can be called from any thread.
The Init and Finalize functions must be called from the main plugin thread. The SetCurrent function may be called on another thread depending on the drawing model.


= NPDrawingModelAsyncBitmapSurface =
= NPDrawingModelAsyncBitmapSurface =
Confirmed users
138

edits

Navigation menu