michael@0: /* michael@0: * CAUTION: EXPERIMENTAL CODE michael@0: * michael@0: * This code is not to be used and will not be supported michael@0: * if it fails on you. DO NOT USE! michael@0: * michael@0: */ michael@0: michael@0: #ifndef SkPathUtils_DEFINED michael@0: #define SkPathUtils_DEFINED michael@0: michael@0: #include "SkPath.h" michael@0: michael@0: /* michael@0: * The following methods return the boundary path given a 1-bit bitmap, specified michael@0: * by width/height and stride. The bits are interpreted as 1 being "in" the path, michael@0: * and 0 being "out". The bits are interpreted as MSB on the left, and LSB on the right. michael@0: */ michael@0: michael@0: class SK_API SkPathUtils { michael@0: public: michael@0: /** michael@0: This variation iterates the binary data sequentially (as in scanline fashion) michael@0: and will add each run of 1's to the path as a rectangular path. Upon parsing michael@0: all binary data the path is simplified using the PathOps::Simplify() method. michael@0: */ michael@0: static void BitsToPath_Path(SkPath* path, const char* bitmap, michael@0: int w, int h, int rowBytes); michael@0: michael@0: /** michael@0: This variation utilizes the SkRegion class to generate paths, adding michael@0: each run of 1's to the SkRegion as an SkIRect. Upon parsing the entirety michael@0: of the binary the SkRegion is converted to a Path via getBoundaryPath(). michael@0: */ michael@0: static void BitsToPath_Region(SkPath* path, const char* bitmap, michael@0: int w, int h, int rowBytes); michael@0: michael@0: }; michael@0: michael@0: #endif