RenderNode.java revision 0645128b80621edee70f8cab4afb208fe0c26bec
1f666ad7046c0b1b255835f75aeb7d1391067df93John Reck/* 2f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Copyright (C) 2010 The Android Open Source Project 3f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 4f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Licensed under the Apache License, Version 2.0 (the "License"); 5f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * you may not use this file except in compliance with the License. 6f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * You may obtain a copy of the License at 7f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 8f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * http://www.apache.org/licenses/LICENSE-2.0 9f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 10f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Unless required by applicable law or agreed to in writing, software 11f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * distributed under the License is distributed on an "AS IS" BASIS, 12f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * See the License for the specific language governing permissions and 14f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * limitations under the License. 15f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 16f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 17f666ad7046c0b1b255835f75aeb7d1391067df93John Reckpackage android.view; 18f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 1949e6c73913e9bee58ea5e3984be151ee8e033163Chris Craikimport android.annotation.NonNull; 20f666ad7046c0b1b255835f75aeb7d1391067df93John Reckimport android.graphics.Matrix; 21b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craikimport android.graphics.Outline; 2225fbb3fa1138675379102a44405852555cefccbdJohn Reckimport android.graphics.Paint; 23f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 24f666ad7046c0b1b255835f75aeb7d1391067df93John Reck/** 25f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>A display list records a series of graphics related operations and can replay 26f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * them later. Display lists are usually built by recording operations on a 27f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * {@link HardwareCanvas}. Replaying the operations from a display list avoids 28f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * executing application code on every frame, and is thus much more efficient.</p> 29f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 30f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>Display lists are used internally for all views by default, and are not 31f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * typically used directly. One reason to consider using a display is a custom 32f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * {@link View} implementation that needs to issue a large number of drawing commands. 33f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * When the view invalidates, all the drawing commands must be reissued, even if 34f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * large portions of the drawing command stream stay the same frame to frame, which 35f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * can become a performance bottleneck. To solve this issue, a custom View might split 36f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * its content into several display lists. A display list is updated only when its 37f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * content, and only its content, needs to be updated.</p> 38f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 39f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>A text editor might for instance store each paragraph into its own display list. 40f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Thus when the user inserts or removes characters, only the display list of the 41f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * affected paragraph needs to be recorded again.</p> 42f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 43f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Hardware acceleration</h3> 44f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>Display lists can only be replayed using a {@link HardwareCanvas}. They are not 45f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * supported in software. Always make sure that the {@link android.graphics.Canvas} 46f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * you are using to render a display list is hardware accelerated using 47f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * {@link android.graphics.Canvas#isHardwareAccelerated()}.</p> 48f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 49f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Creating a display list</h3> 50f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <pre class="prettyprint"> 51f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * HardwareRenderer renderer = myView.getHardwareRenderer(); 52f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * if (renderer != null) { 53f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * DisplayList displayList = renderer.createDisplayList(); 54f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * HardwareCanvas canvas = displayList.start(width, height); 55f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * try { 56f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * // Draw onto the canvas 57f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * // For instance: canvas.drawBitmap(...); 58f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } finally { 59f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * displayList.end(); 60f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 61f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 62f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * </pre> 63f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 64f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Rendering a display list on a View</h3> 65f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <pre class="prettyprint"> 66f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * protected void onDraw(Canvas canvas) { 67f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * if (canvas.isHardwareAccelerated()) { 68f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * HardwareCanvas hardwareCanvas = (HardwareCanvas) canvas; 69f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * hardwareCanvas.drawDisplayList(mDisplayList); 70f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 71f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 72f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * </pre> 73f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 74f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Releasing resources</h3> 75f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>This step is not mandatory but recommended if you want to release resources 76f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * held by a display list as soon as possible.</p> 77f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <pre class="prettyprint"> 78f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * // Mark this display list invalid, it cannot be used for drawing anymore, 79f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * // and release resources held by this display list 80f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * displayList.clear(); 81f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * </pre> 82f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 83f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Properties</h3> 84f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>In addition, a display list offers several properties, such as 85f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * {@link #setScaleX(float)} or {@link #setLeft(int)}, that can be used to affect all 86f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * the drawing commands recorded within. For instance, these properties can be used 87f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * to move around a large number of images without re-issuing all the individual 88f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <code>drawBitmap()</code> calls.</p> 89f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 90f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <pre class="prettyprint"> 91f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * private void createDisplayList() { 92f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * mDisplayList = DisplayList.create("MyDisplayList"); 93f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * HardwareCanvas canvas = mDisplayList.start(width, height); 94f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * try { 95f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * for (Bitmap b : mBitmaps) { 96f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * canvas.drawBitmap(b, 0.0f, 0.0f, null); 97f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * canvas.translate(0.0f, b.getHeight()); 98f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 99f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } finally { 100f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * displayList.end(); 101f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 102f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 103f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 104f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * protected void onDraw(Canvas canvas) { 105f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * if (canvas.isHardwareAccelerated()) { 106f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * HardwareCanvas hardwareCanvas = (HardwareCanvas) canvas; 107f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * hardwareCanvas.drawDisplayList(mDisplayList); 108f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 109f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 110f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 111f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * private void moveContentBy(int x) { 112f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * // This will move all the bitmaps recorded inside the display list 113f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * // by x pixels to the right and redraw this view. All the commands 114f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * // recorded in createDisplayList() won't be re-issued, only onDraw() 115f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * // will be invoked and will execute very quickly 116f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * mDisplayList.offsetLeftAndRight(x); 117f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * invalidate(); 118f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * } 119f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * </pre> 120f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 121f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Threading</h3> 122f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>Display lists must be created on and manipulated from the UI thread only.</p> 123f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 124f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @hide 125f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 126f666ad7046c0b1b255835f75aeb7d1391067df93John Reckpublic class RenderNode { 127f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 128f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Flag used when calling 1299a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik * {@link HardwareCanvas#drawRenderNode(RenderNode, android.graphics.Rect, int)} 130f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * When this flag is set, draw operations lying outside of the bounds of the 131f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * display list will be culled early. It is recommeneded to always set this 132f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * flag. 133f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 134f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public static final int FLAG_CLIP_CHILDREN = 0x1; 135f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 136f666ad7046c0b1b255835f75aeb7d1391067df93John Reck // NOTE: The STATUS_* values *must* match the enum in DrawGlInfo.h 137f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 138f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 139f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Indicates that the display list is done drawing. 140f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 1419a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik * @see HardwareCanvas#drawRenderNode(RenderNode, android.graphics.Rect, int) 142f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 143f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public static final int STATUS_DONE = 0x0; 144f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 145f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 146f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Indicates that the display list needs another drawing pass. 147f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 1489a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik * @see HardwareCanvas#drawRenderNode(RenderNode, android.graphics.Rect, int) 149f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 150f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public static final int STATUS_DRAW = 0x1; 151f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 152f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 153f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Indicates that the display list needs to re-execute its GL functors. 154f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 1559a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik * @see HardwareCanvas#drawRenderNode(RenderNode, android.graphics.Rect, int) 156f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see HardwareCanvas#callDrawGLFunction(long) 157f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 158f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public static final int STATUS_INVOKE = 0x2; 159f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 160f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 161f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Indicates that the display list performed GL drawing operations. 162f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 1639a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik * @see HardwareCanvas#drawRenderNode(RenderNode, android.graphics.Rect, int) 164f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 165f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public static final int STATUS_DREW = 0x4; 166f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 167f666ad7046c0b1b255835f75aeb7d1391067df93John Reck private boolean mValid; 1688de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private final long mNativeRenderNode; 169f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 170f666ad7046c0b1b255835f75aeb7d1391067df93John Reck private RenderNode(String name) { 1718de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck mNativeRenderNode = nCreate(name); 172f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 173f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 174f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 175e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * @see RenderNode#adopt(long) 176e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck */ 177e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck private RenderNode(long nativePtr) { 178e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck mNativeRenderNode = nativePtr; 179e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck } 180e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 181e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck /** 1829a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik * Creates a new RenderNode that can be used to record batches of 1839a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik * drawing operations, and store / apply render properties when drawn. 184f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 1859a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik * @param name The name of the RenderNode, used for debugging purpose. May be null. 186f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 1879a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik * @return A new RenderNode. 188f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 189f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public static RenderNode create(String name) { 190f666ad7046c0b1b255835f75aeb7d1391067df93John Reck return new RenderNode(name); 191f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 192f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 193f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 194e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * Adopts an existing native render node. 195e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * 196e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * Note: This will *NOT* incRef() on the native object, however it will 197e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * decRef() when it is destroyed. The caller should have already incRef'd it 198e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck */ 199e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck public static RenderNode adopt(long nativePtr) { 200e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck return new RenderNode(nativePtr); 201e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck } 202e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 203e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 204e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck /** 20549e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik * Starts recording a display list for the render node. All 20649e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik * operations performed on the returned canvas are recorded and 20749e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik * stored in this display list. 208f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 20949e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik * Calling this method will mark the render node invalid until 2108de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck * {@link #end(HardwareCanvas)} is called. 21149e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik * Only valid render nodes can be replayed. 212f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 21349e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik * @param width The width of the recording viewport 21449e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik * @param height The height of the recording viewport 215f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 216f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @return A canvas to record drawing operations. 217f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 2188de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck * @see #end(HardwareCanvas) 219f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #isValid() 220f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 221f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public HardwareCanvas start(int width, int height) { 2221c058e96b3fb5075c34b89cf22773373811abf7aJohn Reck HardwareCanvas canvas = GLES20RecordingCanvas.obtain(this); 223f666ad7046c0b1b255835f75aeb7d1391067df93John Reck canvas.setViewport(width, height); 224f666ad7046c0b1b255835f75aeb7d1391067df93John Reck // The dirty rect should always be null for a display list 225f666ad7046c0b1b255835f75aeb7d1391067df93John Reck canvas.onPreDraw(null); 226f666ad7046c0b1b255835f75aeb7d1391067df93John Reck return canvas; 227f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 228f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 229f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 230f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Ends the recording for this display list. A display list cannot be 231f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * replayed if recording is not finished. Calling this method marks 232f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * the display list valid and {@link #isValid()} will return true. 233f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 234f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #start(int, int) 235f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #isValid() 236f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 2378de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck public void end(HardwareCanvas endCanvas) { 238f666ad7046c0b1b255835f75aeb7d1391067df93John Reck if (!(endCanvas instanceof GLES20RecordingCanvas)) { 239f666ad7046c0b1b255835f75aeb7d1391067df93John Reck throw new IllegalArgumentException("Passed an invalid canvas to end!"); 240f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 241f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 242f666ad7046c0b1b255835f75aeb7d1391067df93John Reck GLES20RecordingCanvas canvas = (GLES20RecordingCanvas) endCanvas; 243f666ad7046c0b1b255835f75aeb7d1391067df93John Reck canvas.onPostDraw(); 2448de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck long renderNodeData = canvas.finishRecording(); 2458de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck nSetDisplayListData(mNativeRenderNode, renderNodeData); 246f666ad7046c0b1b255835f75aeb7d1391067df93John Reck canvas.recycle(); 247f666ad7046c0b1b255835f75aeb7d1391067df93John Reck mValid = true; 248f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 249f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 250f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 251f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Reset native resources. This is called when cleaning up the state of display lists 252f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * during destruction of hardware resources, to ensure that we do not hold onto 253f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * obsolete resources after related resources are gone. 254f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 255f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public void destroyDisplayListData() { 256f666ad7046c0b1b255835f75aeb7d1391067df93John Reck if (!mValid) return; 257f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 2588de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck nSetDisplayListData(mNativeRenderNode, 0); 259f666ad7046c0b1b255835f75aeb7d1391067df93John Reck mValid = false; 260f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 261f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 262f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 263df0c431e6cc23c0348d2e71fd834d74379afa33dChris Craik * Returns whether the RenderNode's display list content is currently usable. 264df0c431e6cc23c0348d2e71fd834d74379afa33dChris Craik * If this returns false, the display list should be re-recorded prior to replaying it. 265f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 266f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @return boolean true if the display list is able to be replayed, false otherwise. 267f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 268f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public boolean isValid() { return mValid; } 269f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 270f666ad7046c0b1b255835f75aeb7d1391067df93John Reck long getNativeDisplayList() { 271f666ad7046c0b1b255835f75aeb7d1391067df93John Reck if (!mValid) { 272f666ad7046c0b1b255835f75aeb7d1391067df93John Reck throw new IllegalStateException("The display list is not valid."); 273f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 2748de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return mNativeRenderNode; 275f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 276f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 277f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /////////////////////////////////////////////////////////////////////////// 27849e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik // Matrix manipulation 27949e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik /////////////////////////////////////////////////////////////////////////// 28049e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik 28149e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik public boolean hasIdentityMatrix() { 2828de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nHasIdentityMatrix(mNativeRenderNode); 28349e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik } 28449e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik 28549e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik public void getMatrix(@NonNull Matrix outMatrix) { 2868de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck nGetTransformMatrix(mNativeRenderNode, outMatrix.native_instance); 28749e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik } 28849e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik 28949e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik public void getInverseMatrix(@NonNull Matrix outMatrix) { 2908de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck nGetInverseTransformMatrix(mNativeRenderNode, outMatrix.native_instance); 29149e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik } 29249e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik 29349e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik /////////////////////////////////////////////////////////////////////////// 29449e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik // RenderProperty Setters 295f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /////////////////////////////////////////////////////////////////////////// 296f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 297f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 298f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Set the caching property on the display list, which indicates whether the display list 299f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * holds a layer. Layer display lists should avoid creating an alpha layer, since alpha is 300f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * handled in the drawLayer operation directly (and more efficiently). 301f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 302f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param caching true if the display list represents a hardware layer, false otherwise. 303f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 30425fbb3fa1138675379102a44405852555cefccbdJohn Reck public boolean setLayerType(int layerType) { 30525fbb3fa1138675379102a44405852555cefccbdJohn Reck return nSetLayerType(mNativeRenderNode, layerType); 30625fbb3fa1138675379102a44405852555cefccbdJohn Reck } 30725fbb3fa1138675379102a44405852555cefccbdJohn Reck 30825fbb3fa1138675379102a44405852555cefccbdJohn Reck public boolean setLayerPaint(Paint paint) { 30925fbb3fa1138675379102a44405852555cefccbdJohn Reck return nSetLayerPaint(mNativeRenderNode, paint != null ? paint.mNativePaint : 0); 310f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 311f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 312f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 31349e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik * Set whether the Render node should clip itself to its bounds. This property is controlled by 314f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * the view's parent. 315f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 316f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param clipToBounds true if the display list should clip to its bounds 317f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 31879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setClipToBounds(boolean clipToBounds) { 31979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetClipToBounds(mNativeRenderNode, clipToBounds); 320f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 321f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 322f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 323f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets whether the display list should be drawn immediately after the 32449e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik * closest ancestor display list containing a projection receiver. 325f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 326f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param shouldProject true if the display list should be projected onto a 327f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * containing volume. 328f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 32979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setProjectBackwards(boolean shouldProject) { 33079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetProjectBackwards(mNativeRenderNode, shouldProject); 331f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 332f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 333f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 334f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets whether the display list is a projection receiver - that its parent 335f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * DisplayList should draw any descendent DisplayLists with 336f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * ProjectBackwards=true directly on top of it. Default value is false. 337f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 33879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setProjectionReceiver(boolean shouldRecieve) { 33979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetProjectionReceiver(mNativeRenderNode, shouldRecieve); 340f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 341f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 342f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 343f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the outline, defining the shape that casts a shadow, and the path to 344f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * be clipped if setClipToOutline is set. 345f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 346b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik * Deep copies the data into native to simplify reference ownership. 347b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik */ 34879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setOutline(Outline outline) { 3490645128b80621edee70f8cab4afb208fe0c26becChris Craik if (outline == null) { 3500645128b80621edee70f8cab4afb208fe0c26becChris Craik return nSetOutlineNone(mNativeRenderNode); 3510645128b80621edee70f8cab4afb208fe0c26becChris Craik } else if (outline.isEmpty()) { 35279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetOutlineEmpty(mNativeRenderNode); 353b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik } else if (outline.mRect != null) { 35479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetOutlineRoundRect(mNativeRenderNode, outline.mRect.left, outline.mRect.top, 355b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik outline.mRect.right, outline.mRect.bottom, outline.mRadius); 356b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik } else if (outline.mPath != null) { 35779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetOutlineConvexPath(mNativeRenderNode, outline.mPath.mNativePath); 358b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik } 35979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck throw new IllegalArgumentException("Unrecognized outline?"); 360f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 361f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 362f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 363f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Enables or disables clipping to the outline. 364f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 365f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param clipToOutline true if clipping to the outline. 366f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 36779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setClipToOutline(boolean clipToOutline) { 36879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetClipToOutline(mNativeRenderNode, clipToOutline); 369f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 370f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 371deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik public boolean getClipToOutline() { 372deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik return nGetClipToOutline(mNativeRenderNode); 373deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik } 374deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik 375f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 3768c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik * Controls the RenderNode's circular reveal clip. 3778c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik */ 37879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setRevealClip(boolean shouldClip, boolean inverseClip, 3798c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik float x, float y, float radius) { 38079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetRevealClip(mNativeRenderNode, shouldClip, inverseClip, x, y, radius); 3818c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik } 3828c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik 3838c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik /** 384f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Set the static matrix on the display list. The specified matrix is combined with other 385f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * transforms (such as {@link #setScaleX(float)}, {@link #setRotation(float)}, etc.) 386f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 387f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param matrix A transform matrix to apply to this display list 388f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 38979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setStaticMatrix(Matrix matrix) { 39079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetStaticMatrix(mNativeRenderNode, matrix.native_instance); 391f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 392f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 393f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 394f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Set the Animation matrix on the display list. This matrix exists if an Animation is 395f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * currently playing on a View, and is set on the display list during at draw() time. When 396f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * the Animation finishes, the matrix should be cleared by sending <code>null</code> 397f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * for the matrix parameter. 398f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 399f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param matrix The matrix, null indicates that the matrix should be cleared. 400f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 40179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setAnimationMatrix(Matrix matrix) { 40279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetAnimationMatrix(mNativeRenderNode, 403f666ad7046c0b1b255835f75aeb7d1391067df93John Reck (matrix != null) ? matrix.native_instance : 0); 404f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 405f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 406f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 407f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the translucency level for the display list. 408f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 409f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param alpha The translucency of the display list, must be a value between 0.0f and 1.0f 410f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 411f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setAlpha(float) 412f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getAlpha() 413f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 41479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setAlpha(float alpha) { 41579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetAlpha(mNativeRenderNode, alpha); 416f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 417f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 418f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 419f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the translucency level of this display list. 420f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 421f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @return A value between 0.0f and 1.0f 422f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 423f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setAlpha(float) 424f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 425f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getAlpha() { 4268de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetAlpha(mNativeRenderNode); 427f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 428f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 429f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 430f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets whether the display list renders content which overlaps. Non-overlapping rendering 431f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * can use a fast path for alpha that avoids rendering to an offscreen buffer. By default 432f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * display lists consider they do not have overlapping content. 433f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 434f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param hasOverlappingRendering False if the content is guaranteed to be non-overlapping, 435f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * true otherwise. 436f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 437f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see android.view.View#hasOverlappingRendering() 438f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #hasOverlappingRendering() 439f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 44079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setHasOverlappingRendering(boolean hasOverlappingRendering) { 44179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetHasOverlappingRendering(mNativeRenderNode, hasOverlappingRendering); 442f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 443f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 444f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 445f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Indicates whether the content of this display list overlaps. 446f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 447f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @return True if this display list renders content which overlaps, false otherwise. 448f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 449f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setHasOverlappingRendering(boolean) 450f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 451f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public boolean hasOverlappingRendering() { 452f666ad7046c0b1b255835f75aeb7d1391067df93John Reck //noinspection SimplifiableIfStatement 4538de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nHasOverlappingRendering(mNativeRenderNode); 454f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 455f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 45679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setElevation(float lift) { 45779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetElevation(mNativeRenderNode, lift); 458cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik } 459cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik 460cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik public float getElevation() { 461cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik return nGetElevation(mNativeRenderNode); 462cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik } 463cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik 464f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 465f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the translation value for the display list on the X axis. 466f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 467f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param translationX The X axis translation value of the display list, in pixels 468f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 469f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setTranslationX(float) 470f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getTranslationX() 471f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 47279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setTranslationX(float translationX) { 47379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetTranslationX(mNativeRenderNode, translationX); 474f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 475f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 476f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 477f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the translation value for this display list on the X axis, in pixels. 478f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 479f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setTranslationX(float) 480f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 481f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getTranslationX() { 4828de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetTranslationX(mNativeRenderNode); 483f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 484f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 485f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 486f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the translation value for the display list on the Y axis. 487f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 488f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param translationY The Y axis translation value of the display list, in pixels 489f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 490f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setTranslationY(float) 491f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getTranslationY() 492f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 49379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setTranslationY(float translationY) { 49479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetTranslationY(mNativeRenderNode, translationY); 495f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 496f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 497f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 498f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the translation value for this display list on the Y axis, in pixels. 499f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 500f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setTranslationY(float) 501f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 502f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getTranslationY() { 5038de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetTranslationY(mNativeRenderNode); 504f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 505f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 506f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 507f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the translation value for the display list on the Z axis. 508f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 509f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setTranslationZ(float) 510f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getTranslationZ() 511f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 51279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setTranslationZ(float translationZ) { 51379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetTranslationZ(mNativeRenderNode, translationZ); 514f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 515f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 516f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 517f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the translation value for this display list on the Z axis. 518f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 519f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setTranslationZ(float) 520f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 521f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getTranslationZ() { 5228de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetTranslationZ(mNativeRenderNode); 523f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 524f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 525f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 526f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the rotation value for the display list around the Z axis. 527f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 528f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param rotation The rotation value of the display list, in degrees 529f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 530f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setRotation(float) 531f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getRotation() 532f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 53379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setRotation(float rotation) { 53479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetRotation(mNativeRenderNode, rotation); 535f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 536f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 537f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 538f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the rotation value for this display list around the Z axis, in degrees. 539f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 540f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setRotation(float) 541f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 542f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getRotation() { 5438de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetRotation(mNativeRenderNode); 544f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 545f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 546f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 547f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the rotation value for the display list around the X axis. 548f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 549f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param rotationX The rotation value of the display list, in degrees 550f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 551f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setRotationX(float) 552f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getRotationX() 553f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 55479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setRotationX(float rotationX) { 55579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetRotationX(mNativeRenderNode, rotationX); 556f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 557f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 558f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 559f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the rotation value for this display list around the X axis, in degrees. 560f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 561f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setRotationX(float) 562f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 563f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getRotationX() { 5648de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetRotationX(mNativeRenderNode); 565f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 566f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 567f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 568f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the rotation value for the display list around the Y axis. 569f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 570f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param rotationY The rotation value of the display list, in degrees 571f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 572f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setRotationY(float) 573f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getRotationY() 574f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 57579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setRotationY(float rotationY) { 57679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetRotationY(mNativeRenderNode, rotationY); 577f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 578f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 579f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 580f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the rotation value for this display list around the Y axis, in degrees. 581f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 582f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setRotationY(float) 583f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 584f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getRotationY() { 5858de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetRotationY(mNativeRenderNode); 586f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 587f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 588f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 589f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the scale value for the display list on the X axis. 590f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 591f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param scaleX The scale value of the display list 592f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 593f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setScaleX(float) 594f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getScaleX() 595f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 59679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setScaleX(float scaleX) { 59779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetScaleX(mNativeRenderNode, scaleX); 598f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 599f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 600f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 601f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the scale value for this display list on the X axis. 602f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 603f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setScaleX(float) 604f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 605f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getScaleX() { 6068de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetScaleX(mNativeRenderNode); 607f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 608f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 609f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 610f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the scale value for the display list on the Y axis. 611f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 612f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param scaleY The scale value of the display list 613f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 614f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setScaleY(float) 615f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getScaleY() 616f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 61779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setScaleY(float scaleY) { 61879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetScaleY(mNativeRenderNode, scaleY); 619f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 620f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 621f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 622f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the scale value for this display list on the Y axis. 623f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 624f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setScaleY(float) 625f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 626f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getScaleY() { 6278de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetScaleY(mNativeRenderNode); 628f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 629f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 630f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 631f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the pivot value for the display list on the X axis 632f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 633f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param pivotX The pivot value of the display list on the X axis, in pixels 634f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 635f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setPivotX(float) 636f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getPivotX() 637f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 63879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setPivotX(float pivotX) { 63979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetPivotX(mNativeRenderNode, pivotX); 640f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 641f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 642f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 643f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the pivot value for this display list on the X axis, in pixels. 644f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 645f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setPivotX(float) 646f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 647f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getPivotX() { 6488de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetPivotX(mNativeRenderNode); 649f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 650f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 651f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 652f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the pivot value for the display list on the Y axis 653f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 654f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param pivotY The pivot value of the display list on the Y axis, in pixels 655f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 656f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setPivotY(float) 657f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getPivotY() 658f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 65979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setPivotY(float pivotY) { 66079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetPivotY(mNativeRenderNode, pivotY); 661f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 662f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 663f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 664f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the pivot value for this display list on the Y axis, in pixels. 665f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 666f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setPivotY(float) 667f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 668f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getPivotY() { 6698de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetPivotY(mNativeRenderNode); 670f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 671f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 67249e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik public boolean isPivotExplicitlySet() { 6738de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nIsPivotExplicitlySet(mNativeRenderNode); 67449e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik } 67549e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik 676f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 677f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the camera distance for the display list. Refer to 678f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * {@link View#setCameraDistance(float)} for more information on how to 679f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * use this property. 680f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 681f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param distance The distance in Z of the camera of the display list 682f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 683f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setCameraDistance(float) 684f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getCameraDistance() 685f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 68679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setCameraDistance(float distance) { 68779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetCameraDistance(mNativeRenderNode, distance); 688f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 689f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 690f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 691f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the distance in Z of the camera of the display list. 692f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 693f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setCameraDistance(float) 694f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 695f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getCameraDistance() { 6968de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetCameraDistance(mNativeRenderNode); 697f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 698f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 699f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 700f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the left position for the display list. 701f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 702f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param left The left position, in pixels, of the display list 703f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 704f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setLeft(int) 705f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getLeft() 706f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 70779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setLeft(int left) { 70879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetLeft(mNativeRenderNode, left); 709f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 710f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 711f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 712f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the left position for the display list in pixels. 713f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 714f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setLeft(int) 715f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 716f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getLeft() { 7178de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetLeft(mNativeRenderNode); 718f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 719f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 720f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 721f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the top position for the display list. 722f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 723f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param top The top position, in pixels, of the display list 724f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 725f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setTop(int) 726f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getTop() 727f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 72879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setTop(int top) { 72979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetTop(mNativeRenderNode, top); 730f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 731f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 732f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 733f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the top position for the display list in pixels. 734f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 735f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setTop(int) 736f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 737f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getTop() { 7388de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetTop(mNativeRenderNode); 739f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 740f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 741f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 742f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the right position for the display list. 743f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 744f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param right The right position, in pixels, of the display list 745f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 746f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setRight(int) 747f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getRight() 748f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 74979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setRight(int right) { 75079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetRight(mNativeRenderNode, right); 751f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 752f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 753f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 754f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the right position for the display list in pixels. 755f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 756f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setRight(int) 757f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 758f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getRight() { 7598de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetRight(mNativeRenderNode); 760f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 761f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 762f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 763f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the bottom position for the display list. 764f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 765f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param bottom The bottom position, in pixels, of the display list 766f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 767f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setBottom(int) 768f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #getBottom() 769f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 77079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setBottom(int bottom) { 77179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetBottom(mNativeRenderNode, bottom); 772f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 773f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 774f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 775f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Returns the bottom position for the display list in pixels. 776f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 777f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see #setBottom(int) 778f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 779f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public float getBottom() { 7808de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck return nGetBottom(mNativeRenderNode); 781f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 782f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 783f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 784f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Sets the left and top positions for the display list 785f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 786f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param left The left position of the display list, in pixels 787f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param top The top position of the display list, in pixels 788f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param right The right position of the display list, in pixels 789f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param bottom The bottom position of the display list, in pixels 790f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 791f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setLeft(int) 792f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setTop(int) 793f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setRight(int) 794f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#setBottom(int) 795f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 79679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean setLeftTopRightBottom(int left, int top, int right, int bottom) { 79779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nSetLeftTopRightBottom(mNativeRenderNode, left, top, right, bottom); 798f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 799f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 800f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 801f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Offsets the left and right positions for the display list 802f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 803f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param offset The amount that the left and right positions of the display 804f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * list are offset, in pixels 805f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 806f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#offsetLeftAndRight(int) 807f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 80879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean offsetLeftAndRight(float offset) { 80979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nOffsetLeftAndRight(mNativeRenderNode, offset); 810f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 811f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 812f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 813f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Offsets the top and bottom values for the display list 814f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 815f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @param offset The amount that the top and bottom positions of the display 816f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * list are offset, in pixels 817f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * 818f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @see View#offsetTopAndBottom(int) 819f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 82079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck public boolean offsetTopAndBottom(float offset) { 82179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck return nOffsetTopAndBottom(mNativeRenderNode, offset); 822f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 823f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 824f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /** 825f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Outputs the display list to the log. This method exists for use by 826f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * tools to output display lists for selected nodes to the log. 827f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */ 828f666ad7046c0b1b255835f75aeb7d1391067df93John Reck public void output() { 8298de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck nOutput(mNativeRenderNode); 830f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 831f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 832fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck /** 833fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck * Gets the size of the DisplayList for debug purposes. 834fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck */ 835fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck public int getDebugSize() { 836fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck return nGetDebugSize(mNativeRenderNode); 837fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck } 838fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck 839f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /////////////////////////////////////////////////////////////////////////// 840e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck // Animations 841e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck /////////////////////////////////////////////////////////////////////////// 842e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 843e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck public void addAnimator(RenderNodeAnimator animator) { 844e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck nAddAnimator(mNativeRenderNode, animator.getNativeAnimator()); 845e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck } 846e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 847e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck /////////////////////////////////////////////////////////////////////////// 848f666ad7046c0b1b255835f75aeb7d1391067df93John Reck // Native methods 849f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /////////////////////////////////////////////////////////////////////////// 850f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 8518de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native long nCreate(String name); 8528de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native void nDestroyRenderNode(long renderNode); 8538de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native void nSetDisplayListData(long renderNode, long newData); 854f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 85549e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik // Matrix 85649e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik 8578de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native void nGetTransformMatrix(long renderNode, long nativeMatrix); 8588de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native void nGetInverseTransformMatrix(long renderNode, long nativeMatrix); 8598de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native boolean nHasIdentityMatrix(long renderNode); 86049e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik 861f666ad7046c0b1b255835f75aeb7d1391067df93John Reck // Properties 862f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 86379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nOffsetTopAndBottom(long renderNode, float offset); 86479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nOffsetLeftAndRight(long renderNode, float offset); 86579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetLeftTopRightBottom(long renderNode, int left, int top, 866f666ad7046c0b1b255835f75aeb7d1391067df93John Reck int right, int bottom); 86779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetBottom(long renderNode, int bottom); 86879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetRight(long renderNode, int right); 86979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetTop(long renderNode, int top); 87079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetLeft(long renderNode, int left); 87179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetCameraDistance(long renderNode, float distance); 87279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetPivotY(long renderNode, float pivotY); 87379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetPivotX(long renderNode, float pivotX); 87425fbb3fa1138675379102a44405852555cefccbdJohn Reck private static native boolean nSetLayerType(long renderNode, int layerType); 87525fbb3fa1138675379102a44405852555cefccbdJohn Reck private static native boolean nSetLayerPaint(long renderNode, long paint); 87679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetClipToBounds(long renderNode, boolean clipToBounds); 87779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetProjectBackwards(long renderNode, boolean shouldProject); 87879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetProjectionReceiver(long renderNode, boolean shouldRecieve); 87979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetOutlineRoundRect(long renderNode, int left, int top, 880b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik int right, int bottom, float radius); 88179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetOutlineConvexPath(long renderNode, long nativePath); 88279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetOutlineEmpty(long renderNode); 8830645128b80621edee70f8cab4afb208fe0c26becChris Craik private static native boolean nSetOutlineNone(long renderNode); 88479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetClipToOutline(long renderNode, boolean clipToOutline); 88579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetRevealClip(long renderNode, 8868c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik boolean shouldClip, boolean inverseClip, float x, float y, float radius); 88779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetAlpha(long renderNode, float alpha); 88879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetHasOverlappingRendering(long renderNode, 889f666ad7046c0b1b255835f75aeb7d1391067df93John Reck boolean hasOverlappingRendering); 89079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetElevation(long renderNode, float lift); 89179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetTranslationX(long renderNode, float translationX); 89279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetTranslationY(long renderNode, float translationY); 89379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetTranslationZ(long renderNode, float translationZ); 89479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetRotation(long renderNode, float rotation); 89579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetRotationX(long renderNode, float rotationX); 89679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetRotationY(long renderNode, float rotationY); 89779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetScaleX(long renderNode, float scaleX); 89879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetScaleY(long renderNode, float scaleY); 89979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetStaticMatrix(long renderNode, long nativeMatrix); 90079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck private static native boolean nSetAnimationMatrix(long renderNode, long animationMatrix); 9018de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck 9028de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native boolean nHasOverlappingRendering(long renderNode); 903deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik private static native boolean nGetClipToOutline(long renderNode); 9048de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetAlpha(long renderNode); 9058de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetLeft(long renderNode); 9068de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetTop(long renderNode); 9078de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetRight(long renderNode); 9088de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetBottom(long renderNode); 9098de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetCameraDistance(long renderNode); 9108de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetScaleX(long renderNode); 9118de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetScaleY(long renderNode); 912cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik private static native float nGetElevation(long renderNode); 9138de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetTranslationX(long renderNode); 9148de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetTranslationY(long renderNode); 9158de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetTranslationZ(long renderNode); 9168de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetRotation(long renderNode); 9178de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetRotationX(long renderNode); 9188de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetRotationY(long renderNode); 9198de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native boolean nIsPivotExplicitlySet(long renderNode); 9208de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetPivotX(long renderNode); 9218de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native float nGetPivotY(long renderNode); 9228de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck private static native void nOutput(long renderNode); 923fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck private static native int nGetDebugSize(long renderNode); 924f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 925f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /////////////////////////////////////////////////////////////////////////// 926e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck // Animations 927e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck /////////////////////////////////////////////////////////////////////////// 928e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 929e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck private static native void nAddAnimator(long renderNode, long animatorPtr); 930e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 931e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck /////////////////////////////////////////////////////////////////////////// 932f666ad7046c0b1b255835f75aeb7d1391067df93John Reck // Finalization 933f666ad7046c0b1b255835f75aeb7d1391067df93John Reck /////////////////////////////////////////////////////////////////////////// 934f666ad7046c0b1b255835f75aeb7d1391067df93John Reck 935f666ad7046c0b1b255835f75aeb7d1391067df93John Reck @Override 936f666ad7046c0b1b255835f75aeb7d1391067df93John Reck protected void finalize() throws Throwable { 937f666ad7046c0b1b255835f75aeb7d1391067df93John Reck try { 9388de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck nDestroyRenderNode(mNativeRenderNode); 939f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } finally { 940f666ad7046c0b1b255835f75aeb7d1391067df93John Reck super.finalize(); 941f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 942f666ad7046c0b1b255835f75aeb7d1391067df93John Reck } 943f666ad7046c0b1b255835f75aeb7d1391067df93John Reck} 944