NPAPI:CoreGraphicsDrawing: Difference between revisions

Jump to navigation Jump to search
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,
                        int16 argc, char* argn[], char* argv[], NPSavedData* saved)
                        uint16 mode, int16 argc, char* argn[],
                        char* argv[], NPSavedData* saved)
  {
  {
    // Check if the browser supports the CoreGraphics drawing model
    // Check if the browser supports the CoreGraphics drawing model
    NPBool supportsCoreGraphics = FALSE;
    NPBool supportsCoreGraphics = FALSE;
    if (browser->getvalue(instance, NPNVsupportsCoreGraphicsBool, &supportsCoreGraphics) != NPERR_NO_ERROR ||
    NPError err = browser->getvalue(instance,
    !supportsCoreGraphics)
                                    NPNVsupportsCoreGraphicsBool,
        return NPERR_INCOMPATIBLE_VERSION_ERROR;
                                    &supportsCoreGraphics);
    // Set the drawing model
    if (err != NPERR_NO_ERROR || !supportsCoreGraphics)
    if (browser->setvalue(instance, NPNVpluginDrawingModel, (void *)NPDrawingModelCoreGraphics) != NPERR_NO_ERROR)
        return NPERR_INCOMPATIBLE_VERSION_ERROR;<br>
        return NPERR_INCOMPATIBLE_VERSION_ERROR;
    // Set the drawing model
    return NPERR_NO_ERROR;
    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 ==
Confirmed users, Bureaucrats and Sysops emeriti
1,680

edits

Navigation menu