Native Client

pp::ImageData Class Reference

Inheritance diagram for pp::ImageData:

List of all members.

Public Functions

 ImageData ()
 ImageData (PassRef, PP_Resource resource)
 ImageData (const ImageData &other)
 ImageData (const InstanceHandle &instance, PP_ImageDataFormat format, const Size &size, bool init_to_zero)
ImageDataoperator= (const ImageData &other)
PP_ImageDataFormat format () const
pp::Size size () const
int32_t stride () const
void * data () const
const uint32_t * GetAddr32 (const Point &coord) const
uint32_t * GetAddr32 (const Point &coord)

Static Public Member Functions

static bool IsImageDataFormatSupported (PP_ImageDataFormat format)
static PP_ImageDataFormat GetNativeImageDataFormat ()

Constructor and Destructor Details

pp::ImageData::ImageData ( )

Default constructor for creating an is_null() ImageData object.

pp::ImageData::ImageData ( PassRef  ,
PP_Resource  resource 
)

A constructor used when you have received a PP_Resource as a return value that has already been reference counted.

Parameters:
[in]resourceA PP_Resource corresponding to image data.
pp::ImageData::ImageData ( const ImageData other)

The copy constructor for ImageData.

This constructor produces an ImageData object that shares the underlying Image resource with other.

Parameters:
[in]otherA pointer to an image data.
pp::ImageData::ImageData ( const InstanceHandle instance,
PP_ImageDataFormat  format,
const Size size,
bool  init_to_zero 
)

A constructor that allocates a new ImageData in the browser with the provided parameters.

The resulting object will be is_null() if the allocation failed.

Parameters:
[in]instanceThe instance with which this resource will be associated.
[in]formatA PP_ImageDataFormat containing desired image format. PP_ImageDataFormat is an enumeration of the different types of image data formats. Refer to ppb_image_data.h for further information.
[in]sizeA pointer to a Size containing the image size.
[in]init_to_zeroA bool used to determine transparency at creation. Set the init_to_zero flag if you want the bitmap initialized to transparent during the creation process. If this flag is not set, the current contents of the bitmap will be undefined, and the module should be sure to set all the pixels.

Function Details

void* pp::ImageData::data ( ) const [inline]

A getter function for returning a raw pointer to the image pixels.

Returns:
A raw pointer to the image pixels.
PP_ImageDataFormat pp::ImageData::format ( ) const [inline]

A getter function for returning the current format for images.

Returns:
PP_ImageDataFormat containing the preferred format.
const uint32_t* pp::ImageData::GetAddr32 ( const Point coord) const

This function is used retrieve the address of the given pixel for 32-bit pixel formats.

Parameters:
[in]coordA Point representing the x and y coordinates for a specific pixel.
Returns:
The address for the pixel.
uint32_t* pp::ImageData::GetAddr32 ( const Point coord)

This function is used retrieve the address of the given pixel for 32-bit pixel formats.

Parameters:
[in]coordA Point representing the x and y coordinates for a specific pixel.
Returns:
The address for the pixel.
static PP_ImageDataFormat pp::ImageData::GetNativeImageDataFormat ( ) [static]

GetNativeImageDataFormat() determines the browser's preferred format for images.

Using this format guarantees no extra conversions will occur when painting.

Returns:
PP_ImageDataFormat containing the preferred format.
static bool pp::ImageData::IsImageDataFormatSupported ( PP_ImageDataFormat  format) [static]

IsImageDataFormatSupported() returns true if the supplied format is supported by the browser.

Note: PP_IMAGEDATAFORMAT_BGRA_PREMUL and PP_IMAGEDATAFORMAT_RGBA_PREMUL formats are always supported. Other image formats do not make this guarantee, and should be checked first with IsImageDataFormatSupported() before using.

Parameters:
[in]formatImage data format.
Returns:
true if the format is supported by the browser.
ImageData& pp::ImageData::operator= ( const ImageData other)

This function decrements the reference count of this ImageData and increments the reference count of the other ImageData.

This ImageData shares the underlying image resource with other.

Parameters:
[in]otherAn other image data.
Returns:
A new image data context.
pp::Size pp::ImageData::size ( ) const [inline]

A getter function for returning the image size.

Returns:
The image size in pixels.
int32_t pp::ImageData::stride ( ) const [inline]

A getter function for returning the row width in bytes.

Returns:
The row width in bytes.

The documentation for this class was generated from the following file:

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.