70
edits
No edit summary |
Stuartmorgan (talk | contribs) (Clarify that this spec assumes the Carbon model, and explain the precedence, since it's a common point of confusion) |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 11: | Line 11: | ||
== Overview == | == Overview == | ||
The Core Graphics drawing model is an alternative drawing model for 32-bit Mac OS X plugins and the default drawing model for 64-bit Mac OS X plugins. | |||
<i>Note: This specification pre-dates the Cocoa specification, so it assumes the Carbon event model. Discussions of "changes" refer to differences from the QuickDraw drawing model. When using CoreGraphics with the [[NPAPI:CocoaEventModel|Cocoa event model]], changes in the Cocoa model may supersede information given here.</i> | |||
== Negotiating Core Graphics Drawing == | == Negotiating Core Graphics Drawing == | ||
| Line 17: | Line 19: | ||
For documentation on negotiating drawing models, see [[NPAPI:Models]]. The drawing model variables for Core Graphics are: | For documentation on negotiating drawing models, see [[NPAPI:Models]]. The drawing model variables for Core Graphics are: | ||
* NPDrawingModelCoreGraphics | * NPDrawingModelCoreGraphics (NPDrawingModel = 1) | ||
* NPNVsupportsCoreGraphicsBool | * NPNVsupportsCoreGraphicsBool (NPNVariable = 2001) | ||
== Excluding QuickDraw == | == Excluding QuickDraw == | ||
QuickDraw is default drawing model for 32-bit Mac OS X plugins. | QuickDraw is default drawing model for 32-bit Mac OS X plugins. The QuickDraw drawing model does not exist for 64-bit Mac OS X. The drawing model variables for Quickdraw are: | ||
* NPDrawingModelQuickDraw | * NPDrawingModelQuickDraw (NPDrawingModel = 0) | ||
* NPNVsupportsQuickDrawBool | * NPNVsupportsQuickDrawBool (NPNVariable = 2000) | ||
Plugins and browsers that are compiled 64-bit must entirely exclude QuickDraw support, since there will be no 64-bit QuickDraw. | Plugins and browsers that are compiled 64-bit must entirely exclude QuickDraw support, since there will be no 64-bit QuickDraw. | ||
| Line 34: | Line 36: | ||
#define NP_NO_QUICKDRAW | #define NP_NO_QUICKDRAW | ||
#endif | #endif | ||
== The Core Graphics Drawing Model == | == The Core Graphics Drawing Model == | ||
| Line 41: | Line 41: | ||
If a plugin sets the drawing model to NPDrawingModelCoreGraphics, then the meanings of some of the NPAPI data structures change: | If a plugin sets the drawing model to NPDrawingModelCoreGraphics, then the meanings of some of the NPAPI data structures change: | ||
- NPWindow's 'window' field becomes a NP_CGContext: | - NPWindow's 'window' field (under the Carbon event model) becomes a NP_CGContext: | ||
/* NP_CGContext is the type of the NPWindow's 'window' when the | /* NP_CGContext is the type of the NPWindow's 'window' when the | ||
| Line 77: | Line 77: | ||
== Bridging QuickDraw and CoreGraphics == | == Bridging QuickDraw and CoreGraphics == | ||
There is a way for plugins to draw using CoreGraphics, yet remain compatible with QuickDraw-only browsers. The idea is to use QDBeginCGContext() and QDEndCGContext() to obtain a CGContextRef for the CGrafPtr provided by the browser. | |||
static CGContextRef beginQDPluginUpdate(NPWindow *window) | static CGContextRef beginQDPluginUpdate(NPWindow *window) | ||
edits