commit-bot@chromium.org | 064779a | 2013-07-01 17:50:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * CAUTION: EXPERIMENTAL CODE |
| 3 | * |
| 4 | * This code is not to be used and will not be supported |
| 5 | * if it fails on you. DO NOT USE! |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | #ifndef SkPathUtils_DEFINED |
tfarina@chromium.org | 293f019 | 2013-07-08 13:00:42 +0000 | [diff] [blame] | 10 | #define SkPathUtils_DEFINED |
commit-bot@chromium.org | 064779a | 2013-07-01 17:50:29 +0000 | [diff] [blame] | 11 | |
| 12 | #include "SkPath.h" |
| 13 | |
| 14 | /* |
| 15 | * The following methods return the boundary path given a 1-bit bitmap, specified |
| 16 | * by width/height and stride. The bits are interpreted as 1 being "in" the path, |
| 17 | * and 0 being "out". The bits are interpreted as MSB on the left, and LSB on the right. |
| 18 | */ |
| 19 | |
| 20 | class SK_API SkPathUtils { |
| 21 | public: |
| 22 | /** |
| 23 | This variation iterates the binary data sequentially (as in scanline fashion) |
| 24 | and will add each run of 1's to the path as a rectangular path. Upon parsing |
| 25 | all binary data the path is simplified using the PathOps::Simplify() method. |
| 26 | */ |
| 27 | static void BitsToPath_Path(SkPath* path, const char* bitmap, |
commit-bot@chromium.org | d43f644 | 2013-07-09 16:30:38 +0000 | [diff] [blame] | 28 | int w, int h, int rowBytes); |
commit-bot@chromium.org | 064779a | 2013-07-01 17:50:29 +0000 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | This variation utilizes the SkRegion class to generate paths, adding |
| 32 | each run of 1's to the SkRegion as an SkIRect. Upon parsing the entirety |
| 33 | of the binary the SkRegion is converted to a Path via getBoundaryPath(). |
| 34 | */ |
| 35 | static void BitsToPath_Region(SkPath* path, const char* bitmap, |
commit-bot@chromium.org | d43f644 | 2013-07-09 16:30:38 +0000 | [diff] [blame] | 36 | int w, int h, int rowBytes); |
commit-bot@chromium.org | 064779a | 2013-07-01 17:50:29 +0000 | [diff] [blame] | 37 | |
| 38 | }; |
| 39 | |
| 40 | #endif |