Brian Salomon | ab664fa | 2017-03-24 16:07:20 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 Google Inc. |
| 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 SkInsetConvexPolygon_DEFINED |
| 9 | #define SkInsetConvexPolygon_DEFINED |
| 10 | |
| 11 | #include "SkTDArray.h" |
| 12 | #include "SkPoint.h" |
| 13 | |
| 14 | /** |
| 15 | * Generates a polygon that is inset a given distance from the boundary of a given convex polygon. |
| 16 | * |
| 17 | * @param inputPolygonVerts Array of points representing the vertices of the original polygon. |
| 18 | * It should be convex and have no coincident points. |
| 19 | * @param inputPolygonSize Number of vertices in the original polygon. |
| 20 | * @param insetDistance How far we wish to inset the polygon. This should be a positive value. |
| 21 | * @param insetPolygon The resulting inset polygon, if any. |
| 22 | * @return true if an inset polygon exists, false otherwise. |
| 23 | */ |
| 24 | bool SkInsetConvexPolygon(const SkPoint* inputPolygonVerts, int inputPolygonSize, |
| 25 | SkScalar insetDistance, SkTDArray<SkPoint>* insetPolygon); |
| 26 | |
| 27 | #endif |