/* Copyright 2012 The Chromium Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* From ppb_image_data.idl modified Tue Nov 13 08:48:25 2012. */ #ifndef PPAPI_C_PPB_IMAGE_DATA_H_ #define PPAPI_C_PPB_IMAGE_DATA_H_ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_size.h" #include "ppapi/c/pp_stdint.h" #define PPB_IMAGEDATA_INTERFACE_1_0 … #define PPB_IMAGEDATA_INTERFACE … /** * @file * This file defines the <code>PPB_ImageData</code> struct for determining how * a browser handles image data. */ /** * @addtogroup Enums * @{ */ /** * <code>PP_ImageDataFormat</code> is an enumeration of the different types of * image data formats. * * The third part of each enumeration value describes the memory layout from * the lowest address to the highest. For example, BGRA means the B component * is stored in the lowest address, no matter what endianness the platform is * using. * * The PREMUL suffix implies pre-multiplied alpha is used. In this mode, the * red, green and blue color components of the pixel data supplied to an image * data should be pre-multiplied by their alpha value. For example: starting * with floating point color components, here is how to convert them to 8-bit * premultiplied components for image data: * * ...components of a pixel, floats ranging from 0 to 1... * <code>float red = 1.0f;</code> * <code>float green = 0.50f;</code> * <code>float blue = 0.0f;</code> * <code>float alpha = 0.75f;</code> * ...components for image data are 8-bit values ranging from 0 to 255... * <code>uint8_t image_data_red_premul = (uint8_t)(red * alpha * 255.0f); * </code> * <code>uint8_t image_data_green_premul = (uint8_t)(green * alpha * 255.0f); * </code> * <code>uint8_t image_data_blue_premul = (uint8_t)(blue * alpha * 255.0f); * </code> * <code>uint8_t image_data_alpha_premul = (uint8_t)(alpha * 255.0f);</code> * * <strong>Note:</strong> The resulting pre-multiplied red, green and blue * components should not be greater than the alpha value. */ PP_ImageDataFormat; PP_COMPILE_ASSERT_SIZE_IN_BYTES(…); /** * @} */ /** * @addtogroup Structs * @{ */ /** * The <code>PP_ImageDataDesc</code> structure represents a description of * image data. */ struct PP_ImageDataDesc { … }; PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(…); /** * @} */ /** * @addtogroup Interfaces * @{ */ /** * The <code>PPB_ImageData</code> interface contains pointers to several * functions for determining the browser's treatment of image data. */ struct PPB_ImageData_1_0 { … }; PPB_ImageData; /** * @} */ #endif /* PPAPI_C_PPB_IMAGE_DATA_H_ */