1f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin/*
2f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin * Copyright (C) 2010 The Android Open Source Project
3f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin *
4f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin * Licensed under the Apache License, Version 2.0 (the "License");
5f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin * you may not use this file except in compliance with the License.
6f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin * You may obtain a copy of the License at
7f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin *
8f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin *      http://www.apache.org/licenses/LICENSE-2.0
9f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin *
10f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin * Unless required by applicable law or agreed to in writing, software
11f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin * distributed under the License is distributed on an "AS IS" BASIS,
12f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin * See the License for the specific language governing permissions and
14f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin * limitations under the License.
15f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin */
16f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
17a4eae1abb4f2547dfbda84301ee764ce35464881John Reckpackage com.android.gallery3d.glrenderer;
18f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
197da54d7e41e04ea5122009b40de19be0724e1ca4George Mountimport android.graphics.Bitmap;
2064072a071151b55fcbf97f6204d3c2258db386faGeorge Mountimport android.graphics.Rect;
21f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Linimport android.graphics.RectF;
22f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
23bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mountimport javax.microedition.khronos.opengles.GL11;
24bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount
25f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin//
26f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin// GLCanvas gives a convenient interface to draw using OpenGL.
27f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin//
28f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin// When a rectangle is specified in this interface, it means the region
29f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin// [x, x+width) * [y, y+height)
30f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin//
3150b33abe053ccab7be3d1bca2328e792507963d4George Mountpublic interface GLCanvas {
327da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
3350b33abe053ccab7be3d1bca2328e792507963d4George Mount    public GLId getGLId();
346eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount
35f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Tells GLCanvas the size of the underlying GL surface. This should be
36f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // called before first drawing and when the size of GL surface is changed.
37f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // This is called by GLRoot and should not be called by the clients
38f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // who only want to draw on the GLCanvas. Both width and height must be
39f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // nonnegative.
40bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void setSize(int width, int height);
41f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
42f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Clear the drawing buffers. This should only be used by GLRoot.
43bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void clearBuffer();
447da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
45bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void clearBuffer(float[] argb);
46f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
47f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Sets and gets the current alpha, alpha must be in [0, 1].
48bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void setAlpha(float alpha);
497da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
50bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract float getAlpha();
51f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
52f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // (current alpha) = (current alpha) * alpha
53bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void multiplyAlpha(float alpha);
54f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
55f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Change the current transform matrix.
56bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void translate(float x, float y, float z);
577da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
58bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void translate(float x, float y);
597da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
60bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void scale(float sx, float sy, float sz);
617da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
62bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void rotate(float angle, float x, float y, float z);
637da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
64bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void multiplyMatrix(float[] mMatrix, int offset);
65f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
667b83fb8e3a8978b33a6b9bfc56d85fe2c1a9cf06Chih-Chung Chang    // Pushes the configuration state (matrix, and alpha) onto
67f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // a private stack.
68bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void save();
69f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
70f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Same as save(), but only save those specified in saveFlags.
71bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void save(int saveFlags);
72f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
73f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    public static final int SAVE_FLAG_ALL = 0xFFFFFFFF;
747b83fb8e3a8978b33a6b9bfc56d85fe2c1a9cf06Chih-Chung Chang    public static final int SAVE_FLAG_ALPHA = 0x01;
757b83fb8e3a8978b33a6b9bfc56d85fe2c1a9cf06Chih-Chung Chang    public static final int SAVE_FLAG_MATRIX = 0x02;
76f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
77f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Pops from the top of the stack as current configuration state (matrix,
78f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // alpha, and clip). This call balances a previous call to save(), and is
79f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // used to remove all modifications to the configuration state since the
80f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // last save call.
81bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void restore();
82f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
83f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Draws a line using the specified paint from (x1, y1) to (x2, y2).
84f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // (Both end points are included).
85bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void drawLine(float x1, float y1, float x2, float y2, GLPaint paint);
86f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
87f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Draws a rectangle using the specified paint from (x1, y1) to (x2, y2).
88f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // (Both end points are included).
89bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void drawRect(float x1, float y1, float x2, float y2, GLPaint paint);
90f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
91f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Fills the specified rectangle with the specified color.
92bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void fillRect(float x, float y, float width, float height, int color);
93f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
94f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Draws a texture to the specified rectangle.
95bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void drawTexture(
96bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount            BasicTexture texture, int x, int y, int width, int height);
977da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
98bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void drawMesh(BasicTexture tex, int x, int y, int xyBuffer,
99f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin            int uvBuffer, int indexBuffer, int indexCount);
100f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
101b29a27f475a2c449abdda8d4e03d30914feed8c6Chih-Chung Chang    // Draws the source rectangle part of the texture to the target rectangle.
102bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void drawTexture(BasicTexture texture, RectF source, RectF target);
103f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
104b29a27f475a2c449abdda8d4e03d30914feed8c6Chih-Chung Chang    // Draw a texture with a specified texture transform.
105bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void drawTexture(BasicTexture texture, float[] mTextureTransform,
106b29a27f475a2c449abdda8d4e03d30914feed8c6Chih-Chung Chang                int x, int y, int w, int h);
107b29a27f475a2c449abdda8d4e03d30914feed8c6Chih-Chung Chang
108f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Draw two textures to the specified rectangle. The actual texture used is
109f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // from * (1 - ratio) + to * ratio
110f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // The two textures must have the same size.
111bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void drawMixed(BasicTexture from, int toColor,
112f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin            float ratio, int x, int y, int w, int h);
113f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
114a8f3473271cb4bfc5b47f520402bad7cddb5d3e8Owen Lin    // Draw a region of a texture and a specified color to the specified
115a8f3473271cb4bfc5b47f520402bad7cddb5d3e8Owen Lin    // rectangle. The actual color used is from * (1 - ratio) + to * ratio.
116a8f3473271cb4bfc5b47f520402bad7cddb5d3e8Owen Lin    // The region of the texture is defined by parameter "src". The target
117a8f3473271cb4bfc5b47f520402bad7cddb5d3e8Owen Lin    // rectangle is specified by parameter "target".
118bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void drawMixed(BasicTexture from, int toColor,
119a8f3473271cb4bfc5b47f520402bad7cddb5d3e8Owen Lin            float ratio, RectF src, RectF target);
120a8f3473271cb4bfc5b47f520402bad7cddb5d3e8Owen Lin
121f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Unloads the specified texture from the canvas. The resource allocated
122f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // to draw the texture will be released. The specified texture will return
123f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // to the unloaded state. This function should be called only from
124f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // BasicTexture or its descendant
125bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract boolean unloadTexture(BasicTexture texture);
126f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
127f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Delete the specified buffer object, similar to unloadTexture.
128bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void deleteBuffer(int bufferId);
129f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
130f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // Delete the textures and buffers in GL side. This function should only be
131f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin    // called in the GL thread.
132bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void deleteRecycledResources();
133f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin
1347b83fb8e3a8978b33a6b9bfc56d85fe2c1a9cf06Chih-Chung Chang    // Dump statistics information and clear the counters. For debug only.
135bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void dumpStatisticsAndClear();
1367da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
137bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void beginRenderTarget(RawTexture texture);
1387da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
139bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void endRenderTarget();
1407da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
1417da54d7e41e04ea5122009b40de19be0724e1ca4George Mount    /**
1427da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * Sets texture parameters to use GL_CLAMP_TO_EDGE for both
1437da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T. Sets texture parameters to be
1447da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * GL_LINEAR for GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER.
1457da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * bindTexture() must be called prior to this.
1467da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     *
1477da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param texture The texture to set parameters on.
1487da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     */
149bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void setTextureParameters(BasicTexture texture);
1507da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
1517da54d7e41e04ea5122009b40de19be0724e1ca4George Mount    /**
1527da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * Initializes the texture to a size by calling texImage2D on it.
1537da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     *
1547da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param texture The texture to initialize the size.
1557da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param format The texture format (e.g. GL_RGBA)
1567da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param type The texture type (e.g. GL_UNSIGNED_BYTE)
1577da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     */
158bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void initializeTextureSize(BasicTexture texture, int format, int type);
1597da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
1607da54d7e41e04ea5122009b40de19be0724e1ca4George Mount    /**
1617da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * Initializes the texture to a size by calling texImage2D on it.
1627da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     *
1637da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param texture The texture to initialize the size.
1647da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param bitmap The bitmap to initialize the bitmap with.
1657da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     */
166bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void initializeTexture(BasicTexture texture, Bitmap bitmap);
1677da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
1687da54d7e41e04ea5122009b40de19be0724e1ca4George Mount    /**
1697da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * Calls glTexSubImage2D to upload a bitmap to the texture.
1707da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     *
1717da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param texture The target texture to write to.
1727da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param xOffset Specifies a texel offset in the x direction within the
1737da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     *            texture array.
1747da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param yOffset Specifies a texel offset in the y direction within the
1757da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     *            texture array.
1767da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param format The texture format (e.g. GL_RGBA)
1777da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * @param type The texture type (e.g. GL_UNSIGNED_BYTE)
1787da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     */
179bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void texSubImage2D(BasicTexture texture, int xOffset, int yOffset,
180bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount            Bitmap bitmap,
1817da54d7e41e04ea5122009b40de19be0724e1ca4George Mount            int format, int type);
1827da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
1837da54d7e41e04ea5122009b40de19be0724e1ca4George Mount    /**
1847da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     * Generates buffers and uploads the buffer data.
1857da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     *
1866eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount     * @param buffer The buffer to upload
1876eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount     * @return The buffer ID that was generated.
1886eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount     */
189bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract int uploadBuffer(java.nio.FloatBuffer buffer);
1906eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount
1916eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount    /**
1926eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount     * Generates buffers and uploads the element array buffer data.
1936eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount     *
1946eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount     * @param buffer The buffer to upload
1956eb33768a15e2b4cc647bc55474568cf710876dbGeorge Mount     * @return The buffer ID that was generated.
1967da54d7e41e04ea5122009b40de19be0724e1ca4George Mount     */
197bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract int uploadBuffer(java.nio.ByteBuffer buffer);
1987da54d7e41e04ea5122009b40de19be0724e1ca4George Mount
1997da54d7e41e04ea5122009b40de19be0724e1ca4George Mount    /**
20064072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * After LightCycle makes GL calls, this method is called to restore the GL
20164072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * configuration to the one expected by GLCanvas.
20264072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     */
203bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void recoverFromLightCycle();
20464072a071151b55fcbf97f6204d3c2258db386faGeorge Mount
20564072a071151b55fcbf97f6204d3c2258db386faGeorge Mount    /**
20664072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * Gets the bounds given by x, y, width, and height as well as the internal
20764072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * matrix state. There is no special handling for non-90-degree rotations.
20864072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * It only considers the lower-left and upper-right corners as the bounds.
20964072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     *
21064072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * @param bounds The output bounds to write to.
21164072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * @param x The left side of the input rectangle.
21264072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * @param y The bottom of the input rectangle.
21364072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * @param width The width of the input rectangle.
21464072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     * @param height The height of the input rectangle.
21564072a071151b55fcbf97f6204d3c2258db386faGeorge Mount     */
216bdb71cc6acbd78d5aa02d2e142b792247fb6e0bdGeorge Mount    public abstract void getBounds(Rect bounds, int x, int y, int width, int height);
217f9a0a4306d589b4a4e20554fed512a603426bfa1Owen Lin}
218