summaryrefslogtreecommitdiffstats
path: root/o3d/plugin/idl
diff options
context:
space:
mode:
authoryux@google.com <yux@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 01:07:36 +0000
committeryux@google.com <yux@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 01:07:36 +0000
commit128ff759facb55e3c0c1326e97c00b325ac3f484 (patch)
tree868fda83a815ac414abac1466091faced5bc3eb1 /o3d/plugin/idl
parent267088ffb702c649bfd2c1123f1f9c3f391b69d2 (diff)
downloadchromium_src-128ff759facb55e3c0c1326e97c00b325ac3f484.zip
chromium_src-128ff759facb55e3c0c1326e97c00b325ac3f484.tar.gz
chromium_src-128ff759facb55e3c0c1326e97c00b325ac3f484.tar.bz2
expose bitmap in js.
Review URL: http://codereview.chromium.org/150058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin/idl')
-rw-r--r--o3d/plugin/idl/bitmap.idl92
-rw-r--r--o3d/plugin/idl/pack.idl20
-rw-r--r--o3d/plugin/idl/texture.idl41
3 files changed, 153 insertions, 0 deletions
diff --git a/o3d/plugin/idl/bitmap.idl b/o3d/plugin/idl/bitmap.idl
new file mode 100644
index 0000000..066ca5a
--- /dev/null
+++ b/o3d/plugin/idl/bitmap.idl
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2009, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+namespace o3d {
+
+%[
+Bitmap provides an interface for basic image operations on bitmap,
+including scale and crop. The contents of bitmap can be created from
+RawData via pack.createBitmapFromRawData(), and also can be transfered
+to mip of a Texure2D or a specific face of TextureCUBE via methods
+in Texture.
+%]
+
+[nocpp, include="core/cross/bitmap.h"]
+class Bitmap : ParamObject {
+ %[
+ enum ImageFileType {
+ \li UNKNOWN, Image type unknown.
+ \li TGA, image in TGA format.
+ \li JPEG, image in JPEG format.
+ \li PNG, image in PNG format.
+ \li DDS, image in DDS format.
+ };
+ %]
+ enum ImageFileType {
+ UNKNOWN,
+ TGA,
+ JPEG,
+ PNG,
+ DDS
+ };
+
+ %[
+ Copy pixels from source bitmap. Scales if the width and height of source
+ and dest do not match.
+ \param source_img source bitmap which would be drawn.
+ \param source_x x-coordinate of the starting pixel in the source image.
+ \param source_y y-coordinate of the starting pixel in the source image.
+ \param source_width width of the source image to draw.
+ \param source_height Height of the source image to draw.
+ \param dest_x x-coordinate of the starting pixel in the dest image.
+ \param dest_y y-coordinate of the starting pixel in the dest image.
+ \param dest_width width of the dest image to draw.
+ \param dest_height height of the dest image to draw.
+ %]
+ void DrawImage(Bitmap source_img, int source_x, int source_y,
+ int source_width, int source_height,
+ int dest_x, int dest_y,
+ int dest_width, int dest_height);
+
+ %[
+ The width of the bitmap (read only).
+ %]
+ [getter] int width_;
+
+ %[
+ The height of the bitmap (read only).
+ %]
+ [getter] int height_;
+
+}; // Bitmap
+
+} // namespace o3d
diff --git a/o3d/plugin/idl/pack.idl b/o3d/plugin/idl/pack.idl
index d52424a..0c9cba7 100644
--- a/o3d/plugin/idl/pack.idl
+++ b/o3d/plugin/idl/pack.idl
@@ -116,6 +116,7 @@ typedef ObjectBase[] ObjectArray;
Note: You may omit the 'o3d.'.
\param type_name name of Class to create. Valid type names are:
+ \li o3d.Bitmap
\li o3d.Canvas
\li o3d.CanvasLinearGradient
\li o3d.CanvasPaint
@@ -306,6 +307,25 @@ typedef ObjectBase[] ObjectArray;
%]
Texture? CreateTextureFromRawData(RawData raw_data,
bool generate_mips);
+
+ %[
+ Create a new Bitmap object from RawData.
+
+ \param raw_data contains the bitmap data in one of the know formats.
+ \return the new bitmap object.
+ %]
+ Bitmap? CreateBitmapFromRawData(RawData raw_data);
+
+ %[
+ Create a new Bitmap object of the specified size and format and
+ reserves the necessary resources for it.
+
+ \param width The width of the bitmap in pixel.
+ \param height The height of the bitmap in pixel.
+ \param format The format of the bitmap.
+ \return the new bitmap obejct.
+ %]
+ Bitmap? CreateBitmap(int width, int height, Texture::Format format);
}; // Pack
} // namespace o3d
diff --git a/o3d/plugin/idl/texture.idl b/o3d/plugin/idl/texture.idl
index 014f77e..6207e9f 100644
--- a/o3d/plugin/idl/texture.idl
+++ b/o3d/plugin/idl/texture.idl
@@ -186,6 +186,25 @@ namespace o3d {
int source_width,
float[] values);
+ %[
+ Copy pixels from source bitmap to certain mip level.
+ Scales if the width and height of source and dest do not match.
+
+ \param source_img source bitmap which would be drawn.
+ \param source_x x-coordinate of the starting pixel in the source image.
+ \param source_y y-coordinate of the starting pixel in the source image.
+ \param source_width width of the source image to draw.
+ \param source_height Height of the source image to draw.
+ \param dest_x x-coordinate of the starting pixel in the dest image.
+ \param dest_y y-coordinate of the starting pixel in the dest image.
+ \param dest_width width of the dest image.
+ \param dest_height height of the dest image.
+ \param dest_mip on which mip level the sourceImg would be drawn.
+ %]
+ void DrawImage(Bitmap source_img, int source_x, int source_y,
+ int source_width, int source_height,
+ int dest_x, int dest_y,
+ int dest_width, int dest_height, int dest_mip);
[verbatim=cpp_glue] %{
void SetRectCheck(o3d::Texture2D* self,
@@ -426,6 +445,28 @@ coordinates.
\return The RenderSurface object.
%]
RenderSurface? GetRenderSurface(CubeFace face, int mip_level, Pack pack);
+
+ %[
+ Copy pixels from source bitmap to certain mip level.
+ Scales if the width and height of source and dest do not match.
+
+ \param source_img source bitmap which would be drawn.
+ \param source_x x-coordinate of the starting pixel in the source image.
+ \param source_y y-coordinate of the starting pixel in the source image.
+ \param source_width width of the source image to draw.
+ \param source_height Height of the source image to draw.
+ \param dest_x x-coordinate of the starting pixel in the dest image.
+ \param dest_y y-coordinate of the starting pixel in the dest image.
+ \param dest_width width of the dest image.
+ \param dest_height height of the dest image.
+ \param face on which face the sourceImg would be drawn.
+ \param dest_mip on which mip level the sourceImg would be drawn.
+ %]
+ void DrawImage(Bitmap source_img, int source_x, int source_y,
+ int source_width, int source_height,
+ int dest_x, int dest_y,
+ int dest_width, int dest_height,
+ CubeFace face, int dest_mip);
}; // TextureCUBE
} // namespace o3d