@Override public void init() { // remove the background layer added by default graphics().rootLayer().removeAll(); // add a grey square SurfaceImage surf = graphics().createSurface(width, height); surf.surface().setFillColor(Color.rgb(200, 200, 200)); surf.surface().fillRect(0, 0, width, height); square = graphics().createImageLayer(surf); graphics().rootLayer().add(square); }
@Override public void onSuccess(Image image) { // once the image loads, create our layers imageLayer1 = graphics().createImageLayer(image); SurfaceImage surface1 = graphics().createSurface(image.width(), image.height()); surface1.surface().drawImage(image, 0, 0); surfaceLayer1 = graphics().createImageLayer(surface1); CanvasImage canvas1 = graphics().createImage(image.width(), image.height()); canvas1.canvas().drawImage(image, 0, 0); canvasLayer1 = graphics().createImageLayer(canvas1); imageLayer2 = graphics().createImageLayer(image); SurfaceImage surface2 = graphics().createSurface(image.width(), image.height()); surface2.surface().drawImage(image, 0, 0); surfaceLayer2 = graphics().createImageLayer(surface2); CanvasImage canvas2 = graphics().createImage(image.width(), image.height()); canvas2.canvas().drawImage(image, 0, 0); canvasLayer2 = graphics().createImageLayer(canvas2); // add layers to the rootLayer rootLayer.addAt(imageLayer1, offset, offset); rootLayer.addAt(surfaceLayer1, offset + width, offset); rootLayer.addAt(canvasLayer1, offset + 2 * width, offset); rootLayer.addAt(imageLayer2, offset, offset + 2 * height); rootLayer.addAt(surfaceLayer2, offset + width, offset + 2 * height); rootLayer.addAt(canvasLayer2, offset + 2 * width, offset + 2 * height); }
}, 120, 210, "ImmediateLayer patterned fillRect, fillTriangles"); SurfaceImage patted = graphics().createSurface(100, 100); patted.surface().setFillPattern(pattern).fillRect(0, 0, 100, 100); ypos = ygap + addTest(170, ypos, graphics().createImageLayer(patted), SurfaceImage dot = graphics().createSurface(10, 10); dot.surface().setFillColor(0xFFFF0000); dot.surface().fillRect(0, 0, 5, 5); paintUpped = graphics().createSurface(100, 100); ypos = ygap + addTest(315, ypos, graphics().createImageLayer(paintUpped), "SurfaceImage updated in paint()");
x += width; SurfaceImage surf1 = graphics().createSurface(image.width(), image.height()); surf1.surface().setAlpha(0.5f).drawImage(image, 0, 0); groupLayer.addAt(graphics().createImageLayer(surf1), x, offset); x += width; SurfaceImage surf2 = graphics().createSurface(image.width(), image.height()); surf2.surface().drawImage(image, 0, 0); groupLayer.addAt(graphics().createImageLayer(surf2).setAlpha(0.5f), x, offset); x += width; SurfaceImage surf1b = graphics().createSurface(image.width(), image.height()); surf1b.surface().setAlpha(0.5f).drawImage(image, 0, 0); groupLayer.addAt(graphics().createImageLayer(surf1b), x, offset + 2 * height); x += width; SurfaceImage surf2b = graphics().createSurface(image.width(), image.height()); surf2b.surface().drawImage(image, 0, 0); groupLayer.addAt(graphics().createImageLayer(surf2b).setAlpha(0.5f), x, offset + 2 * height);
SurfaceImage bg = graphics().createSurface(fullWidth, fullHeight); bg.surface().setFillColor(Color.rgb(255, 255, 255)); bg.surface().fillRect(0, 0, fullWidth, fullHeight);
SurfaceImage bg = graphics().createSurface((int) (4 * width), (int) (4 * height)); bg.surface().setFillColor(Color.rgb(255, 255, 255)); bg.surface().fillRect(0, 0, bg.surface().width(), bg.surface().height());
SurfaceImage image = graphics().createSurface(twidth, theight); image.surface().translate(-gap, -gap).drawLayer(group); graphics().rootLayer().addAt(graphics().createImageLayer(image), x, y);
SurfaceImage surf = graphics().createSurface(orange.width(), orange.height()); surf.surface().drawImage(orange, 0, 0); Image.Region surfrep = surf.subImage(0, phh/2, pw, phh);
SurfaceImage si = graphics().createSurface(100, 50); si.surface().setFillColor(0xFF99CCFF).fillRect(0, 0, 100, 50); s1 = graphics().createImageLayer(si);