@Override public Canvas restore() { ctx.restore(); return this; }
@Override public Canvas restore() { ctx.restore(); return this; }
@Override public Canvas restore() { ctx.restore(); return this; }
private void clearCanvas(Canvas canvas) { canvas.getContext2d().save(); canvas.getContext2d().setTransform(1, 0, 0, 1, 0, 0); canvas.getContext2d().clearRect(0, 0, canvas.getCoordinateSpaceWidth(), canvas.getCoordinateSpaceHeight()); canvas.getContext2d().restore(); }
private void clearCanvas(Canvas canvas) { canvas.getContext2d().save(); canvas.getContext2d().setTransform(1, 0, 0, 1, 0, 0); canvas.getContext2d().clearRect(0, 0, canvas.getCoordinateSpaceWidth(), canvas.getCoordinateSpaceHeight()); canvas.getContext2d().restore(); }
@Override public void paint(Canvas canvas, Matrix matrix) { /* * paint image on canvas based on the original and with the transformations of the matrix. * */ Context2d context2d = canvas.getContext2d(); context2d.save(); boolean xReversal = matrix.getXx() < 0; boolean yReversal = matrix.getYy() < 0; context2d.scale(xReversal ? -1 : 1, yReversal ? -1 : 1); double xValue = xReversal ? box.getMaxX() * -1 : box.getX(); double yValue = yReversal ? box.getMaxY() * -1 : box.getY(); context2d.drawImage(hiddenImageCanvas.getCanvasElement(), xValue, yValue, box.getWidth(), box.getHeight()); context2d.restore(); }
@Override public void paint(Canvas canvas, Matrix matrix) { canvas.getContext2d().save(); canvas.getContext2d().setFillStyle(fillStyle); canvas.getContext2d().fillRect(box.getX(), box.getY(), box.getWidth(), box.getHeight()); canvas.getContext2d().setStrokeStyle(strokeStyle); canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx()); canvas.getContext2d().strokeRect(box.getX(), box.getY(), box.getWidth(), box.getHeight()); canvas.getContext2d().restore(); }
@Override public void paint(Canvas canvas, Matrix matrix) { canvas.getContext2d().save(); canvas.getContext2d().setFillStyle(fillStyle); canvas.getContext2d().fillRect(box.getX(), box.getY(), box.getWidth(), box.getHeight()); canvas.getContext2d().setStrokeStyle(strokeStyle); canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx()); canvas.getContext2d().strokeRect(box.getX(), box.getY(), box.getWidth(), box.getHeight()); canvas.getContext2d().restore(); }
@Override public void paint(Canvas canvas, Matrix matrix) { if (Geometry.POLYGON.equals(geometry.getGeometryType())) { canvas.getContext2d().save(); canvas.getContext2d().setFillStyle(fillStyle); canvas.getContext2d().setStrokeStyle(strokeStyle); canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx()); canvas.getContext2d().beginPath(); for (Geometry ring : geometry.getGeometries()) { Coordinate[] coords = ring.getCoordinates(); canvas.getContext2d().moveTo(coords[0].getX(), coords[0].getY()); for (int i = 1; i < coords.length - 1; i++) { canvas.getContext2d().lineTo(coords[i].getX(), coords[i].getY()); } } canvas.getContext2d().closePath(); canvas.getContext2d().fill(); canvas.getContext2d().stroke(); canvas.getContext2d().restore(); } }
@Override public void paint(Canvas canvas, Matrix matrix) { if (Geometry.POLYGON.equals(geometry.getGeometryType())) { canvas.getContext2d().save(); canvas.getContext2d().setFillStyle(fillStyle); canvas.getContext2d().setStrokeStyle(strokeStyle); canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx()); canvas.getContext2d().beginPath(); for (Geometry ring : geometry.getGeometries()) { Coordinate[] coords = ring.getCoordinates(); canvas.getContext2d().moveTo(coords[0].getX(), coords[0].getY()); for (int i = 1; i < coords.length - 1; i++) { canvas.getContext2d().lineTo(coords[i].getX(), coords[i].getY()); } } canvas.getContext2d().closePath(); canvas.getContext2d().fill(); canvas.getContext2d().stroke(); canvas.getContext2d().restore(); } }