OLD | NEW |
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 #ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_ | |
6 #define PPAPI_C_DEV_PPP_PRINTING_DEV_H_ | |
7 | 5 |
8 #include "ppapi/c/pp_bool.h" | 6 /** |
9 #include "ppapi/c/pp_instance.h" | 7 * Implementation of the Printing interface. |
10 #include "ppapi/c/pp_macros.h" | 8 */ |
11 #include "ppapi/c/pp_rect.h" | |
12 #include "ppapi/c/pp_resource.h" | |
13 #include "ppapi/c/pp_stdint.h" | |
14 | 9 |
15 typedef enum { | 10 label Chrome { |
| 11 M14 = 0.5 |
| 12 }; |
| 13 |
| 14 [assert_size(4)] |
| 15 enum PP_PrintOrientation_Dev { |
16 PP_PRINTORIENTATION_NORMAL = 0, | 16 PP_PRINTORIENTATION_NORMAL = 0, |
17 PP_PRINTORIENTATION_ROTATED_90_CW = 1, | 17 PP_PRINTORIENTATION_ROTATED_90_CW = 1, |
18 PP_PRINTORIENTATION_ROTATED_180 = 2, | 18 PP_PRINTORIENTATION_ROTATED_180 = 2, |
19 PP_PRINTORIENTATION_ROTATED_90_CCW = 3 | 19 PP_PRINTORIENTATION_ROTATED_90_CCW = 3 |
20 } PP_PrintOrientation_Dev; | 20 }; |
21 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); | |
22 | 21 |
23 typedef enum { | 22 [assert_size(4)] |
| 23 enum PP_PrintOutputFormat_Dev { |
24 PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0, | 24 PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0, |
25 PP_PRINTOUTPUTFORMAT_PDF = 1u << 1, | 25 PP_PRINTOUTPUTFORMAT_PDF = 1u << 1, |
26 PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2, | 26 PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2, |
27 PP_PRINTOUTPUTFORMAT_EMF = 1u << 3 | 27 PP_PRINTOUTPUTFORMAT_EMF = 1u << 3 |
28 } PP_PrintOutputFormat_Dev; | 28 }; |
29 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); | |
30 | 29 |
| 30 [assert_size(32)] |
31 struct PP_PrintSettings_Dev { | 31 struct PP_PrintSettings_Dev { |
32 /** This is the size of the printable area in points (1/72 of an inch) */ | 32 /** This is the size of the printable area in points (1/72 of an inch) */ |
33 struct PP_Rect printable_area; | 33 PP_Rect printable_area; |
34 int32_t dpi; | 34 int32_t dpi; |
35 PP_PrintOrientation_Dev orientation; | 35 PP_PrintOrientation_Dev orientation; |
36 PP_Bool grayscale; | 36 PP_Bool grayscale; |
37 PP_PrintOutputFormat_Dev format; | 37 PP_PrintOutputFormat_Dev format; |
38 }; | 38 }; |
39 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 32); | |
40 | 39 |
41 /** | 40 /** |
42 * Specifies a contiguous range of page numbers to be printed. | 41 * Specifies a contiguous range of page numbers to be printed. |
43 * The page numbers use a zero-based index. | 42 * The page numbers use a zero-based index. |
44 */ | 43 */ |
| 44 [assert_size(8)] |
45 struct PP_PrintPageNumberRange_Dev { | 45 struct PP_PrintPageNumberRange_Dev { |
46 uint32_t first_page_number; | 46 uint32_t first_page_number; |
47 uint32_t last_page_number; | 47 uint32_t last_page_number; |
48 }; | 48 }; |
49 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); | |
50 | 49 |
51 /* Interface for the plugin to implement printing. */ | 50 interface PPP_Printing_Dev { |
52 #define PPP_PRINTING_DEV_INTERFACE_0_5 "PPP_Printing(Dev);0.5" | |
53 #define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_5 | |
54 | |
55 struct PPP_Printing_Dev { | |
56 /** | 51 /** |
57 * Returns a bit field representing the supported print output formats. For | 52 * Returns a bit field representing the supported print output formats. For |
58 * example, if only Raster and PostScript are supported, | 53 * example, if only Raster and PostScript are supported, |
59 * QuerySupportedFormats returns a value equivalent to: | 54 * QuerySupportedFormats returns a value equivalent to: |
60 * (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) | 55 * (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) |
61 */ | 56 */ |
62 uint32_t (*QuerySupportedFormats)(PP_Instance instance); | 57 uint32_t QuerySupportedFormats([in] PP_Instance instance); |
63 | 58 |
64 /** | 59 /** |
65 * Begins a print session with the given print settings. Calls to PrintPage | 60 * Begins a print session with the given print settings. Calls to PrintPage |
66 * can only be made after a successful call to Begin. Returns the number of | 61 * can only be made after a successful call to Begin. Returns the number of |
67 * pages required for the print output at the given page size (0 indicates | 62 * pages required for the print output at the given page size (0 indicates |
68 * a failure). | 63 * a failure). |
69 */ | 64 */ |
70 int32_t (*Begin)(PP_Instance instance, | 65 int32_t Begin([in] PP_Instance instance, |
71 const struct PP_PrintSettings_Dev* print_settings); | 66 [in] PP_PrintSettings_Dev print_settings); |
72 | 67 |
73 /** | 68 /** |
74 * Prints the specified pages using the format specified in Begin. | 69 * Prints the specified pages using the format specified in Begin. |
75 * Returns a resource that represents the printed output. | 70 * Returns a resource that represents the printed output. |
76 * This is a PPB_ImageData resource if the output format is | 71 * This is a PPB_ImageData resource if the output format is |
77 * PP_PrintOutputFormat_Raster and a PPB_Blob otherwise. Returns 0 on | 72 * PP_PrintOutputFormat_Raster and a PPB_Blob otherwise. Returns 0 on |
78 * failure. | 73 * failure. |
79 */ | 74 */ |
80 PP_Resource (*PrintPages)( | 75 PP_Resource PrintPages([in] PP_Instance instance, |
81 PP_Instance instance, | 76 [in] PP_PrintPageNumberRange_Dev page_ranges, |
82 const struct PP_PrintPageNumberRange_Dev* page_ranges, | 77 [in] uint32_t page_range_count); |
83 uint32_t page_range_count); | |
84 | 78 |
85 /** Ends the print session. Further calls to PrintPage will fail. */ | 79 /** Ends the print session. Further calls to PrintPage will fail. */ |
86 void (*End)(PP_Instance instance); | 80 void End([in] PP_Instance instance); |
87 | 81 |
88 /** | 82 /** |
89 * Returns true if the current content should be printed into the full page | 83 * Returns true if the current content should be printed into the full page |
90 * and not scaled down to fit within the printer's printable area. | 84 * and not scaled down to fit within the printer's printable area. |
91 */ | 85 */ |
92 PP_Bool (*IsScalingDisabled)(PP_Instance instance); | 86 PP_Bool IsScalingDisabled([in] PP_Instance instance); |
93 }; | 87 }; |
94 | 88 |
95 #endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */ | |
96 | |
OLD | NEW |