Confirmed users, Bureaucrats and Sysops emeriti
1,680
edits
Line 66: | Line 66: | ||
Here is an example of a CoreGraphics-only plugin negotiating the drawing model: | Here is an example of a CoreGraphics-only plugin negotiating the drawing model: | ||
static NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, | static NPError NPP_New(NPMIMEType pluginType, NPP instance, | ||
uint16 mode, int16 argc, char* argn[], | |||
char* argv[], NPSavedData* saved) | |||
{ | { | ||
// Check if the browser supports the CoreGraphics drawing model | |||
NPBool supportsCoreGraphics = FALSE; | |||
NPError err = browser->getvalue(instance, | |||
NPNVsupportsCoreGraphicsBool, | |||
&supportsCoreGraphics); | |||
if (err != NPERR_NO_ERROR || !supportsCoreGraphics) | |||
return NPERR_INCOMPATIBLE_VERSION_ERROR;<br> | |||
// Set the drawing model | |||
err = browser->setvalue(instance, | |||
} | NPNVpluginDrawingModel, | ||
(void*)NPDrawingModelCoreGraphics); | |||
if (err != NPERR_NO_ERROR) | |||
return NPERR_INCOMPATIBLE_VERSION_ERROR;<br> | |||
return NPERR_NO_ERROR; | |||
} | |||
== The QuickDraw drawing model == | == The QuickDraw drawing model == |