1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/include/utils/SkPathUtils.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,40 @@ 1.4 +/* 1.5 + * CAUTION: EXPERIMENTAL CODE 1.6 + * 1.7 + * This code is not to be used and will not be supported 1.8 + * if it fails on you. DO NOT USE! 1.9 + * 1.10 + */ 1.11 + 1.12 +#ifndef SkPathUtils_DEFINED 1.13 +#define SkPathUtils_DEFINED 1.14 + 1.15 +#include "SkPath.h" 1.16 + 1.17 +/* 1.18 + * The following methods return the boundary path given a 1-bit bitmap, specified 1.19 + * by width/height and stride. The bits are interpreted as 1 being "in" the path, 1.20 + * and 0 being "out". The bits are interpreted as MSB on the left, and LSB on the right. 1.21 + */ 1.22 + 1.23 +class SK_API SkPathUtils { 1.24 +public: 1.25 + /** 1.26 + This variation iterates the binary data sequentially (as in scanline fashion) 1.27 + and will add each run of 1's to the path as a rectangular path. Upon parsing 1.28 + all binary data the path is simplified using the PathOps::Simplify() method. 1.29 + */ 1.30 + static void BitsToPath_Path(SkPath* path, const char* bitmap, 1.31 + int w, int h, int rowBytes); 1.32 + 1.33 + /** 1.34 + This variation utilizes the SkRegion class to generate paths, adding 1.35 + each run of 1's to the SkRegion as an SkIRect. Upon parsing the entirety 1.36 + of the binary the SkRegion is converted to a Path via getBoundaryPath(). 1.37 + */ 1.38 + static void BitsToPath_Region(SkPath* path, const char* bitmap, 1.39 + int w, int h, int rowBytes); 1.40 + 1.41 +}; 1.42 + 1.43 +#endif