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 | |
6 /* From dev/ppp_printing_dev.idl modified Thu Nov 17 09:51:33 2011. */ | |
7 | |
5 #ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_ | 8 #ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_ |
6 #define PPAPI_C_DEV_PPP_PRINTING_DEV_H_ | 9 #define PPAPI_C_DEV_PPP_PRINTING_DEV_H_ |
7 | 10 |
8 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_macros.h" | 13 #include "ppapi/c/pp_macros.h" |
14 #include "ppapi/c/pp_point.h" | |
11 #include "ppapi/c/pp_rect.h" | 15 #include "ppapi/c/pp_rect.h" |
12 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
17 #include "ppapi/c/pp_size.h" | |
13 #include "ppapi/c/pp_stdint.h" | 18 #include "ppapi/c/pp_stdint.h" |
14 | 19 |
20 #define PPP_PRINTING_DEV_INTERFACE_0_5 "PPP_Printing(Dev);0.5" | |
21 #define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_5 | |
22 | |
23 /** | |
24 * @file | |
25 * Implementation of the Printing interface. | |
26 */ | |
27 | |
28 | |
29 /** | |
30 * @addtogroup Enums | |
31 * @{ | |
32 */ | |
15 typedef enum { | 33 typedef enum { |
16 PP_PRINTORIENTATION_NORMAL = 0, | 34 PP_PRINTORIENTATION_NORMAL = 0, |
17 PP_PRINTORIENTATION_ROTATED_90_CW = 1, | 35 PP_PRINTORIENTATION_ROTATED_90_CW = 1, |
18 PP_PRINTORIENTATION_ROTATED_180 = 2, | 36 PP_PRINTORIENTATION_ROTATED_180 = 2, |
19 PP_PRINTORIENTATION_ROTATED_90_CCW = 3 | 37 PP_PRINTORIENTATION_ROTATED_90_CCW = 3 |
20 } PP_PrintOrientation_Dev; | 38 } PP_PrintOrientation_Dev; |
21 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); | 39 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); |
22 | 40 |
23 typedef enum { | 41 typedef enum { |
24 PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0, | 42 PP_PRINTOUTPUTFORMAT_RASTER = 1 << 0, |
25 PP_PRINTOUTPUTFORMAT_PDF = 1u << 1, | 43 PP_PRINTOUTPUTFORMAT_PDF = 1 << 1, |
26 PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2, | 44 PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1 << 2, |
27 PP_PRINTOUTPUTFORMAT_EMF = 1u << 3 | 45 PP_PRINTOUTPUTFORMAT_EMF = 1 << 3 |
dmichael (off chromium)
2011/11/17 19:04:41
yipe... we should probably still use unsigned lite
jvoung - send to chromium...
2011/11/17 20:51:34
Left shifts should be okay, right (no sign extensi
dmichael (off chromium)
2011/11/17 21:05:49
Yeah, it should give the value you want. I was con
jvoung - send to chromium...
2011/11/17 22:00:09
Done.
| |
28 } PP_PrintOutputFormat_Dev; | 46 } PP_PrintOutputFormat_Dev; |
29 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); | 47 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); |
48 /** | |
49 * @} | |
50 */ | |
30 | 51 |
52 /** | |
53 * @addtogroup Structs | |
54 * @{ | |
55 */ | |
31 struct PP_PrintSettings_Dev { | 56 struct PP_PrintSettings_Dev { |
32 /** This is the size of the printable area in points (1/72 of an inch) */ | 57 /** This is the size of the printable area in points (1/72 of an inch) */ |
33 struct PP_Rect printable_area; | 58 struct PP_Rect printable_area; |
34 int32_t dpi; | 59 int32_t dpi; |
35 PP_PrintOrientation_Dev orientation; | 60 PP_PrintOrientation_Dev orientation; |
36 PP_Bool grayscale; | 61 PP_Bool grayscale; |
37 PP_PrintOutputFormat_Dev format; | 62 PP_PrintOutputFormat_Dev format; |
38 }; | 63 }; |
39 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 32); | 64 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 32); |
40 | 65 |
41 /** | 66 /** |
42 * Specifies a contiguous range of page numbers to be printed. | 67 * Specifies a contiguous range of page numbers to be printed. |
43 * The page numbers use a zero-based index. | 68 * The page numbers use a zero-based index. |
44 */ | 69 */ |
45 struct PP_PrintPageNumberRange_Dev { | 70 struct PP_PrintPageNumberRange_Dev { |
46 uint32_t first_page_number; | 71 uint32_t first_page_number; |
47 uint32_t last_page_number; | 72 uint32_t last_page_number; |
48 }; | 73 }; |
49 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); | 74 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); |
75 /** | |
76 * @} | |
77 */ | |
50 | 78 |
51 /* Interface for the plugin to implement printing. */ | 79 /** |
52 #define PPP_PRINTING_DEV_INTERFACE_0_5 "PPP_Printing(Dev);0.5" | 80 * @addtogroup Interfaces |
53 #define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_5 | 81 * @{ |
54 | 82 */ |
55 struct PPP_Printing_Dev { | 83 struct PPP_Printing_Dev { |
56 /** | 84 /** |
57 * Returns a bit field representing the supported print output formats. For | 85 * Returns a bit field representing the supported print output formats. For |
58 * example, if only Raster and PostScript are supported, | 86 * example, if only Raster and PostScript are supported, |
59 * QuerySupportedFormats returns a value equivalent to: | 87 * QuerySupportedFormats returns a value equivalent to: |
60 * (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) | 88 * (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) |
61 */ | 89 */ |
62 uint32_t (*QuerySupportedFormats)(PP_Instance instance); | 90 uint32_t (*QuerySupportedFormats)(PP_Instance instance); |
63 | |
64 /** | 91 /** |
65 * Begins a print session with the given print settings. Calls to PrintPage | 92 * 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 | 93 * 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 | 94 * pages required for the print output at the given page size (0 indicates |
68 * a failure). | 95 * a failure). |
69 */ | 96 */ |
70 int32_t (*Begin)(PP_Instance instance, | 97 int32_t (*Begin)(PP_Instance instance, |
71 const struct PP_PrintSettings_Dev* print_settings); | 98 const struct PP_PrintSettings_Dev* print_settings); |
72 | |
73 /** | 99 /** |
74 * Prints the specified pages using the format specified in Begin. | 100 * Prints the specified pages using the format specified in Begin. |
75 * Returns a resource that represents the printed output. | 101 * Returns a resource that represents the printed output. |
76 * This is a PPB_ImageData resource if the output format is | 102 * This is a PPB_ImageData resource if the output format is |
77 * PP_PrintOutputFormat_Raster and a PPB_Blob otherwise. Returns 0 on | 103 * PP_PrintOutputFormat_Raster and a PPB_Blob otherwise. Returns 0 on |
78 * failure. | 104 * failure. |
79 */ | 105 */ |
80 PP_Resource (*PrintPages)( | 106 PP_Resource (*PrintPages)( |
81 PP_Instance instance, | 107 PP_Instance instance, |
82 const struct PP_PrintPageNumberRange_Dev* page_ranges, | 108 const struct PP_PrintPageNumberRange_Dev* page_ranges, |
83 uint32_t page_range_count); | 109 uint32_t page_range_count); |
84 | |
85 /** Ends the print session. Further calls to PrintPage will fail. */ | 110 /** Ends the print session. Further calls to PrintPage will fail. */ |
86 void (*End)(PP_Instance instance); | 111 void (*End)(PP_Instance instance); |
87 | |
88 /** | 112 /** |
89 * Returns true if the current content should be printed into the full page | 113 * 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. | 114 * and not scaled down to fit within the printer's printable area. |
91 */ | 115 */ |
92 PP_Bool (*IsScalingDisabled)(PP_Instance instance); | 116 PP_Bool (*IsScalingDisabled)(PP_Instance instance); |
93 }; | 117 }; |
118 /** | |
119 * @} | |
120 */ | |
94 | 121 |
95 #endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */ | 122 #endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */ |
96 | 123 |
OLD | NEW |