use of android.graphics.Picture in project UltimateAndroid by cymcsg.
the class SVGParser method parse.
private static SVG parse(InputStream in, Integer searchColor, Integer replaceColor, boolean whiteMode, int targetWidth, int targetHeight) throws SVGParseException {
// Util.debug("Parsing SVG...");
try {
long start = System.currentTimeMillis();
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
final Picture picture = new Picture();
SVGHandler handler = new SVGHandler(picture, targetWidth, targetHeight);
handler.setColorSwap(searchColor, replaceColor);
handler.setWhiteMode(whiteMode);
xr.setContentHandler(handler);
xr.parse(new InputSource(in));
// Util.debug("Parsing complete in " + (System.currentTimeMillis() - start) + " millis.");
SVG result = new SVG(picture, handler.bounds);
// Skip bounds if it was an empty pic
if (!Float.isInfinite(handler.limits.top)) {
result.setLimits(handler.limits);
}
return result;
} catch (Exception e) {
throw new SVGParseException(e);
}
}
use of android.graphics.Picture in project chromeview by pwnall.
the class JavaBrowserViewRendererHelper method recordBitmapIntoPicture.
/**
* Creates a new Picture that records drawing a provided bitmap.
* Will return an empty Picture if the Bitmap is null.
*/
@CalledByNative
private static Picture recordBitmapIntoPicture(Bitmap bitmap) {
Picture picture = new Picture();
if (bitmap != null) {
Canvas recordingCanvas = picture.beginRecording(bitmap.getWidth(), bitmap.getHeight());
drawBitmapIntoCanvas(bitmap, recordingCanvas);
picture.endRecording();
}
return picture;
}
Aggregations