blob: 3ab7558a25367b88b5b06c04c3bf3d8b5dc36460 [file] [log] [blame]
Brian Salomonab664fa2017-03-24 16:07:20 +00001/*
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 */
24bool SkInsetConvexPolygon(const SkPoint* inputPolygonVerts, int inputPolygonSize,
25 SkScalar insetDistance, SkTDArray<SkPoint>* insetPolygon);
26
27#endif