|
|
Line 6: |
Line 6: |
| = Proposal = | | = Proposal = |
|
| |
|
| I propose an NPAPI Drawing model which would allow a plugin to render directly into an image memory buffer, without involving XSurface. | | I propose an NPAPI DrawImage event type which would allow a plugin to render directly into an image memory buffer, without involving X-Surface. |
|
| |
|
| = Event model negotiation = | | = Drawing Image Event = |
|
| |
|
| For documentation on negotiating event models, see [[NPAPI:Models]]. The event model variables for all platforms are: | | For documentation on negotiating event type, see Plugins:IndependentEventModel. |
| | The drawing image type variable for Platform independent image rendering is: |
|
| |
|
| <pre>
| | * NPEventType_DrawImage |
| * NPEventModelNative - (Native platform default events, X/HWND... ) | |
| * NPEventModelIndependent
| |
| * NPNVsupportsNativeBool (NPNVariable = 3000)
| |
| * NPNVsupportsIndependentBool (NPNVariable = 3001)
| |
| </pre>
| |
| | |
| We should provide the possibility to implement a different event model for all platforms (not only Mac OS X).
| |
| | |
| == NPEventModelNative ==
| |
| | |
| Plugin and browser consider event structure as native event pointer, and Handling works as it is now by default in windowless mode.
| |
| | |
| == NPEventModelIndependent ==
| |
| | |
| <pre>
| |
| typedef struct _NPEvent
| |
| {
| |
| void* event; /* event structure pointer */
| |
| NPEventType type; /* typ of event, defined in NPEventType */
| |
| } NPEvent;
| |
| </pre>
| |
| | |
| <pre>
| |
| typedef enum {
| |
| NPEventType_Native = 0x0001, /* Native event structure specific to platform (XEvent, HWND...)
| |
| NPEventType_DrawImage = 0x0002, /* Draw Image even type, event structure == NPImageData.
| |
| NPEventType_GetFocusEvent = ....
| |
| ............
| |
| Other events which are need to be platform independent
| |
| ............
| |
| } NPEventType;
| |
| </pre>
| |
| | |
| == NPEventModelType negotiation ==
| |
| | |
| Browser and plugin should negotiate Event model type:
| |
| * if no supported model type defined or NPEventModelNative only, then we use the default event model system, specific to platform
| |
| * If NPEventModelIndependent was negotiated as supported, then browser and plugin should also negotiate the list of supported events
| |
| | |
| === NPEventType negotiation ===
| |
| | |
| <pre>
| |
| NPNVsupportsEventTypes = 4000
| |
| | |
| NPEventType aTypes;
| |
| browser->getvalue(instance, NPNVsupportsEventTypes, &aTypes)
| |
| </pre>
| |
| | |
| Then plugin should decide which event supported by plugin and browser (remove bits which are not supported by plugin), and set value to browser:
| |
| | |
| <pre>
| |
| browser->setvalue(instance, NPNVsupportsEventTypes, commonTypes);
| |
| </pre>
| |
| | |
| = Drawing Model =
| |
| | |
| For documentation on negotiating drawing model, see NPAPI:Models. The drawing model variables for Platform independent image rendering are:
| |
| | |
| * NPDrawingModelImage (NPDrawingModel = 0)
| |
| * NPNVsupportsDrawImageBool (NPNVariable = 2000)
| |
| | |
| == NPDrawingModelImage ==
| |
|
| |
|
| Using NPImageData structure as event | | Using NPImageData structure as event |
Line 103: |
Line 42: |
| <pre> | | <pre> |
| typedef enum { | | typedef enum { |
| NPImageFormatARGB32 = 0x0001, | | NPImageFormatARGB32 = 0x0001, /* a8r8g8b8 */ |
| NPImageFormatRGB24 = 0x0002, | | NPImageFormatRGB24 = 0x0002, /* x8r8g8b8 */ |
| NPImageFormatRGB16_565 = 0x0004, | | NPImageFormatARGB16_565 = 0x0004, /* a1r5g6b5 */ |
| NPImageFormatA8 = 0x0008, | | NPImageFormatRGB16_565 = 0x0008 /* r5g6b5 */ |
| NPImageFormatA1 = 0x0010 | | ...... |
| | More formats could be added here if needed |
| | ...... |
| } NPImageFormat; | | } NPImageFormat; |
| </pre> | | </pre> |
Line 117: |
Line 58: |
| </pre> | | </pre> |
|
| |
|
| Implementation is similar to Event types negotiation
| | Similar to Event types negotiation [[Plugins:IndependentEventModel#NPEventType_negotiation]] |
|
| |
|
| <pre> | | <pre> |
Line 132: |
Line 73: |
| And then browser should use only formats enumerated in commonFormats value. | | And then browser should use only formats enumerated in commonFormats value. |
|
| |
|
| According to plugin state (transparency), and platform preffered depth/image-format browser will send event to plugin with specific format. | | According to plugin state (transparency), and platform proffered depth/image-format browser will send event to plugin with specific format. |