Public Member Functions
CompositorLayer () | |
CompositorLayer (const CompositorLayer &other) | |
CompositorLayer (const Resource &resource) | |
CompositorLayer (PassRef, PP_Resource resource) | |
~CompositorLayer () | |
int32_t | SetColor (float red, float green, float blue, float alpha, const Size &size) |
int32_t | SetTexture (const Graphics3D &context, uint32_t target, uint32_t texture, const Size &size, const CompletionCallback &cc) |
int32_t | SetImage (const ImageData &image, const CompletionCallback &callback) |
int32_t | SetImage (const ImageData &image, const Size &size, const CompletionCallback &callback) |
int32_t | SetClipRect (const Rect &rect) |
int32_t | SetTransform (const float matrix[16]) |
int32_t | SetOpacity (float opacity) |
int32_t | SetBlendMode (PP_BlendMode mode) |
int32_t | SetSourceRect (const FloatRect &rect) |
int32_t | SetPremultipliedAlpha (bool premult) |
Static Public Member Functions
static bool | IsCompositorLayer (const Resource &resource) |
Constructor & Destructor Documentation
Default constructor for creating an is_null() CompositorLayer
object.
pp::CompositorLayer::CompositorLayer | ( | const CompositorLayer & | other | ) |
The copy constructor for CompositorLayer
.
- Parameters:
[in] other A reference to a CompositorLayer
.
pp::CompositorLayer::CompositorLayer | ( | const Resource & | resource | ) | [explicit] |
Constructs a CompositorLayer
from a Resource
.
- Parameters:
[in] resource A PPB_CompositorLayer
resource.
pp::CompositorLayer::CompositorLayer | ( | PassRef | , |
PP_Resource | resource | ||
) |
A constructor used when you have received a PP_Resource
as a return value that has had 1 ref added for you.
- Parameters:
[in] resource A PPB_CompositorLayer
resource.
Destructor.
Member Function Documentation
static bool pp::CompositorLayer::IsCompositorLayer | ( | const Resource & | resource | ) | [static] |
Checks whether a Resource
is a compositor layer, to test whether it is appropriate for use with the CompositorLayer
constructor.
- Parameters:
[in] resource A Resource
to test.
- Returns:
- True if
resource
is a compositor layer.
int32_t pp::CompositorLayer::SetBlendMode | ( | PP_BlendMode | mode | ) |
Sets the blend mode which is used to composite the layer.
param[in] mode A PP_BlendMode
. The default value is PP_BLENDMODE_SRC_OVER
.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
int32_t pp::CompositorLayer::SetClipRect | ( | const Rect & | rect | ) |
Sets a clip rectangle for a compositor layer.
The Chromium compositor applies a transform matrix on the layer first, and then clips the layer with the rectangle.
param[in] rect The clip rectangle. The origin is top-left corner of the plugin.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
int32_t pp::CompositorLayer::SetColor | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha, | ||
const Size & | size | ||
) |
Sets the color of a solid color layer.
If the layer is uninitialized, it will initialize the layer first, and then set its color. If the layer has been initialized to another kind of layer, the layer will not be changed, and PP_ERROR_BADARGUMENT
will be returned.
param[in] red A float
for the red color component. It will be clamped to [0, 1] param[in] green A float
for the green color component. It will be clamped to [0, 1]. param[in] blue A float
for the blue color component. It will be clamped to [0, 1]. param[in] alpha A float
for the alpha color component. It will be clamped to [0, 1]. param[in] size A Size
for the size of the layer before transform.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
int32_t pp::CompositorLayer::SetImage | ( | const ImageData & | image, |
const CompletionCallback & | callback | ||
) |
Sets the image of an image layer.
If the layer is uninitialized, it will initiliaze the layer first, and then set the image of it. If the layer has been initialized to another kind of layer, the layer will not be changed, and PP_ERROR_BADARGUMENT
will be returned.
param[in] image_data A PP_Resource
corresponding to an image data resource. param[in] cc A CompletionCallback
to be called when the image data is released by Chromium compositor.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
int32_t pp::CompositorLayer::SetImage | ( | const ImageData & | image, |
const Size & | size, | ||
const CompletionCallback & | callback | ||
) |
Sets the image of an image layer.
If the layer is uninitialized, it will initialize the layer first, and then set its image. The layer size will be set to the image's size. The source rect will be set to the full image. If the layer has been initialized to another kind of layer, the layer will not be changed, and PP_ERROR_BADARGUMENT
will be returned.
param[in] image_data A ImageData
corresponding to an image data resource. param[in] size A Size
for the size of the layer before transform. param[in] cc A CompletionCallback
to be called when the image data is released by Chromium compositor.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
int32_t pp::CompositorLayer::SetOpacity | ( | float | opacity | ) |
Sets the opacity value which will be applied to the layer.
The effective value of each pixel is computed as:
if (premult_alpha) pixel.rgb = pixel.rgb * opacity; pixel.a = pixel.a * opactiy;
param[in] opacity A float
for the opacity value. The default value is 1.0f.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
int32_t pp::CompositorLayer::SetPremultipliedAlpha | ( | bool | premult | ) |
Sets the premultiplied alpha for an texture layer.
param[in] premult A bool
with true
if pre-multiplied alpha is used.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
int32_t pp::CompositorLayer::SetSourceRect | ( | const FloatRect & | rect | ) |
Sets a source rectangle for a texture layer or an image layer.
param[in] rect A FloatRect
for an area of the source to consider. For a texture layer, rect is in uv coordinates. For an image layer, rect is in pixels. If the rect is beyond the dimensions of the texture or image, PP_ERROR_BADARGUMENT
will be returned. If the layer size does not match the source rect size, bilinear scaling will be used.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
int32_t pp::CompositorLayer::SetTexture | ( | const Graphics3D & | context, |
uint32_t | target, | ||
uint32_t | texture, | ||
const Size & | size, | ||
const CompletionCallback & | cc | ||
) |
Sets the texture of a texture layer.
If the layer is uninitialized, it will initialize the layer first, and then set its texture. The source rect will be set to ((0, 0), (1, 1)). If the layer has been initialized to another kind of layer, the layer will not be changed, and PP_ERROR_BADARGUMENT
will be returned.
param[in] context A Graphics3D
corresponding to a graphics 3d resource which owns the GL texture. param[in] target GL texture target (GL_TEXTURE_2D, etc). param[in] texture A GL texture object id. param[in] size A Size
for the size of the layer before transform. param[in] cc A CompletionCallback
to be called when the texture is released by Chromium compositor.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
int32_t pp::CompositorLayer::SetTransform | ( | const float | matrix[16] | ) |
Sets a transform matrix which is used to composite the layer.
param[in] matrix A float array with 16 elements. The matrix is coloum major. The default transform matrix is an identity matrix.
- Returns:
- An int32_t containing a result code from
pp_errors.h
.
The documentation for this class was generated from the following file: