| 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_macros.h" | 10 #include "ppapi/c/pp_macros.h" |
| 10 #include "ppapi/c/pp_module.h" | 11 #include "ppapi/c/pp_module.h" |
| 11 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
| 12 #include "ppapi/c/pp_size.h" | 13 #include "ppapi/c/pp_size.h" |
| 13 #include "ppapi/c/pp_stdint.h" | 14 #include "ppapi/c/pp_stdint.h" |
| 14 | 15 |
| 15 typedef enum { | 16 typedef enum { |
| 16 PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 17 PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
| 17 PP_IMAGEDATAFORMAT_RGBA_PREMUL | 18 PP_IMAGEDATAFORMAT_RGBA_PREMUL |
| 18 } PP_ImageDataFormat; | 19 } PP_ImageDataFormat; |
| 19 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ImageDataFormat, 4); | 20 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ImageDataFormat, 4); |
| 20 | 21 |
| 21 struct PP_ImageDataDesc { | 22 struct PP_ImageDataDesc { |
| 22 PP_ImageDataFormat format; | 23 PP_ImageDataFormat format; |
| 23 | 24 |
| 24 /** Size of the bitmap in pixels. */ | 25 /** Size of the bitmap in pixels. */ |
| 25 struct PP_Size size; | 26 struct PP_Size size; |
| 26 | 27 |
| 27 /** The row width in bytes. This may be different than width * 4 since there | 28 /** The row width in bytes. This may be different than width * 4 since there |
| 28 * may be padding at the end of the lines. | 29 * may be padding at the end of the lines. |
| 29 */ | 30 */ |
| 30 int32_t stride; | 31 int32_t stride; |
| 31 }; | 32 }; |
| 32 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ImageDataDesc, 16); | 33 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ImageDataDesc, 16); |
| 33 | 34 |
| 34 #define PPB_IMAGEDATA_INTERFACE "PPB_ImageData;0.2" | 35 #define PPB_IMAGEDATA_INTERFACE "PPB_ImageData;0.3" |
| 35 | 36 |
| 36 /** | 37 /** |
| 37 * @file | 38 * @file |
| 38 * Defines the API ... | 39 * Defines the API ... |
| 39 * | 40 * |
| 40 * @addtogroup PPB | 41 * @addtogroup PPB |
| 41 * @{ | 42 * @{ |
| 42 */ | 43 */ |
| 43 | 44 |
| 44 struct PPB_ImageData { | 45 struct PPB_ImageData { |
| 45 /** | 46 /** |
| 46 * Returns the browser's preferred format for image data. This format will be | 47 * Returns the browser's preferred format for image data. This format will be |
| 47 * the format is uses internally for painting. Other formats may require | 48 * the format is uses internally for painting. Other formats may require |
| 48 * internal conversions to paint or may have additional restrictions depending | 49 * internal conversions to paint or may have additional restrictions depending |
| 49 * on the function. | 50 * on the function. |
| 50 */ | 51 */ |
| 51 PP_ImageDataFormat (*GetNativeImageDataFormat)(); | 52 PP_ImageDataFormat (*GetNativeImageDataFormat)(); |
| 52 | 53 |
| 53 /** | 54 /** |
| 54 * Returns PP_TRUE if the given image data format is supported by the browser. | 55 * Returns PP_TRUE if the given image data format is supported by the browser. |
| 55 */ | 56 */ |
| 56 PP_Bool (*IsImageDataFormatSupported)(PP_ImageDataFormat format); | 57 PP_Bool (*IsImageDataFormatSupported)(PP_ImageDataFormat format); |
| 57 | 58 |
| 58 /** | 59 /** |
| 59 * Allocates an image data resource with the given format and size. The | 60 * Allocates an image data resource with the given format and size. The |
| 60 * return value will have a nonzero ID on success, or zero on failure. | 61 * return value will have a nonzero ID on success, or zero on failure. |
| 61 * Failure means the module handle, image size, or format was invalid. | 62 * Failure means the instance, image size, or format was invalid. |
| 62 * | 63 * |
| 63 * Set the init_to_zero flag if you want the bitmap initialized to | 64 * Set the init_to_zero flag if you want the bitmap initialized to |
| 64 * transparent during the creation process. If this flag is not set, the | 65 * transparent during the creation process. If this flag is not set, the |
| 65 * current contents of the bitmap will be undefined, and the plugin should | 66 * current contents of the bitmap will be undefined, and the plugin should |
| 66 * be sure to set all the pixels. | 67 * be sure to set all the pixels. |
| 67 * | 68 * |
| 68 * For security reasons, if uninitialized, the bitmap will not contain random | 69 * For security reasons, if uninitialized, the bitmap will not contain random |
| 69 * memory, but may contain data from a previous image produced by the same | 70 * memory, but may contain data from a previous image produced by the same |
| 70 * plugin if the bitmap was cached and re-used. | 71 * plugin if the bitmap was cached and re-used. |
| 71 */ | 72 */ |
| 72 PP_Resource (*Create)(PP_Module module, | 73 PP_Resource (*Create)(PP_Instance instance, |
| 73 PP_ImageDataFormat format, | 74 PP_ImageDataFormat format, |
| 74 const struct PP_Size* size, | 75 const struct PP_Size* size, |
| 75 PP_Bool init_to_zero); | 76 PP_Bool init_to_zero); |
| 76 | 77 |
| 77 /** | 78 /** |
| 78 * Returns PP_TRUE if the given resource is an image data. Returns PP_FALSE if | 79 * Returns PP_TRUE if the given resource is an image data. Returns PP_FALSE if |
| 79 * the resource is invalid or some type other than an image data. | 80 * the resource is invalid or some type other than an image data. |
| 80 */ | 81 */ |
| 81 PP_Bool (*IsImageData)(PP_Resource image_data); | 82 PP_Bool (*IsImageData)(PP_Resource image_data); |
| 82 | 83 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 96 | 97 |
| 97 void (*Unmap)(PP_Resource image_data); | 98 void (*Unmap)(PP_Resource image_data); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 /** | 101 /** |
| 101 * @} | 102 * @} |
| 102 * End addtogroup PPB | 103 * End addtogroup PPB |
| 103 */ | 104 */ |
| 104 #endif /* PPAPI_C_PPB_IMAGE_DATA_H_ */ | 105 #endif /* PPAPI_C_PPB_IMAGE_DATA_H_ */ |
| 105 | 106 |
| OLD | NEW |