NPAPI:DrawImage: Difference between revisions

Jump to navigation Jump to search
Line 44: Line 44:
   } NPImageFormat;
   } NPImageFormat;
    
    
   typedef struct _NPImageData
   typedef struct _NPImageData
   {
   {
Line 50: Line 51:
     int32_t      stride;    /* Stride of data image pointer */
     int32_t      stride;    /* Stride of data image pointer */
     NPImageFormat format;    /* Format of image pointer */
     NPImageFormat format;    /* Format of image pointer */
     NPSize        dataSize;  /* Data buffer size */
     /* size of plugin window in current buffer, used for scale information */
     /* Plugin window area rectangle relative to 0,0 beginning of buffer image */
     NPSize        pluginSize;
    NPRect        pluginArea;
  /* "data" points to exposeX/Y point, which is also offset in plugin window area */
    /* Clip rectangle relative to pluginArea rectangle */
  int32_t      exposeX;
    NPRect       clip;
  int32_t      exposeY;
  } NPImageData;
  /* size of data buffer, size of area where plugin should paint */
  /* exposeX/Y + exposeSize <= pluginSize */
  NPSize       exposeSize;  
} NPImageData;
 
How to initialize cairo destination surface with this info:
<pre>
cairo_surface_t *src = plugin_window_image (probably cached)
cairo_surface_t *dest =
  cairo_image_surface_create_for_data((unsigned char*)event->data,
                                      CAIRO_FORMAT_XXX(event->format),
                                      event->exposeSize.width,
                                      event->exposeSize.height,
                                      event->stride);
 
cairo_t *cr = cairo_create(dest);
cairo_set_source_surface (cr, src, -event->exposeRect.left, -event->exposeRect.top);
</pre>


= NPImageFormat Type Negotiation =
= NPImageFormat Type Negotiation =
Confirmed users
180

edits

Navigation menu