Package java.awt.geom

Examples of java.awt.geom.Dimension2D


                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

                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

  public Inline createImageInline(String filenameHint, String altText,
      int id1, int id2, long cx, boolean link) throws Exception {
   
    ImageSize size = imageInfo.getSize();

    Dimension2D dPt = size.getDimensionPt();
    double imageWidthTwips = dPt.getWidth() * 20;
    log.debug("imageWidthTwips: " + imageWidthTwips);

    long cy;

    log.debug("Scaling image height to retain aspect ratio");
    cy = UnitsOfMeasurement.twipToEMU(dPt.getHeight() * 20 * cx / imageWidthTwips);

    // Now convert cx to EMU
    cx = UnitsOfMeasurement.twipToEMU(cx);
   

View Full Code Here

 
    public static void displayImageInfo(ImageInfo info) {
 
      ImageSize size = info.getSize();
     
      Dimension2D dPt = size.getDimensionPt();
      Dimension dPx = size.getDimensionPx();

      log.debug(info.getOriginalURI() + " " + info.getMimeType()
                + " " + Math.round(dPx.getWidth()) + "x" + Math.round(dPx.getHeight()));
           
        log.debug("Resolution:" + Math.round(size.getDpiHorizontal()) + "x" + Math.round(size.getDpiVertical()));
        log.debug("Print size: " + Math.round(dPt.getWidth() / 72) + "\" x" + Math.round(dPt.getHeight() / 72) + "\"");
   
  }
View Full Code Here

      double writableWidthTwips = page.getWritableWidthTwips();        
      log.debug("writableWidthTwips: " + writableWidthTwips);
     
        ImageSize size = imageInfo.getSize();
       
        Dimension2D dPt = size.getDimensionPt();
      double imageWidthTwips = dPt.getWidth() * 20;
      log.debug("imageWidthTwips: " + imageWidthTwips);
     
      long cx;
      long cy;
      boolean scaled = false;
            if (imageWidthTwips > writableWidthTwips) {
       
        log.debug("Scaling image to fit page width");
        scaled = true;
       
        cx = UnitsOfMeasurement.twipToEMU(writableWidthTwips);
                cy = UnitsOfMeasurement.twipToEMU(dPt.getHeight() * 20 * writableWidthTwips / imageWidthTwips);
       
      } else {

        log.debug("Scaling image - not necessary");
       
        cx = UnitsOfMeasurement.twipToEMU(imageWidthTwips);
        cy = UnitsOfMeasurement.twipToEMU(dPt.getHeight() * 20);     
       
      }
     
      log.debug("cx=" + cx + "; cy=" + cy);
     
View Full Code Here

    }

    final String minSizeText = result1.getProperty("minimumSize");
    if (minSizeText != null)
    {
      final Dimension2D size = (Dimension2D) new DoubleDimensionConverter().convertFromString(minSizeText, getLocator());
      getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(size.getWidth()));
      getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(size.getHeight()));
    }

    final String prefSizeText = result1.getProperty("preferredSize");
    if (prefSizeText != null)
    {
      final Dimension2D size = (Dimension2D) new DoubleDimensionConverter().convertFromString(prefSizeText, getLocator());
      getStyle().setStyleProperty(ElementStyleKeys.WIDTH, new Float(size.getWidth()));
      getStyle().setStyleProperty(ElementStyleKeys.HEIGHT, new Float(size.getHeight()));
    }

    final String maxSizeText = result1.getProperty("maximumSize");
    if (maxSizeText != null)
    {
      final Dimension2D size = (Dimension2D) new DoubleDimensionConverter().convertFromString(maxSizeText, getLocator());
      getStyle().setStyleProperty(ElementStyleKeys.MAX_WIDTH, new Float(size.getWidth()));
      getStyle().setStyleProperty(ElementStyleKeys.MAX_HEIGHT, new Float(size.getHeight()));
    }

    final String bgColorText = result1.getProperty("background");
    if (bgColorText != null)
    {
View Full Code Here

   * @param attrs the attributes.
   * @throws SAXException if there is a parsing error.
   */
  protected void startParsing(final Attributes attrs) throws SAXException
  {
    final Dimension2D pageSize = DoubleDimensionConverter.getObject(attrs.getValue(getUri(), "pageSize"));
    final double topBorder = Double.parseDouble(attrs.getValue(getUri(), "topBorder"));
    final double leftBorder = Double.parseDouble(attrs.getValue(getUri(), "leftBorder"));
    final double bottomBorder = Double.parseDouble(attrs.getValue(getUri(), "bottomBorder"));
    final double rightBorder = Double.parseDouble(attrs.getValue(getUri(), "rightBorder"));

    final Paper paper = PageFormatFactory.getInstance().createPaper(pageSize.getWidth(), pageSize.getHeight());
    PageFormatFactory.getInstance().setBorders(paper, topBorder, leftBorder, bottomBorder, rightBorder);

    pageFormat = new PageFormat();
    pageFormat.setPaper(paper);

View Full Code Here

   * @throws IOException if an I/O error occured.
   */
  public void writeObject(final Object o, final ObjectOutputStream out)
      throws IOException
  {
    final Dimension2D dim = (Dimension2D) o;
    out.writeDouble(dim.getWidth());
    out.writeDouble(dim.getHeight());
  }
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.