summaryrefslogtreecommitdiffstats
path: root/ppapi/api/ppb_image_data.idl
diff options
context:
space:
mode:
authorneb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-30 17:37:54 +0000
committerneb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-30 17:37:54 +0000
commit2272ed3505a36c7d1543f24b770ea85dcfee8640 (patch)
tree91bc7c2235c7d07b65f16e2b78f49382d863fb0b /ppapi/api/ppb_image_data.idl
parentf917b80b0878fe92ca856696af2dc47a0f5e1c55 (diff)
downloadchromium_src-2272ed3505a36c7d1543f24b770ea85dcfee8640.zip
chromium_src-2272ed3505a36c7d1543f24b770ea85dcfee8640.tar.gz
chromium_src-2272ed3505a36c7d1543f24b770ea85dcfee8640.tar.bz2
IDL version of PPAPI interfaces.
BUG=none TEST=none yet... soon. Review URL: http://codereview.chromium.org/6726041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79857 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/api/ppb_image_data.idl')
-rw-r--r--ppapi/api/ppb_image_data.idl86
1 files changed, 86 insertions, 0 deletions
diff --git a/ppapi/api/ppb_image_data.idl b/ppapi/api/ppb_image_data.idl
new file mode 100644
index 0000000..aa3cbd0
--- /dev/null
+++ b/ppapi/api/ppb_image_data.idl
@@ -0,0 +1,86 @@
+/* Copyright (c) 2011 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.
+ */
+
+/* Defines the image data API. */
+
+/* Bitmap formats. */
+enum PP_ImageDataFormat {
+ /* 32 bits, BGRA byte order, premultiplied alpha */
+ PP_IMAGEDATAFORMAT_BGRA_PREMUL = 0,
+ /* 32 bits, RGBA byte order, premultiplied alpha */
+ PP_IMAGEDATAFORMAT_RGBA_PREMUL = 1
+};
+
+/* Description of a bitmap. */
+struct PP_ImageDataDesc {
+ /* Byte format. */
+ PP_ImageDataFormat format;
+
+ /* Size of the bitmap in pixels. */
+ PP_Size size;
+
+ /* The row width in bytes. This may be different than width * 4 since there
+ * may be padding at the end of the lines.
+ */
+ int32_t stride;
+};
+
+/* Interface for manipulating 2D bitmaps. */
+interface PPB_ImageData_0_3 {
+ /* Returns the browser's preferred format for image data. This format will be
+ * the format is uses internally for painting. Other formats may require
+ * internal conversions to paint or may have additional restrictions depending
+ * on the function.
+ */
+ PP_ImageDataFormat GetNativeImageDataFormat();
+
+ /* Returns PP_TRUE if the given image data format is supported by the browser.
+ */
+ PP_Bool IsImageDataFormatSupported(
+ [in] PP_ImageDataFormat format);
+
+ /* Allocates an image data resource with the given format and size. The
+ * return value will have a nonzero ID on success, or zero on failure.
+ * Failure means the instance, image size, or format was invalid.
+ *
+ * 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 plugin should
+ * be sure to set all the pixels.
+ *
+ * For security reasons, if uninitialized, the bitmap will not contain random
+ * memory, but may contain data from a previous image produced by the same
+ * plugin if the bitmap was cached and re-used.
+ */
+ PP_Resource Create(
+ [in] PP_Instance instance,
+ [in] PP_ImageDataFormat format,
+ [in] PP_Size size,
+ [in] PP_Bool init_to_zero);
+
+ /* Returns PP_TRUE if the given resource is an image data. Returns PP_FALSE if
+ * the resource is invalid or some type other than an image data.
+ */
+ PP_Bool IsImageData(
+ [in] PP_Resource image_data);
+
+ /* Computes the description of the image data. Returns PP_TRUE on success,
+ * PP_FALSE if the resource is not an image data. On PP_FALSE, the |desc|
+ * structure will be filled with 0.
+ */
+ PP_Bool Describe(
+ [in] PP_Resource image_data,
+ [out] PP_ImageDataDesc desc);
+
+ /* Maps this bitmap into the plugin address space and returns a pointer to the
+ * beginning of the data.
+ */
+ mem_t Map(
+ [in] PP_Resource image_data);
+
+ /* Unmaps this bitmaps from the plugin address space */
+ void Unmap(
+ [in] PP_Resource image_data);
+};