joel.liang | 8cbb424 | 2017-01-09 18:39:43 -0800 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkPath.h" |
joel.liang | 8cbb424 | 2017-01-09 18:39:43 -0800 | [diff] [blame] | 12 | |
| 13 | class SkMatrix; |
| 14 | |
joel.liang | 8cbb424 | 2017-01-09 18:39:43 -0800 | [diff] [blame] | 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 | |
Mike Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 29 | inline bool IsDistanceFieldSupportedFillType(SkPathFillType fFillType) |
joel.liang | 8cbb424 | 2017-01-09 18:39:43 -0800 | [diff] [blame] | 30 | { |
Mike Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 31 | return (SkPathFillType::kEvenOdd == fFillType || |
| 32 | SkPathFillType::kInverseEvenOdd == fFillType); |
joel.liang | 8cbb424 | 2017-01-09 18:39:43 -0800 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | #endif |