NPAPI:DrawImage: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 37: Line 37:
= Event Structure =
= Event Structure =


= Drawing Image Event =
  typedef enum {
    NPImageFormatARGB32    = 0,  /* a8r8g8b8 */
    NPImageFormatRGB24      = 2,  /* x8r8g8b8 */
    NPImageFormatRGB16_565  = 3  /* r5g6b5  */
    ...
  } NPImageFormat;


For documentation on negotiating event type, see Plugins:IndependentEventModel.
  typedef struct _NPImageData
The drawing image type variable for Platform independent image rendering is:
  {
    /* Image data parameters */
    char*        data;      /* image pointer */
    int32_t      stride;    /* Stride of data image pointer */
    NPImageFormat format;    /* Format of image pointer */
    NPSize        dataSize;  /* Data buffer size */
    /* Clip rectangle, must be used for trusted plugins */
    int32_t      x;      /* Expose x relative to 0,0 of plugin window area*/
    int32_t      y;      /* Expose y relative to 0,0 of plugin window area */
    uint32_t      width;  /* Expose width */
    uint32_t      height; /* Expose height */
    /* Position and scale values for plugin area */
    float        translateX; /* translate X matrix value, (x offset) */
    float        translateY; /* translate Y matrix value, (y offset) */
    /* Defines plugin window size on scaled context, if 1 then size = window size */
    float        scaleX;    /* scale X matrix value */
    float        scaleY;    /* scale Y matrix value */
  } NPImageData;


* NPEventType_DrawImage
= NPImageFormat type negotiation =
 
Using NPImageData structure as event
where NPImageData:
<pre>
typedef struct _NPImageData
{
  /* Image data parameters */
  char*        data;      /* image pointer */
  int32_t      stride;    /* Stride of data image pointer */
  NPImageFormat format;    /* Format of image pointer */
  NPSize        dataSize;  /* Data buffer size */
  /* Clip rectangle, must be used for trusted plugins */
  int32_t      x;          /* Expose x relative to 0,0 of plugin window area*/
  int32_t      y;          /* Expose y relative to 0,0 of plugin window area */
  uint32_t      width;      /* Expose width */
  uint32_t      height;    /* Expose height */
  /* Position and scale values for plugin area */
  float        translateX; /* translate X matrix value, (x offset) */
  float        translateY; /* translate Y matrix value, (y offset) */
  /* Defines plugin window size on scaled context, if 1 then size = window size */
  float        scaleX;    /* scale X matrix value */
  float        scaleY;    /* scale Y matrix value */
} NPImageData;
</pre>
 
where NPImageFormat (similar to the current Cairo image format list):
<pre>
typedef enum {
  NPImageFormatARGB32    = 0x0001,    /* a8r8g8b8 */
  NPImageFormatRGB24      = 0x0002,    /* x8r8g8b8 */
  NPImageFormatRGB16_565  = 0x0004      /* r5g6b5  */
  ......
  More formats could be added here if needed
  ......
} NPImageFormat;
</pre>
 
=== NPImageFormat type negotiation ===


<pre>
<pre>
Confirmed users, Bureaucrats and Sysops emeriti
1,680

edits