List of usage examples for java.awt.geom Point2D getY
public abstract double getY();
From source file:MouseTest.java
/** * Adds a square to the collection.// w ww. ja v a2 s .c om * @param p the center of the square */ public void add(Point2D p) { double x = p.getX(); double y = p.getY(); current = new Rectangle2D.Double(x - SIDELENGTH / 2, y - SIDELENGTH / 2, SIDELENGTH, SIDELENGTH); squares.add(current); repaint(); }
From source file:RollingText.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "Java Source and Support."; Font font = new Font("Serif", Font.PLAIN, 24); FontRenderContext frc = g2.getFontRenderContext(); g2.translate(40, 80);//from www . j a v a 2 s.com GlyphVector gv = font.createGlyphVector(frc, s); int length = gv.getNumGlyphs(); for (int i = 0; i < length; i++) { Point2D p = gv.getGlyphPosition(i); double theta = (double) i / (double) (length - 1) * Math.PI / 4; AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY()); at.rotate(theta); Shape glyph = gv.getGlyphOutline(i); Shape transformedGlyph = at.createTransformedShape(glyph); g2.fill(transformedGlyph); } }
From source file:edu.umass.cs.iesl.pdf2meta.cli.extract.pdfbox.pagedrawer.MoveTo.java
/** * process : m : Begin new subpath.//from ww w . j a va 2 s . co m * @param operator The operator that is being executed. * @param arguments List * @throws java.io.IOException If there is an error processing the operator. */ public void process(PDFOperator operator, List<COSBase> arguments) throws IOException { try { GraphicsAwarePDFStreamEngine drawer = (GraphicsAwarePDFStreamEngine) context; COSNumber x = (COSNumber) arguments.get(0); COSNumber y = (COSNumber) arguments.get(1); Point2D pos = drawer.transformedPoint(x.floatValue(), y.floatValue()); drawer.getLinePath().moveTo((float) pos.getX(), (float) pos.getY()); } catch (Exception exception) { log.warn(exception, exception); } }
From source file:org.apache.pdfbox.util.operator.pagedrawer.MoveTo.java
/** * process : m : Begin new subpath./*from w w w . j av a 2 s . c om*/ * @param operator The operator that is being executed. * @param arguments List * @throws IOException If there is an error processing the operator. */ public void process(PDFOperator operator, List<COSBase> arguments) throws IOException { try { PageDrawer drawer = (PageDrawer) context; COSNumber x = (COSNumber) arguments.get(0); COSNumber y = (COSNumber) arguments.get(1); Point2D pos = drawer.transformedPoint(x.doubleValue(), y.doubleValue()); drawer.getLinePath().moveTo((float) pos.getX(), (float) pos.getY()); } catch (Exception exception) { log.warn(exception, exception); } }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "www.java2s.com www.java2s.com"; Font font = new Font("Serif", Font.PLAIN, 24); FontRenderContext frc = g2.getFontRenderContext(); g2.translate(40, 80);/*from w w w .j a va 2 s .c o m*/ GlyphVector gv = font.createGlyphVector(frc, s); int length = gv.getNumGlyphs(); for (int i = 0; i < length; i++) { Point2D p = gv.getGlyphPosition(i); double theta = (double) i / (double) (length - 1) * Math.PI / 4; AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY()); at.rotate(theta); Shape glyph = gv.getGlyphOutline(i); Shape transformedGlyph = at.createTransformedShape(glyph); g2.fill(transformedGlyph); } }
From source file:pdfimport.pdfbox.operators.MoveTo.java
/** * process : m : Begin new subpath./*from w ww . ja va 2 s. c o m*/ * @param operator The operator that is being executed. * @param arguments List * @throws IOException If there is an error processing the operator. */ @Override public void process(PDFOperator operator, List<COSBase> arguments) throws IOException { try { PageDrawer drawer = (PageDrawer) context; COSNumber x = (COSNumber) arguments.get(0); COSNumber y = (COSNumber) arguments.get(1); Point2D pos = drawer.transformedPoint(x.doubleValue(), y.doubleValue()); drawer.getLinePath().moveTo((float) pos.getX(), (float) pos.getY()); } catch (Exception exception) { log.warn(exception, exception); } }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "www.java2s.com www.java2s.com"; Font font = new Font("Serif", Font.PLAIN, 24); FontRenderContext frc = g2.getFontRenderContext(); g2.translate(40, 80);//w w w . j a va2 s. c om GlyphVector gv = font.createGlyphVector(frc, s); System.out.println(gv.getFont()); int length = gv.getNumGlyphs(); for (int i = 0; i < length; i++) { Point2D p = gv.getGlyphPosition(i); double theta = (double) i / (double) (length - 1) * Math.PI / 4; AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY()); at.rotate(theta); Shape glyph = gv.getGlyphOutline(i); Shape transformedGlyph = at.createTransformedShape(glyph); g2.fill(transformedGlyph); } }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "www.java2s.com www.java2s.com"; Font font = new Font("Serif", Font.PLAIN, 24); FontRenderContext frc = g2.getFontRenderContext(); g2.translate(40, 80);//from w w w .j a v a 2 s . c om GlyphVector gv = font.createGlyphVector(frc, s); System.out.println(gv.getOutline()); int length = gv.getNumGlyphs(); for (int i = 0; i < length; i++) { Point2D p = gv.getGlyphPosition(i); double theta = (double) i / (double) (length - 1) * Math.PI / 4; AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY()); at.rotate(theta); Shape glyph = gv.getGlyphOutline(i); Shape transformedGlyph = at.createTransformedShape(glyph); g2.fill(transformedGlyph); } }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "www.java2s.com www.java2s.com"; Font font = new Font("Serif", Font.PLAIN, 24); FontRenderContext frc = g2.getFontRenderContext(); g2.translate(40, 80);/*from w w w. j a va 2 s . c o m*/ GlyphVector gv = font.createGlyphVector(frc, s); System.out.println(gv.getVisualBounds()); int length = gv.getNumGlyphs(); for (int i = 0; i < length; i++) { Point2D p = gv.getGlyphPosition(i); double theta = (double) i / (double) (length - 1) * Math.PI / 4; AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY()); at.rotate(theta); Shape glyph = gv.getGlyphOutline(i); Shape transformedGlyph = at.createTransformedShape(glyph); g2.fill(transformedGlyph); } }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "www.java2s.com www.java2s.com"; Font font = new Font("Serif", Font.PLAIN, 24); FontRenderContext frc = g2.getFontRenderContext(); g2.translate(40, 80);/* w ww. j a va 2 s . co m*/ GlyphVector gv = font.createGlyphVector(frc, s); System.out.println(gv.getLogicalBounds()); int length = gv.getNumGlyphs(); for (int i = 0; i < length; i++) { Point2D p = gv.getGlyphPosition(i); double theta = (double) i / (double) (length - 1) * Math.PI / 4; AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY()); at.rotate(theta); Shape glyph = gv.getGlyphOutline(i); Shape transformedGlyph = at.createTransformedShape(glyph); g2.fill(transformedGlyph); } }