summaryrefslogtreecommitdiffstats
path: root/ppapi/api/ppb_compositor_layer.idl
diff options
context:
space:
mode:
authormiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 18:57:38 +0000
committermiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 18:57:38 +0000
commitf55c05ea8abc69cb414fa6ce3919f6b9f50ca39a (patch)
tree4ff639f7a4a8d23cae24d4b56d7ccc41678f54a5 /ppapi/api/ppb_compositor_layer.idl
parentc69f87070b21309fc9c0b727b2e1f8ef6f58f61f (diff)
downloadchromium_src-f55c05ea8abc69cb414fa6ce3919f6b9f50ca39a.zip
chromium_src-f55c05ea8abc69cb414fa6ce3919f6b9f50ca39a.tar.gz
chromium_src-f55c05ea8abc69cb414fa6ce3919f6b9f50ca39a.tar.bz2
[PPAPI] API definition for compositor artifacts
API Proposal http://goo.gl/V7xcu3 BUG=374383 R=binji@chromium.org, dmichael@chromium.org, mpearson@chromium.org, piman@chromium.org, raymes@chromium.org, yzshen@chromium.org Review URL: https://codereview.chromium.org/292523003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275490 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/api/ppb_compositor_layer.idl')
-rw-r--r--ppapi/api/ppb_compositor_layer.idl222
1 files changed, 222 insertions, 0 deletions
diff --git a/ppapi/api/ppb_compositor_layer.idl b/ppapi/api/ppb_compositor_layer.idl
new file mode 100644
index 0000000..a457ccc
--- /dev/null
+++ b/ppapi/api/ppb_compositor_layer.idl
@@ -0,0 +1,222 @@
+/* Copyright 2014 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+[generate_thunk]
+
+label Chrome {
+ [channel=dev] M37 = 0.1
+};
+
+/**
+ * This enumeration contains blend modes used for computing the result pixels
+ * based on the source RGBA values in layers with the RGBA values that are
+ * already in the destination framebuffer.
+ * alpha_src, color_src: source alpha and color.
+ * alpha_dst, color_dst: destination alpha and color (before compositing).
+ * Below descriptions of the blend modes assume the colors are pre-multiplied.
+ * This interface is still in development (Dev API status) and may change,
+ * so is only supported on Dev channel and Canary currently.
+ */
+enum PP_BlendMode {
+ /**
+ * No blending, copy source to the destination directly.
+ */
+ PP_BLENDMODE_NONE,
+
+ /**
+ * Source is placed over the destination.
+ * Resulting alpha = alpha_src + alpha_dst - alpha_src * alpha_dst
+ * Resulting color = color_src + color_dst * (1 - alpha_src)
+ */
+ PP_BLENDMODE_SRC_OVER,
+
+ /**
+ * The last blend mode.
+ */
+ PP_BLENDMODE_LAST = PP_BLENDMODE_SRC_OVER
+};
+
+/**
+ * Defines the <code>PPB_CompositorLayer</code> interface. It is used by
+ * <code>PPB_Compositor</code>.
+ */
+interface PPB_CompositorLayer {
+ /**
+ * Determines if a resource is a compositor layer resource.
+ *
+ * @param[in] resource The <code>PP_Resource</code> to test.
+ *
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
+ * resource is a compositor layer resource or <code>PP_FALSE</code>
+ * otherwise.
+ */
+ PP_Bool IsCompositorLayer([in] PP_Resource resource);
+
+ /**
+ * 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 <code>PP_ERROR_BADARGUMENT</code> will be returned.
+ *
+ * param[in] layer A <code>PP_Resource</code> corresponding to a compositor
+ * layer resource.
+ * param[in] red A <code>float</code> for the red color component. It will be
+ * clamped to [0, 1].
+ * param[in] green A <code>float</code> for the green color component. It will
+ * be clamped to [0, 1].
+ * param[in] blue A <code>float</code> for the blue color component. It will
+ * be clamped to [0, 1].
+ * param[in] alpha A <code>float</code> for the alpha color component. It will
+ * be clamped to [0, 1].
+ * param[in] size A <code>PP_Size</code> for the size of the layer before
+ * transform.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t SetColor([in] PP_Resource layer,
+ [in] float_t red,
+ [in] float_t green,
+ [in] float_t blue,
+ [in] float_t alpha,
+ [in] PP_Size size);
+
+ /**
+ * 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 <code>PP_ERROR_BADARGUMENT</code> will be returned.
+ *
+ * param[in] layer A <code>PP_Resource</code> corresponding to a compositor
+ * layer resource.
+ * param[in] context A <code>PP_Resource</code> corresponding to a graphics
+ * 3d resource which owns the GL texture.
+ * param[in] texture A GL texture object id.
+ * param[in] size A <code>PP_Size</code> for the size of the layer before
+ * transform.
+ * param[in] cc A <code>PP_CompletionCallback</code> to be called when
+ * the texture is released by Chromium compositor.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t SetTexture([in] PP_Resource layer,
+ [in] PP_Resource context,
+ [in] uint32_t texture,
+ [in] PP_Size size,
+ [in] 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 <code>PP_ERROR_BADARGUMENT</code>
+ * will be returned.
+ *
+ * param[in] layer A <code>PP_Resource</code> corresponding to a compositor
+ * layer resource.
+ * param[in] image_data A <code>PP_Resource</code> corresponding to
+ * an image data resource.
+ * param[in] size A <code>PP_Size</code> for the size of the layer before
+ * transform. If NULL, the image's size will be used.
+ * param[in] cc A <code>PP_CompletionCallback</code> to be called when
+ * the image data is released by Chromium compositor.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t SetImage([in] PP_Resource layer,
+ [in] PP_Resource image_data,
+ [in] PP_Size size,
+ [in] PP_CompletionCallback cc);
+
+ /**
+ * 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 <code>PP_Resource</code> corresponding to a compositor
+ * layer resource.
+ * param[in] rect The clip rectangle. The origin is top-left corner of
+ * the plugin.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t SetClipRect([in] PP_Resource layer,
+ [in] PP_Rect rect);
+
+ /**
+ * Sets a transform matrix which is used to composite the layer.
+ *
+ * param[in] layer A <code>PP_Resource</code> 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.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t SetTransform([in] PP_Resource layer,
+ [in] float_t[16] matrix);
+
+ /**
+ * 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 <code>PP_Resource</code> corresponding to a compositor
+ * layer resource.
+ * param[in] opacity A <code>float</code> for the opacity value, The default
+ * value is 1.0f.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t SetOpacity([in] PP_Resource layer,
+ [in] float_t opacity);
+
+ /**
+ * Sets the blend mode which is used to composite the layer.
+ *
+ * param[in] layer A <code>PP_Resource</code> corresponding to a compositor
+ * layer resource.
+ * param[in] mode A <code>PP_BlendMode</code>. The default mode is
+ * <code>PP_BLENDMODE_SRC_OVER</code>.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t SetBlendMode([in] PP_Resource layer,
+ [in] PP_BlendMode mode);
+
+ /**
+ * Sets a source rectangle for a texture layer or an image layer.
+ *
+ * param[in] layer A <code>PP_Resource</code> corresponding to a compositor
+ * layer resource.
+ * param[in] rect A <code>PP_FloatRect</code> 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, <code>PP_ERROR_BADARGUMENT</code> will be returned.
+ * If the layer size does not match the source rect size, bilinear scaling
+ * will be used.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t SetSourceRect([in] PP_Resource layer,
+ [in] PP_FloatRect rect);
+
+ /**
+ * Sets the premultiplied alpha for an texture layer.
+ *
+ * param[in] layer A <code>PP_Resource</code> corresponding to a compositor
+ * layer resource.
+ * param[in] premult A <code>PP_Bool</code> with <code>PP_TRUE</code> if
+ * pre-multiplied alpha is used.
+ *
+ * @return An int32_t containing a result code from <code>pp_errors.h</code>.
+ */
+ int32_t SetPremultipliedAlpha([in] PP_Resource layer,
+ [in] PP_Bool premult);
+};