blob: c28e335e4eee58e223ef3fb71d88dcf094e140fc [file] [log] [blame]
John Reckf666ad72014-03-14 16:24:57 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.view;
18
Chris Craik49e6c732014-03-31 12:34:11 -070019import android.annotation.NonNull;
Chris Craika753f4c2014-07-24 12:39:17 -070020import android.annotation.Nullable;
Mathew Inwoode5ad5982018-08-17 15:07:52 +010021import android.annotation.UnsupportedAppUsage;
John Reckf666ad72014-03-14 16:24:57 -070022import android.graphics.Matrix;
Chris Craikb49f4462014-03-20 12:44:20 -070023import android.graphics.Outline;
John Reck25fbb3f2014-06-12 13:46:45 -070024import android.graphics.Paint;
Chris Craika753f4c2014-07-24 12:39:17 -070025import android.graphics.Rect;
Doris Liu766431a2016-02-04 22:17:11 +000026import android.graphics.drawable.AnimatedVectorDrawable;
John Reckf666ad72014-03-14 16:24:57 -070027
Chris Craikfc294242016-12-13 18:10:46 -080028import dalvik.annotation.optimization.CriticalNative;
John Reck395e9b82016-08-24 13:22:37 -070029import dalvik.annotation.optimization.FastNative;
30
John Reckb99fff52016-11-16 15:21:57 -080031import libcore.util.NativeAllocationRegistry;
32
John Reckf666ad72014-03-14 16:24:57 -070033/**
34 * <p>A display list records a series of graphics related operations and can replay
35 * them later. Display lists are usually built by recording operations on a
Chris Craikf6829a02015-03-10 10:28:59 -070036 * {@link DisplayListCanvas}. Replaying the operations from a display list avoids
John Reckf666ad72014-03-14 16:24:57 -070037 * executing application code on every frame, and is thus much more efficient.</p>
38 *
39 * <p>Display lists are used internally for all views by default, and are not
40 * typically used directly. One reason to consider using a display is a custom
41 * {@link View} implementation that needs to issue a large number of drawing commands.
42 * When the view invalidates, all the drawing commands must be reissued, even if
43 * large portions of the drawing command stream stay the same frame to frame, which
44 * can become a performance bottleneck. To solve this issue, a custom View might split
45 * its content into several display lists. A display list is updated only when its
46 * content, and only its content, needs to be updated.</p>
47 *
48 * <p>A text editor might for instance store each paragraph into its own display list.
49 * Thus when the user inserts or removes characters, only the display list of the
50 * affected paragraph needs to be recorded again.</p>
51 *
52 * <h3>Hardware acceleration</h3>
Chris Craikf6829a02015-03-10 10:28:59 -070053 * <p>Display lists can only be replayed using a {@link DisplayListCanvas}. They are not
John Reckf666ad72014-03-14 16:24:57 -070054 * supported in software. Always make sure that the {@link android.graphics.Canvas}
55 * you are using to render a display list is hardware accelerated using
56 * {@link android.graphics.Canvas#isHardwareAccelerated()}.</p>
57 *
58 * <h3>Creating a display list</h3>
59 * <pre class="prettyprint">
Stan Iliev45faba52016-06-28 13:33:15 -040060 * ThreadedRenderer renderer = myView.getThreadedRenderer();
John Reckf666ad72014-03-14 16:24:57 -070061 * if (renderer != null) {
62 * DisplayList displayList = renderer.createDisplayList();
Chris Craikf6829a02015-03-10 10:28:59 -070063 * DisplayListCanvas canvas = displayList.start(width, height);
John Reckf666ad72014-03-14 16:24:57 -070064 * try {
65 * // Draw onto the canvas
66 * // For instance: canvas.drawBitmap(...);
67 * } finally {
68 * displayList.end();
69 * }
70 * }
71 * </pre>
72 *
73 * <h3>Rendering a display list on a View</h3>
74 * <pre class="prettyprint">
75 * protected void onDraw(Canvas canvas) {
76 * if (canvas.isHardwareAccelerated()) {
Chris Craikf6829a02015-03-10 10:28:59 -070077 * DisplayListCanvas displayListCanvas = (DisplayListCanvas) canvas;
78 * displayListCanvas.drawDisplayList(mDisplayList);
John Reckf666ad72014-03-14 16:24:57 -070079 * }
80 * }
81 * </pre>
82 *
83 * <h3>Releasing resources</h3>
84 * <p>This step is not mandatory but recommended if you want to release resources
85 * held by a display list as soon as possible.</p>
86 * <pre class="prettyprint">
87 * // Mark this display list invalid, it cannot be used for drawing anymore,
88 * // and release resources held by this display list
89 * displayList.clear();
90 * </pre>
91 *
92 * <h3>Properties</h3>
93 * <p>In addition, a display list offers several properties, such as
94 * {@link #setScaleX(float)} or {@link #setLeft(int)}, that can be used to affect all
95 * the drawing commands recorded within. For instance, these properties can be used
96 * to move around a large number of images without re-issuing all the individual
97 * <code>drawBitmap()</code> calls.</p>
98 *
99 * <pre class="prettyprint">
100 * private void createDisplayList() {
101 * mDisplayList = DisplayList.create("MyDisplayList");
Chris Craikf6829a02015-03-10 10:28:59 -0700102 * DisplayListCanvas canvas = mDisplayList.start(width, height);
John Reckf666ad72014-03-14 16:24:57 -0700103 * try {
104 * for (Bitmap b : mBitmaps) {
105 * canvas.drawBitmap(b, 0.0f, 0.0f, null);
106 * canvas.translate(0.0f, b.getHeight());
107 * }
108 * } finally {
109 * displayList.end();
110 * }
111 * }
112 *
113 * protected void onDraw(Canvas canvas) {
114 * if (canvas.isHardwareAccelerated()) {
Chris Craikf6829a02015-03-10 10:28:59 -0700115 * DisplayListCanvas displayListCanvas = (DisplayListCanvas) canvas;
116 * displayListCanvas.drawDisplayList(mDisplayList);
John Reckf666ad72014-03-14 16:24:57 -0700117 * }
118 * }
119 *
120 * private void moveContentBy(int x) {
121 * // This will move all the bitmaps recorded inside the display list
122 * // by x pixels to the right and redraw this view. All the commands
123 * // recorded in createDisplayList() won't be re-issued, only onDraw()
124 * // will be invoked and will execute very quickly
125 * mDisplayList.offsetLeftAndRight(x);
126 * invalidate();
127 * }
128 * </pre>
129 *
130 * <h3>Threading</h3>
131 * <p>Display lists must be created on and manipulated from the UI thread only.</p>
132 *
133 * @hide
134 */
135public class RenderNode {
John Reckf666ad72014-03-14 16:24:57 -0700136
John Reckb99fff52016-11-16 15:21:57 -0800137 // Use a Holder to allow static initialization in the boot image.
138 private static class NoImagePreloadHolder {
139 public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry(
140 RenderNode.class.getClassLoader(), nGetNativeFinalizer(), 1024);
141 }
142
John Reck119907c2014-08-14 09:02:01 -0700143 // Do not access directly unless you are ThreadedRenderer
John Reckb99fff52016-11-16 15:21:57 -0800144 final long mNativeRenderNode;
John Reck119907c2014-08-14 09:02:01 -0700145 private final View mOwningView;
John Reckf666ad72014-03-14 16:24:57 -0700146
John Reck119907c2014-08-14 09:02:01 -0700147 private RenderNode(String name, View owningView) {
John Reck8de65a82014-04-09 15:23:38 -0700148 mNativeRenderNode = nCreate(name);
John Reckb99fff52016-11-16 15:21:57 -0800149 NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mNativeRenderNode);
John Reck119907c2014-08-14 09:02:01 -0700150 mOwningView = owningView;
John Reckf666ad72014-03-14 16:24:57 -0700151 }
152
153 /**
John Recke45b1fd2014-04-15 09:50:16 -0700154 * @see RenderNode#adopt(long)
155 */
156 private RenderNode(long nativePtr) {
157 mNativeRenderNode = nativePtr;
John Reckb99fff52016-11-16 15:21:57 -0800158 NoImagePreloadHolder.sRegistry.registerNativeAllocation(this, mNativeRenderNode);
John Reck119907c2014-08-14 09:02:01 -0700159 mOwningView = null;
John Recke45b1fd2014-04-15 09:50:16 -0700160 }
161
162 /**
John Reck3acf03822016-11-02 11:14:47 -0700163 * Immediately destroys the RenderNode
164 * Only suitable for testing/benchmarking where waiting for the GC/finalizer
165 * is not feasible.
166 */
167 public void destroy() {
John Reckb99fff52016-11-16 15:21:57 -0800168 // TODO: Removed temporarily
John Reck3acf03822016-11-02 11:14:47 -0700169 }
170
171 /**
Chris Craik9a347f12014-06-27 17:23:47 -0700172 * Creates a new RenderNode that can be used to record batches of
173 * drawing operations, and store / apply render properties when drawn.
John Reckf666ad72014-03-14 16:24:57 -0700174 *
Chris Craik9a347f12014-06-27 17:23:47 -0700175 * @param name The name of the RenderNode, used for debugging purpose. May be null.
John Reckf666ad72014-03-14 16:24:57 -0700176 *
Chris Craik9a347f12014-06-27 17:23:47 -0700177 * @return A new RenderNode.
John Reckf666ad72014-03-14 16:24:57 -0700178 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100179 @UnsupportedAppUsage
John Reck119907c2014-08-14 09:02:01 -0700180 public static RenderNode create(String name, @Nullable View owningView) {
181 return new RenderNode(name, owningView);
John Reckf666ad72014-03-14 16:24:57 -0700182 }
183
184 /**
John Recke45b1fd2014-04-15 09:50:16 -0700185 * Adopts an existing native render node.
186 *
187 * Note: This will *NOT* incRef() on the native object, however it will
188 * decRef() when it is destroyed. The caller should have already incRef'd it
189 */
190 public static RenderNode adopt(long nativePtr) {
191 return new RenderNode(nativePtr);
192 }
193
John Reck3acf03822016-11-02 11:14:47 -0700194 /**
195 * Enable callbacks for position changes.
196 */
197 public void requestPositionUpdates(SurfaceView view) {
198 nRequestPositionUpdates(mNativeRenderNode, view);
199 }
200
John Recke45b1fd2014-04-15 09:50:16 -0700201
202 /**
Chris Craik49e6c732014-03-31 12:34:11 -0700203 * Starts recording a display list for the render node. All
204 * operations performed on the returned canvas are recorded and
205 * stored in this display list.
John Reckf666ad72014-03-14 16:24:57 -0700206 *
Chris Craik49e6c732014-03-31 12:34:11 -0700207 * Calling this method will mark the render node invalid until
Chris Craikf6829a02015-03-10 10:28:59 -0700208 * {@link #end(DisplayListCanvas)} is called.
Chris Craik49e6c732014-03-31 12:34:11 -0700209 * Only valid render nodes can be replayed.
John Reckf666ad72014-03-14 16:24:57 -0700210 *
Chris Craik49e6c732014-03-31 12:34:11 -0700211 * @param width The width of the recording viewport
212 * @param height The height of the recording viewport
John Reckf666ad72014-03-14 16:24:57 -0700213 *
214 * @return A canvas to record drawing operations.
215 *
Chris Craikf6829a02015-03-10 10:28:59 -0700216 * @see #end(DisplayListCanvas)
John Reckf666ad72014-03-14 16:24:57 -0700217 * @see #isValid()
218 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100219 @UnsupportedAppUsage
Chris Craikf6829a02015-03-10 10:28:59 -0700220 public DisplayListCanvas start(int width, int height) {
Derek Sollenbergercc882b62015-07-09 15:51:20 -0400221 return DisplayListCanvas.obtain(this, width, height);
John Reckf666ad72014-03-14 16:24:57 -0700222 }
223
224 /**
225 * Ends the recording for this display list. A display list cannot be
226 * replayed if recording is not finished. Calling this method marks
227 * the display list valid and {@link #isValid()} will return true.
228 *
229 * @see #start(int, int)
230 * @see #isValid()
231 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100232 @UnsupportedAppUsage
Chris Craik3891f3a2015-04-02 15:28:08 -0700233 public void end(DisplayListCanvas canvas) {
Chris Craik003cc3d2015-10-16 10:24:55 -0700234 long displayList = canvas.finishRecording();
235 nSetDisplayList(mNativeRenderNode, displayList);
John Reckf666ad72014-03-14 16:24:57 -0700236 canvas.recycle();
John Reckf666ad72014-03-14 16:24:57 -0700237 }
238
239 /**
240 * Reset native resources. This is called when cleaning up the state of display lists
241 * during destruction of hardware resources, to ensure that we do not hold onto
242 * obsolete resources after related resources are gone.
John Reckf666ad72014-03-14 16:24:57 -0700243 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100244 @UnsupportedAppUsage
Chris Craik003cc3d2015-10-16 10:24:55 -0700245 public void discardDisplayList() {
Chris Craik003cc3d2015-10-16 10:24:55 -0700246 nSetDisplayList(mNativeRenderNode, 0);
John Reckf666ad72014-03-14 16:24:57 -0700247 }
248
John Reckf666ad72014-03-14 16:24:57 -0700249 /**
Chris Craikdf0c4312014-03-28 16:55:08 -0700250 * Returns whether the RenderNode's display list content is currently usable.
251 * If this returns false, the display list should be re-recorded prior to replaying it.
John Reckf666ad72014-03-14 16:24:57 -0700252 *
253 * @return boolean true if the display list is able to be replayed, false otherwise.
254 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100255 @UnsupportedAppUsage
John Reck2de950d2017-01-25 10:58:30 -0800256 public boolean isValid() {
257 return nIsValid(mNativeRenderNode);
258 }
John Reckf666ad72014-03-14 16:24:57 -0700259
260 long getNativeDisplayList() {
John Reck2de950d2017-01-25 10:58:30 -0800261 if (!isValid()) {
John Reckf666ad72014-03-14 16:24:57 -0700262 throw new IllegalStateException("The display list is not valid.");
263 }
John Reck8de65a82014-04-09 15:23:38 -0700264 return mNativeRenderNode;
John Reckf666ad72014-03-14 16:24:57 -0700265 }
266
267 ///////////////////////////////////////////////////////////////////////////
Chris Craik49e6c732014-03-31 12:34:11 -0700268 // Matrix manipulation
269 ///////////////////////////////////////////////////////////////////////////
270
271 public boolean hasIdentityMatrix() {
John Reck8de65a82014-04-09 15:23:38 -0700272 return nHasIdentityMatrix(mNativeRenderNode);
Chris Craik49e6c732014-03-31 12:34:11 -0700273 }
274
275 public void getMatrix(@NonNull Matrix outMatrix) {
John Reck8de65a82014-04-09 15:23:38 -0700276 nGetTransformMatrix(mNativeRenderNode, outMatrix.native_instance);
Chris Craik49e6c732014-03-31 12:34:11 -0700277 }
278
279 public void getInverseMatrix(@NonNull Matrix outMatrix) {
John Reck8de65a82014-04-09 15:23:38 -0700280 nGetInverseTransformMatrix(mNativeRenderNode, outMatrix.native_instance);
Chris Craik49e6c732014-03-31 12:34:11 -0700281 }
282
283 ///////////////////////////////////////////////////////////////////////////
284 // RenderProperty Setters
John Reckf666ad72014-03-14 16:24:57 -0700285 ///////////////////////////////////////////////////////////////////////////
286
John Reck25fbb3f2014-06-12 13:46:45 -0700287 public boolean setLayerType(int layerType) {
288 return nSetLayerType(mNativeRenderNode, layerType);
289 }
290
sergeyv342a7e62016-03-24 16:06:46 -0700291 public boolean setLayerPaint(@Nullable Paint paint) {
Derek Sollenbergerdfba4d32014-09-02 15:42:54 -0400292 return nSetLayerPaint(mNativeRenderNode, paint != null ? paint.getNativeInstance() : 0);
John Reckf666ad72014-03-14 16:24:57 -0700293 }
294
Chris Craika753f4c2014-07-24 12:39:17 -0700295 public boolean setClipBounds(@Nullable Rect rect) {
296 if (rect == null) {
297 return nSetClipBoundsEmpty(mNativeRenderNode);
298 } else {
299 return nSetClipBounds(mNativeRenderNode, rect.left, rect.top, rect.right, rect.bottom);
300 }
301 }
302
John Reckf666ad72014-03-14 16:24:57 -0700303 /**
Chris Craik49e6c732014-03-31 12:34:11 -0700304 * Set whether the Render node should clip itself to its bounds. This property is controlled by
John Reckf666ad72014-03-14 16:24:57 -0700305 * the view's parent.
306 *
307 * @param clipToBounds true if the display list should clip to its bounds
308 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100309 @UnsupportedAppUsage
John Reck79c7de72014-05-23 10:33:31 -0700310 public boolean setClipToBounds(boolean clipToBounds) {
311 return nSetClipToBounds(mNativeRenderNode, clipToBounds);
John Reckf666ad72014-03-14 16:24:57 -0700312 }
313
314 /**
John Reckf666ad72014-03-14 16:24:57 -0700315 * Sets whether the display list should be drawn immediately after the
Chris Craik49e6c732014-03-31 12:34:11 -0700316 * closest ancestor display list containing a projection receiver.
John Reckf666ad72014-03-14 16:24:57 -0700317 *
318 * @param shouldProject true if the display list should be projected onto a
319 * containing volume.
320 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100321 @UnsupportedAppUsage
John Reck79c7de72014-05-23 10:33:31 -0700322 public boolean setProjectBackwards(boolean shouldProject) {
323 return nSetProjectBackwards(mNativeRenderNode, shouldProject);
John Reckf666ad72014-03-14 16:24:57 -0700324 }
325
326 /**
327 * Sets whether the display list is a projection receiver - that its parent
328 * DisplayList should draw any descendent DisplayLists with
329 * ProjectBackwards=true directly on top of it. Default value is false.
330 */
John Reck79c7de72014-05-23 10:33:31 -0700331 public boolean setProjectionReceiver(boolean shouldRecieve) {
332 return nSetProjectionReceiver(mNativeRenderNode, shouldRecieve);
John Reckf666ad72014-03-14 16:24:57 -0700333 }
334
335 /**
336 * Sets the outline, defining the shape that casts a shadow, and the path to
337 * be clipped if setClipToOutline is set.
338 *
Chris Craikb49f4462014-03-20 12:44:20 -0700339 * Deep copies the data into native to simplify reference ownership.
John Reckf666ad72014-03-14 16:24:57 -0700340 */
Chris Craik136d1af2016-04-04 13:40:39 -0700341 public boolean setOutline(@Nullable Outline outline) {
Chris Craik06451282014-07-21 10:25:54 -0700342 if (outline == null) {
343 return nSetOutlineNone(mNativeRenderNode);
Chris Craikb49f4462014-03-20 12:44:20 -0700344 }
Chris Craik136d1af2016-04-04 13:40:39 -0700345
346 switch(outline.mMode) {
347 case Outline.MODE_EMPTY:
348 return nSetOutlineEmpty(mNativeRenderNode);
349 case Outline.MODE_ROUND_RECT:
350 return nSetOutlineRoundRect(mNativeRenderNode, outline.mRect.left, outline.mRect.top,
351 outline.mRect.right, outline.mRect.bottom, outline.mRadius, outline.mAlpha);
352 case Outline.MODE_CONVEX_PATH:
353 return nSetOutlineConvexPath(mNativeRenderNode, outline.mPath.mNativePath,
354 outline.mAlpha);
355 }
356
John Reck79c7de72014-05-23 10:33:31 -0700357 throw new IllegalArgumentException("Unrecognized outline?");
John Reckf666ad72014-03-14 16:24:57 -0700358 }
359
Chris Craik5c75c522014-09-05 14:08:08 -0700360 public boolean hasShadow() {
361 return nHasShadow(mNativeRenderNode);
362 }
363
John Reckd8be4a02017-11-17 15:06:24 -0800364 /** setSpotShadowColor */
365 public boolean setSpotShadowColor(int color) {
366 return nSetSpotShadowColor(mNativeRenderNode, color);
367 }
368
369 /** setAmbientShadowColor */
370 public boolean setAmbientShadowColor(int color) {
371 return nSetAmbientShadowColor(mNativeRenderNode, color);
372 }
373
374 /** getSpotShadowColor */
375 public int getSpotShadowColor() {
376 return nGetSpotShadowColor(mNativeRenderNode);
377 }
378
379 /** getAmbientShadowColor */
380 public int getAmbientShadowColor() {
381 return nGetAmbientShadowColor(mNativeRenderNode);
John Reck3c0369b2017-11-13 16:47:35 -0800382 }
383
John Reckf666ad72014-03-14 16:24:57 -0700384 /**
385 * Enables or disables clipping to the outline.
386 *
387 * @param clipToOutline true if clipping to the outline.
388 */
John Reck79c7de72014-05-23 10:33:31 -0700389 public boolean setClipToOutline(boolean clipToOutline) {
390 return nSetClipToOutline(mNativeRenderNode, clipToOutline);
John Reckf666ad72014-03-14 16:24:57 -0700391 }
392
Chris Craikdeeda3d2014-05-05 19:09:33 -0700393 public boolean getClipToOutline() {
394 return nGetClipToOutline(mNativeRenderNode);
395 }
396
John Reckf666ad72014-03-14 16:24:57 -0700397 /**
Chris Craik8c271ca2014-03-25 10:33:01 -0700398 * Controls the RenderNode's circular reveal clip.
399 */
Chris Craikaf4d04c2014-07-29 12:50:14 -0700400 public boolean setRevealClip(boolean shouldClip,
Chris Craik8c271ca2014-03-25 10:33:01 -0700401 float x, float y, float radius) {
Chris Craikaf4d04c2014-07-29 12:50:14 -0700402 return nSetRevealClip(mNativeRenderNode, shouldClip, x, y, radius);
Chris Craik8c271ca2014-03-25 10:33:01 -0700403 }
404
405 /**
John Reckf666ad72014-03-14 16:24:57 -0700406 * Set the static matrix on the display list. The specified matrix is combined with other
407 * transforms (such as {@link #setScaleX(float)}, {@link #setRotation(float)}, etc.)
408 *
409 * @param matrix A transform matrix to apply to this display list
John Reckf666ad72014-03-14 16:24:57 -0700410 */
John Reck79c7de72014-05-23 10:33:31 -0700411 public boolean setStaticMatrix(Matrix matrix) {
412 return nSetStaticMatrix(mNativeRenderNode, matrix.native_instance);
John Reckf666ad72014-03-14 16:24:57 -0700413 }
414
415 /**
416 * Set the Animation matrix on the display list. This matrix exists if an Animation is
417 * currently playing on a View, and is set on the display list during at draw() time. When
418 * the Animation finishes, the matrix should be cleared by sending <code>null</code>
419 * for the matrix parameter.
420 *
421 * @param matrix The matrix, null indicates that the matrix should be cleared.
John Reckf666ad72014-03-14 16:24:57 -0700422 */
John Reck79c7de72014-05-23 10:33:31 -0700423 public boolean setAnimationMatrix(Matrix matrix) {
424 return nSetAnimationMatrix(mNativeRenderNode,
John Reckf666ad72014-03-14 16:24:57 -0700425 (matrix != null) ? matrix.native_instance : 0);
426 }
427
428 /**
429 * Sets the translucency level for the display list.
430 *
431 * @param alpha The translucency of the display list, must be a value between 0.0f and 1.0f
432 *
433 * @see View#setAlpha(float)
434 * @see #getAlpha()
435 */
John Reck79c7de72014-05-23 10:33:31 -0700436 public boolean setAlpha(float alpha) {
437 return nSetAlpha(mNativeRenderNode, alpha);
John Reckf666ad72014-03-14 16:24:57 -0700438 }
439
440 /**
441 * Returns the translucency level of this display list.
442 *
443 * @return A value between 0.0f and 1.0f
444 *
445 * @see #setAlpha(float)
446 */
447 public float getAlpha() {
John Reck8de65a82014-04-09 15:23:38 -0700448 return nGetAlpha(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700449 }
450
451 /**
452 * Sets whether the display list renders content which overlaps. Non-overlapping rendering
453 * can use a fast path for alpha that avoids rendering to an offscreen buffer. By default
454 * display lists consider they do not have overlapping content.
455 *
456 * @param hasOverlappingRendering False if the content is guaranteed to be non-overlapping,
457 * true otherwise.
458 *
459 * @see android.view.View#hasOverlappingRendering()
460 * @see #hasOverlappingRendering()
461 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100462 @UnsupportedAppUsage
John Reck79c7de72014-05-23 10:33:31 -0700463 public boolean setHasOverlappingRendering(boolean hasOverlappingRendering) {
464 return nSetHasOverlappingRendering(mNativeRenderNode, hasOverlappingRendering);
John Reckf666ad72014-03-14 16:24:57 -0700465 }
466
467 /**
468 * Indicates whether the content of this display list overlaps.
469 *
470 * @return True if this display list renders content which overlaps, false otherwise.
471 *
472 * @see #setHasOverlappingRendering(boolean)
473 */
474 public boolean hasOverlappingRendering() {
475 //noinspection SimplifiableIfStatement
John Reck8de65a82014-04-09 15:23:38 -0700476 return nHasOverlappingRendering(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700477 }
478
John Reck79c7de72014-05-23 10:33:31 -0700479 public boolean setElevation(float lift) {
480 return nSetElevation(mNativeRenderNode, lift);
Chris Craikcc39e162014-04-25 18:34:11 -0700481 }
482
483 public float getElevation() {
484 return nGetElevation(mNativeRenderNode);
485 }
486
John Reckf666ad72014-03-14 16:24:57 -0700487 /**
488 * Sets the translation value for the display list on the X axis.
489 *
490 * @param translationX The X axis translation value of the display list, in pixels
491 *
492 * @see View#setTranslationX(float)
493 * @see #getTranslationX()
494 */
John Reck79c7de72014-05-23 10:33:31 -0700495 public boolean setTranslationX(float translationX) {
496 return nSetTranslationX(mNativeRenderNode, translationX);
John Reckf666ad72014-03-14 16:24:57 -0700497 }
498
499 /**
500 * Returns the translation value for this display list on the X axis, in pixels.
501 *
502 * @see #setTranslationX(float)
503 */
504 public float getTranslationX() {
John Reck8de65a82014-04-09 15:23:38 -0700505 return nGetTranslationX(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700506 }
507
508 /**
509 * Sets the translation value for the display list on the Y axis.
510 *
511 * @param translationY The Y axis translation value of the display list, in pixels
512 *
513 * @see View#setTranslationY(float)
514 * @see #getTranslationY()
515 */
John Reck79c7de72014-05-23 10:33:31 -0700516 public boolean setTranslationY(float translationY) {
517 return nSetTranslationY(mNativeRenderNode, translationY);
John Reckf666ad72014-03-14 16:24:57 -0700518 }
519
520 /**
521 * Returns the translation value for this display list on the Y axis, in pixels.
522 *
523 * @see #setTranslationY(float)
524 */
525 public float getTranslationY() {
John Reck8de65a82014-04-09 15:23:38 -0700526 return nGetTranslationY(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700527 }
528
529 /**
530 * Sets the translation value for the display list on the Z axis.
531 *
532 * @see View#setTranslationZ(float)
533 * @see #getTranslationZ()
534 */
John Reck79c7de72014-05-23 10:33:31 -0700535 public boolean setTranslationZ(float translationZ) {
536 return nSetTranslationZ(mNativeRenderNode, translationZ);
John Reckf666ad72014-03-14 16:24:57 -0700537 }
538
539 /**
540 * Returns the translation value for this display list on the Z axis.
541 *
542 * @see #setTranslationZ(float)
543 */
544 public float getTranslationZ() {
John Reck8de65a82014-04-09 15:23:38 -0700545 return nGetTranslationZ(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700546 }
547
548 /**
549 * Sets the rotation value for the display list around the Z axis.
550 *
551 * @param rotation The rotation value of the display list, in degrees
552 *
553 * @see View#setRotation(float)
554 * @see #getRotation()
555 */
John Reck79c7de72014-05-23 10:33:31 -0700556 public boolean setRotation(float rotation) {
557 return nSetRotation(mNativeRenderNode, rotation);
John Reckf666ad72014-03-14 16:24:57 -0700558 }
559
560 /**
561 * Returns the rotation value for this display list around the Z axis, in degrees.
562 *
563 * @see #setRotation(float)
564 */
565 public float getRotation() {
John Reck8de65a82014-04-09 15:23:38 -0700566 return nGetRotation(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700567 }
568
569 /**
570 * Sets the rotation value for the display list around the X axis.
571 *
572 * @param rotationX The rotation value of the display list, in degrees
573 *
574 * @see View#setRotationX(float)
575 * @see #getRotationX()
576 */
John Reck79c7de72014-05-23 10:33:31 -0700577 public boolean setRotationX(float rotationX) {
578 return nSetRotationX(mNativeRenderNode, rotationX);
John Reckf666ad72014-03-14 16:24:57 -0700579 }
580
581 /**
582 * Returns the rotation value for this display list around the X axis, in degrees.
583 *
584 * @see #setRotationX(float)
585 */
586 public float getRotationX() {
John Reck8de65a82014-04-09 15:23:38 -0700587 return nGetRotationX(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700588 }
589
590 /**
591 * Sets the rotation value for the display list around the Y axis.
592 *
593 * @param rotationY The rotation value of the display list, in degrees
594 *
595 * @see View#setRotationY(float)
596 * @see #getRotationY()
597 */
John Reck79c7de72014-05-23 10:33:31 -0700598 public boolean setRotationY(float rotationY) {
599 return nSetRotationY(mNativeRenderNode, rotationY);
John Reckf666ad72014-03-14 16:24:57 -0700600 }
601
602 /**
603 * Returns the rotation value for this display list around the Y axis, in degrees.
604 *
605 * @see #setRotationY(float)
606 */
607 public float getRotationY() {
John Reck8de65a82014-04-09 15:23:38 -0700608 return nGetRotationY(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700609 }
610
611 /**
612 * Sets the scale value for the display list on the X axis.
613 *
614 * @param scaleX The scale value of the display list
615 *
616 * @see View#setScaleX(float)
617 * @see #getScaleX()
618 */
John Reck79c7de72014-05-23 10:33:31 -0700619 public boolean setScaleX(float scaleX) {
620 return nSetScaleX(mNativeRenderNode, scaleX);
John Reckf666ad72014-03-14 16:24:57 -0700621 }
622
623 /**
624 * Returns the scale value for this display list on the X axis.
625 *
626 * @see #setScaleX(float)
627 */
628 public float getScaleX() {
John Reck8de65a82014-04-09 15:23:38 -0700629 return nGetScaleX(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700630 }
631
632 /**
633 * Sets the scale value for the display list on the Y axis.
634 *
635 * @param scaleY The scale value of the display list
636 *
637 * @see View#setScaleY(float)
638 * @see #getScaleY()
639 */
John Reck79c7de72014-05-23 10:33:31 -0700640 public boolean setScaleY(float scaleY) {
641 return nSetScaleY(mNativeRenderNode, scaleY);
John Reckf666ad72014-03-14 16:24:57 -0700642 }
643
644 /**
645 * Returns the scale value for this display list on the Y axis.
646 *
647 * @see #setScaleY(float)
648 */
649 public float getScaleY() {
John Reck8de65a82014-04-09 15:23:38 -0700650 return nGetScaleY(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700651 }
652
653 /**
John Reckf666ad72014-03-14 16:24:57 -0700654 * Sets the pivot value for the display list on the X axis
655 *
656 * @param pivotX The pivot value of the display list on the X axis, in pixels
657 *
658 * @see View#setPivotX(float)
659 * @see #getPivotX()
660 */
John Reck79c7de72014-05-23 10:33:31 -0700661 public boolean setPivotX(float pivotX) {
662 return nSetPivotX(mNativeRenderNode, pivotX);
John Reckf666ad72014-03-14 16:24:57 -0700663 }
664
665 /**
666 * Returns the pivot value for this display list on the X axis, in pixels.
667 *
668 * @see #setPivotX(float)
669 */
670 public float getPivotX() {
John Reck8de65a82014-04-09 15:23:38 -0700671 return nGetPivotX(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700672 }
673
674 /**
675 * Sets the pivot value for the display list on the Y axis
676 *
677 * @param pivotY The pivot value of the display list on the Y axis, in pixels
678 *
679 * @see View#setPivotY(float)
680 * @see #getPivotY()
681 */
John Reck79c7de72014-05-23 10:33:31 -0700682 public boolean setPivotY(float pivotY) {
683 return nSetPivotY(mNativeRenderNode, pivotY);
John Reckf666ad72014-03-14 16:24:57 -0700684 }
685
686 /**
687 * Returns the pivot value for this display list on the Y axis, in pixels.
688 *
689 * @see #setPivotY(float)
690 */
691 public float getPivotY() {
John Reck8de65a82014-04-09 15:23:38 -0700692 return nGetPivotY(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700693 }
694
Chris Craik49e6c732014-03-31 12:34:11 -0700695 public boolean isPivotExplicitlySet() {
John Reck8de65a82014-04-09 15:23:38 -0700696 return nIsPivotExplicitlySet(mNativeRenderNode);
Chris Craik49e6c732014-03-31 12:34:11 -0700697 }
698
John Reck8686e1f2018-03-21 16:31:21 -0700699 /** lint */
700 public boolean resetPivot() {
701 return nResetPivot(mNativeRenderNode);
702 }
703
John Reckf666ad72014-03-14 16:24:57 -0700704 /**
705 * Sets the camera distance for the display list. Refer to
706 * {@link View#setCameraDistance(float)} for more information on how to
707 * use this property.
708 *
709 * @param distance The distance in Z of the camera of the display list
710 *
711 * @see View#setCameraDistance(float)
712 * @see #getCameraDistance()
713 */
John Reck79c7de72014-05-23 10:33:31 -0700714 public boolean setCameraDistance(float distance) {
715 return nSetCameraDistance(mNativeRenderNode, distance);
John Reckf666ad72014-03-14 16:24:57 -0700716 }
717
718 /**
719 * Returns the distance in Z of the camera of the display list.
720 *
721 * @see #setCameraDistance(float)
722 */
723 public float getCameraDistance() {
John Reck8de65a82014-04-09 15:23:38 -0700724 return nGetCameraDistance(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700725 }
726
727 /**
728 * Sets the left position for the display list.
729 *
730 * @param left The left position, in pixels, of the display list
731 *
732 * @see View#setLeft(int)
John Reckf666ad72014-03-14 16:24:57 -0700733 */
John Reck79c7de72014-05-23 10:33:31 -0700734 public boolean setLeft(int left) {
735 return nSetLeft(mNativeRenderNode, left);
John Reckf666ad72014-03-14 16:24:57 -0700736 }
737
738 /**
John Reckf666ad72014-03-14 16:24:57 -0700739 * Sets the top position for the display list.
740 *
741 * @param top The top position, in pixels, of the display list
742 *
743 * @see View#setTop(int)
John Reckf666ad72014-03-14 16:24:57 -0700744 */
John Reck79c7de72014-05-23 10:33:31 -0700745 public boolean setTop(int top) {
746 return nSetTop(mNativeRenderNode, top);
John Reckf666ad72014-03-14 16:24:57 -0700747 }
748
749 /**
John Reckf666ad72014-03-14 16:24:57 -0700750 * Sets the right position for the display list.
751 *
752 * @param right The right position, in pixels, of the display list
753 *
754 * @see View#setRight(int)
John Reckf666ad72014-03-14 16:24:57 -0700755 */
John Reck79c7de72014-05-23 10:33:31 -0700756 public boolean setRight(int right) {
757 return nSetRight(mNativeRenderNode, right);
John Reckf666ad72014-03-14 16:24:57 -0700758 }
759
760 /**
John Reckf666ad72014-03-14 16:24:57 -0700761 * Sets the bottom position for the display list.
762 *
763 * @param bottom The bottom position, in pixels, of the display list
764 *
765 * @see View#setBottom(int)
John Reckf666ad72014-03-14 16:24:57 -0700766 */
John Reck79c7de72014-05-23 10:33:31 -0700767 public boolean setBottom(int bottom) {
768 return nSetBottom(mNativeRenderNode, bottom);
John Reckf666ad72014-03-14 16:24:57 -0700769 }
770
771 /**
John Reckf666ad72014-03-14 16:24:57 -0700772 * Sets the left and top positions for the display list
773 *
774 * @param left The left position of the display list, in pixels
775 * @param top The top position of the display list, in pixels
776 * @param right The right position of the display list, in pixels
777 * @param bottom The bottom position of the display list, in pixels
778 *
779 * @see View#setLeft(int)
780 * @see View#setTop(int)
781 * @see View#setRight(int)
782 * @see View#setBottom(int)
783 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100784 @UnsupportedAppUsage
John Reck79c7de72014-05-23 10:33:31 -0700785 public boolean setLeftTopRightBottom(int left, int top, int right, int bottom) {
786 return nSetLeftTopRightBottom(mNativeRenderNode, left, top, right, bottom);
John Reckf666ad72014-03-14 16:24:57 -0700787 }
788
789 /**
790 * Offsets the left and right positions for the display list
791 *
792 * @param offset The amount that the left and right positions of the display
793 * list are offset, in pixels
794 *
795 * @see View#offsetLeftAndRight(int)
796 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100797 @UnsupportedAppUsage
Chris Craika753f4c2014-07-24 12:39:17 -0700798 public boolean offsetLeftAndRight(int offset) {
John Reck79c7de72014-05-23 10:33:31 -0700799 return nOffsetLeftAndRight(mNativeRenderNode, offset);
John Reckf666ad72014-03-14 16:24:57 -0700800 }
801
802 /**
803 * Offsets the top and bottom values for the display list
804 *
805 * @param offset The amount that the top and bottom positions of the display
806 * list are offset, in pixels
807 *
808 * @see View#offsetTopAndBottom(int)
809 */
Chris Craika753f4c2014-07-24 12:39:17 -0700810 public boolean offsetTopAndBottom(int offset) {
John Reck79c7de72014-05-23 10:33:31 -0700811 return nOffsetTopAndBottom(mNativeRenderNode, offset);
John Reckf666ad72014-03-14 16:24:57 -0700812 }
813
814 /**
815 * Outputs the display list to the log. This method exists for use by
816 * tools to output display lists for selected nodes to the log.
John Reckf666ad72014-03-14 16:24:57 -0700817 */
Mathew Inwoode5ad5982018-08-17 15:07:52 +0100818 @UnsupportedAppUsage
John Reckf666ad72014-03-14 16:24:57 -0700819 public void output() {
John Reck8de65a82014-04-09 15:23:38 -0700820 nOutput(mNativeRenderNode);
John Reckf666ad72014-03-14 16:24:57 -0700821 }
822
John Reckfe5e7b72014-05-23 17:42:28 -0700823 /**
824 * Gets the size of the DisplayList for debug purposes.
825 */
826 public int getDebugSize() {
827 return nGetDebugSize(mNativeRenderNode);
828 }
829
John Reckf666ad72014-03-14 16:24:57 -0700830 ///////////////////////////////////////////////////////////////////////////
John Recke45b1fd2014-04-15 09:50:16 -0700831 // Animations
832 ///////////////////////////////////////////////////////////////////////////
833
834 public void addAnimator(RenderNodeAnimator animator) {
John Reck119907c2014-08-14 09:02:01 -0700835 if (mOwningView == null || mOwningView.mAttachInfo == null) {
836 throw new IllegalStateException("Cannot start this animator on a detached view!");
837 }
John Recke45b1fd2014-04-15 09:50:16 -0700838 nAddAnimator(mNativeRenderNode, animator.getNativeAnimator());
John Reck119907c2014-08-14 09:02:01 -0700839 mOwningView.mAttachInfo.mViewRootImpl.registerAnimatingRenderNode(this);
840 }
841
Doris Liu8b083202016-02-19 21:46:06 +0000842 public boolean isAttached() {
843 return mOwningView != null && mOwningView.mAttachInfo != null;
844 }
845
Doris Liu67ce99b2016-05-17 16:50:31 -0700846 public void registerVectorDrawableAnimator(
847 AnimatedVectorDrawable.VectorDrawableAnimatorRT animatorSet) {
Doris Liu766431a2016-02-04 22:17:11 +0000848 if (mOwningView == null || mOwningView.mAttachInfo == null) {
849 throw new IllegalStateException("Cannot start this animator on a detached view!");
850 }
Doris Liu67ce99b2016-05-17 16:50:31 -0700851 mOwningView.mAttachInfo.mViewRootImpl.registerVectorDrawableAnimator(animatorSet);
Doris Liu766431a2016-02-04 22:17:11 +0000852 }
853
John Reck119907c2014-08-14 09:02:01 -0700854 public void endAllAnimators() {
855 nEndAllAnimators(mNativeRenderNode);
John Recke45b1fd2014-04-15 09:50:16 -0700856 }
857
John Recke45b1fd2014-04-15 09:50:16 -0700858 ///////////////////////////////////////////////////////////////////////////
Chris Craikfc294242016-12-13 18:10:46 -0800859 // Regular JNI methods
John Reckf666ad72014-03-14 16:24:57 -0700860 ///////////////////////////////////////////////////////////////////////////
861
John Reck2de950d2017-01-25 10:58:30 -0800862 private static native long nCreate(String name);
John Reck44b49f02016-03-25 14:29:48 -0700863
John Reck395e9b82016-08-24 13:22:37 -0700864 private static native long nGetNativeFinalizer();
John Reck8de65a82014-04-09 15:23:38 -0700865 private static native void nOutput(long renderNode);
John Reckfe5e7b72014-05-23 17:42:28 -0700866 private static native int nGetDebugSize(long renderNode);
John Reckf6481082016-02-02 15:18:23 -0800867 private static native void nRequestPositionUpdates(long renderNode, SurfaceView callback);
868
John Recke45b1fd2014-04-15 09:50:16 -0700869 // Animations
John Recke45b1fd2014-04-15 09:50:16 -0700870
871 private static native void nAddAnimator(long renderNode, long animatorPtr);
John Reck119907c2014-08-14 09:02:01 -0700872 private static native void nEndAllAnimators(long renderNode);
John Recke45b1fd2014-04-15 09:50:16 -0700873
Chris Craikfc294242016-12-13 18:10:46 -0800874
John Recke45b1fd2014-04-15 09:50:16 -0700875 ///////////////////////////////////////////////////////////////////////////
Chris Craikfc294242016-12-13 18:10:46 -0800876 // @FastNative methods
877 ///////////////////////////////////////////////////////////////////////////
878
879 @FastNative
880 private static native void nSetDisplayList(long renderNode, long newData);
881
882
883 ///////////////////////////////////////////////////////////////////////////
884 // @CriticalNative methods
John Reckf666ad72014-03-14 16:24:57 -0700885 ///////////////////////////////////////////////////////////////////////////
886
John Reck2de950d2017-01-25 10:58:30 -0800887 @CriticalNative
888 private static native boolean nIsValid(long renderNode);
889
John Reck395e9b82016-08-24 13:22:37 -0700890 // Matrix
891
Chris Craikfc294242016-12-13 18:10:46 -0800892 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700893 private static native void nGetTransformMatrix(long renderNode, long nativeMatrix);
Chris Craikfc294242016-12-13 18:10:46 -0800894 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700895 private static native void nGetInverseTransformMatrix(long renderNode, long nativeMatrix);
Chris Craikfc294242016-12-13 18:10:46 -0800896 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700897 private static native boolean nHasIdentityMatrix(long renderNode);
898
899 // Properties
900
Chris Craikfc294242016-12-13 18:10:46 -0800901 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700902 private static native boolean nOffsetTopAndBottom(long renderNode, int offset);
Chris Craikfc294242016-12-13 18:10:46 -0800903 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700904 private static native boolean nOffsetLeftAndRight(long renderNode, int offset);
Chris Craikfc294242016-12-13 18:10:46 -0800905 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700906 private static native boolean nSetLeftTopRightBottom(long renderNode, int left, int top,
907 int right, int bottom);
Chris Craikfc294242016-12-13 18:10:46 -0800908 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700909 private static native boolean nSetBottom(long renderNode, int bottom);
Chris Craikfc294242016-12-13 18:10:46 -0800910 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700911 private static native boolean nSetRight(long renderNode, int right);
Chris Craikfc294242016-12-13 18:10:46 -0800912 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700913 private static native boolean nSetTop(long renderNode, int top);
Chris Craikfc294242016-12-13 18:10:46 -0800914 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700915 private static native boolean nSetLeft(long renderNode, int left);
Chris Craikfc294242016-12-13 18:10:46 -0800916 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700917 private static native boolean nSetCameraDistance(long renderNode, float distance);
Chris Craikfc294242016-12-13 18:10:46 -0800918 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700919 private static native boolean nSetPivotY(long renderNode, float pivotY);
Chris Craikfc294242016-12-13 18:10:46 -0800920 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700921 private static native boolean nSetPivotX(long renderNode, float pivotX);
Chris Craikfc294242016-12-13 18:10:46 -0800922 @CriticalNative
John Reck8686e1f2018-03-21 16:31:21 -0700923 private static native boolean nResetPivot(long renderNode);
924 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700925 private static native boolean nSetLayerType(long renderNode, int layerType);
Chris Craikfc294242016-12-13 18:10:46 -0800926 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700927 private static native boolean nSetLayerPaint(long renderNode, long paint);
Chris Craikfc294242016-12-13 18:10:46 -0800928 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700929 private static native boolean nSetClipToBounds(long renderNode, boolean clipToBounds);
Chris Craikfc294242016-12-13 18:10:46 -0800930 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700931 private static native boolean nSetClipBounds(long renderNode, int left, int top,
932 int right, int bottom);
Chris Craikfc294242016-12-13 18:10:46 -0800933 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700934 private static native boolean nSetClipBoundsEmpty(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -0800935 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700936 private static native boolean nSetProjectBackwards(long renderNode, boolean shouldProject);
Chris Craikfc294242016-12-13 18:10:46 -0800937 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700938 private static native boolean nSetProjectionReceiver(long renderNode, boolean shouldRecieve);
Chris Craikfc294242016-12-13 18:10:46 -0800939 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700940 private static native boolean nSetOutlineRoundRect(long renderNode, int left, int top,
941 int right, int bottom, float radius, float alpha);
Chris Craikfc294242016-12-13 18:10:46 -0800942 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700943 private static native boolean nSetOutlineConvexPath(long renderNode, long nativePath,
944 float alpha);
Chris Craikfc294242016-12-13 18:10:46 -0800945 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700946 private static native boolean nSetOutlineEmpty(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -0800947 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700948 private static native boolean nSetOutlineNone(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -0800949 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700950 private static native boolean nHasShadow(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -0800951 @CriticalNative
John Reckd8be4a02017-11-17 15:06:24 -0800952 private static native boolean nSetSpotShadowColor(long renderNode, int color);
953 @CriticalNative
954 private static native boolean nSetAmbientShadowColor(long renderNode, int color);
955 @CriticalNative
956 private static native int nGetSpotShadowColor(long renderNode);
957 @CriticalNative
958 private static native int nGetAmbientShadowColor(long renderNode);
John Reck3c0369b2017-11-13 16:47:35 -0800959 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700960 private static native boolean nSetClipToOutline(long renderNode, boolean clipToOutline);
Chris Craikfc294242016-12-13 18:10:46 -0800961 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700962 private static native boolean nSetRevealClip(long renderNode,
963 boolean shouldClip, float x, float y, float radius);
Chris Craikfc294242016-12-13 18:10:46 -0800964 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700965 private static native boolean nSetAlpha(long renderNode, float alpha);
Chris Craikfc294242016-12-13 18:10:46 -0800966 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700967 private static native boolean nSetHasOverlappingRendering(long renderNode,
968 boolean hasOverlappingRendering);
Chris Craikfc294242016-12-13 18:10:46 -0800969 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700970 private static native boolean nSetElevation(long renderNode, float lift);
Chris Craikfc294242016-12-13 18:10:46 -0800971 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700972 private static native boolean nSetTranslationX(long renderNode, float translationX);
Chris Craikfc294242016-12-13 18:10:46 -0800973 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700974 private static native boolean nSetTranslationY(long renderNode, float translationY);
Chris Craikfc294242016-12-13 18:10:46 -0800975 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700976 private static native boolean nSetTranslationZ(long renderNode, float translationZ);
Chris Craikfc294242016-12-13 18:10:46 -0800977 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700978 private static native boolean nSetRotation(long renderNode, float rotation);
Chris Craikfc294242016-12-13 18:10:46 -0800979 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700980 private static native boolean nSetRotationX(long renderNode, float rotationX);
Chris Craikfc294242016-12-13 18:10:46 -0800981 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700982 private static native boolean nSetRotationY(long renderNode, float rotationY);
Chris Craikfc294242016-12-13 18:10:46 -0800983 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700984 private static native boolean nSetScaleX(long renderNode, float scaleX);
Chris Craikfc294242016-12-13 18:10:46 -0800985 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700986 private static native boolean nSetScaleY(long renderNode, float scaleY);
Chris Craikfc294242016-12-13 18:10:46 -0800987 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700988 private static native boolean nSetStaticMatrix(long renderNode, long nativeMatrix);
Chris Craikfc294242016-12-13 18:10:46 -0800989 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700990 private static native boolean nSetAnimationMatrix(long renderNode, long animationMatrix);
991
Chris Craikfc294242016-12-13 18:10:46 -0800992 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700993 private static native boolean nHasOverlappingRendering(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -0800994 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700995 private static native boolean nGetClipToOutline(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -0800996 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700997 private static native float nGetAlpha(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -0800998 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -0700999 private static native float nGetCameraDistance(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001000 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001001 private static native float nGetScaleX(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001002 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001003 private static native float nGetScaleY(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001004 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001005 private static native float nGetElevation(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001006 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001007 private static native float nGetTranslationX(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001008 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001009 private static native float nGetTranslationY(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001010 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001011 private static native float nGetTranslationZ(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001012 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001013 private static native float nGetRotation(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001014 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001015 private static native float nGetRotationX(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001016 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001017 private static native float nGetRotationY(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001018 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001019 private static native boolean nIsPivotExplicitlySet(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001020 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001021 private static native float nGetPivotX(long renderNode);
Chris Craikfc294242016-12-13 18:10:46 -08001022 @CriticalNative
John Reck395e9b82016-08-24 13:22:37 -07001023 private static native float nGetPivotY(long renderNode);
John Reckf666ad72014-03-14 16:24:57 -07001024}