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;
20a753f4c6cb8558795e673df1896532cd148781e2Chris Craikimport android.annotation.Nullable;
21f666ad7046c0b1b255835f75aeb7d1391067df93John Reckimport android.graphics.Matrix;
22b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craikimport android.graphics.Outline;
2325fbb3fa1138675379102a44405852555cefccbdJohn Reckimport android.graphics.Paint;
24a753f4c6cb8558795e673df1896532cd148781e2Chris Craikimport android.graphics.Rect;
25766431aa57c16ece8842287a92b2e7208e3b8ac3Doris Liuimport android.graphics.drawable.AnimatedVectorDrawable;
26f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
27f666ad7046c0b1b255835f75aeb7d1391067df93John Reck/**
28f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>A display list records a series of graphics related operations and can replay
29f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * them later. Display lists are usually built by recording operations on a
30f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik * {@link DisplayListCanvas}. Replaying the operations from a display list avoids
31f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * executing application code on every frame, and is thus much more efficient.</p>
32f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
33f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>Display lists are used internally for all views by default, and are not
34f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * typically used directly. One reason to consider using a display is a custom
35f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * {@link View} implementation that needs to issue a large number of drawing commands.
36f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * When the view invalidates, all the drawing commands must be reissued, even if
37f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * large portions of the drawing command stream stay the same frame to frame, which
38f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * can become a performance bottleneck. To solve this issue, a custom View might split
39f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * its content into several display lists. A display list is updated only when its
40f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * content, and only its content, needs to be updated.</p>
41f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
42f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>A text editor might for instance store each paragraph into its own display list.
43f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * Thus when the user inserts or removes characters, only the display list of the
44f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * affected paragraph needs to be recorded again.</p>
45f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
46f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Hardware acceleration</h3>
47f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik * <p>Display lists can only be replayed using a {@link DisplayListCanvas}. They are not
48f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * supported in software. Always make sure that the {@link android.graphics.Canvas}
49f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * you are using to render a display list is hardware accelerated using
50f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * {@link android.graphics.Canvas#isHardwareAccelerated()}.</p>
51f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
52f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Creating a display list</h3>
53f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <pre class="prettyprint">
54f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     HardwareRenderer renderer = myView.getHardwareRenderer();
55f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     if (renderer != null) {
56f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         DisplayList displayList = renderer.createDisplayList();
57f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik *         DisplayListCanvas canvas = displayList.start(width, height);
58f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         try {
59f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *             // Draw onto the canvas
60f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *             // For instance: canvas.drawBitmap(...);
61f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         } finally {
62f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *             displayList.end();
63f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         }
64f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     }
65f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * </pre>
66f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
67f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Rendering a display list on a View</h3>
68f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <pre class="prettyprint">
69f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     protected void onDraw(Canvas canvas) {
70f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         if (canvas.isHardwareAccelerated()) {
71f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik *             DisplayListCanvas displayListCanvas = (DisplayListCanvas) canvas;
72f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik *             displayListCanvas.drawDisplayList(mDisplayList);
73f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         }
74f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     }
75f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * </pre>
76f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
77f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Releasing resources</h3>
78f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>This step is not mandatory but recommended if you want to release resources
79f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * held by a display list as soon as possible.</p>
80f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <pre class="prettyprint">
81f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     // Mark this display list invalid, it cannot be used for drawing anymore,
82f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     // and release resources held by this display list
83f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     displayList.clear();
84f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * </pre>
85f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
86f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Properties</h3>
87f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>In addition, a display list offers several properties, such as
88f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * {@link #setScaleX(float)} or {@link #setLeft(int)}, that can be used to affect all
89f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * the drawing commands recorded within. For instance, these properties can be used
90f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * to move around a large number of images without re-issuing all the individual
91f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <code>drawBitmap()</code> calls.</p>
92f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
93f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <pre class="prettyprint">
94f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     private void createDisplayList() {
95f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         mDisplayList = DisplayList.create("MyDisplayList");
96f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik *         DisplayListCanvas canvas = mDisplayList.start(width, height);
97f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         try {
98f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *             for (Bitmap b : mBitmaps) {
99f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *                 canvas.drawBitmap(b, 0.0f, 0.0f, null);
100f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *                 canvas.translate(0.0f, b.getHeight());
101f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *             }
102f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         } finally {
103f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *             displayList.end();
104f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         }
105f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     }
106f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
107f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     protected void onDraw(Canvas canvas) {
108f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         if (canvas.isHardwareAccelerated()) {
109f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik *             DisplayListCanvas displayListCanvas = (DisplayListCanvas) canvas;
110f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik *             displayListCanvas.drawDisplayList(mDisplayList);
111f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *         }
112f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     }
113f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
114f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     private void moveContentBy(int x) {
115f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *          // This will move all the bitmaps recorded inside the display list
116f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *          // by x pixels to the right and redraw this view. All the commands
117f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *          // recorded in createDisplayList() won't be re-issued, only onDraw()
118f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *          // will be invoked and will execute very quickly
119f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *          mDisplayList.offsetLeftAndRight(x);
120f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *          invalidate();
121f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *     }
122f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * </pre>
123f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
124f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <h3>Threading</h3>
125f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * <p>Display lists must be created on and manipulated from the UI thread only.</p>
126f666ad7046c0b1b255835f75aeb7d1391067df93John Reck *
127f666ad7046c0b1b255835f75aeb7d1391067df93John Reck * @hide
128f666ad7046c0b1b255835f75aeb7d1391067df93John Reck */
129f666ad7046c0b1b255835f75aeb7d1391067df93John Reckpublic class RenderNode {
130f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
131f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    private boolean mValid;
132119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck    // Do not access directly unless you are ThreadedRenderer
133119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck    final long mNativeRenderNode;
134119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck    private final View mOwningView;
135f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
136119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck    private RenderNode(String name, View owningView) {
1378de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        mNativeRenderNode = nCreate(name);
138119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck        mOwningView = owningView;
139f648108f83d4e74811919e9811efb8fcc184b8a3John Reck        if (mOwningView instanceof SurfaceView) {
140f648108f83d4e74811919e9811efb8fcc184b8a3John Reck            nRequestPositionUpdates(mNativeRenderNode, (SurfaceView) mOwningView);
141f648108f83d4e74811919e9811efb8fcc184b8a3John Reck        }
142f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
143f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
144f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
145e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck     * @see RenderNode#adopt(long)
146e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck     */
147e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    private RenderNode(long nativePtr) {
148e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck        mNativeRenderNode = nativePtr;
149119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck        mOwningView = null;
150e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    }
151e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
152e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    /**
1539a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik     * Creates a new RenderNode that can be used to record batches of
1549a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik     * drawing operations, and store / apply render properties when drawn.
155f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
1569a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik     * @param name The name of the RenderNode, used for debugging purpose. May be null.
157f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
1589a347f199284ad8bcb8a81bfbd306fe0b1a710baChris Craik     * @return A new RenderNode.
159f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
160119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck    public static RenderNode create(String name, @Nullable View owningView) {
161119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck        return new RenderNode(name, owningView);
162f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
163f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
164f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
165e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck     * Adopts an existing native render node.
166e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck     *
167e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck     * Note: This will *NOT* incRef() on the native object, however it will
168e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck     * decRef() when it is destroyed. The caller should have already incRef'd it
169e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck     */
170e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    public static RenderNode adopt(long nativePtr) {
171e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck        return new RenderNode(nativePtr);
172e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    }
173e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
174e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
175e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    /**
17649e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik     * Starts recording a display list for the render node. All
17749e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik     * operations performed on the returned canvas are recorded and
17849e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik     * stored in this display list.
179f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
18049e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik     * Calling this method will mark the render node invalid until
181f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik     * {@link #end(DisplayListCanvas)} is called.
18249e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik     * Only valid render nodes can be replayed.
183f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
18449e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik     * @param width The width of the recording viewport
18549e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik     * @param height The height of the recording viewport
186f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
187f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @return A canvas to record drawing operations.
188f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
189f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik     * @see #end(DisplayListCanvas)
190f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #isValid()
191f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
192f6829a0a618b4523619ec53c996b04d67e3186b9Chris Craik    public DisplayListCanvas start(int width, int height) {
193cc882b6518129a11fa007f8c9343e972f03607b4Derek Sollenberger        return DisplayListCanvas.obtain(this, width, height);
194f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
195f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
196f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
197f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Ends the recording for this display list. A display list cannot be
198f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * replayed if recording is not finished. Calling this method marks
199f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * the display list valid and {@link #isValid()} will return true.
200f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
201f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #start(int, int)
202f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #isValid()
203f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
2043891f3ad598561d5a82c07795e1fee7f1d3612d1Chris Craik    public void end(DisplayListCanvas canvas) {
205003cc3dec8e2a92e51086fbcd5ee1bb236efa701Chris Craik        long displayList = canvas.finishRecording();
206003cc3dec8e2a92e51086fbcd5ee1bb236efa701Chris Craik        nSetDisplayList(mNativeRenderNode, displayList);
207f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        canvas.recycle();
208f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        mValid = true;
209f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
210f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
211f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
212f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Reset native resources. This is called when cleaning up the state of display lists
213f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * during destruction of hardware resources, to ensure that we do not hold onto
214f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * obsolete resources after related resources are gone.
215f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
216003cc3dec8e2a92e51086fbcd5ee1bb236efa701Chris Craik    public void discardDisplayList() {
217f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        if (!mValid) return;
218f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
219003cc3dec8e2a92e51086fbcd5ee1bb236efa701Chris Craik        nSetDisplayList(mNativeRenderNode, 0);
220f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        mValid = false;
221f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
222f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
223f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
224df0c431e6cc23c0348d2e71fd834d74379afa33dChris Craik     * Returns whether the RenderNode's display list content is currently usable.
225df0c431e6cc23c0348d2e71fd834d74379afa33dChris Craik     * If this returns false, the display list should be re-recorded prior to replaying it.
226f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
227f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @return boolean true if the display list is able to be replayed, false otherwise.
228f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
229f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public boolean isValid() { return mValid; }
230f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
231f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    long getNativeDisplayList() {
232f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        if (!mValid) {
233f666ad7046c0b1b255835f75aeb7d1391067df93John Reck            throw new IllegalStateException("The display list is not valid.");
234f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        }
2358de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return mNativeRenderNode;
236f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
237f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
238f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    ///////////////////////////////////////////////////////////////////////////
23949e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    // Matrix manipulation
24049e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    ///////////////////////////////////////////////////////////////////////////
24149e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik
24249e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    public boolean hasIdentityMatrix() {
2438de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nHasIdentityMatrix(mNativeRenderNode);
24449e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    }
24549e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik
24649e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    public void getMatrix(@NonNull Matrix outMatrix) {
2478de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        nGetTransformMatrix(mNativeRenderNode, outMatrix.native_instance);
24849e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    }
24949e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik
25049e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    public void getInverseMatrix(@NonNull Matrix outMatrix) {
2518de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        nGetInverseTransformMatrix(mNativeRenderNode, outMatrix.native_instance);
25249e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    }
25349e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik
25449e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    ///////////////////////////////////////////////////////////////////////////
25549e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    // RenderProperty Setters
256f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    ///////////////////////////////////////////////////////////////////////////
257f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
25825fbb3fa1138675379102a44405852555cefccbdJohn Reck    public boolean setLayerType(int layerType) {
25925fbb3fa1138675379102a44405852555cefccbdJohn Reck        return nSetLayerType(mNativeRenderNode, layerType);
26025fbb3fa1138675379102a44405852555cefccbdJohn Reck    }
26125fbb3fa1138675379102a44405852555cefccbdJohn Reck
262342a7e6a7cdf0f3ddf9302c0fd9d8a73ba98bb7fsergeyv    public boolean setLayerPaint(@Nullable Paint paint) {
263dfba4d3d11bbf47dff45f94d61d4d97510b3034aDerek Sollenberger        return nSetLayerPaint(mNativeRenderNode, paint != null ? paint.getNativeInstance() : 0);
264f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
265f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
266a753f4c6cb8558795e673df1896532cd148781e2Chris Craik    public boolean setClipBounds(@Nullable Rect rect) {
267a753f4c6cb8558795e673df1896532cd148781e2Chris Craik        if (rect == null) {
268a753f4c6cb8558795e673df1896532cd148781e2Chris Craik            return nSetClipBoundsEmpty(mNativeRenderNode);
269a753f4c6cb8558795e673df1896532cd148781e2Chris Craik        } else {
270a753f4c6cb8558795e673df1896532cd148781e2Chris Craik            return nSetClipBounds(mNativeRenderNode, rect.left, rect.top, rect.right, rect.bottom);
271a753f4c6cb8558795e673df1896532cd148781e2Chris Craik        }
272a753f4c6cb8558795e673df1896532cd148781e2Chris Craik    }
273a753f4c6cb8558795e673df1896532cd148781e2Chris Craik
274f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
27549e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik     * Set whether the Render node should clip itself to its bounds. This property is controlled by
276f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * the view's parent.
277f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
278f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param clipToBounds true if the display list should clip to its bounds
279f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
28079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setClipToBounds(boolean clipToBounds) {
28179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetClipToBounds(mNativeRenderNode, clipToBounds);
282f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
283f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
284f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
285f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets whether the display list should be drawn immediately after the
28649e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik     * closest ancestor display list containing a projection receiver.
287f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
288f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param shouldProject true if the display list should be projected onto a
289f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *            containing volume.
290f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
29179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setProjectBackwards(boolean shouldProject) {
29279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetProjectBackwards(mNativeRenderNode, shouldProject);
293f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
294f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
295f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
296f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets whether the display list is a projection receiver - that its parent
297f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * DisplayList should draw any descendent DisplayLists with
298f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * ProjectBackwards=true directly on top of it. Default value is false.
299f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
30079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setProjectionReceiver(boolean shouldRecieve) {
30179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetProjectionReceiver(mNativeRenderNode, shouldRecieve);
302f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
303f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
304f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
305f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the outline, defining the shape that casts a shadow, and the path to
306f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * be clipped if setClipToOutline is set.
307f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
308b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik     * Deep copies the data into native to simplify reference ownership.
309b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik     */
310136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik    public boolean setOutline(@Nullable Outline outline) {
3110645128b80621edee70f8cab4afb208fe0c26becChris Craik        if (outline == null) {
3120645128b80621edee70f8cab4afb208fe0c26becChris Craik            return nSetOutlineNone(mNativeRenderNode);
313b49f446c98096c4790a11d9b5bc83a4e585278c9Chris Craik        }
314136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik
315136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik        switch(outline.mMode) {
316136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik            case Outline.MODE_EMPTY:
317136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik                return nSetOutlineEmpty(mNativeRenderNode);
318136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik            case Outline.MODE_ROUND_RECT:
319136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik                return nSetOutlineRoundRect(mNativeRenderNode, outline.mRect.left, outline.mRect.top,
320136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik                        outline.mRect.right, outline.mRect.bottom, outline.mRadius, outline.mAlpha);
321136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik            case Outline.MODE_CONVEX_PATH:
322136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik                return nSetOutlineConvexPath(mNativeRenderNode, outline.mPath.mNativePath,
323136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik                        outline.mAlpha);
324136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik        }
325136d1af1cc67f51e8523189260a7c4a22cc02768Chris Craik
32679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        throw new IllegalArgumentException("Unrecognized outline?");
327f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
328f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
3295c75c52e048a01c23b18f4e31ae624b5fe43e23cChris Craik    public boolean hasShadow() {
3305c75c52e048a01c23b18f4e31ae624b5fe43e23cChris Craik        return nHasShadow(mNativeRenderNode);
3315c75c52e048a01c23b18f4e31ae624b5fe43e23cChris Craik    }
3325c75c52e048a01c23b18f4e31ae624b5fe43e23cChris Craik
333f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
334f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Enables or disables clipping to the outline.
335f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
336f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param clipToOutline true if clipping to the outline.
337f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
33879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setClipToOutline(boolean clipToOutline) {
33979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetClipToOutline(mNativeRenderNode, clipToOutline);
340f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
341f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
342deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik    public boolean getClipToOutline() {
343deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik        return nGetClipToOutline(mNativeRenderNode);
344deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik    }
345deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik
346f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
3478c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik     * Controls the RenderNode's circular reveal clip.
3488c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik     */
349af4d04cab6d48ae0d6a5e79bd30f679af87abaadChris Craik    public boolean setRevealClip(boolean shouldClip,
3508c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik            float x, float y, float radius) {
351af4d04cab6d48ae0d6a5e79bd30f679af87abaadChris Craik        return nSetRevealClip(mNativeRenderNode, shouldClip, x, y, radius);
3528c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik    }
3538c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik
3548c271ca63b62061fd22cfee78fd6a574b44476fdChris Craik    /**
355f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Set the static matrix on the display list. The specified matrix is combined with other
356f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * transforms (such as {@link #setScaleX(float)}, {@link #setRotation(float)}, etc.)
357f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
358f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param matrix A transform matrix to apply to this display list
359f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
36079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setStaticMatrix(Matrix matrix) {
36179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetStaticMatrix(mNativeRenderNode, matrix.native_instance);
362f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
363f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
364f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
365f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Set the Animation matrix on the display list. This matrix exists if an Animation is
366f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * currently playing on a View, and is set on the display list during at draw() time. When
367f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * the Animation finishes, the matrix should be cleared by sending <code>null</code>
368f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * for the matrix parameter.
369f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
370f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param matrix The matrix, null indicates that the matrix should be cleared.
371f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
37279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setAnimationMatrix(Matrix matrix) {
37379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetAnimationMatrix(mNativeRenderNode,
374f666ad7046c0b1b255835f75aeb7d1391067df93John Reck                (matrix != null) ? matrix.native_instance : 0);
375f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
376f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
377f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
378f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the translucency level for the display list.
379f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
380f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param alpha The translucency of the display list, must be a value between 0.0f and 1.0f
381f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
382f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setAlpha(float)
383f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getAlpha()
384f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
38579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setAlpha(float alpha) {
38679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetAlpha(mNativeRenderNode, alpha);
387f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
388f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
389f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
390f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the translucency level of this display list.
391f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
392f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @return A value between 0.0f and 1.0f
393f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
394f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setAlpha(float)
395f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
396f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getAlpha() {
3978de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetAlpha(mNativeRenderNode);
398f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
399f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
400f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
401f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets whether the display list renders content which overlaps. Non-overlapping rendering
402f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * can use a fast path for alpha that avoids rendering to an offscreen buffer. By default
403f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * display lists consider they do not have overlapping content.
404f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
405f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param hasOverlappingRendering False if the content is guaranteed to be non-overlapping,
406f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *                                true otherwise.
407f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
408f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see android.view.View#hasOverlappingRendering()
409f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #hasOverlappingRendering()
410f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
41179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setHasOverlappingRendering(boolean hasOverlappingRendering) {
41279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetHasOverlappingRendering(mNativeRenderNode, hasOverlappingRendering);
413f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
414f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
415f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
416f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Indicates whether the content of this display list overlaps.
417f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
418f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @return True if this display list renders content which overlaps, false otherwise.
419f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
420f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setHasOverlappingRendering(boolean)
421f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
422f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public boolean hasOverlappingRendering() {
423f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        //noinspection SimplifiableIfStatement
4248de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nHasOverlappingRendering(mNativeRenderNode);
425f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
426f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
42779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setElevation(float lift) {
42879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetElevation(mNativeRenderNode, lift);
429cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik    }
430cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik
431cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik    public float getElevation() {
432cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik        return nGetElevation(mNativeRenderNode);
433cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik    }
434cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik
435f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
436f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the translation value for the display list on the X axis.
437f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
438f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param translationX The X axis translation value of the display list, in pixels
439f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
440f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setTranslationX(float)
441f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getTranslationX()
442f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
44379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setTranslationX(float translationX) {
44479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetTranslationX(mNativeRenderNode, translationX);
445f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
446f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
447f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
448f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the translation value for this display list on the X axis, in pixels.
449f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
450f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setTranslationX(float)
451f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
452f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getTranslationX() {
4538de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetTranslationX(mNativeRenderNode);
454f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
455f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
456f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
457f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the translation value for the display list on the Y axis.
458f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
459f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param translationY The Y axis translation value of the display list, in pixels
460f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
461f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setTranslationY(float)
462f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getTranslationY()
463f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
46479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setTranslationY(float translationY) {
46579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetTranslationY(mNativeRenderNode, translationY);
466f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
467f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
468f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
469f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the translation value for this display list on the Y axis, in pixels.
470f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
471f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setTranslationY(float)
472f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
473f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getTranslationY() {
4748de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetTranslationY(mNativeRenderNode);
475f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
476f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
477f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
478f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the translation value for the display list on the Z axis.
479f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
480f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setTranslationZ(float)
481f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getTranslationZ()
482f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
48379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setTranslationZ(float translationZ) {
48479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetTranslationZ(mNativeRenderNode, translationZ);
485f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
486f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
487f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
488f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the translation value for this display list on the Z axis.
489f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
490f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setTranslationZ(float)
491f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
492f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getTranslationZ() {
4938de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetTranslationZ(mNativeRenderNode);
494f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
495f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
496f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
497f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the rotation value for the display list around the Z axis.
498f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
499f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param rotation The rotation value of the display list, in degrees
500f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
501f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setRotation(float)
502f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getRotation()
503f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
50479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setRotation(float rotation) {
50579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetRotation(mNativeRenderNode, rotation);
506f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
507f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
508f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
509f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the rotation value for this display list around the Z axis, in degrees.
510f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
511f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setRotation(float)
512f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
513f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getRotation() {
5148de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetRotation(mNativeRenderNode);
515f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
516f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
517f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
518f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the rotation value for the display list around the X axis.
519f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
520f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param rotationX The rotation value of the display list, in degrees
521f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
522f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setRotationX(float)
523f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getRotationX()
524f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
52579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setRotationX(float rotationX) {
52679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetRotationX(mNativeRenderNode, rotationX);
527f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
528f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
529f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
530f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the rotation value for this display list around the X axis, in degrees.
531f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
532f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setRotationX(float)
533f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
534f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getRotationX() {
5358de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetRotationX(mNativeRenderNode);
536f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
537f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
538f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
539f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the rotation value for the display list around the Y axis.
540f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
541f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param rotationY The rotation value of the display list, in degrees
542f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
543f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setRotationY(float)
544f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getRotationY()
545f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
54679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setRotationY(float rotationY) {
54779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetRotationY(mNativeRenderNode, rotationY);
548f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
549f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
550f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
551f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the rotation value for this display list around the Y axis, in degrees.
552f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
553f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setRotationY(float)
554f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
555f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getRotationY() {
5568de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetRotationY(mNativeRenderNode);
557f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
558f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
559f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
560f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the scale value for the display list on the X axis.
561f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
562f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param scaleX The scale value of the display list
563f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
564f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setScaleX(float)
565f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getScaleX()
566f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
56779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setScaleX(float scaleX) {
56879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetScaleX(mNativeRenderNode, scaleX);
569f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
570f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
571f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
572f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the scale value for this display list on the X axis.
573f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
574f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setScaleX(float)
575f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
576f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getScaleX() {
5778de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetScaleX(mNativeRenderNode);
578f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
579f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
580f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
581f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the scale value for the display list on the Y axis.
582f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
583f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param scaleY The scale value of the display list
584f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
585f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setScaleY(float)
586f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getScaleY()
587f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
58879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setScaleY(float scaleY) {
58979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetScaleY(mNativeRenderNode, scaleY);
590f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
591f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
592f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
593f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the scale value for this display list on the Y axis.
594f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
595f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setScaleY(float)
596f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
597f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getScaleY() {
5988de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetScaleY(mNativeRenderNode);
599f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
600f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
601f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
602f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the pivot value for the display list on the X axis
603f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
604f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param pivotX The pivot value of the display list on the X axis, in pixels
605f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
606f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setPivotX(float)
607f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getPivotX()
608f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
60979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setPivotX(float pivotX) {
61079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetPivotX(mNativeRenderNode, pivotX);
611f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
612f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
613f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
614f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the pivot value for this display list on the X axis, in pixels.
615f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
616f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setPivotX(float)
617f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
618f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getPivotX() {
6198de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetPivotX(mNativeRenderNode);
620f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
621f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
622f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
623f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the pivot value for the display list on the Y axis
624f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
625f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param pivotY The pivot value of the display list on the Y axis, in pixels
626f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
627f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setPivotY(float)
628f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getPivotY()
629f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
63079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setPivotY(float pivotY) {
63179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetPivotY(mNativeRenderNode, pivotY);
632f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
633f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
634f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
635f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the pivot value for this display list on the Y axis, in pixels.
636f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
637f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setPivotY(float)
638f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
639f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getPivotY() {
6408de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetPivotY(mNativeRenderNode);
641f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
642f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
64349e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    public boolean isPivotExplicitlySet() {
6448de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nIsPivotExplicitlySet(mNativeRenderNode);
64549e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    }
64649e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik
647f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
648f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the camera distance for the display list. Refer to
649f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * {@link View#setCameraDistance(float)} for more information on how to
650f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * use this property.
651f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
652f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param distance The distance in Z of the camera of the display list
653f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
654f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setCameraDistance(float)
655f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #getCameraDistance()
656f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
65779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setCameraDistance(float distance) {
65879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetCameraDistance(mNativeRenderNode, distance);
659f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
660f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
661f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
662f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Returns the distance in Z of the camera of the display list.
663f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
664f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see #setCameraDistance(float)
665f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
666f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public float getCameraDistance() {
6678de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        return nGetCameraDistance(mNativeRenderNode);
668f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
669f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
670f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
671f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the left position for the display list.
672f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
673f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param left The left position, in pixels, of the display list
674f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
675f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setLeft(int)
676f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
67779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setLeft(int left) {
67879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetLeft(mNativeRenderNode, left);
679f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
680f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
681f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
682f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the top position for the display list.
683f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
684f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param top The top position, in pixels, of the display list
685f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
686f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setTop(int)
687f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
68879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setTop(int top) {
68979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetTop(mNativeRenderNode, top);
690f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
691f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
692f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
693f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the right position for the display list.
694f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
695f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param right The right position, in pixels, of the display list
696f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
697f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setRight(int)
698f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
69979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setRight(int right) {
70079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetRight(mNativeRenderNode, right);
701f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
702f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
703f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
704f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the bottom position for the display list.
705f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
706f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param bottom The bottom position, in pixels, of the display list
707f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
708f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setBottom(int)
709f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
71079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setBottom(int bottom) {
71179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetBottom(mNativeRenderNode, bottom);
712f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
713f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
714f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
715f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Sets the left and top positions for the display list
716f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
717f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param left The left position of the display list, in pixels
718f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param top The top position of the display list, in pixels
719f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param right The right position of the display list, in pixels
720f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param bottom The bottom position of the display list, in pixels
721f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
722f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setLeft(int)
723f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setTop(int)
724f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setRight(int)
725f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#setBottom(int)
726f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
72779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    public boolean setLeftTopRightBottom(int left, int top, int right, int bottom) {
72879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nSetLeftTopRightBottom(mNativeRenderNode, left, top, right, bottom);
729f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
730f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
731f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
732f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Offsets the left and right positions for the display list
733f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
734f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param offset The amount that the left and right positions of the display
735f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *               list are offset, in pixels
736f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
737f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#offsetLeftAndRight(int)
738f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
739a753f4c6cb8558795e673df1896532cd148781e2Chris Craik    public boolean offsetLeftAndRight(int offset) {
74079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nOffsetLeftAndRight(mNativeRenderNode, offset);
741f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
742f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
743f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
744f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Offsets the top and bottom values for the display list
745f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
746f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @param offset The amount that the top and bottom positions of the display
747f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *               list are offset, in pixels
748f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     *
749f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * @see View#offsetTopAndBottom(int)
750f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
751a753f4c6cb8558795e673df1896532cd148781e2Chris Craik    public boolean offsetTopAndBottom(int offset) {
75279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck        return nOffsetTopAndBottom(mNativeRenderNode, offset);
753f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
754f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
755f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    /**
756f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * Outputs the display list to the log. This method exists for use by
757f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     * tools to output display lists for selected nodes to the log.
758f666ad7046c0b1b255835f75aeb7d1391067df93John Reck     */
759f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    public void output() {
7608de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck        nOutput(mNativeRenderNode);
761f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
762f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
763fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck    /**
764fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck     * Gets the size of the DisplayList for debug purposes.
765fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck     */
766fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck    public int getDebugSize() {
767fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck        return nGetDebugSize(mNativeRenderNode);
768fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck    }
769fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck
77044b49f070aafe8ad44efae87341121cce49ff11cJohn Reck    /**
77144b49f070aafe8ad44efae87341121cce49ff11cJohn Reck     * Called by native when the passed displaylist is removed from the draw tree
77244b49f070aafe8ad44efae87341121cce49ff11cJohn Reck     */
77344b49f070aafe8ad44efae87341121cce49ff11cJohn Reck    void onRenderNodeDetached() {
77444b49f070aafe8ad44efae87341121cce49ff11cJohn Reck        discardDisplayList();
77544b49f070aafe8ad44efae87341121cce49ff11cJohn Reck        if (mOwningView != null) {
77644b49f070aafe8ad44efae87341121cce49ff11cJohn Reck            mOwningView.onRenderNodeDetached(this);
77744b49f070aafe8ad44efae87341121cce49ff11cJohn Reck        }
77844b49f070aafe8ad44efae87341121cce49ff11cJohn Reck    }
77944b49f070aafe8ad44efae87341121cce49ff11cJohn Reck
780f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    ///////////////////////////////////////////////////////////////////////////
781e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    // Animations
782e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    ///////////////////////////////////////////////////////////////////////////
783e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
784e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    public void addAnimator(RenderNodeAnimator animator) {
785119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck        if (mOwningView == null || mOwningView.mAttachInfo == null) {
786119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck            throw new IllegalStateException("Cannot start this animator on a detached view!");
787119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck        }
788e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck        nAddAnimator(mNativeRenderNode, animator.getNativeAnimator());
789119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck        mOwningView.mAttachInfo.mViewRootImpl.registerAnimatingRenderNode(this);
790119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck    }
791119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck
7928b083206aef627b6445a8c6be8bf5bb1d778a7f8Doris Liu    public boolean isAttached() {
7938b083206aef627b6445a8c6be8bf5bb1d778a7f8Doris Liu        return mOwningView != null && mOwningView.mAttachInfo != null;
7948b083206aef627b6445a8c6be8bf5bb1d778a7f8Doris Liu    }
7958b083206aef627b6445a8c6be8bf5bb1d778a7f8Doris Liu
79628cfd20f024a56a927014351c8bdf9d8552603e3Doris Liu    public void addAnimator(AnimatedVectorDrawable.VectorDrawableAnimatorRT animatorSet) {
797766431aa57c16ece8842287a92b2e7208e3b8ac3Doris Liu        if (mOwningView == null || mOwningView.mAttachInfo == null) {
798766431aa57c16ece8842287a92b2e7208e3b8ac3Doris Liu            throw new IllegalStateException("Cannot start this animator on a detached view!");
799766431aa57c16ece8842287a92b2e7208e3b8ac3Doris Liu        }
800766431aa57c16ece8842287a92b2e7208e3b8ac3Doris Liu        nAddAnimator(mNativeRenderNode, animatorSet.getAnimatorNativePtr());
801766431aa57c16ece8842287a92b2e7208e3b8ac3Doris Liu        mOwningView.mAttachInfo.mViewRootImpl.registerAnimatingRenderNode(this);
802766431aa57c16ece8842287a92b2e7208e3b8ac3Doris Liu    }
803766431aa57c16ece8842287a92b2e7208e3b8ac3Doris Liu
804119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck    public void endAllAnimators() {
805119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck        nEndAllAnimators(mNativeRenderNode);
806e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    }
807e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
808e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    ///////////////////////////////////////////////////////////////////////////
809f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    // Native methods
810f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    ///////////////////////////////////////////////////////////////////////////
811f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
81244b49f070aafe8ad44efae87341121cce49ff11cJohn Reck    // Intentionally not static because it acquires a reference to 'this'
81344b49f070aafe8ad44efae87341121cce49ff11cJohn Reck    private native long nCreate(String name);
81444b49f070aafe8ad44efae87341121cce49ff11cJohn Reck
8158de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native void nDestroyRenderNode(long renderNode);
816003cc3dec8e2a92e51086fbcd5ee1bb236efa701Chris Craik    private static native void nSetDisplayList(long renderNode, long newData);
817f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
81849e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik    // Matrix
81949e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik
8208de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native void nGetTransformMatrix(long renderNode, long nativeMatrix);
8218de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native void nGetInverseTransformMatrix(long renderNode, long nativeMatrix);
8228de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native boolean nHasIdentityMatrix(long renderNode);
82349e6c73913e9bee58ea5e3984be151ee8e033163Chris Craik
824f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    // Properties
825f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
826a753f4c6cb8558795e673df1896532cd148781e2Chris Craik    private static native boolean nOffsetTopAndBottom(long renderNode, int offset);
827a753f4c6cb8558795e673df1896532cd148781e2Chris Craik    private static native boolean nOffsetLeftAndRight(long renderNode, int offset);
82879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetLeftTopRightBottom(long renderNode, int left, int top,
829f666ad7046c0b1b255835f75aeb7d1391067df93John Reck            int right, int bottom);
83079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetBottom(long renderNode, int bottom);
83179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetRight(long renderNode, int right);
83279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetTop(long renderNode, int top);
83379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetLeft(long renderNode, int left);
83479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetCameraDistance(long renderNode, float distance);
83579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetPivotY(long renderNode, float pivotY);
83679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetPivotX(long renderNode, float pivotX);
83725fbb3fa1138675379102a44405852555cefccbdJohn Reck    private static native boolean nSetLayerType(long renderNode, int layerType);
83825fbb3fa1138675379102a44405852555cefccbdJohn Reck    private static native boolean nSetLayerPaint(long renderNode, long paint);
83979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetClipToBounds(long renderNode, boolean clipToBounds);
840a753f4c6cb8558795e673df1896532cd148781e2Chris Craik    private static native boolean nSetClipBounds(long renderNode, int left, int top,
841a753f4c6cb8558795e673df1896532cd148781e2Chris Craik            int right, int bottom);
842a753f4c6cb8558795e673df1896532cd148781e2Chris Craik    private static native boolean nSetClipBoundsEmpty(long renderNode);
84379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetProjectBackwards(long renderNode, boolean shouldProject);
84479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetProjectionReceiver(long renderNode, boolean shouldRecieve);
84579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetOutlineRoundRect(long renderNode, int left, int top,
84677b5cad3efedd20f2b7cc14d87ccce1b0261960aChris Craik            int right, int bottom, float radius, float alpha);
84777b5cad3efedd20f2b7cc14d87ccce1b0261960aChris Craik    private static native boolean nSetOutlineConvexPath(long renderNode, long nativePath,
84877b5cad3efedd20f2b7cc14d87ccce1b0261960aChris Craik            float alpha);
84979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetOutlineEmpty(long renderNode);
8500645128b80621edee70f8cab4afb208fe0c26becChris Craik    private static native boolean nSetOutlineNone(long renderNode);
8515c75c52e048a01c23b18f4e31ae624b5fe43e23cChris Craik    private static native boolean nHasShadow(long renderNode);
85279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetClipToOutline(long renderNode, boolean clipToOutline);
85379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetRevealClip(long renderNode,
854af4d04cab6d48ae0d6a5e79bd30f679af87abaadChris Craik            boolean shouldClip, float x, float y, float radius);
85579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetAlpha(long renderNode, float alpha);
85679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetHasOverlappingRendering(long renderNode,
857f666ad7046c0b1b255835f75aeb7d1391067df93John Reck            boolean hasOverlappingRendering);
85879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetElevation(long renderNode, float lift);
85979c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetTranslationX(long renderNode, float translationX);
86079c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetTranslationY(long renderNode, float translationY);
86179c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetTranslationZ(long renderNode, float translationZ);
86279c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetRotation(long renderNode, float rotation);
86379c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetRotationX(long renderNode, float rotationX);
86479c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetRotationY(long renderNode, float rotationY);
86579c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetScaleX(long renderNode, float scaleX);
86679c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetScaleY(long renderNode, float scaleY);
86779c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetStaticMatrix(long renderNode, long nativeMatrix);
86879c7de77a7da9cbcb9428ab6203987feb35a427fJohn Reck    private static native boolean nSetAnimationMatrix(long renderNode, long animationMatrix);
8698de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck
8708de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native boolean nHasOverlappingRendering(long renderNode);
871deeda3d337aed1eee218b89a7aba5992ced371f0Chris Craik    private static native boolean nGetClipToOutline(long renderNode);
8728de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetAlpha(long renderNode);
8738de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetCameraDistance(long renderNode);
8748de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetScaleX(long renderNode);
8758de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetScaleY(long renderNode);
876cc39e16cb98855f35079941b5e7e6eac2b7bc388Chris Craik    private static native float nGetElevation(long renderNode);
8778de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetTranslationX(long renderNode);
8788de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetTranslationY(long renderNode);
8798de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetTranslationZ(long renderNode);
8808de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetRotation(long renderNode);
8818de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetRotationX(long renderNode);
8828de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetRotationY(long renderNode);
8838de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native boolean nIsPivotExplicitlySet(long renderNode);
8848de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetPivotX(long renderNode);
8858de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native float nGetPivotY(long renderNode);
8868de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck    private static native void nOutput(long renderNode);
887fe5e7b7346a54537b980796ceeca66bfdbd05561John Reck    private static native int nGetDebugSize(long renderNode);
888f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
889f648108f83d4e74811919e9811efb8fcc184b8a3John Reck    private static native void nRequestPositionUpdates(long renderNode, SurfaceView callback);
890f648108f83d4e74811919e9811efb8fcc184b8a3John Reck
891f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    ///////////////////////////////////////////////////////////////////////////
892e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    // Animations
893e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    ///////////////////////////////////////////////////////////////////////////
894e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
895e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    private static native void nAddAnimator(long renderNode, long animatorPtr);
896119907cd2575c56b1ebf66348b52e67aaf6a88d8John Reck    private static native void nEndAllAnimators(long renderNode);
897e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
898e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    ///////////////////////////////////////////////////////////////////////////
899f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    // Finalization
900f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    ///////////////////////////////////////////////////////////////////////////
901f666ad7046c0b1b255835f75aeb7d1391067df93John Reck
902f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    @Override
903f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    protected void finalize() throws Throwable {
904f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        try {
9058de65a8e05285df52a1e6f0c1d5616dd233298a7John Reck            nDestroyRenderNode(mNativeRenderNode);
906f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        } finally {
907f666ad7046c0b1b255835f75aeb7d1391067df93John Reck            super.finalize();
908f666ad7046c0b1b255835f75aeb7d1391067df93John Reck        }
909f666ad7046c0b1b255835f75aeb7d1391067df93John Reck    }
910f666ad7046c0b1b255835f75aeb7d1391067df93John Reck}
911