/** Clears the entire surface to transparent blackness. */ public Surface clear () { return clear(0, 0, 0, 0); }
/** Clears the entire surface to transparent blackness. */ public Surface clear () { return clear(0, 0, 0, 0); }
/** * Renders the main scene graph into the OpenGL frame buffer. */ protected void paintScene () { viewSurf.saveTx(); viewSurf.begin(); viewSurf.clear(cred, cgreen, cblue, calpha); try { rootLayer.paint(viewSurf); } finally { viewSurf.end(); viewSurf.restoreTx(); } }
@Override public void layout () { super.layout(); Texture texture = _texture.get(); TextureSurface surf = new TextureSurface(iface.plat.graphics(), _defaultBatch, texture); surf.begin().clear(); layer.paint(surf); surf.end().close(); }
@Override public void paint(float alpha) { for (ImageLayer dot : dots) { if (random() > 0.95) { dot.setTranslation(dotBox.x + random()*(dotBox.width-10), dotBox.y + random()*(dotBox.height-10)); } } if (paintUpped != null) { float now = (elapsed + UPDATE_RATE*alpha)/1000; float sin = Math.abs(FloatMath.sin(now)), cos = Math.abs(FloatMath.cos(now)); int sinColor = (int)(sin * 255), cosColor = (int)(cos * 255); int c1 = (0xFF << 24) | (sinColor << 16) | (cosColor << 8); int c2 = (0xFF << 24) | (cosColor << 16) | (sinColor << 8); paintUpped.surface().clear(); paintUpped.surface().setFillColor(c1).fillRect(0, 0, 50, 50); paintUpped.surface().setFillColor(c2).fillRect(50, 50, 50, 50); } }
patted.begin().clear().setFillPattern(ttex).fillRect(0, 0, 100, 100).end().close(); ypos = ygap + addTest(170, ypos, new ImageLayer(patted.texture), "SurfaceImage patterned fillRect"); int c1 = (0xFF << 24) | (sinColor << 16) | (cosColor << 8); int c2 = (0xFF << 24) | (cosColor << 16) | (sinColor << 8); paintUpped.begin().clear(). setFillColor(c1).fillRect(0, 0, 50, 50). setFillColor(c2).fillRect(50, 50, 50, 50).
otile.width(), otile.height(), Texture.Config.DEFAULT.repeat(true, true)); new TextureSurface(game.graphics, game.defaultBatch, subtex).begin(). clear().draw(otile, 0, 0).end().close();
surf.begin().clear().draw(imtex, 0, 0).end().close(); game.rootLayer.addAt(new ImageLayer(surf.texture), offset + width, offset); game.rootLayer.addAt(new ImageLayer(surf.texture), offset + width, offset + 2*height);
surf1.begin().clear().setAlpha(0.5f).draw(imtex, 0, 0).end().close(); groupLayer.addAt(new ImageLayer(surf1.texture), x, y0); addDescrip("surface a=0.5\nimg layer a=1", x, y1, width); surf2.begin().clear().draw(imtex, 0, 0).end().close(); groupLayer.addAt(new ImageLayer(surf2.texture).setAlpha(0.5f), x, y0); addDescrip("surface a=1\nimg layer a=0.5", x, y1, width);