Changes

Jump to: navigation, search

NPAPI:Pepper

894 bytes added, 04:15, 30 March 2010
Printing
The whole Pepper audio design document is too long to embed here.&nbsp; [[Plugins:PepperAudioAPI|Please click here for the Pepper Audio API]]<br>
= Plugin Extensions for Pepper = Plugins can also provide Pepper extensions for use by the browser. As with the browser extensions structure, plugin extensions structure is defined in npapi_extensions.h. <pre>/* from npapi_extensions.h */typedef struct _NPPExtensions { NPPGetPrintExtensionsPtr getPrintExtensions; /* ... */} NPPExtensions;</pre> The browser can request a plugin's Pepper interface by <pre>NPPExtensions *extensions;NPP_GetValue(instance, NPPVPepperExtensions, &extensions);</pre> == Printing == Pepper modules can choose to export the Pepper printing interface. Today the interface is raster-oriented, but we plan to provide a vector interface in the future. To get the plugin print interface the browser can call the getPrintExtensions method on the extensions vector. This returns another vector of methods. <pre>/* Returns NULL if the plugin does not support print extensions */typedef NPPPrintExtensions* (*NPPGetPrintExtensionsPtr)(NPP instance); /* TBD: Provide a vector interface for printing. We need to decide * on a vector format that can support embedded fonts. A vector format will * greatly reduce the size of the required output buffer*/ typedef struct _NPPPrintExtensions { NPPPrintBeginPtr printBegin; NPPGetRasterDimensionsPtr getRasterDimensions; NPPPrintPageRasterPtr printPageRaster; NPPPrintEndPtr printEnd;} NPPPrintExtensions;</pre> To begin a print operation the browser calls the first method. This returns the total number of pages to print at the given printableArea size and DPI. printableArea is in points (a point is 1/72 of an inch). The plugin is expected to remember the values of printableArea and printerDPI for use in subsequent print interface calls. These values should be cleared by the printEnd method.
<pre>
/* Being a print operation. Returns the total number of pages to print at the
* given printableArea size and DPI. printableArea is in points (a point is 1/72
* of an inch). The plugin is expected to remember the values of printableArea
* and printerDPI for use in subsequent print interface calls. These values
* should be cleared in printEnd*/
typedef NPError (*NPPPrintBeginPtr) (
NPP instance,
int32 printerDPI,
int32* numPages);
</* Returns pre> The second method returns the required raster dimensions for the given page. */ <pre>
typedef NPError (*NPPGetRasterDimensionsPtr) (
NPP instance,
int32* widthInPixels,
int32* heightInPixels);
</* Prints pre> The third method rasterizes the specified page This allows into a printSurface of the same format as used for the plugin to print a raster output2D device API. */ <pre>
typedef NPError (*NPPPrintPageRasterPtr) (
NPP instance,
int32 pageNumber,
NPDeviceContext2D* printSurface);
</* Ends the print operation */typedef NPError (*NPPPrintEndPtr) (NPP instance);pre>
/* TBD: Provide a vector interface for printing. We need to decide * on a vector format that can support embedded fonts. A vector format will * greatly reduce The last method ends the size of the required output buffer*/ typedef struct _NPPPrintExtensions { NPPPrintBeginPtr printBegin; NPPGetRasterDimensionsPtr getRasterDimensions; NPPPrintPageRasterPtr printPageRaster; NPPPrintEndPtr printEnd;} NPPPrintExtensions; /* Returns NULL if the plugin does not support print extensions */typedef NPPPrintExtensions* (*NPPGetPrintExtensionsPtr)(NPP instance); typedef struct _NPPExtensions { NPPGetPrintExtensionsPtr getPrintExtensions;} NPPExtensions;operation.
<pre>
typedef NPError (*NPPPrintEndPtr) (NPP instance);
</pre>
= Themes =
89
edits

Navigation menu