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_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" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 * <code>float alpha = 0.75f;</code> | 46 * <code>float alpha = 0.75f;</code> |
47 * ...components for image data are 8-bit values ranging from 0 to 255... | 47 * ...components for image data are 8-bit values ranging from 0 to 255... |
48 * <code>uint8_t image_data_red_premul = (uint8_t)(red * alpha * 255.0f); | 48 * <code>uint8_t image_data_red_premul = (uint8_t)(red * alpha * 255.0f); |
49 * </code> | 49 * </code> |
50 * <code>uint8_t image_data_green_premul = (uint8_t)(green * alpha * 255.0f); | 50 * <code>uint8_t image_data_green_premul = (uint8_t)(green * alpha * 255.0f); |
51 * </code> | 51 * </code> |
52 * <code>uint8_t image_data_blue_premul = (uint8_t)(blue * alpha * 255.0f); | 52 * <code>uint8_t image_data_blue_premul = (uint8_t)(blue * alpha * 255.0f); |
53 * </code> | 53 * </code> |
54 * <code>uint8_t image_data_alpha_premul = (uint8_t)(alpha * 255.0f);</code> | 54 * <code>uint8_t image_data_alpha_premul = (uint8_t)(alpha * 255.0f);</code> |
55 * | 55 * |
56 * Note: The resulting pre-multiplied red, green and blue components should not | 56 * <strong>Note:</strong> The resulting pre-multiplied red, green and blue |
57 * be greater than the alpha value. | 57 * components should not be greater than the alpha value. |
58 */ | 58 */ |
59 typedef enum { | 59 typedef enum { |
60 PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 60 PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
61 PP_IMAGEDATAFORMAT_RGBA_PREMUL | 61 PP_IMAGEDATAFORMAT_RGBA_PREMUL |
62 } PP_ImageDataFormat; | 62 } PP_ImageDataFormat; |
63 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ImageDataFormat, 4); | 63 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ImageDataFormat, 4); |
64 /** | 64 /** |
65 * @} | 65 * @} |
66 */ | 66 */ |
67 | 67 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 * | 117 * |
118 * @return A <code>PP_ImageDataFormat</code> containing the preferred format. | 118 * @return A <code>PP_ImageDataFormat</code> containing the preferred format. |
119 */ | 119 */ |
120 PP_ImageDataFormat (*GetNativeImageDataFormat)(); | 120 PP_ImageDataFormat (*GetNativeImageDataFormat)(); |
121 | 121 |
122 /** | 122 /** |
123 * IsImageDataFormatSupported() determines if the given image data format is | 123 * IsImageDataFormatSupported() determines if the given image data format is |
124 * supported by the browser. | 124 * supported by the browser. |
125 * | 125 * |
126 * @param[in] format The image data format. | 126 * @param[in] format The image data format. |
| 127 * |
127 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 128 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
128 * image data format is supported by the browser. | 129 * image data format is supported by the browser. |
129 */ | 130 */ |
130 PP_Bool (*IsImageDataFormatSupported)(PP_ImageDataFormat format); | 131 PP_Bool (*IsImageDataFormatSupported)(PP_ImageDataFormat format); |
131 | 132 |
132 /** | 133 /** |
133 * Create() allocates an image data resource with the given format and size. | 134 * Create() allocates an image data resource with the given format and size. |
134 * | 135 * |
135 * For security reasons, if uninitialized, the bitmap will not contain random | 136 * For security reasons, if uninitialized, the bitmap will not contain random |
136 * memory, but may contain data from a previous image produced by the same | 137 * memory, but may contain data from a previous image produced by the same |
(...skipping 17 matching lines...) Expand all Loading... |
154 PP_Resource (*Create)(PP_Instance instance, | 155 PP_Resource (*Create)(PP_Instance instance, |
155 PP_ImageDataFormat format, | 156 PP_ImageDataFormat format, |
156 const struct PP_Size* size, | 157 const struct PP_Size* size, |
157 PP_Bool init_to_zero); | 158 PP_Bool init_to_zero); |
158 | 159 |
159 /** | 160 /** |
160 * IsImageData() determiens if a given resource is image data. | 161 * IsImageData() determiens if a given resource is image data. |
161 * | 162 * |
162 * @param[in] image_data A <code>PP_Resource</code> corresponding to image | 163 * @param[in] image_data A <code>PP_Resource</code> corresponding to image |
163 * data. | 164 * data. |
| 165 * |
164 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 166 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
165 * resrouce is an image data or <code>PP_FALSE</code> if the resource is | 167 * resrouce is an image data or <code>PP_FALSE</code> if the resource is |
166 * invalid or some type other than image data. | 168 * invalid or some type other than image data. |
167 */ | 169 */ |
168 PP_Bool (*IsImageData)(PP_Resource image_data); | 170 PP_Bool (*IsImageData)(PP_Resource image_data); |
169 | 171 |
170 /** | 172 /** |
171 * Describe() computes the description of the | 173 * Describe() computes the description of the |
172 * image data. | 174 * image data. |
173 * | 175 * |
174 * @param[in] image_data A <code>PP_Resource</code> corresponding to image | 176 * @param[in] image_data A <code>PP_Resource</code> corresponding to image |
175 * data. | 177 * data. |
176 * @param[in,out] desc A pointer to a <code>PP_ImageDataDesc</code> | 178 * @param[in,out] desc A pointer to a <code>PP_ImageDataDesc</code> |
177 * containing the description. | 179 * containing the description. |
| 180 * |
178 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or | 181 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or |
179 * <code>PP_FALSE</code> if the resource is not an image data. On | 182 * <code>PP_FALSE</code> if the resource is not an image data. On |
180 * <code>PP_FALSE</code>, the <code>desc</code> structure will be filled | 183 * <code>PP_FALSE</code>, the <code>desc</code> structure will be filled |
181 * with 0. | 184 * with 0. |
182 */ | 185 */ |
183 PP_Bool (*Describe)(PP_Resource image_data, | 186 PP_Bool (*Describe)(PP_Resource image_data, |
184 struct PP_ImageDataDesc* desc); | 187 struct PP_ImageDataDesc* desc); |
185 | 188 |
186 /** | 189 /** |
187 * Map() maps an image data into the module address space. | 190 * Map() maps an image data into the module address space. |
188 * | 191 * |
189 * @param[in] image_data A <code>PP_Resource</code> corresponding to image | 192 * @param[in] image_data A <code>PP_Resource</code> corresponding to image |
190 * data. | 193 * data. |
| 194 * |
191 * @return A pointer to the beginning of the data. | 195 * @return A pointer to the beginning of the data. |
192 */ | 196 */ |
193 void* (*Map)(PP_Resource image_data); | 197 void* (*Map)(PP_Resource image_data); |
194 | 198 |
195 /** | 199 /** |
196 * Unmap is a pointer to a function that unmaps an image data from the module | 200 * Unmap is a pointer to a function that unmaps an image data from the module |
197 * address space. | 201 * address space. |
198 * | 202 * |
199 * @param[in] image_data A <code>PP_Resource</code> corresponding to image | 203 * @param[in] image_data A <code>PP_Resource</code> corresponding to image |
200 * data. | 204 * data. |
201 */ | 205 */ |
202 void (*Unmap)(PP_Resource image_data); | 206 void (*Unmap)(PP_Resource image_data); |
203 }; | 207 }; |
204 /** | 208 /** |
205 * @} | 209 * @} |
206 */ | 210 */ |
207 | 211 |
208 #endif /* PPAPI_C_PPB_IMAGE_DATA_H_ */ | 212 #endif /* PPAPI_C_PPB_IMAGE_DATA_H_ */ |
OLD | NEW |