14bbc2931263b232fba61807fca00e127573eff42Doris Liu/*
24bbc2931263b232fba61807fca00e127573eff42Doris Liu * Copyright (C) 2015 The Android Open Source Project
34bbc2931263b232fba61807fca00e127573eff42Doris Liu *
44bbc2931263b232fba61807fca00e127573eff42Doris Liu * Licensed under the Apache License, Version 2.0 (the "License");
54bbc2931263b232fba61807fca00e127573eff42Doris Liu * you may not use this file except in compliance with the License.
64bbc2931263b232fba61807fca00e127573eff42Doris Liu * You may obtain a copy of the License at
74bbc2931263b232fba61807fca00e127573eff42Doris Liu *
84bbc2931263b232fba61807fca00e127573eff42Doris Liu *      http://www.apache.org/licenses/LICENSE-2.0
94bbc2931263b232fba61807fca00e127573eff42Doris Liu *
104bbc2931263b232fba61807fca00e127573eff42Doris Liu * Unless required by applicable law or agreed to in writing, software
114bbc2931263b232fba61807fca00e127573eff42Doris Liu * distributed under the License is distributed on an "AS IS" BASIS,
124bbc2931263b232fba61807fca00e127573eff42Doris Liu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134bbc2931263b232fba61807fca00e127573eff42Doris Liu * See the License for the specific language governing permissions and
144bbc2931263b232fba61807fca00e127573eff42Doris Liu * limitations under the License.
154bbc2931263b232fba61807fca00e127573eff42Doris Liu */
164bbc2931263b232fba61807fca00e127573eff42Doris Liu
174bbc2931263b232fba61807fca00e127573eff42Doris Liu#include "GraphicsJNI.h"
181d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu#include "jni.h"
194bbc2931263b232fba61807fca00e127573eff42Doris Liu#include "core_jni_helpers.h"
204bbc2931263b232fba61807fca00e127573eff42Doris Liu
211d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu#include "PathParser.h"
224bbc2931263b232fba61807fca00e127573eff42Doris Liu#include "VectorDrawable.h"
234bbc2931263b232fba61807fca00e127573eff42Doris Liu
24dccca44ffda4836b56a21da95a046c9708ffd49csergeyv#include <hwui/Paint.h>
25dccca44ffda4836b56a21da95a046c9708ffd49csergeyv
264bbc2931263b232fba61807fca00e127573eff42Doris Liunamespace android {
274bbc2931263b232fba61807fca00e127573eff42Doris Liuusing namespace uirenderer;
284bbc2931263b232fba61807fca00e127573eff42Doris Liuusing namespace uirenderer::VectorDrawable;
294bbc2931263b232fba61807fca00e127573eff42Doris Liu
301d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu/**
311d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu * VectorDrawable's pre-draw construction.
321d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu */
334bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jlong createTree(JNIEnv*, jobject, jlong groupPtr) {
344bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* rootGroup = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
354bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Tree* tree = new VectorDrawable::Tree(rootGroup);
364bbc2931263b232fba61807fca00e127573eff42Doris Liu    return reinterpret_cast<jlong>(tree);
374bbc2931263b232fba61807fca00e127573eff42Doris Liu}
384bbc2931263b232fba61807fca00e127573eff42Doris Liu
39028029730bf2d177f84316d2d444d409eba4b6cbDoris Liustatic jlong createTreeFromCopy(JNIEnv*, jobject, jlong treePtr, jlong groupPtr) {
40028029730bf2d177f84316d2d444d409eba4b6cbDoris Liu    VectorDrawable::Group* rootGroup = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
41028029730bf2d177f84316d2d444d409eba4b6cbDoris Liu    VectorDrawable::Tree* treeToCopy = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
42028029730bf2d177f84316d2d444d409eba4b6cbDoris Liu    VectorDrawable::Tree* tree = new VectorDrawable::Tree(treeToCopy, rootGroup);
43028029730bf2d177f84316d2d444d409eba4b6cbDoris Liu    return reinterpret_cast<jlong>(tree);
44028029730bf2d177f84316d2d444d409eba4b6cbDoris Liu}
45028029730bf2d177f84316d2d444d409eba4b6cbDoris Liu
461d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic jlong createEmptyFullPath(JNIEnv*, jobject) {
471d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::FullPath* newPath = new VectorDrawable::FullPath();
481d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return reinterpret_cast<jlong>(newPath);
494bbc2931263b232fba61807fca00e127573eff42Doris Liu}
504bbc2931263b232fba61807fca00e127573eff42Doris Liu
511d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic jlong createFullPath(JNIEnv*, jobject, jlong srcFullPathPtr) {
521d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::FullPath* srcFullPath =
531d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu            reinterpret_cast<VectorDrawable::FullPath*>(srcFullPathPtr);
541d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::FullPath* newPath = new VectorDrawable::FullPath(*srcFullPath);
551d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return reinterpret_cast<jlong>(newPath);
564bbc2931263b232fba61807fca00e127573eff42Doris Liu}
574bbc2931263b232fba61807fca00e127573eff42Doris Liu
581d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic jlong createEmptyClipPath(JNIEnv*, jobject) {
591d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::ClipPath* newPath = new VectorDrawable::ClipPath();
601d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return reinterpret_cast<jlong>(newPath);
611d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu}
621d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu
631d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic jlong createClipPath(JNIEnv*, jobject, jlong srcClipPathPtr) {
641d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::ClipPath* srcClipPath =
651d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu            reinterpret_cast<VectorDrawable::ClipPath*>(srcClipPathPtr);
661d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::ClipPath* newPath = new VectorDrawable::ClipPath(*srcClipPath);
671d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return reinterpret_cast<jlong>(newPath);
681d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu}
691d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu
701d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic jlong createEmptyGroup(JNIEnv*, jobject) {
711d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::Group* newGroup = new VectorDrawable::Group();
721d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return reinterpret_cast<jlong>(newGroup);
731d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu}
741d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu
751d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic jlong createGroup(JNIEnv*, jobject, jlong srcGroupPtr) {
761d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::Group* srcGroup = reinterpret_cast<VectorDrawable::Group*>(srcGroupPtr);
771d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::Group* newGroup = new VectorDrawable::Group(*srcGroup);
781d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return reinterpret_cast<jlong>(newGroup);
791d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu}
801d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu
811d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic void setNodeName(JNIEnv* env, jobject, jlong nodePtr, jstring nameStr) {
821d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::Node* node = reinterpret_cast<VectorDrawable::Node*>(nodePtr);
831d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    const char* nodeName = env->GetStringUTFChars(nameStr, NULL);
841d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    node->setName(nodeName);
851d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    env->ReleaseStringUTFChars(nameStr, nodeName);
861d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu}
871d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu
881d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic void addChild(JNIEnv*, jobject, jlong groupPtr, jlong childPtr) {
891d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
901d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::Node* child = reinterpret_cast<VectorDrawable::Node*>(childPtr);
911d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    group->addChild(child);
924bbc2931263b232fba61807fca00e127573eff42Doris Liu}
934bbc2931263b232fba61807fca00e127573eff42Doris Liu
944bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setAllowCaching(JNIEnv*, jobject, jlong treePtr, jboolean allowCaching) {
954bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
964bbc2931263b232fba61807fca00e127573eff42Doris Liu    tree->setAllowCaching(allowCaching);
974bbc2931263b232fba61807fca00e127573eff42Doris Liu}
984bbc2931263b232fba61807fca00e127573eff42Doris Liu
991d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu/**
1001d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu * Draw
1011d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu */
102f8d131cc8dc4ef675b8f8fc57dcc26062d575d32Doris Liustatic int draw(JNIEnv* env, jobject, jlong treePtr, jlong canvasPtr,
1034bbc2931263b232fba61807fca00e127573eff42Doris Liu        jlong colorFilterPtr, jobject jrect, jboolean needsMirroring, jboolean canReuseCache) {
1044bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
1054bbc2931263b232fba61807fca00e127573eff42Doris Liu    Canvas* canvas = reinterpret_cast<Canvas*>(canvasPtr);
1064bbc2931263b232fba61807fca00e127573eff42Doris Liu    SkRect rect;
1074bbc2931263b232fba61807fca00e127573eff42Doris Liu    GraphicsJNI::jrect_to_rect(env, jrect, &rect);
1084bbc2931263b232fba61807fca00e127573eff42Doris Liu    SkColorFilter* colorFilter = reinterpret_cast<SkColorFilter*>(colorFilterPtr);
109f8d131cc8dc4ef675b8f8fc57dcc26062d575d32Doris Liu    return tree->draw(canvas, colorFilter, rect, needsMirroring, canReuseCache);
1104bbc2931263b232fba61807fca00e127573eff42Doris Liu}
1114bbc2931263b232fba61807fca00e127573eff42Doris Liu
1121d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu/**
1131d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu * Setters and getters for updating staging properties that can happen both pre-draw and post draw.
1141d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu */
1151d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic void setTreeViewportSize(JNIEnv*, jobject, jlong treePtr,
1161d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu        jfloat viewportWidth, jfloat viewportHeight) {
1171d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
1181d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    tree->mutateStagingProperties()->setViewportSize(viewportWidth, viewportHeight);
1194bbc2931263b232fba61807fca00e127573eff42Doris Liu}
1204bbc2931263b232fba61807fca00e127573eff42Doris Liu
1211d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic jboolean setRootAlpha(JNIEnv*, jobject, jlong treePtr, jfloat alpha) {
1221d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
1231d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return tree->mutateStagingProperties()->setRootAlpha(alpha);
1241d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu}
1251d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu
1261d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liustatic jfloat getRootAlpha(JNIEnv*, jobject, jlong treePtr) {
1271d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
1281d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return tree->stagingProperties()->getRootAlpha();
1294bbc2931263b232fba61807fca00e127573eff42Doris Liu}
1304bbc2931263b232fba61807fca00e127573eff42Doris Liu
1314bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void updateFullPathPropertiesAndStrokeStyles(JNIEnv*, jobject, jlong fullPathPtr,
1324bbc2931263b232fba61807fca00e127573eff42Doris Liu        jfloat strokeWidth, jint strokeColor, jfloat strokeAlpha, jint fillColor, jfloat fillAlpha,
1334bbc2931263b232fba61807fca00e127573eff42Doris Liu        jfloat trimPathStart, jfloat trimPathEnd, jfloat trimPathOffset, jfloat strokeMiterLimit,
13446591f4a2dbd785bcae2b82bb490e78208605ec8Teng-Hui Zhu        jint strokeLineCap, jint strokeLineJoin, jint fillType) {
1354bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
1361d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    fullPath->mutateStagingProperties()->updateProperties(strokeWidth, strokeColor, strokeAlpha,
1371d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu            fillColor, fillAlpha, trimPathStart, trimPathEnd, trimPathOffset, strokeMiterLimit,
1381d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu            strokeLineCap, strokeLineJoin, fillType);
1394bbc2931263b232fba61807fca00e127573eff42Doris Liu}
1404bbc2931263b232fba61807fca00e127573eff42Doris Liu
141dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhustatic void updateFullPathFillGradient(JNIEnv*, jobject, jlong pathPtr, jlong fillGradientPtr) {
142dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu    VectorDrawable::FullPath* path = reinterpret_cast<VectorDrawable::FullPath*>(pathPtr);
143dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu    SkShader* fillShader = reinterpret_cast<SkShader*>(fillGradientPtr);
1441d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    path->mutateStagingProperties()->setFillGradient(fillShader);
145dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu}
146dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu
147dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhustatic void updateFullPathStrokeGradient(JNIEnv*, jobject, jlong pathPtr, jlong strokeGradientPtr) {
148dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu    VectorDrawable::FullPath* path = reinterpret_cast<VectorDrawable::FullPath*>(pathPtr);
149dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu    SkShader* strokeShader = reinterpret_cast<SkShader*>(strokeGradientPtr);
1501d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    path->mutateStagingProperties()->setStrokeGradient(strokeShader);
151dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu}
152dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu
1534bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jboolean getFullPathProperties(JNIEnv* env, jobject, jlong fullPathPtr,
1544bbc2931263b232fba61807fca00e127573eff42Doris Liu        jbyteArray outProperties, jint length) {
1554bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
1564bbc2931263b232fba61807fca00e127573eff42Doris Liu    int8_t pathProperties[length];
1571d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    bool success = fullPath->stagingProperties()->copyProperties(pathProperties, length);
1584bbc2931263b232fba61807fca00e127573eff42Doris Liu    env->SetByteArrayRegion(outProperties, 0, length, reinterpret_cast<int8_t*>(&pathProperties));
1594bbc2931263b232fba61807fca00e127573eff42Doris Liu    return success;
1604bbc2931263b232fba61807fca00e127573eff42Doris Liu}
1614bbc2931263b232fba61807fca00e127573eff42Doris Liu
1624bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jboolean getGroupProperties(JNIEnv* env, jobject, jlong groupPtr,
1634bbc2931263b232fba61807fca00e127573eff42Doris Liu        jfloatArray outProperties, jint length) {
1644bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
1654bbc2931263b232fba61807fca00e127573eff42Doris Liu    float groupProperties[length];
1661d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    bool success = group->stagingProperties()->copyProperties(groupProperties, length);
1674bbc2931263b232fba61807fca00e127573eff42Doris Liu    env->SetFloatArrayRegion(outProperties, 0, length, reinterpret_cast<float*>(&groupProperties));
1684bbc2931263b232fba61807fca00e127573eff42Doris Liu    return success;
1694bbc2931263b232fba61807fca00e127573eff42Doris Liu}
1704bbc2931263b232fba61807fca00e127573eff42Doris Liu
1714bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void updateGroupProperties(JNIEnv*, jobject, jlong groupPtr, jfloat rotate, jfloat pivotX,
1724bbc2931263b232fba61807fca00e127573eff42Doris Liu        jfloat pivotY, jfloat scaleX, jfloat scaleY, jfloat translateX, jfloat translateY) {
1734bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
1741d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    group->mutateStagingProperties()->updateProperties(rotate, pivotX, pivotY, scaleX, scaleY,
1751d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu            translateX, translateY);
1764bbc2931263b232fba61807fca00e127573eff42Doris Liu}
1774bbc2931263b232fba61807fca00e127573eff42Doris Liu
1784bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setPathString(JNIEnv* env, jobject, jlong pathPtr, jstring inputStr,
1794bbc2931263b232fba61807fca00e127573eff42Doris Liu        jint stringLength) {
1804bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Path* path = reinterpret_cast<VectorDrawable::Path*>(pathPtr);
1814bbc2931263b232fba61807fca00e127573eff42Doris Liu    const char* pathString = env->GetStringUTFChars(inputStr, NULL);
1821d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu
1831d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    PathParser::ParseResult result;
1841d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    PathData data;
185b35da390601e3c24e777d72daacd8dbeb4d1d9c4Doris Liu    PathParser::getPathDataFromAsciiString(&data, &result, pathString, stringLength);
1860a1a5167be26d363d4e27bdc7b816f425b7b4e66Doris Liu    if (result.failureOccurred) {
1870a1a5167be26d363d4e27bdc7b816f425b7b4e66Doris Liu        doThrowIAE(env, result.failureMessage.c_str());
1880a1a5167be26d363d4e27bdc7b816f425b7b4e66Doris Liu    }
1891d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    path->mutateStagingProperties()->setData(data);
1904bbc2931263b232fba61807fca00e127573eff42Doris Liu    env->ReleaseStringUTFChars(inputStr, pathString);
1914bbc2931263b232fba61807fca00e127573eff42Doris Liu}
1924bbc2931263b232fba61807fca00e127573eff42Doris Liu
1931d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu/**
1941d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu * Setters and getters that should only be called from animation thread for animation purpose.
1951d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu */
1964bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getRotation(JNIEnv*, jobject, jlong groupPtr) {
1974bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
1981d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return group->stagingProperties()->getRotation();
1994bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2004bbc2931263b232fba61807fca00e127573eff42Doris Liu
2014bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setRotation(JNIEnv*, jobject, jlong groupPtr, jfloat rotation) {
2024bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2031d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    group->mutateStagingProperties()->setRotation(rotation);
2044bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2054bbc2931263b232fba61807fca00e127573eff42Doris Liu
2064bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getPivotX(JNIEnv*, jobject, jlong groupPtr) {
2074bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2081d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return group->stagingProperties()->getPivotX();
2094bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2104bbc2931263b232fba61807fca00e127573eff42Doris Liu
2114bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setPivotX(JNIEnv*, jobject, jlong groupPtr, jfloat pivotX) {
2124bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2131d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    group->mutateStagingProperties()->setPivotX(pivotX);
2144bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2154bbc2931263b232fba61807fca00e127573eff42Doris Liu
2164bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getPivotY(JNIEnv*, jobject, jlong groupPtr) {
2174bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2181d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return group->stagingProperties()->getPivotY();
2194bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2204bbc2931263b232fba61807fca00e127573eff42Doris Liu
2214bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setPivotY(JNIEnv*, jobject, jlong groupPtr, jfloat pivotY) {
2224bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2231d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    group->mutateStagingProperties()->setPivotY(pivotY);
2244bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2254bbc2931263b232fba61807fca00e127573eff42Doris Liu
2264bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getScaleX(JNIEnv*, jobject, jlong groupPtr) {
2274bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2281d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return group->stagingProperties()->getScaleX();
2294bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2304bbc2931263b232fba61807fca00e127573eff42Doris Liu
2314bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setScaleX(JNIEnv*, jobject, jlong groupPtr, jfloat scaleX) {
2324bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2331d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    group->mutateStagingProperties()->setScaleX(scaleX);
2344bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2354bbc2931263b232fba61807fca00e127573eff42Doris Liu
2364bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getScaleY(JNIEnv*, jobject, jlong groupPtr) {
2374bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2381d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return group->stagingProperties()->getScaleY();
2394bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2404bbc2931263b232fba61807fca00e127573eff42Doris Liu
2414bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setScaleY(JNIEnv*, jobject, jlong groupPtr, jfloat scaleY) {
2424bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2431d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    group->mutateStagingProperties()->setScaleY(scaleY);
2444bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2454bbc2931263b232fba61807fca00e127573eff42Doris Liu
2464bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getTranslateX(JNIEnv*, jobject, jlong groupPtr) {
2474bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2481d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return group->stagingProperties()->getTranslateX();
2494bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2504bbc2931263b232fba61807fca00e127573eff42Doris Liu
2514bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setTranslateX(JNIEnv*, jobject, jlong groupPtr, jfloat translateX) {
2524bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2531d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    group->mutateStagingProperties()->setTranslateX(translateX);
2544bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2554bbc2931263b232fba61807fca00e127573eff42Doris Liu
2564bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getTranslateY(JNIEnv*, jobject, jlong groupPtr) {
2574bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2581d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return group->stagingProperties()->getTranslateY();
2594bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2604bbc2931263b232fba61807fca00e127573eff42Doris Liu
2614bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setTranslateY(JNIEnv*, jobject, jlong groupPtr, jfloat translateY) {
2624bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
2631d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    group->mutateStagingProperties()->setTranslateY(translateY);
2644bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2654bbc2931263b232fba61807fca00e127573eff42Doris Liu
2664bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setPathData(JNIEnv*, jobject, jlong pathPtr, jlong pathDataPtr) {
2674bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::Path* path = reinterpret_cast<VectorDrawable::Path*>(pathPtr);
2684bbc2931263b232fba61807fca00e127573eff42Doris Liu    PathData* pathData = reinterpret_cast<PathData*>(pathDataPtr);
2691d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    path->mutateStagingProperties()->setData(*pathData);
2704bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2714bbc2931263b232fba61807fca00e127573eff42Doris Liu
2724bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getStrokeWidth(JNIEnv*, jobject, jlong fullPathPtr) {
2734bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
2741d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return fullPath->stagingProperties()->getStrokeWidth();
2754bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2764bbc2931263b232fba61807fca00e127573eff42Doris Liu
2774bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setStrokeWidth(JNIEnv*, jobject, jlong fullPathPtr, jfloat strokeWidth) {
2784bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
2791d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    fullPath->mutateStagingProperties()->setStrokeWidth(strokeWidth);
2804bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2814bbc2931263b232fba61807fca00e127573eff42Doris Liu
2824bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jint getStrokeColor(JNIEnv*, jobject, jlong fullPathPtr) {
2834bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
2841d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return fullPath->stagingProperties()->getStrokeColor();
2854bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2864bbc2931263b232fba61807fca00e127573eff42Doris Liu
2874bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setStrokeColor(JNIEnv*, jobject, jlong fullPathPtr, jint strokeColor) {
2884bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
2891d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    fullPath->mutateStagingProperties()->setStrokeColor(strokeColor);
2904bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2914bbc2931263b232fba61807fca00e127573eff42Doris Liu
2924bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getStrokeAlpha(JNIEnv*, jobject, jlong fullPathPtr) {
2934bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
2941d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return fullPath->stagingProperties()->getStrokeAlpha();
2954bbc2931263b232fba61807fca00e127573eff42Doris Liu}
2964bbc2931263b232fba61807fca00e127573eff42Doris Liu
2974bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setStrokeAlpha(JNIEnv*, jobject, jlong fullPathPtr, jfloat strokeAlpha) {
2984bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
2991d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    fullPath->mutateStagingProperties()->setStrokeAlpha(strokeAlpha);
3004bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3014bbc2931263b232fba61807fca00e127573eff42Doris Liu
3024bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jint getFillColor(JNIEnv*, jobject, jlong fullPathPtr) {
3034bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3041d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return fullPath->stagingProperties()->getFillColor();
3054bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3064bbc2931263b232fba61807fca00e127573eff42Doris Liu
3074bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setFillColor(JNIEnv*, jobject, jlong fullPathPtr, jint fillColor) {
3084bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3091d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    fullPath->mutateStagingProperties()->setFillColor(fillColor);
3104bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3114bbc2931263b232fba61807fca00e127573eff42Doris Liu
3124bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getFillAlpha(JNIEnv*, jobject, jlong fullPathPtr) {
3134bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3141d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return fullPath->stagingProperties()->getFillAlpha();
3154bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3164bbc2931263b232fba61807fca00e127573eff42Doris Liu
3174bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setFillAlpha(JNIEnv*, jobject, jlong fullPathPtr, jfloat fillAlpha) {
3184bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3191d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    fullPath->mutateStagingProperties()->setFillAlpha(fillAlpha);
3204bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3214bbc2931263b232fba61807fca00e127573eff42Doris Liu
3224bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getTrimPathStart(JNIEnv*, jobject, jlong fullPathPtr) {
3234bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3241d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return fullPath->stagingProperties()->getTrimPathStart();
3254bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3264bbc2931263b232fba61807fca00e127573eff42Doris Liu
3274bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setTrimPathStart(JNIEnv*, jobject, jlong fullPathPtr, jfloat trimPathStart) {
3284bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3291d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    fullPath->mutateStagingProperties()->setTrimPathStart(trimPathStart);
3304bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3314bbc2931263b232fba61807fca00e127573eff42Doris Liu
3324bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getTrimPathEnd(JNIEnv*, jobject, jlong fullPathPtr) {
3334bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3341d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return fullPath->stagingProperties()->getTrimPathEnd();
3354bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3364bbc2931263b232fba61807fca00e127573eff42Doris Liu
3374bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setTrimPathEnd(JNIEnv*, jobject, jlong fullPathPtr, jfloat trimPathEnd) {
3384bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3391d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    fullPath->mutateStagingProperties()->setTrimPathEnd(trimPathEnd);
3404bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3414bbc2931263b232fba61807fca00e127573eff42Doris Liu
3424bbc2931263b232fba61807fca00e127573eff42Doris Liustatic jfloat getTrimPathOffset(JNIEnv*, jobject, jlong fullPathPtr) {
3434bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3441d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    return fullPath->stagingProperties()->getTrimPathOffset();
3454bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3464bbc2931263b232fba61807fca00e127573eff42Doris Liu
3474bbc2931263b232fba61807fca00e127573eff42Doris Liustatic void setTrimPathOffset(JNIEnv*, jobject, jlong fullPathPtr, jfloat trimPathOffset) {
3484bbc2931263b232fba61807fca00e127573eff42Doris Liu    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
3491d8e194661085f9a18ab1b3cd12f9e19d3a86be5Doris Liu    fullPath->mutateStagingProperties()->setTrimPathOffset(trimPathOffset);
3504bbc2931263b232fba61807fca00e127573eff42Doris Liu}
3514bbc2931263b232fba61807fca00e127573eff42Doris Liu
3524bbc2931263b232fba61807fca00e127573eff42Doris Liustatic const JNINativeMethod gMethods[] = {
353cdedc9a80d971c8152b6f2674c040c79cff3b8ddDoris Liu        {"nCreateTree", "!(J)J", (void*)createTree},
354028029730bf2d177f84316d2d444d409eba4b6cbDoris Liu        {"nCreateTreeFromCopy", "!(JJ)J", (void*)createTreeFromCopy},
3554bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetRendererViewportSize", "!(JFF)V", (void*)setTreeViewportSize},
3564bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetRootAlpha", "!(JF)Z", (void*)setRootAlpha},
3574bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetRootAlpha", "!(J)F", (void*)getRootAlpha},
3584bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetAllowCaching", "!(JZ)V", (void*)setAllowCaching},
3594bbc2931263b232fba61807fca00e127573eff42Doris Liu
360f8d131cc8dc4ef675b8f8fc57dcc26062d575d32Doris Liu        {"nDraw", "(JJJLandroid/graphics/Rect;ZZ)I", (void*)draw},
3614bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nCreateFullPath", "!()J", (void*)createEmptyFullPath},
3624bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nCreateFullPath", "!(J)J", (void*)createFullPath},
36346591f4a2dbd785bcae2b82bb490e78208605ec8Teng-Hui Zhu        {"nUpdateFullPathProperties", "!(JFIFIFFFFFIII)V", (void*)updateFullPathPropertiesAndStrokeStyles},
364dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu        {"nUpdateFullPathFillGradient", "!(JJ)V", (void*)updateFullPathFillGradient},
365dbee9bb342cdfaa5155b1918f90262c05e2464cbTeng-Hui Zhu        {"nUpdateFullPathStrokeGradient", "!(JJ)V", (void*)updateFullPathStrokeGradient},
3664bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetFullPathProperties", "(J[BI)Z", (void*)getFullPathProperties},
3674bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetGroupProperties", "(J[FI)Z", (void*)getGroupProperties},
3684bbc2931263b232fba61807fca00e127573eff42Doris Liu
3694bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nCreateClipPath", "!()J", (void*)createEmptyClipPath},
3704bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nCreateClipPath", "!(J)J", (void*)createClipPath},
3714bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nCreateGroup", "!()J", (void*)createEmptyGroup},
3724bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nCreateGroup", "!(J)J", (void*)createGroup},
3734bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetName", "(JLjava/lang/String;)V", (void*)setNodeName},
3744bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nUpdateGroupProperties", "!(JFFFFFFF)V", (void*)updateGroupProperties},
3754bbc2931263b232fba61807fca00e127573eff42Doris Liu
3764bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nAddChild", "!(JJ)V", (void*)addChild},
3774bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetPathString", "(JLjava/lang/String;I)V", (void*)setPathString},
3784bbc2931263b232fba61807fca00e127573eff42Doris Liu
3794bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetRotation", "!(J)F", (void*)getRotation},
3804bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetRotation", "!(JF)V", (void*)setRotation},
3814bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetPivotX", "!(J)F", (void*)getPivotX},
3824bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetPivotX", "!(JF)V", (void*)setPivotX},
3834bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetPivotY", "!(J)F", (void*)getPivotY},
3844bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetPivotY", "!(JF)V", (void*)setPivotY},
3854bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetScaleX", "!(J)F", (void*)getScaleX},
3864bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetScaleX", "!(JF)V", (void*)setScaleX},
3874bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetScaleY", "!(J)F", (void*)getScaleY},
3884bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetScaleY", "!(JF)V", (void*)setScaleY},
3894bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetTranslateX", "!(J)F", (void*)getTranslateX},
3904bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetTranslateX", "!(JF)V", (void*)setTranslateX},
3914bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetTranslateY", "!(J)F", (void*)getTranslateY},
3924bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetTranslateY", "!(JF)V", (void*)setTranslateY},
3934bbc2931263b232fba61807fca00e127573eff42Doris Liu
3944bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetPathData", "!(JJ)V", (void*)setPathData},
3954bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetStrokeWidth", "!(J)F", (void*)getStrokeWidth},
3964bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetStrokeWidth", "!(JF)V", (void*)setStrokeWidth},
3974bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetStrokeColor", "!(J)I", (void*)getStrokeColor},
3984bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetStrokeColor", "!(JI)V", (void*)setStrokeColor},
3994bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetStrokeAlpha", "!(J)F", (void*)getStrokeAlpha},
4004bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetStrokeAlpha", "!(JF)V", (void*)setStrokeAlpha},
4014bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetFillColor", "!(J)I", (void*)getFillColor},
4024bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetFillColor", "!(JI)V", (void*)setFillColor},
4034bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetFillAlpha", "!(J)F", (void*)getFillAlpha},
4044bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetFillAlpha", "!(JF)V", (void*)setFillAlpha},
4054bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetTrimPathStart", "!(J)F", (void*)getTrimPathStart},
4064bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetTrimPathStart", "!(JF)V", (void*)setTrimPathStart},
4074bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetTrimPathEnd", "!(J)F", (void*)getTrimPathEnd},
4084bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetTrimPathEnd", "!(JF)V", (void*)setTrimPathEnd},
4094bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nGetTrimPathOffset", "!(J)F", (void*)getTrimPathOffset},
4104bbc2931263b232fba61807fca00e127573eff42Doris Liu        {"nSetTrimPathOffset", "!(JF)V", (void*)setTrimPathOffset},
4114bbc2931263b232fba61807fca00e127573eff42Doris Liu};
4124bbc2931263b232fba61807fca00e127573eff42Doris Liu
4134bbc2931263b232fba61807fca00e127573eff42Doris Liuint register_android_graphics_drawable_VectorDrawable(JNIEnv* env) {
4144bbc2931263b232fba61807fca00e127573eff42Doris Liu    return RegisterMethodsOrDie(env, "android/graphics/drawable/VectorDrawable", gMethods, NELEM(gMethods));
4154bbc2931263b232fba61807fca00e127573eff42Doris Liu}
4164bbc2931263b232fba61807fca00e127573eff42Doris Liu
4174bbc2931263b232fba61807fca00e127573eff42Doris Liu}; // namespace android
418