Implement path parsing from string to skia path in native. The parsing contains two main stages: 1) Parse string into a list of nodes that contains one operation (such as move) and a vector of floats as params for that operation. 2) Interpret the operations defined in the nodes into SkPath operations, and create a skia path Also provided unit test for parsing a string path into a list of nodes, and then to a skia path. Change-Id: I0ce13df5e3bb90987dcdc80fe8b039af175ad2e2
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
/*
|
|
* Copyright (C) 2015 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef ANDROID_HWUI_PATHPARSER_H
|
|
#define ANDROID_HWUI_PATHPARSER_H
|
|
|
|
#include "VectorDrawablePath.h"
|
|
|
|
#include <jni.h>
|
|
#include <android/log.h>
|
|
|
|
namespace android {
|
|
namespace uirenderer {
|
|
|
|
class PathParser {
|
|
public:
|
|
static void parseStringForSkPath(SkPath* outPath, const char* pathStr, size_t strLength);
|
|
static void getPathDataFromString(PathData* outData, const char* pathStr, size_t strLength);
|
|
static void dump(const PathData& data);
|
|
};
|
|
|
|
}; // namespace uirenderer
|
|
}; // namespace android
|
|
#endif //ANDROID_HWUI_PATHPARSER_H
|