public JuliaRealViewer2DExample( final ComplexDoubleType c, final int maxIterations, final int maxAmplitude, final Converter<LongType, ARGBType> converter) { this.c = c; juliaset = new JuliaRealRandomAccessible(c, maxIterations, maxAmplitude); /* center shift */ final AffineTransform2D centerShift = new AffineTransform2D(); centerShift.set(1, 0, -width / 2.0, 0, 1, -height / 2.0); /* center un-shift */ final AffineTransform2D centerUnShift = new AffineTransform2D(); centerUnShift.set(1, 0, width / 2.0, 0, 1, height / 2.0); /* initialize rotation */ final AffineTransform2D rotation = new AffineTransform2D(); rotation.scale(200); rotation.preConcatenate(centerUnShift); final LogoPainter logo = new LogoPainter(); viewer = new InteractiveRealViewer2D<LongType>(width, height, juliaset, rotation, converter) { @Override public void drawScreenImage() { super.drawScreenImage(); logo.paint(screenImage); } }; viewer.getDisplay().addHandler(new JuliaListener()); }
public double getScale() { final AffineTransform2D a = viewer.getDisplay().getViewerTransform(); final double ax = a.get(0, 0); final double ay = a.get(0, 1); return Math.sqrt(ax * ax + ay * ay); }