1 /* 2 * Copyright 2017 ARM Ltd. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrDistanceFieldGenFromVector_DEFINED 9 #define GrDistanceFieldGenFromVector_DEFINED 10 11 #include "include/core/SkPath.h" 12 13 class SkMatrix; 14 15 /** Given a vector path, generate the associated distance field. 16 17 * @param distanceField The distance field to be generated. Should already be allocated 18 * by the client with the padding defined in "SkDistanceFieldGen.h". 19 * @param path The path we're using to generate the distance field. 20 * @param matrix Transformation matrix for path. 21 * @param width Width of the distance field. 22 * @param height Height of the distance field. 23 * @param rowBytes Size of each row in the distance field, in bytes. 24 */ 25 bool GrGenerateDistanceFieldFromPath(unsigned char* distanceField, 26 const SkPath& path, const SkMatrix& viewMatrix, 27 int width, int height, size_t rowBytes); 28 IsDistanceFieldSupportedFillType(SkPathFillType fFillType)29inline bool IsDistanceFieldSupportedFillType(SkPathFillType fFillType) 30 { 31 return (SkPathFillType::kEvenOdd == fFillType || 32 SkPathFillType::kInverseEvenOdd == fFillType); 33 } 34 35 #endif 36