Package java.awt.geom

Examples of java.awt.geom.Dimension2D


  {
    // 1. Add the page to the document!
    Page page = new Page(document); // Instantiates the page inside the document context.
    document.getPages().add(page); // Puts the page in the pages collection.

    Dimension2D pageSize = page.getSize();

    // 2. Create a content composer for the page!
    PrimitiveComposer composer = new PrimitiveComposer(page);

    // 3. Drawing the page contents...
    try
    {
      composer.setFont(
        new StandardType1Font(
          document,
          StandardType1Font.FamilyEnum.Courier,
          true,
          false
          ),
        32
        );
    }
    catch(Exception e)
    {throw new RuntimeException(e);}

    EnumSet<AlignmentXEnum> xAlignments = EnumSet.allOf(AlignmentXEnum.class);
    EnumSet<AlignmentYEnum> yAlignments = EnumSet.allOf(AlignmentYEnum.class);
    int step = (int)(pageSize.getHeight()) / (xAlignments.size() * yAlignments.size()+1);

    BlockComposer blockComposer = new BlockComposer(composer);
    {
      blockComposer.begin(
        new Rectangle2D.Double(
          30,
          0,
          pageSize.getWidth()-60,
          step*.8
          ),
        AlignmentXEnum.Center,
        AlignmentYEnum.Middle
        );
View Full Code Here


  {
    // 1. Add the page to the document!
    Page page = new Page(document); // Instantiates the page inside the document context.
    document.getPages().add(page); // Puts the page in the pages collection.

    Dimension2D pageSize = page.getSize();

    // 2. Create a content composer for the page!
    PrimitiveComposer composer = new PrimitiveComposer(page);

    // 3. Drawing the page contents...
    try
    {
      composer.setFont(
        new StandardType1Font(
          document,
          StandardType1Font.FamilyEnum.Courier,
          true,
          false
          ),
        32
        );
    }
    catch(Exception e)
    {throw new RuntimeException(e);}
   
    int stepCount = 5;
    int step = (int)(pageSize.getHeight()) / (stepCount + 1);
    BlockComposer blockComposer = new BlockComposer(composer);
    {
      blockComposer.begin(
        new Rectangle2D.Double(
          30,
          0,
          pageSize.getWidth()-60,
          step*.8
          ),
        AlignmentXEnum.Center,
        AlignmentYEnum.Middle
        );
View Full Code Here

    Pages pages = document.getPages();
    // Page 1.
    {
      Page page = new Page(document);
      pages.add(page);
      Dimension2D pageSize = page.getSize();

      PrimitiveComposer composer = new PrimitiveComposer(page);
      {
        BlockComposer blockComposer = new BlockComposer(composer);
        blockComposer.setHyphenation(true);
        blockComposer.begin(
          new Rectangle2D.Double(
            Margin,
            Margin,
            (float)pageSize.getWidth() - Margin * 2,
            (float)pageSize.getHeight() - Margin * 2
            ),
          AlignmentXEnum.Left,
          AlignmentYEnum.Top
          );
        StandardType1Font bodyFont = new StandardType1Font(
          document,
          StandardType1Font.FamilyEnum.Courier,
          true,
          false
          );
        composer.setFont(bodyFont,32);
        blockComposer.showText("Barcode sample"); blockComposer.showBreak();
        composer.setFont(bodyFont,16);
        blockComposer.showText("Showing the EAN-13 Bar Code on different compositions:"); blockComposer.showBreak();
        blockComposer.showText("- page 1: on the lower right corner of the page, 100pt wide;"); blockComposer.showBreak();
        blockComposer.showText("- page 2: on the middle of the page, 1/3-page wide, 25 degree counterclockwise rotated;"); blockComposer.showBreak();
        blockComposer.showText("- page 3: filled page, 90 degree clockwise rotated."); blockComposer.showBreak();
        blockComposer.end();
      }

      // Show the barcode!
      composer.showXObject(
        barcodeXObject,
        new Point2D.Double(
          (float)pageSize.getWidth() - Margin,
          (float)pageSize.getHeight() - Margin
          ),
        new Dimension(100,0),
        AlignmentXEnum.Right,
        AlignmentYEnum.Bottom,
        0
        );
      composer.flush();
    }

    // Page 2.
    {
      Page page = new Page(document);
      pages.add(page);
      Dimension2D pageSize = page.getSize();

      PrimitiveComposer composer = new PrimitiveComposer(page);
      // Show the barcode!
      composer.showXObject(
        barcodeXObject,
        new Point2D.Double(
          (float)pageSize.getWidth() / 2,
          (float)pageSize.getHeight() / 2
          ),
        new Dimension((int)pageSize.getWidth()/3,0),
        AlignmentXEnum.Center,
        AlignmentYEnum.Middle,
        25
        );
      composer.flush();
    }

    // Page 3.
    {
      Page page = new Page(document);
      pages.add(page);
      Dimension2D pageSize = page.getSize();

      PrimitiveComposer composer = new PrimitiveComposer(page);
      // Show the barcode!
      composer.showXObject(
        barcodeXObject,
        new Point2D.Double(
          (float)pageSize.getWidth() / 2,
          (float)pageSize.getHeight() / 2
          ),
        new Dimension((int)pageSize.getHeight(),(int)pageSize.getWidth()),
        AlignmentXEnum.Center,
        AlignmentYEnum.Middle,
        -90
        );
      composer.flush();
View Full Code Here

        }
        return crop;
    }

    Dimension2D getRotateLimitDimensions() {
        Dimension2D limit = overlay.getRotateLimitDimensions();
        if (limit != null) {
            double scale = xform.getScaleX();
            limit.setSize(
                limit.getWidth() / scale, limit.getHeight() / scale
            );
        }
        return limit;
    }
View Full Code Here

    public void setTransform(AffineTransform xform) {
        // Reinitialize the crop, so it scales with the image and follows
        // rotations:
        final CropBounds crop = getCrop();
        final CropBounds reset = getResetCropBounds();
        Dimension2D rotateLimitDimensions = getRotateLimitDimensions();
        this.xform = xform;
        setCrop(crop);
        setResetCropBounds(reset);
        setRotateLimitDimensions(rotateLimitDimensions);
    }
View Full Code Here

            if (nextDocumentLoader != null) {
                startDocumentLoader();
                return;
            }

            Dimension2D dim = bridgeContext.getDocumentSize();
            setMySize(new Dimension((int)dim.getWidth(),
                                    (int)dim.getHeight()));
            SVGSVGElement elt = svgDocument.getRootElement();
            Dimension d = getSize();
            prevComponentSize = d;
            if (d.width  < 1) d.width  = 1;
            if (d.height < 1) d.height = 1;
View Full Code Here

                startDocumentLoader();
                return;
            }

            GraphicsNode gn = e.getGVTRoot();
            Dimension2D dim = bridgeContext.getDocumentSize();
            if (gn == null || dim == null) {
                JSVGComponent.this.image = null;
                repaint();
            } else {
                setMySize(new Dimension((int)dim.getWidth(),
                                        (int)dim.getHeight()));
                JSVGComponent.this.setGraphicsNode(gn, false);
                computeRenderingTransform();
            }
            userAgent.displayError(((GVTTreeBuilder)e.getSource())
                                   .getException());
View Full Code Here

                startDocumentLoader();
                return;
            }

            GraphicsNode gn = e.getGVTRoot();
            Dimension2D dim = bridgeContext.getDocumentSize();
            if (gn == null || dim == null) {
                JSVGComponent.this.image = null;
                repaint();
            } else {
                JSVGComponent.this.setGraphicsNode(gn, false);
View Full Code Here

            if (isDynamicDocument && JSVGComponent.this.eventsEnabled) {
                startSVGLoadEventDispatcher(e.getGVTRoot());
            } else {
                JSVGComponent.this.setGraphicsNode(e.getGVTRoot(), false);
            }
            Dimension2D dim = bridgeContext.getDocumentSize();
            setPreferredSize(new Dimension((int)dim.getWidth(),
                                           (int)dim.getHeight()));
            invalidate();
        }
View Full Code Here

                startDocumentLoader();
                return;
            }

            GraphicsNode gn = e.getGVTRoot();
            Dimension2D dim = bridgeContext.getDocumentSize();
            if (gn == null || dim == null) {
                JSVGComponent.this.image = null;
                repaint();
            } else {
                JSVGComponent.this.setGraphicsNode(gn, false);
                setPreferredSize(new Dimension((int)dim.getWidth(),
                                               (int)dim.getHeight()));
                invalidate();
            }
            userAgent.displayError(((GVTTreeBuilder)e.getSource())
                                   .getException());
        }
View Full Code Here

TOP

Related Classes of java.awt.geom.Dimension2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.