1064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org/* 2064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org * CAUTION: EXPERIMENTAL CODE 3064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org * 4064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org * This code is not to be used and will not be supported 5064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org * if it fails on you. DO NOT USE! 6064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org * 7064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org */ 8064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org 9064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org#ifndef SkPathUtils_DEFINED 10293f01939ccb3a97ce3c3e907829fa3a11b78fa0tfarina@chromium.org#define SkPathUtils_DEFINED 11064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org 12064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org#include "SkPath.h" 13064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org 14064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org/* 15064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org * The following methods return the boundary path given a 1-bit bitmap, specified 16064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org * by width/height and stride. The bits are interpreted as 1 being "in" the path, 17064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org * and 0 being "out". The bits are interpreted as MSB on the left, and LSB on the right. 18064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org */ 19064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org 20064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.orgclass SK_API SkPathUtils { 21064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.orgpublic: 22064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org /** 23064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org This variation iterates the binary data sequentially (as in scanline fashion) 24064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org and will add each run of 1's to the path as a rectangular path. Upon parsing 25064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org all binary data the path is simplified using the PathOps::Simplify() method. 26064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org */ 27064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org static void BitsToPath_Path(SkPath* path, const char* bitmap, 28d43f6449129f11c9823bdeb0fb8ac38ab6d76a28commit-bot@chromium.org int w, int h, int rowBytes); 29064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org 30064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org /** 31064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org This variation utilizes the SkRegion class to generate paths, adding 32064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org each run of 1's to the SkRegion as an SkIRect. Upon parsing the entirety 33064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org of the binary the SkRegion is converted to a Path via getBoundaryPath(). 34064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org */ 35064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org static void BitsToPath_Region(SkPath* path, const char* bitmap, 36d43f6449129f11c9823bdeb0fb8ac38ab6d76a28commit-bot@chromium.org int w, int h, int rowBytes); 37064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org 38064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org}; 39064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org 40064779aa18694b68536c113f7d5b74ccbe38d3bacommit-bot@chromium.org#endif 41