Java Code Examples for java.awt.geom.AffineTransform#equals()
The following examples show how to use
java.awt.geom.AffineTransform#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dragonwell8_jdk File: RasterPrinterJob.java License: GNU General Public License v2.0 | 6 votes |
synchronized void setGraphicsConfigInfo(AffineTransform at, double pw, double ph) { Point2D.Double pt = new Point2D.Double(pw, ph); at.transform(pt, pt); if (pgConfig == null || defaultDeviceTransform == null || !at.equals(defaultDeviceTransform) || deviceWidth != (int)pt.getX() || deviceHeight != (int)pt.getY()) { deviceWidth = (int)pt.getX(); deviceHeight = (int)pt.getY(); defaultDeviceTransform = at; pgConfig = null; } }
Example 2
Source Project: dragonwell8_jdk File: PSPrinterJob.java License: GNU General Public License v2.0 | 6 votes |
void emitTransform(AffineTransform transform) { if (transform != null && transform.equals(mTransform) == false) { double[] matrix = new double[6]; transform.getMatrix(matrix); mPSStream.println("[" + (float)matrix[0] + " " + (float)matrix[1] + " " + (float)matrix[2] + " " + (float)matrix[3] + " " + (float)matrix[4] + " " + (float)matrix[5] + "] concat"); mTransform = transform; } }
Example 3
Source Project: dragonwell8_jdk File: TransformSetGet.java License: GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); final VolatileImage vi = gc.createCompatibleVolatileImage(200, 200); final SunGraphics2D sg2d = (SunGraphics2D) vi.createGraphics(); sg2d.constrain(0, 61, 100, 100); final AffineTransform expected = sg2d.cloneTransform(); sg2d.setTransform(sg2d.getTransform()); final AffineTransform actual = sg2d.cloneTransform(); sg2d.dispose(); vi.flush(); if (!expected.equals(actual)) { System.out.println("Expected = " + expected); System.out.println("Actual = " + actual); throw new RuntimeException("Wrong transform"); } }
Example 4
Source Project: jdk8u-jdk File: RasterPrinterJob.java License: GNU General Public License v2.0 | 6 votes |
synchronized void setGraphicsConfigInfo(AffineTransform at, double pw, double ph) { Point2D.Double pt = new Point2D.Double(pw, ph); at.transform(pt, pt); if (pgConfig == null || defaultDeviceTransform == null || !at.equals(defaultDeviceTransform) || deviceWidth != (int)pt.getX() || deviceHeight != (int)pt.getY()) { deviceWidth = (int)pt.getX(); deviceHeight = (int)pt.getY(); defaultDeviceTransform = at; pgConfig = null; } }
Example 5
Source Project: TencentKona-8 File: PSPrinterJob.java License: GNU General Public License v2.0 | 6 votes |
void emitTransform(AffineTransform transform) { if (transform != null && transform.equals(mTransform) == false) { double[] matrix = new double[6]; transform.getMatrix(matrix); mPSStream.println("[" + (float)matrix[0] + " " + (float)matrix[1] + " " + (float)matrix[2] + " " + (float)matrix[3] + " " + (float)matrix[4] + " " + (float)matrix[5] + "] concat"); mTransform = transform; } }
Example 6
Source Project: jdk8u-dev-jdk File: TransformSetGet.java License: GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); final VolatileImage vi = gc.createCompatibleVolatileImage(200, 200); final SunGraphics2D sg2d = (SunGraphics2D) vi.createGraphics(); sg2d.constrain(0, 61, 100, 100); final AffineTransform expected = sg2d.cloneTransform(); sg2d.setTransform(sg2d.getTransform()); final AffineTransform actual = sg2d.cloneTransform(); sg2d.dispose(); vi.flush(); if (!expected.equals(actual)) { System.out.println("Expected = " + expected); System.out.println("Actual = " + actual); throw new RuntimeException("Wrong transform"); } }
Example 7
Source Project: jdk8u60 File: RasterPrinterJob.java License: GNU General Public License v2.0 | 6 votes |
synchronized void setGraphicsConfigInfo(AffineTransform at, double pw, double ph) { Point2D.Double pt = new Point2D.Double(pw, ph); at.transform(pt, pt); if (pgConfig == null || defaultDeviceTransform == null || !at.equals(defaultDeviceTransform) || deviceWidth != (int)pt.getX() || deviceHeight != (int)pt.getY()) { deviceWidth = (int)pt.getX(); deviceHeight = (int)pt.getY(); defaultDeviceTransform = at; pgConfig = null; } }
Example 8
Source Project: openjdk-8-source File: TransformSetGet.java License: GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); final VolatileImage vi = gc.createCompatibleVolatileImage(200, 200); final SunGraphics2D sg2d = (SunGraphics2D) vi.createGraphics(); sg2d.constrain(0, 61, 100, 100); final AffineTransform expected = sg2d.cloneTransform(); sg2d.setTransform(sg2d.getTransform()); final AffineTransform actual = sg2d.cloneTransform(); sg2d.dispose(); vi.flush(); if (!expected.equals(actual)) { System.out.println("Expected = " + expected); System.out.println("Actual = " + actual); throw new RuntimeException("Wrong transform"); } }
Example 9
Source Project: openjdk-jdk8u File: RasterPrinterJob.java License: GNU General Public License v2.0 | 6 votes |
synchronized void setGraphicsConfigInfo(AffineTransform at, double pw, double ph) { Point2D.Double pt = new Point2D.Double(pw, ph); at.transform(pt, pt); if (pgConfig == null || defaultDeviceTransform == null || !at.equals(defaultDeviceTransform) || deviceWidth != (int)pt.getX() || deviceHeight != (int)pt.getY()) { deviceWidth = (int)pt.getX(); deviceHeight = (int)pt.getY(); defaultDeviceTransform = at; pgConfig = null; } }
Example 10
Source Project: openjdk-8-source File: PSPrinterJob.java License: GNU General Public License v2.0 | 6 votes |
void emitTransform(AffineTransform transform) { if (transform != null && transform.equals(mTransform) == false) { double[] matrix = new double[6]; transform.getMatrix(matrix); mPSStream.println("[" + (float)matrix[0] + " " + (float)matrix[1] + " " + (float)matrix[2] + " " + (float)matrix[3] + " " + (float)matrix[4] + " " + (float)matrix[5] + "] concat"); mTransform = transform; } }
Example 11
Source Project: openjdk-jdk8u File: TransformSetGet.java License: GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); final VolatileImage vi = gc.createCompatibleVolatileImage(200, 200); final SunGraphics2D sg2d = (SunGraphics2D) vi.createGraphics(); sg2d.constrain(0, 61, 100, 100); final AffineTransform expected = sg2d.cloneTransform(); sg2d.setTransform(sg2d.getTransform()); final AffineTransform actual = sg2d.cloneTransform(); sg2d.dispose(); vi.flush(); if (!expected.equals(actual)) { System.out.println("Expected = " + expected); System.out.println("Actual = " + actual); throw new RuntimeException("Wrong transform"); } }
Example 12
Source Project: hottub File: TransformSetGet.java License: GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); final VolatileImage vi = gc.createCompatibleVolatileImage(200, 200); final SunGraphics2D sg2d = (SunGraphics2D) vi.createGraphics(); sg2d.constrain(0, 61, 100, 100); final AffineTransform expected = sg2d.cloneTransform(); sg2d.setTransform(sg2d.getTransform()); final AffineTransform actual = sg2d.cloneTransform(); sg2d.dispose(); vi.flush(); if (!expected.equals(actual)) { System.out.println("Expected = " + expected); System.out.println("Actual = " + actual); throw new RuntimeException("Wrong transform"); } }
Example 13
Source Project: openjdk-jdk8u-backup File: PSPrinterJob.java License: GNU General Public License v2.0 | 6 votes |
void emitTransform(AffineTransform transform) { if (transform != null && transform.equals(mTransform) == false) { double[] matrix = new double[6]; transform.getMatrix(matrix); mPSStream.println("[" + (float)matrix[0] + " " + (float)matrix[1] + " " + (float)matrix[2] + " " + (float)matrix[3] + " " + (float)matrix[4] + " " + (float)matrix[5] + "] concat"); mTransform = transform; } }
Example 14
Source Project: openjdk-jdk8u-backup File: TransformSetGet.java License: GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); final VolatileImage vi = gc.createCompatibleVolatileImage(200, 200); final SunGraphics2D sg2d = (SunGraphics2D) vi.createGraphics(); sg2d.constrain(0, 61, 100, 100); final AffineTransform expected = sg2d.cloneTransform(); sg2d.setTransform(sg2d.getTransform()); final AffineTransform actual = sg2d.cloneTransform(); sg2d.dispose(); vi.flush(); if (!expected.equals(actual)) { System.out.println("Expected = " + expected); System.out.println("Actual = " + actual); throw new RuntimeException("Wrong transform"); } }
Example 15
Source Project: Bytecoder File: RasterPrinterJob.java License: Apache License 2.0 | 6 votes |
synchronized void setGraphicsConfigInfo(AffineTransform at, double pw, double ph) { Point2D.Double pt = new Point2D.Double(pw, ph); at.transform(pt, pt); if (pgConfig == null || defaultDeviceTransform == null || !at.equals(defaultDeviceTransform) || deviceWidth != (int)pt.getX() || deviceHeight != (int)pt.getY()) { deviceWidth = (int)pt.getX(); deviceHeight = (int)pt.getY(); defaultDeviceTransform = at; pgConfig = null; } }
Example 16
Source Project: openjdk-8 File: TransformSetGet.java License: GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); final VolatileImage vi = gc.createCompatibleVolatileImage(200, 200); final SunGraphics2D sg2d = (SunGraphics2D) vi.createGraphics(); sg2d.constrain(0, 61, 100, 100); final AffineTransform expected = sg2d.cloneTransform(); sg2d.setTransform(sg2d.getTransform()); final AffineTransform actual = sg2d.cloneTransform(); sg2d.dispose(); vi.flush(); if (!expected.equals(actual)) { System.out.println("Expected = " + expected); System.out.println("Actual = " + actual); throw new RuntimeException("Wrong transform"); } }
Example 17
Source Project: openjdk-jdk9 File: RasterPrinterJob.java License: GNU General Public License v2.0 | 6 votes |
synchronized void setGraphicsConfigInfo(AffineTransform at, double pw, double ph) { Point2D.Double pt = new Point2D.Double(pw, ph); at.transform(pt, pt); if (pgConfig == null || defaultDeviceTransform == null || !at.equals(defaultDeviceTransform) || deviceWidth != (int)pt.getX() || deviceHeight != (int)pt.getY()) { deviceWidth = (int)pt.getX(); deviceHeight = (int)pt.getY(); defaultDeviceTransform = at; pgConfig = null; } }
Example 18
Source Project: Digital File: CircuitComponent.java License: GNU General Public License v3.0 | 5 votes |
/** * maximizes the circuit shown */ public void fitCircuit() { GraphicMinMax gr = new GraphicMinMax(); getCircuit().drawTo(gr); AffineTransform newTrans = new AffineTransform(); if (gr.getMin() != null && getWidth() != 0 && getHeight() != 0) { Vector delta = gr.getMax().sub(gr.getMin()); int pad = circuitScrollPanel.getBarWidth(); double sx = ((double) getWidth() - pad) / (delta.x + SIZE * 2); double sy = ((double) getHeight() - pad) / (delta.y + SIZE * 2); double s = Math.min(sx, sy); newTrans.setToScale(s, s); // set Scaling Vector center = gr.getMin().add(gr.getMax()).div(2); newTrans.translate(-center.x, -center.y); // move drawing center to (0,0) Vector dif = new Vector(getWidth(), getHeight()).div(2); newTrans.translate(dif.x / s, dif.y / s); // move drawing center to frame center isManualScale = false; } else { isManualScale = true; } if (!newTrans.equals(transform)) { transform = newTrans; if (circuitScrollPanel != null) circuitScrollPanel.transformChanged(transform); graphicHasChanged(); } }
Example 19
Source Project: TrakEM2 File: TransformationStep.java License: GNU General Public License v3.0 | 5 votes |
public boolean isIdentical(final History.Step<?> step) { if (step.getClass() != TransformationStep.class) return false; final HashMap<Displayable,AffineTransform> m = ((TransformationStep)step).ht; // cheap test: if (m.size() != this.ht.size()) return false; // Check each: for (final Map.Entry<Displayable,AffineTransform> e : m.entrySet()) { final AffineTransform aff = this.ht.get(e.getKey()); if (null == aff) return false; // at least one Displayable is missing if (!aff.equals(e.getValue())) return false; // at least one Displayable has a different AffineTransform } return true; }
Example 20
Source Project: Bytecoder File: VolatileSurfaceManager.java License: Apache License 2.0 | 4 votes |
/** * Called from SunGraphicsEnv when there has been a display mode change. * Note that we simply invalidate hardware surfaces here; we do not * attempt to recreate or re-render them. This is to avoid threading * conflicts with the native toolkit and associated threads. Instead, * we just nullify the old surface data object and wait for a future * method in the rendering process to recreate the surface. */ public void displayChanged() { lostSurface = true; if (sdAccel != null) { // First, nullify the software surface. This guards against // using a SurfaceData that was created in a different // display mode. sdBackup = null; // Now, invalidate the old hardware-based SurfaceData // Note that getBackupSurface may set sdAccel to null so we have to invalidate it before SurfaceData oldData = sdAccel; sdAccel = null; oldData.invalidate(); sdCurrent = getBackupSurface(); } // Update graphicsConfig for the vImg in case it changed due to // this display change event vImg.updateGraphicsConfig(); // Compare the Graphics configuration transforms to determine // whether the software backed surface needs to be invalidated. AffineTransform atUpdated = vImg.getGraphicsConfig() .getDefaultTransform(); if (!isAccelerationEnabled()) { if (!atUpdated.equals(atCurrent)) { // Ideally there is no need to re-create a software surface. // But some OSs allow changes to display state at runtime. Such // a provision would cause mismatch in graphics configuration of // the display and the surface. Hence we re-create the software // surface as well. sdBackup = null; sdCurrent = getBackupSurface(); } else { // Software backed surface was not invalidated. lostSurface = false; } } // Update the AffineTransformation backing the volatile image atCurrent = atUpdated; }