public final String toDataURL() { if (LienzoGlobals.getInstance().isCanvasSupported()) { ScratchCanvas scratch = new ScratchCanvas(m_wide, m_high); FastArrayList<Layer> layers = getChildNodes(); if (null != layers) { final int size = layers.length(); for (int i = size - 1; i >= 0; i--) { Layer layer = layers.get(i); if ((null != layer) && (layer.isVisible())) { layer.drawWithTransforms(scratch.getContext()); } } } return scratch.toDataURL(); } else { return "data:,"; } }
public final String toDataURL(DataURLType mimetype) { if (LienzoGlobals.getInstance().isCanvasSupported()) { ScratchCanvas scratch = new ScratchCanvas(m_wide, m_high); FastArrayList<Layer> layers = getChildNodes(); if (null != layers) { final int size = layers.length(); for (int i = size - 1; i >= 0; i--) { Layer layer = layers.get(i); if ((null != layer) && (layer.isVisible())) { layer.drawWithTransforms(scratch.getContext()); } } } return scratch.toDataURL(mimetype); } else { return "data:,"; } }
final String toDataURL(DataURLType mimetype, Layer background) { if (LienzoGlobals.getInstance().isCanvasSupported()) { ScratchCanvas scratch = new ScratchCanvas(m_wide, m_high); FastArrayList<Layer> layers = getChildNodes(); if (null != layers) { final int size = layers.length(); if (null != background) { background.drawWithTransforms(scratch.getContext()); } for (int i = size - 1; i >= 0; i--) { Layer layer = layers.get(i); if ((null != layer) && (layer.isVisible())) { layer.drawWithTransforms(scratch.getContext()); } } } return scratch.toDataURL(mimetype); } else { return "data:,"; } }
final String toDataURL(Layer background) { if (LienzoGlobals.getInstance().isCanvasSupported()) { ScratchCanvas scratch = new ScratchCanvas(m_wide, m_high); FastArrayList<Layer> layers = getChildNodes(); if (null != layers) { final int size = layers.length(); if (null != background) { background.drawWithTransforms(scratch.getContext()); } for (int i = size - 1; i >= 0; i--) { Layer layer = layers.get(i); if ((null != layer) && (layer.isVisible())) { layer.drawWithTransforms(scratch.getContext()); } } } return scratch.toDataURL(); } else { return "data:,"; } }