1159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org/*
2159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org *  CAUTION: EXPERIMENTAL CODE
3159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org *
4159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org *  This code is not to be used and will not be supported
5159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org *  if it fails on you. DO NOT USE!
6159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org *
7159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org */
8159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org
9159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org#ifndef SkPathUtils_DEFINED
104e50326bc7aaf1b0b1cde8da72421269e46e5471tfarina@chromium.org#define SkPathUtils_DEFINED
11159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org
12159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org#include "SkPath.h"
13159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org
14159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org/*
15159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org * The following methods return the boundary path given a 1-bit bitmap, specified
16159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org * by width/height and stride. The bits are interpreted as 1 being "in" the path,
17159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org * and 0 being "out". The bits are interpreted as MSB on the left, and LSB on the right.
18159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org */
19159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org
20159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.orgclass SK_API SkPathUtils {
21159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.orgpublic:
22159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org    /**
23159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org       This variation iterates the binary data sequentially (as in scanline fashion)
24159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org       and will add each run of 1's to the path as a rectangular path. Upon parsing
25159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org       all binary data the path is simplified using the PathOps::Simplify() method.
26159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org    */
27159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org    static void BitsToPath_Path(SkPath* path, const char* bitmap,
28feae0e05bc04b95cc12104f0970b7e652a0e845acommit-bot@chromium.org                            int w, int h, int rowBytes);
29159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org
30159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org    /**
31159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org       This variation utilizes the SkRegion class to generate paths, adding
32159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org       each run of 1's to the SkRegion as an SkIRect. Upon parsing the entirety
33159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org       of the binary the SkRegion is converted to a Path via getBoundaryPath().
34159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org    */
35159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org    static void BitsToPath_Region(SkPath* path, const char* bitmap,
36feae0e05bc04b95cc12104f0970b7e652a0e845acommit-bot@chromium.org                                   int w, int h, int rowBytes);
37159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org
38159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org};
39159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org
40159eb42d8c5122bd269a2f7cb71bc4e2bfa153cdcommit-bot@chromium.org#endif
41