OLD | NEW |
---|---|
1 /* Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2010 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_PPB_IMAGE_DATA_H_ | 5 #ifndef PPAPI_C_PPB_IMAGE_DATA_H_ |
6 #define PPAPI_C_PPB_IMAGE_DATA_H_ | 6 #define PPAPI_C_PPB_IMAGE_DATA_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_macros.h" | 10 #include "ppapi/c/pp_macros.h" |
11 #include "ppapi/c/pp_module.h" | 11 #include "ppapi/c/pp_module.h" |
12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
13 #include "ppapi/c/pp_size.h" | 13 #include "ppapi/c/pp_size.h" |
14 #include "ppapi/c/pp_stdint.h" | 14 #include "ppapi/c/pp_stdint.h" |
15 | 15 |
16 /** | 16 /** |
17 * @file | 17 * @file |
18 * Defines the API ... | 18 * This file defines the PPB_ImageData struct for determining how a browser |
19 * handles image data. | |
19 */ | 20 */ |
20 | 21 |
21 /** | 22 /** |
22 * @addtogroup Enums | 23 * @addtogroup Enums |
23 * @{ | 24 * @{ |
24 */ | 25 */ |
25 | 26 |
27 /** | |
28 * PP_ImageDataFormat is an enumeration of the different types of | |
29 * image data formats. | |
30 */ | |
26 typedef enum { | 31 typedef enum { |
27 PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 32 PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
28 PP_IMAGEDATAFORMAT_RGBA_PREMUL | 33 PP_IMAGEDATAFORMAT_RGBA_PREMUL |
29 } PP_ImageDataFormat; | 34 } PP_ImageDataFormat; |
30 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ImageDataFormat, 4); | 35 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ImageDataFormat, 4); |
31 /** | 36 /** |
32 * @} | 37 * @} |
33 */ | 38 */ |
34 | 39 |
35 /** | 40 /** |
36 * @addtogroup Structs | 41 * @addtogroup Structs |
37 * @{ | 42 * @{ |
38 */ | 43 */ |
44 | |
45 /** | |
46 * The PP_ImageDataDesc structure represents a description of image data. | |
47 */ | |
39 struct PP_ImageDataDesc { | 48 struct PP_ImageDataDesc { |
49 | |
50 /** | |
51 * This value represents one of the image data types in the | |
52 * PP_ImageDataFormat enum. | |
53 */ | |
40 PP_ImageDataFormat format; | 54 PP_ImageDataFormat format; |
41 | 55 |
42 /** Size of the bitmap in pixels. */ | 56 /** This value represents the size of the bitmap in pixels. */ |
43 struct PP_Size size; | 57 struct PP_Size size; |
44 | 58 |
45 /** The row width in bytes. This may be different than width * 4 since there | 59 /** |
46 * may be padding at the end of the lines. | 60 * This value represents the row width in bytes. This may be different than |
61 * width * 4 since there may be padding at the end of the lines. | |
47 */ | 62 */ |
48 int32_t stride; | 63 int32_t stride; |
49 }; | 64 }; |
50 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ImageDataDesc, 16); | 65 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ImageDataDesc, 16); |
51 /** | 66 /** |
52 * @} | 67 * @} |
53 */ | 68 */ |
54 | 69 |
55 #define PPB_IMAGEDATA_INTERFACE "PPB_ImageData;0.3" | 70 #define PPB_IMAGEDATA_INTERFACE "PPB_ImageData;0.3" |
56 | 71 |
57 /** | 72 /** |
58 * @addtogroup Interfaces | 73 * @addtogroup Interfaces |
59 * @{ | 74 * @{ |
60 */ | 75 */ |
76 | |
77 /** | |
78 * The PPB_ImageData interface contains pointers to several functions for | |
79 * determining the browser's treatment of image data. | |
80 */ | |
61 struct PPB_ImageData { | 81 struct PPB_ImageData { |
62 /** | 82 /** |
63 * Returns the browser's preferred format for image data. This format will be | 83 * This value represents a pointer to a function that returns the browser's |
dmichael(do not use this one)
2011/03/04 16:42:49
I thought the new wording being used elsewhere was
jond
2011/03/04 17:16:33
Done.
| |
64 * the format is uses internally for painting. Other formats may require | 84 * preferred format for image data. This format will be the format the |
65 * internal conversions to paint or may have additional restrictions depending | 85 * browser uses internally for painting. Other formats may require |
dmichael(do not use this one)
2011/03/04 16:42:49
Might read better as: "The browser uses this form
jond
2011/03/04 17:16:33
Done.
| |
66 * on the function. | 86 * internal conversions to paint or may have additional restrictions |
87 * depending on the function. | |
88 * | |
89 * @return PP_ImageDataFormat containing the preferred format. | |
67 */ | 90 */ |
68 PP_ImageDataFormat (*GetNativeImageDataFormat)(); | 91 PP_ImageDataFormat (*GetNativeImageDataFormat)(); |
69 | 92 |
70 /** | 93 /** |
71 * Returns PP_TRUE if the given image data format is supported by the browser. | 94 * This value represents a pointer to a function that determines if the given |
dmichael(do not use this one)
2011/03/04 16:42:49
Ditto: I think "<name of fucntion pointer> is a p
jond
2011/03/04 17:16:33
Done.
| |
95 * image data format is supported by the browser. | |
96 * | |
97 * @param[in] format The image data format. | |
98 * @return PP_Bool with PP_TRUE if the given image data format is supported | |
99 * by the browser. | |
72 */ | 100 */ |
73 PP_Bool (*IsImageDataFormatSupported)(PP_ImageDataFormat format); | 101 PP_Bool (*IsImageDataFormatSupported)(PP_ImageDataFormat format); |
74 | 102 |
75 /** | 103 /** |
76 * Allocates an image data resource with the given format and size. The | 104 * This value represents a pointer to a function that allocates an image |
77 * return value will have a nonzero ID on success, or zero on failure. | 105 * data resource with the given format and size. |
78 * Failure means the instance, image size, or format was invalid. | |
79 * | |
80 * Set the init_to_zero flag if you want the bitmap initialized to | |
81 * transparent during the creation process. If this flag is not set, the | |
82 * current contents of the bitmap will be undefined, and the plugin should | |
83 * be sure to set all the pixels. | |
84 * | 106 * |
85 * For security reasons, if uninitialized, the bitmap will not contain random | 107 * For security reasons, if uninitialized, the bitmap will not contain random |
86 * memory, but may contain data from a previous image produced by the same | 108 * memory, but may contain data from a previous image produced by the same |
87 * plugin if the bitmap was cached and re-used. | 109 * plugin if the bitmap was cached and re-used. |
110 * | |
111 * @param[in] instance A PP_Instance indentifying one instance of a module. | |
112 * @param[in] format The desired image data format. | |
113 * @param[in] size A pointer to a PP_Size containing the image size. | |
114 * @param[in] init_to_zero A PP_Bool to determine transparency at creation. | |
115 * Set the init_to_zero flag if you want the bitmap initialized to | |
116 * transparent during the creation process. If this flag is not set, the | |
117 * current contents of the bitmap will be undefined, and the plugin should | |
118 * be sure to set all the pixels.. | |
dmichael(do not use this one)
2011/03/04 16:42:49
extra period
jond
2011/03/04 17:16:33
Done.
| |
119 * | |
120 * @return A PP_Resource with a nonzero ID on succes or zero on failure. | |
121 * Failure means the instance, image size, or format was invalid. | |
88 */ | 122 */ |
89 PP_Resource (*Create)(PP_Instance instance, | 123 PP_Resource (*Create)(PP_Instance instance, |
90 PP_ImageDataFormat format, | 124 PP_ImageDataFormat format, |
91 const struct PP_Size* size, | 125 const struct PP_Size* size, |
92 PP_Bool init_to_zero); | 126 PP_Bool init_to_zero); |
93 | 127 |
94 /** | 128 /** |
95 * Returns PP_TRUE if the given resource is an image data. Returns PP_FALSE if | 129 * This value represents a pointer to a function that determiens if a given |
96 * the resource is invalid or some type other than an image data. | 130 * resource is image data. |
131 * | |
132 * @param[in] image_data A PP_Resource corresponding to image data. | |
133 * @return A PP_Bool with PP_TRUE if the given resrouce is an image data | |
134 * or PP_FALSE if the resource is invalid or some type other than image data. | |
97 */ | 135 */ |
98 PP_Bool (*IsImageData)(PP_Resource image_data); | 136 PP_Bool (*IsImageData)(PP_Resource image_data); |
99 | 137 |
100 /** | 138 /** |
101 * Computes the description of the image data. Returns PP_TRUE on success, | 139 * This value represents a pointer to a function that computes the |
102 * PP_FALSE if the resource is not an image data. On PP_FALSE, the |desc| | 140 * description of the image data. |
141 * | |
142 * @param[in] image_data A PP_Resource corresponding to image data. | |
143 * @param[in/out] desc A pointer to a PP_ImageDataDesc containing the | |
144 * description. | |
145 * @return A PP_Bool with PP_TRUE on success or PP_FALSE | |
146 * if the resource is not an image data. On PP_FALSE, the |desc| | |
103 * structure will be filled with 0. | 147 * structure will be filled with 0. |
104 */ | 148 */ |
105 PP_Bool (*Describe)(PP_Resource image_data, | 149 PP_Bool (*Describe)(PP_Resource image_data, |
106 struct PP_ImageDataDesc* desc); | 150 struct PP_ImageDataDesc* desc); |
107 | 151 |
108 /** | 152 /** |
109 * Maps this bitmap into the plugin address space and returns a pointer to the | 153 * This value represents a pointer to a function that maps an image data into |
110 * beginning of the data. | 154 * the plugin address space. |
155 * | |
156 * @param[in] image_data A PP_Resource corresponding to image data. | |
157 * @return A pointer to the beginning of the data. | |
111 */ | 158 */ |
112 void* (*Map)(PP_Resource image_data); | 159 void* (*Map)(PP_Resource image_data); |
113 | 160 |
161 /** | |
162 * This value represents a pointer to a function that unmaps an image data | |
163 * from the plugin address space. | |
164 * | |
165 * @param[in] image_data A PP_Resource corresponding to image data. | |
166 | |
114 void (*Unmap)(PP_Resource image_data); | 167 void (*Unmap)(PP_Resource image_data); |
115 }; | 168 }; |
116 /** | 169 /** |
117 * @} | 170 * @} |
118 */ | 171 */ |
119 | 172 |
120 #endif /* PPAPI_C_PPB_IMAGE_DATA_H_ */ | 173 #endif /* PPAPI_C_PPB_IMAGE_DATA_H_ */ |
121 | 174 |
OLD | NEW |