PPB_CompositorLayer Struct Reference

Data Fields

PP_Bool(* IsCompositorLayer )(PP_Resource resource)
int32_t(* SetColor )(PP_Resource layer, float red, float green, float blue, float alpha, const struct PP_Size *size)
int32_t(* SetTexture )(PP_Resource layer, PP_Resource context, uint32_t target, uint32_t texture, const struct PP_Size *size, struct PP_CompletionCallback cc)
int32_t(* SetImage )(PP_Resource layer, PP_Resource image_data, const struct PP_Size *size, struct PP_CompletionCallback cc)
int32_t(* SetClipRect )(PP_Resource layer, const struct PP_Rect *rect)
int32_t(* SetTransform )(PP_Resource layer, const float matrix[16])
int32_t(* SetOpacity )(PP_Resource layer, float opacity)
int32_t(* SetBlendMode )(PP_Resource layer, PP_BlendMode mode)
int32_t(* SetSourceRect )(PP_Resource layer, const struct PP_FloatRect *rect)
int32_t(* SetPremultipliedAlpha )(PP_Resource layer, PP_Bool premult)

Detailed Description

Defines the PPB_CompositorLayer interface.

It is used by PPB_Compositor.


Field Documentation

Determines if a resource is a compositor layer resource.

Parameters:
[in]resourceThe PP_Resource to test.
Returns:
A PP_Bool with PP_TRUE if the given resource is a compositor layer resource or PP_FALSE otherwise.

Sets the blend mode which is used to composite the layer.

param[in] layer A PP_Resource corresponding to a compositor layer resource. param[in] mode A PP_BlendMode. The default mode is PP_BLENDMODE_SRC_OVER.

Returns:
An int32_t containing a result code from pp_errors.h.
int32_t(* PPB_CompositorLayer::SetClipRect)(PP_Resource layer, const struct PP_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] layer A PP_Resource corresponding to a compositor layer resource. 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(* PPB_CompositorLayer::SetColor)(PP_Resource layer, float red, float green, float blue, float alpha, const struct PP_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] layer A PP_Resource corresponding to a compositor layer resource. 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 PP_Size for the size of the layer before transform.

Returns:
An int32_t containing a result code from pp_errors.h.
int32_t(* PPB_CompositorLayer::SetImage)(PP_Resource layer, PP_Resource image_data, const struct PP_Size *size, struct PP_CompletionCallback cc)

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] layer A PP_Resource corresponding to a compositor layer resource. param[in] image_data A PP_Resource corresponding to an image data resource. param[in] size A PP_Size for the size of the layer before transform. If NULL, the image's size will be used. param[in] cc A PP_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(* PPB_CompositorLayer::SetOpacity)(PP_Resource layer, 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] layer A PP_Resource corresponding to a compositor layer resource. 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.

Sets the premultiplied alpha for an texture layer.

param[in] layer A PP_Resource corresponding to a compositor layer resource. param[in] premult A PP_Bool with PP_TRUE if pre-multiplied alpha is used.

Returns:
An int32_t containing a result code from pp_errors.h.
int32_t(* PPB_CompositorLayer::SetSourceRect)(PP_Resource layer, const struct PP_FloatRect *rect)

Sets a source rectangle for a texture layer or an image layer.

param[in] layer A PP_Resource corresponding to a compositor layer resource. param[in] rect A PP_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(* PPB_CompositorLayer::SetTexture)(PP_Resource layer, PP_Resource context, uint32_t target, uint32_t texture, const struct PP_Size *size, struct PP_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] layer A PP_Resource corresponding to a compositor layer resource. param[in] context A PP_Resource 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 PP_Size for the size of the layer before transform. param[in] cc A PP_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(* PPB_CompositorLayer::SetTransform)(PP_Resource layer, const float matrix[16])

Sets a transform matrix which is used to composite the layer.

param[in] layer A PP_Resource corresponding to a compositor layer resource. param[in] matrix A float array with 16 elements. The matrix is column 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 struct was generated from the following file: