Package org.xhtmlrenderer.extend

Examples of org.xhtmlrenderer.extend.FSImage


                XRLog.layout(Level.WARNING, "No source provided for img element.");
                re = newIrreplaceableImageElement(cssWidth, cssHeight);
            } else {
                //FSImage is here since we need to capture a target H/W
                //for the image (as opposed to what the actual image size is).
                FSImage fsImage = uac.getImageResource(imageSrc).getImage();
                if (fsImage != null) {
                    im = ((AWTFSImage) fsImage).getImage();
                }

                if (im != null) {
View Full Code Here


      return null;
    }

    String nodeName = e.getNodeName();
    if (nodeName.equals("img")) {
      FSImage fsImage = uac.getImageResource(e.getAttribute("src")).getImage();
      if (fsImage != null) {
        if (cssWidth != -1 || cssHeight != -1) {
          fsImage.scale(cssWidth, cssHeight);
        }
        return new ITextImageElement(fsImage);
      }
    /*
    } else if (nodeName.equals("input")) {
View Full Code Here

                byte[] bytes = IOUtils.toByteArray(input);
                Image image = Image.getInstance(bytes);

                float factor = layoutContext.getDotsPerPixel();
                image.scaleAbsolute(image.getPlainWidth() * factor, image.getPlainHeight() * factor);
                FSImage fsImage = new ITextFSImage(image);
               
                if(cssHeight > -1 && cssWidth > -1) {
                    fsImage.scale(cssWidth, cssHeight);
                }
               
                return new ITextImageElement(fsImage);
            } catch (Exception e) {
                Log.error(Geonet.GEONETWORK, "Error writing metadata to PDF", e);
View Full Code Here

         String imageSrc = context.getNamespaceHandler().getImageSourceURI(elem);
         if (imageSrc == null || imageSrc.length() == 0) {
            XRLog.layout(Level.WARNING, "No source provided for img element.");
            re = newIrreplaceableImageElement(cssWidth, cssHeight);
         } else {
            FSImage fsImage = uac.getImageResource(imageSrc).getImage();
            if (fsImage != null) {
               im = ((AWTFSImage) fsImage).getImage();
            }

            if (im != null) {
View Full Code Here

        String nodeName = e.getNodeName();
        if (nodeName.equals("img")) {
            String srcAttr = e.getAttribute("src");
            if (srcAttr != null && srcAttr.length() > 0) {
                FSImage fsImage = uac.getImageResource(srcAttr).getImage();
                if (fsImage != null) {
                    if (cssWidth != -1 || cssHeight != -1) {
                        fsImage.scale(cssWidth, cssHeight);
                    }
                    return new ITextImageElement(fsImage);
                }                   
            }
View Full Code Here

                if (ImageLoadQueue.isKillSwitch(loadItem)) {
                    break;
                }
                final ImageResource ir = ImageResourceLoader.loadImageResourceFromUri(loadItem._uri);
                FSImage awtfsImage = ir.getImage();
                BufferedImage newImg = (BufferedImage) ((AWTFSImage) awtfsImage).getImage();
                XRLog.load(Level.FINE, this + ", loaded " + loadItem._uri);

                loadItem._imageResourceLoader.loaded(ir, newImg.getWidth(), newImg.getHeight());
                final boolean wasScaled;
View Full Code Here

        if (!Configuration.isTrue("xr.renderer.draw.backgrounds", true)) {
            return;
        }
       
        FSColor backgroundColor = style.getBackgroundColor();
        FSImage backgroundImage = getBackgroundImage(c, style);
       
        if ( (backgroundColor == null || backgroundColor == FSRGBColor.TRANSPARENT) &&
                backgroundImage == null) {
            return;
        }
       
        if (backgroundColor != null && backgroundColor != FSRGBColor.TRANSPARENT) {
            setColor(backgroundColor);
            fillRect(backgroundBounds.x, backgroundBounds.y, backgroundBounds.width, backgroundBounds.height);
        }
               
        if (backgroundImage != null) {
            Rectangle localBGImageContainer = bgImageContainer;
            if (style.isFixedBackground()) {
                localBGImageContainer = c.getViewportRectangle();
            }
       
            int xoff = localBGImageContainer.x;
            int yoff = localBGImageContainer.y;
           
            Shape oldclip = getClip();
   
            clip(backgroundBounds);
   
            float imageWidth = backgroundImage.getWidth();
            float imageHeight = backgroundImage.getHeight();
           
            BackgroundPosition position = style.getBackgroundPosition();
            xoff += calcOffset(
                    c, style, position.getHorizontal(), localBGImageContainer.width, imageWidth);
            yoff += calcOffset(
View Full Code Here

            }
        }
    }

    private static void drawImage(RenderingContext c, BlockBox box, MarkerData markerData) {
        FSImage img = null;
        MarkerData.ImageMarker marker = markerData.getImageMarker();
        img = marker.getImage();
        if (img != null) {
            StrutMetrics strutMetrics = box.getMarkerData().getStructMetrics();
            int x = getReferenceX(c, box);
            x += -marker.getLayoutWidth() +
                    (marker.getLayoutWidth() / 2 - img.getWidth() / 2);
            c.getOutputDevice().drawImage(img,
                    x,
                    (int)(getReferenceBaseline(c, box)
                        - strutMetrics.getAscent() / 2 - img.getHeight() / 2));
        }
    }
View Full Code Here

    public JComponent create() {
        JButton button = new JButton();
        Image image = null;

        if (hasAttribute("src")) {
            FSImage fsImage = getUserAgentCallback().getImageResource(getAttribute("src")).getImage();

            if (fsImage != null) {
                image = ((AWTFSImage) fsImage).getImage();
            }
        }
View Full Code Here

    }


    private MarkerData.ImageMarker makeImageMarker(
            LayoutContext c, StrutMetrics structMetrics, String image) {
        FSImage img = null;
        if (! image.equals("none")) {
            img = c.getUac().getImageResource(image).getImage();
            if (img != null) {
                StrutMetrics strutMetrics = structMetrics;
                if (img.getHeight() > strutMetrics.getAscent()) {
                    img.scale(-1, (int) strutMetrics.getAscent());
                }
                MarkerData.ImageMarker result = new MarkerData.ImageMarker();
                result.setImage(img);
                result.setLayoutWidth(img.getWidth() * 2);
                return result;
            }
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.extend.FSImage

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.