| 1 | /* |
| 2 | * Copyright (C) 2015 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 | |
| 17 | #include "GraphicsJNI.h" |
| 18 | |
| 19 | #include "PathParser.h" |
| 20 | #include "VectorDrawable.h" |
| 21 | |
| 22 | #include <hwui/Paint.h> |
| 23 | |
| 24 | namespace android { |
| 25 | using namespace uirenderer; |
| 26 | using namespace uirenderer::VectorDrawable; |
| 27 | |
| 28 | /** |
| 29 | * VectorDrawable's pre-draw construction. |
| 30 | */ |
| 31 | static jlong createTree(JNIEnv*, jobject, jlong groupPtr) { |
| 32 | VectorDrawable::Group* rootGroup = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 33 | VectorDrawable::Tree* tree = new VectorDrawable::Tree(rootGroup); |
| 34 | return reinterpret_cast<jlong>(tree); |
| 35 | } |
| 36 | |
| 37 | static jlong createTreeFromCopy(JNIEnv*, jobject, jlong treePtr, jlong groupPtr) { |
| 38 | VectorDrawable::Group* rootGroup = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 39 | VectorDrawable::Tree* treeToCopy = reinterpret_cast<VectorDrawable::Tree*>(treePtr); |
| 40 | VectorDrawable::Tree* tree = new VectorDrawable::Tree(treeToCopy, rootGroup); |
| 41 | return reinterpret_cast<jlong>(tree); |
| 42 | } |
| 43 | |
| 44 | static jlong createEmptyFullPath(JNIEnv*, jobject) { |
| 45 | VectorDrawable::FullPath* newPath = new VectorDrawable::FullPath(); |
| 46 | return reinterpret_cast<jlong>(newPath); |
| 47 | } |
| 48 | |
| 49 | static jlong createFullPath(JNIEnv*, jobject, jlong srcFullPathPtr) { |
| 50 | VectorDrawable::FullPath* srcFullPath = |
| 51 | reinterpret_cast<VectorDrawable::FullPath*>(srcFullPathPtr); |
| 52 | VectorDrawable::FullPath* newPath = new VectorDrawable::FullPath(*srcFullPath); |
| 53 | return reinterpret_cast<jlong>(newPath); |
| 54 | } |
| 55 | |
| 56 | static jlong createEmptyClipPath(JNIEnv*, jobject) { |
| 57 | VectorDrawable::ClipPath* newPath = new VectorDrawable::ClipPath(); |
| 58 | return reinterpret_cast<jlong>(newPath); |
| 59 | } |
| 60 | |
| 61 | static jlong createClipPath(JNIEnv*, jobject, jlong srcClipPathPtr) { |
| 62 | VectorDrawable::ClipPath* srcClipPath = |
| 63 | reinterpret_cast<VectorDrawable::ClipPath*>(srcClipPathPtr); |
| 64 | VectorDrawable::ClipPath* newPath = new VectorDrawable::ClipPath(*srcClipPath); |
| 65 | return reinterpret_cast<jlong>(newPath); |
| 66 | } |
| 67 | |
| 68 | static jlong createEmptyGroup(JNIEnv*, jobject) { |
| 69 | VectorDrawable::Group* newGroup = new VectorDrawable::Group(); |
| 70 | return reinterpret_cast<jlong>(newGroup); |
| 71 | } |
| 72 | |
| 73 | static jlong createGroup(JNIEnv*, jobject, jlong srcGroupPtr) { |
| 74 | VectorDrawable::Group* srcGroup = reinterpret_cast<VectorDrawable::Group*>(srcGroupPtr); |
| 75 | VectorDrawable::Group* newGroup = new VectorDrawable::Group(*srcGroup); |
| 76 | return reinterpret_cast<jlong>(newGroup); |
| 77 | } |
| 78 | |
| 79 | static void setNodeName(JNIEnv* env, jobject, jlong nodePtr, jstring nameStr) { |
| 80 | VectorDrawable::Node* node = reinterpret_cast<VectorDrawable::Node*>(nodePtr); |
| 81 | const char* nodeName = env->GetStringUTFChars(nameStr, NULL); |
| 82 | node->setName(nodeName); |
| 83 | env->ReleaseStringUTFChars(nameStr, nodeName); |
| 84 | } |
| 85 | |
| 86 | static void addChild(JNIEnv*, jobject, jlong groupPtr, jlong childPtr) { |
| 87 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 88 | VectorDrawable::Node* child = reinterpret_cast<VectorDrawable::Node*>(childPtr); |
| 89 | group->addChild(child); |
| 90 | } |
| 91 | |
| 92 | static void setAllowCaching(JNIEnv*, jobject, jlong treePtr, jboolean allowCaching) { |
| 93 | VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr); |
| 94 | tree->setAllowCaching(allowCaching); |
| 95 | } |
| 96 | |
| 97 | static void setAntiAlias(JNIEnv*, jobject, jlong treePtr, jboolean aa) { |
| 98 | VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr); |
| 99 | tree->setAntiAlias(aa); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Draw |
| 104 | */ |
| 105 | static jint draw(JNIEnv* env, jobject, jlong treePtr, jlong canvasPtr, |
| 106 | jlong colorFilterPtr, jobject jrect, jboolean needsMirroring, jboolean canReuseCache) { |
| 107 | VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr); |
| 108 | Canvas* canvas = reinterpret_cast<Canvas*>(canvasPtr); |
| 109 | SkRect rect; |
| 110 | GraphicsJNI::jrect_to_rect(env, jrect, &rect); |
| 111 | SkColorFilter* colorFilter = reinterpret_cast<SkColorFilter*>(colorFilterPtr); |
| 112 | return tree->draw(canvas, colorFilter, rect, needsMirroring, canReuseCache); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Setters and getters for updating staging properties that can happen both pre-draw and post draw. |
| 117 | */ |
| 118 | static void setTreeViewportSize(JNIEnv*, jobject, jlong treePtr, |
| 119 | jfloat viewportWidth, jfloat viewportHeight) { |
| 120 | VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr); |
| 121 | tree->mutateStagingProperties()->setViewportSize(viewportWidth, viewportHeight); |
| 122 | } |
| 123 | |
| 124 | static jboolean setRootAlpha(JNIEnv*, jobject, jlong treePtr, jfloat alpha) { |
| 125 | VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr); |
| 126 | return tree->mutateStagingProperties()->setRootAlpha(alpha); |
| 127 | } |
| 128 | |
| 129 | static jfloat getRootAlpha(JNIEnv*, jobject, jlong treePtr) { |
| 130 | VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr); |
| 131 | return tree->stagingProperties().getRootAlpha(); |
| 132 | } |
| 133 | |
| 134 | static void updateFullPathPropertiesAndStrokeStyles(JNIEnv*, jobject, jlong fullPathPtr, |
| 135 | jfloat strokeWidth, jint strokeColor, jfloat strokeAlpha, jint fillColor, jfloat fillAlpha, |
| 136 | jfloat trimPathStart, jfloat trimPathEnd, jfloat trimPathOffset, jfloat strokeMiterLimit, |
| 137 | jint strokeLineCap, jint strokeLineJoin, jint fillType) { |
| 138 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 139 | fullPath->mutateStagingProperties()->updateProperties(strokeWidth, strokeColor, strokeAlpha, |
| 140 | fillColor, fillAlpha, trimPathStart, trimPathEnd, trimPathOffset, strokeMiterLimit, |
| 141 | strokeLineCap, strokeLineJoin, fillType); |
| 142 | } |
| 143 | |
| 144 | static void updateFullPathFillGradient(JNIEnv*, jobject, jlong pathPtr, jlong fillGradientPtr) { |
| 145 | VectorDrawable::FullPath* path = reinterpret_cast<VectorDrawable::FullPath*>(pathPtr); |
| 146 | SkShader* fillShader = reinterpret_cast<SkShader*>(fillGradientPtr); |
| 147 | path->mutateStagingProperties()->setFillGradient(fillShader); |
| 148 | } |
| 149 | |
| 150 | static void updateFullPathStrokeGradient(JNIEnv*, jobject, jlong pathPtr, jlong strokeGradientPtr) { |
| 151 | VectorDrawable::FullPath* path = reinterpret_cast<VectorDrawable::FullPath*>(pathPtr); |
| 152 | SkShader* strokeShader = reinterpret_cast<SkShader*>(strokeGradientPtr); |
| 153 | path->mutateStagingProperties()->setStrokeGradient(strokeShader); |
| 154 | } |
| 155 | |
| 156 | static jboolean getFullPathProperties(JNIEnv* env, jobject, jlong fullPathPtr, |
| 157 | jbyteArray outProperties, jint length) { |
| 158 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 159 | int8_t pathProperties[length]; |
| 160 | bool success = fullPath->stagingProperties()->copyProperties(pathProperties, length); |
| 161 | env->SetByteArrayRegion(outProperties, 0, length, reinterpret_cast<int8_t*>(&pathProperties)); |
| 162 | return success; |
| 163 | } |
| 164 | |
| 165 | static jboolean getGroupProperties(JNIEnv* env, jobject, jlong groupPtr, |
| 166 | jfloatArray outProperties, jint length) { |
| 167 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 168 | float groupProperties[length]; |
| 169 | bool success = group->stagingProperties()->copyProperties(groupProperties, length); |
| 170 | env->SetFloatArrayRegion(outProperties, 0, length, reinterpret_cast<float*>(&groupProperties)); |
| 171 | return success; |
| 172 | } |
| 173 | |
| 174 | static void updateGroupProperties(JNIEnv*, jobject, jlong groupPtr, jfloat rotate, jfloat pivotX, |
| 175 | jfloat pivotY, jfloat scaleX, jfloat scaleY, jfloat translateX, jfloat translateY) { |
| 176 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 177 | group->mutateStagingProperties()->updateProperties(rotate, pivotX, pivotY, scaleX, scaleY, |
| 178 | translateX, translateY); |
| 179 | } |
| 180 | |
| 181 | static void setPathString(JNIEnv* env, jobject, jlong pathPtr, jstring inputStr, |
| 182 | jint stringLength) { |
| 183 | VectorDrawable::Path* path = reinterpret_cast<VectorDrawable::Path*>(pathPtr); |
| 184 | const char* pathString = env->GetStringUTFChars(inputStr, NULL); |
| 185 | |
| 186 | PathParser::ParseResult result; |
| 187 | PathData data; |
| 188 | PathParser::getPathDataFromAsciiString(&data, &result, pathString, stringLength); |
| 189 | if (result.failureOccurred) { |
| 190 | doThrowIAE(env, result.failureMessage.c_str()); |
| 191 | } |
| 192 | path->mutateStagingProperties()->setData(data); |
| 193 | env->ReleaseStringUTFChars(inputStr, pathString); |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Setters and getters that should only be called from animation thread for animation purpose. |
| 198 | */ |
| 199 | static jfloat getRotation(JNIEnv*, jobject, jlong groupPtr) { |
| 200 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 201 | return group->stagingProperties()->getRotation(); |
| 202 | } |
| 203 | |
| 204 | static void setRotation(JNIEnv*, jobject, jlong groupPtr, jfloat rotation) { |
| 205 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 206 | group->mutateStagingProperties()->setRotation(rotation); |
| 207 | } |
| 208 | |
| 209 | static jfloat getPivotX(JNIEnv*, jobject, jlong groupPtr) { |
| 210 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 211 | return group->stagingProperties()->getPivotX(); |
| 212 | } |
| 213 | |
| 214 | static void setPivotX(JNIEnv*, jobject, jlong groupPtr, jfloat pivotX) { |
| 215 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 216 | group->mutateStagingProperties()->setPivotX(pivotX); |
| 217 | } |
| 218 | |
| 219 | static jfloat getPivotY(JNIEnv*, jobject, jlong groupPtr) { |
| 220 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 221 | return group->stagingProperties()->getPivotY(); |
| 222 | } |
| 223 | |
| 224 | static void setPivotY(JNIEnv*, jobject, jlong groupPtr, jfloat pivotY) { |
| 225 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 226 | group->mutateStagingProperties()->setPivotY(pivotY); |
| 227 | } |
| 228 | |
| 229 | static jfloat getScaleX(JNIEnv*, jobject, jlong groupPtr) { |
| 230 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 231 | return group->stagingProperties()->getScaleX(); |
| 232 | } |
| 233 | |
| 234 | static void setScaleX(JNIEnv*, jobject, jlong groupPtr, jfloat scaleX) { |
| 235 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 236 | group->mutateStagingProperties()->setScaleX(scaleX); |
| 237 | } |
| 238 | |
| 239 | static jfloat getScaleY(JNIEnv*, jobject, jlong groupPtr) { |
| 240 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 241 | return group->stagingProperties()->getScaleY(); |
| 242 | } |
| 243 | |
| 244 | static void setScaleY(JNIEnv*, jobject, jlong groupPtr, jfloat scaleY) { |
| 245 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 246 | group->mutateStagingProperties()->setScaleY(scaleY); |
| 247 | } |
| 248 | |
| 249 | static jfloat getTranslateX(JNIEnv*, jobject, jlong groupPtr) { |
| 250 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 251 | return group->stagingProperties()->getTranslateX(); |
| 252 | } |
| 253 | |
| 254 | static void setTranslateX(JNIEnv*, jobject, jlong groupPtr, jfloat translateX) { |
| 255 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 256 | group->mutateStagingProperties()->setTranslateX(translateX); |
| 257 | } |
| 258 | |
| 259 | static jfloat getTranslateY(JNIEnv*, jobject, jlong groupPtr) { |
| 260 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 261 | return group->stagingProperties()->getTranslateY(); |
| 262 | } |
| 263 | |
| 264 | static void setTranslateY(JNIEnv*, jobject, jlong groupPtr, jfloat translateY) { |
| 265 | VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr); |
| 266 | group->mutateStagingProperties()->setTranslateY(translateY); |
| 267 | } |
| 268 | |
| 269 | static void setPathData(JNIEnv*, jobject, jlong pathPtr, jlong pathDataPtr) { |
| 270 | VectorDrawable::Path* path = reinterpret_cast<VectorDrawable::Path*>(pathPtr); |
| 271 | PathData* pathData = reinterpret_cast<PathData*>(pathDataPtr); |
| 272 | path->mutateStagingProperties()->setData(*pathData); |
| 273 | } |
| 274 | |
| 275 | static jfloat getStrokeWidth(JNIEnv*, jobject, jlong fullPathPtr) { |
| 276 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 277 | return fullPath->stagingProperties()->getStrokeWidth(); |
| 278 | } |
| 279 | |
| 280 | static void setStrokeWidth(JNIEnv*, jobject, jlong fullPathPtr, jfloat strokeWidth) { |
| 281 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 282 | fullPath->mutateStagingProperties()->setStrokeWidth(strokeWidth); |
| 283 | } |
| 284 | |
| 285 | static jint getStrokeColor(JNIEnv*, jobject, jlong fullPathPtr) { |
| 286 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 287 | return fullPath->stagingProperties()->getStrokeColor(); |
| 288 | } |
| 289 | |
| 290 | static void setStrokeColor(JNIEnv*, jobject, jlong fullPathPtr, jint strokeColor) { |
| 291 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 292 | fullPath->mutateStagingProperties()->setStrokeColor(strokeColor); |
| 293 | } |
| 294 | |
| 295 | static jfloat getStrokeAlpha(JNIEnv*, jobject, jlong fullPathPtr) { |
| 296 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 297 | return fullPath->stagingProperties()->getStrokeAlpha(); |
| 298 | } |
| 299 | |
| 300 | static void setStrokeAlpha(JNIEnv*, jobject, jlong fullPathPtr, jfloat strokeAlpha) { |
| 301 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 302 | fullPath->mutateStagingProperties()->setStrokeAlpha(strokeAlpha); |
| 303 | } |
| 304 | |
| 305 | static jint getFillColor(JNIEnv*, jobject, jlong fullPathPtr) { |
| 306 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 307 | return fullPath->stagingProperties()->getFillColor(); |
| 308 | } |
| 309 | |
| 310 | static void setFillColor(JNIEnv*, jobject, jlong fullPathPtr, jint fillColor) { |
| 311 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 312 | fullPath->mutateStagingProperties()->setFillColor(fillColor); |
| 313 | } |
| 314 | |
| 315 | static jfloat getFillAlpha(JNIEnv*, jobject, jlong fullPathPtr) { |
| 316 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 317 | return fullPath->stagingProperties()->getFillAlpha(); |
| 318 | } |
| 319 | |
| 320 | static void setFillAlpha(JNIEnv*, jobject, jlong fullPathPtr, jfloat fillAlpha) { |
| 321 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 322 | fullPath->mutateStagingProperties()->setFillAlpha(fillAlpha); |
| 323 | } |
| 324 | |
| 325 | static jfloat getTrimPathStart(JNIEnv*, jobject, jlong fullPathPtr) { |
| 326 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 327 | return fullPath->stagingProperties()->getTrimPathStart(); |
| 328 | } |
| 329 | |
| 330 | static void setTrimPathStart(JNIEnv*, jobject, jlong fullPathPtr, jfloat trimPathStart) { |
| 331 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 332 | fullPath->mutateStagingProperties()->setTrimPathStart(trimPathStart); |
| 333 | } |
| 334 | |
| 335 | static jfloat getTrimPathEnd(JNIEnv*, jobject, jlong fullPathPtr) { |
| 336 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 337 | return fullPath->stagingProperties()->getTrimPathEnd(); |
| 338 | } |
| 339 | |
| 340 | static void setTrimPathEnd(JNIEnv*, jobject, jlong fullPathPtr, jfloat trimPathEnd) { |
| 341 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 342 | fullPath->mutateStagingProperties()->setTrimPathEnd(trimPathEnd); |
| 343 | } |
| 344 | |
| 345 | static jfloat getTrimPathOffset(JNIEnv*, jobject, jlong fullPathPtr) { |
| 346 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 347 | return fullPath->stagingProperties()->getTrimPathOffset(); |
| 348 | } |
| 349 | |
| 350 | static void setTrimPathOffset(JNIEnv*, jobject, jlong fullPathPtr, jfloat trimPathOffset) { |
| 351 | VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr); |
| 352 | fullPath->mutateStagingProperties()->setTrimPathOffset(trimPathOffset); |
| 353 | } |
| 354 | |
| 355 | static const JNINativeMethod gMethods[] = { |
| 356 | {"nDraw", "(JJJLandroid/graphics/Rect;ZZ)I", (void*)draw}, |
| 357 | {"nGetFullPathProperties", "(J[BI)Z", (void*)getFullPathProperties}, |
| 358 | {"nGetGroupProperties", "(J[FI)Z", (void*)getGroupProperties}, |
| 359 | {"nSetPathString", "(JLjava/lang/String;I)V", (void*)setPathString}, |
| 360 | {"nSetName", "(JLjava/lang/String;)V", (void*)setNodeName}, |
| 361 | |
| 362 | // ------------- @FastNative ---------------- |
| 363 | |
| 364 | {"nCreateTree", "(J)J", (void*)createTree}, |
| 365 | {"nCreateTreeFromCopy", "(JJ)J", (void*)createTreeFromCopy}, |
| 366 | {"nSetRendererViewportSize", "(JFF)V", (void*)setTreeViewportSize}, |
| 367 | {"nSetRootAlpha", "(JF)Z", (void*)setRootAlpha}, |
| 368 | {"nGetRootAlpha", "(J)F", (void*)getRootAlpha}, |
| 369 | {"nSetAntiAlias", "(JZ)V", (void*)setAntiAlias}, |
| 370 | {"nSetAllowCaching", "(JZ)V", (void*)setAllowCaching}, |
| 371 | |
| 372 | {"nCreateFullPath", "()J", (void*)createEmptyFullPath}, |
| 373 | {"nCreateFullPath", "(J)J", (void*)createFullPath}, |
| 374 | {"nUpdateFullPathProperties", "(JFIFIFFFFFIII)V", (void*)updateFullPathPropertiesAndStrokeStyles}, |
| 375 | {"nUpdateFullPathFillGradient", "(JJ)V", (void*)updateFullPathFillGradient}, |
| 376 | {"nUpdateFullPathStrokeGradient", "(JJ)V", (void*)updateFullPathStrokeGradient}, |
| 377 | |
| 378 | {"nCreateClipPath", "()J", (void*)createEmptyClipPath}, |
| 379 | {"nCreateClipPath", "(J)J", (void*)createClipPath}, |
| 380 | {"nCreateGroup", "()J", (void*)createEmptyGroup}, |
| 381 | {"nCreateGroup", "(J)J", (void*)createGroup}, |
| 382 | {"nUpdateGroupProperties", "(JFFFFFFF)V", (void*)updateGroupProperties}, |
| 383 | |
| 384 | {"nAddChild", "(JJ)V", (void*)addChild}, |
| 385 | {"nGetRotation", "(J)F", (void*)getRotation}, |
| 386 | {"nSetRotation", "(JF)V", (void*)setRotation}, |
| 387 | {"nGetPivotX", "(J)F", (void*)getPivotX}, |
| 388 | {"nSetPivotX", "(JF)V", (void*)setPivotX}, |
| 389 | {"nGetPivotY", "(J)F", (void*)getPivotY}, |
| 390 | {"nSetPivotY", "(JF)V", (void*)setPivotY}, |
| 391 | {"nGetScaleX", "(J)F", (void*)getScaleX}, |
| 392 | {"nSetScaleX", "(JF)V", (void*)setScaleX}, |
| 393 | {"nGetScaleY", "(J)F", (void*)getScaleY}, |
| 394 | {"nSetScaleY", "(JF)V", (void*)setScaleY}, |
| 395 | {"nGetTranslateX", "(J)F", (void*)getTranslateX}, |
| 396 | {"nSetTranslateX", "(JF)V", (void*)setTranslateX}, |
| 397 | {"nGetTranslateY", "(J)F", (void*)getTranslateY}, |
| 398 | {"nSetTranslateY", "(JF)V", (void*)setTranslateY}, |
| 399 | |
| 400 | {"nSetPathData", "(JJ)V", (void*)setPathData}, |
| 401 | {"nGetStrokeWidth", "(J)F", (void*)getStrokeWidth}, |
| 402 | {"nSetStrokeWidth", "(JF)V", (void*)setStrokeWidth}, |
| 403 | {"nGetStrokeColor", "(J)I", (void*)getStrokeColor}, |
| 404 | {"nSetStrokeColor", "(JI)V", (void*)setStrokeColor}, |
| 405 | {"nGetStrokeAlpha", "(J)F", (void*)getStrokeAlpha}, |
| 406 | {"nSetStrokeAlpha", "(JF)V", (void*)setStrokeAlpha}, |
| 407 | {"nGetFillColor", "(J)I", (void*)getFillColor}, |
| 408 | {"nSetFillColor", "(JI)V", (void*)setFillColor}, |
| 409 | {"nGetFillAlpha", "(J)F", (void*)getFillAlpha}, |
| 410 | {"nSetFillAlpha", "(JF)V", (void*)setFillAlpha}, |
| 411 | {"nGetTrimPathStart", "(J)F", (void*)getTrimPathStart}, |
| 412 | {"nSetTrimPathStart", "(JF)V", (void*)setTrimPathStart}, |
| 413 | {"nGetTrimPathEnd", "(J)F", (void*)getTrimPathEnd}, |
| 414 | {"nSetTrimPathEnd", "(JF)V", (void*)setTrimPathEnd}, |
| 415 | {"nGetTrimPathOffset", "(J)F", (void*)getTrimPathOffset}, |
| 416 | {"nSetTrimPathOffset", "(JF)V", (void*)setTrimPathOffset}, |
| 417 | }; |
| 418 | |
| 419 | int register_android_graphics_drawable_VectorDrawable(JNIEnv* env) { |
| 420 | return RegisterMethodsOrDie(env, "android/graphics/drawable/VectorDrawable", gMethods, NELEM(gMethods)); |
| 421 | } |
| 422 | |
| 423 | }; // namespace android |