Package org.apache.xmlgraphics.image.loader

Examples of org.apache.xmlgraphics.image.loader.Image


            throws ImageException, IOException {
        ImageException firstException = null;
        for (int i = 0, c = this.loaders.length; i < c; i++) {
            ImageLoader loader = this.loaders[i];
            try {
                Image img = loader.loadImage(info, hints, session);
                if (img != null && firstException != null) {
                    log.debug("First ImageLoader failed (" + firstException.getMessage()
                            + "). Fallback was successful.");
                }
                return img;
View Full Code Here


    public Image getImage(String uri, ImageFlavor flavor) {
        if (uri == null || "".equals(uri)) {
            return null;
        }
        ImageKey key = new ImageKey(uri, flavor);
        Image img = (Image)images.get(key);
        if (cacheListener != null) {
            if (img != null) {
                cacheListener.cacheHitImage(key);
            } else {
                cacheListener.cacheMissImage(key);
View Full Code Here

        if (hints == null) {
            hints = Collections.EMPTY_MAP;
        }
        long start, duration;
        start = System.currentTimeMillis();
        Image img = null;
       
        //Remember the last image in the pipeline that is cacheable and cache that.
        Image lastCacheableImage = null;
       
        int converterCount = converters.size();
        int startingPoint = 0;
        if (cache != null) {
            for (int i = converterCount - 1; i >= 0; i--) {
View Full Code Here

       
        ImageManager manager = pdfCtx.getImageManager();
        ImageSessionContext sessionContext = pdfCtx.getImageSessionContext();
        try {
            ImageInfo info = manager.getImageInfo(purl.toString(), sessionContext);
            Image image = manager.getImage(info, supportedFlavors, sessionContext);
           
            //TODO color profile overrides aren't handled, yet!
            //ICCColorSpaceExt colorspaceOverride = extractColorSpace(e, ctx);
            AbstractGraphicsNode specializedNode = null;
            if (image instanceof ImageXMLDOM) {
View Full Code Here

            size.setResolution(context.getSourceResolution());
            size.calcPixelsFromSize();
            info.setSize(size);

            //The whole image had to be loaded for this, so keep it
            Image image = new ImageXMLDOM(info, svgDoc,
                    svgDoc.getDocumentElement().getNamespaceURI());
            info.getCustomObjects().put(ImageInfo.ORIGINAL_IMAGE, image);
           
            return info;
        } catch (TransformerException e) {
View Full Code Here

                    }
                   
                };
               
                //The whole image had to be loaded for this, so keep it
                Image image = new ImageGraphics2D(info, painter);
                info.getCustomObjects().put(ImageInfo.ORIGINAL_IMAGE, image);
               
                return info;
            } catch (NoClassDefFoundError ncdfe) {
                try {
View Full Code Here

    public Image loadImage(ImageInfo info, Map hints, ImageSessionContext session)
                throws ImageException, IOException {
        if (!ImageLoaderFactoryMathML.MIME_MATHML.equals(info.getMimeType())) {
            throw new IllegalArgumentException("ImageInfo must be from an MathML image");
        }
        Image img = info.getOriginalImage();
        if (!(img instanceof ImageGraphics2D)) {
            throw new IllegalArgumentException(
                    "ImageInfo was expected to contain the MathML document as Graphics2D image");
        }
        ImageGraphics2D g2dImage = (ImageGraphics2D)img;
View Full Code Here

       
        ImageManager manager = fopFactory.getImageManager();
        ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext());
        assertNotNull("ImageInfo must not be null", info);
       
        Image img = manager.getImage(info, ImageFlavor.XML_DOM,
                userAgent.getImageSessionContext());
        assertNotNull("Image must not be null", img);
        assertEquals(ImageFlavor.XML_DOM, img.getFlavor());
        ImageXMLDOM imgDom = (ImageXMLDOM)img;
        assertNotNull(imgDom.getDocument());
        assertEquals("http://www.w3.org/2000/svg", imgDom.getRootNamespace());
        info = imgDom.getInfo(); //Switch to the ImageInfo returned by the image
        assertEquals(16000, info.getSize().getWidthMpt());
        assertEquals(16000, info.getSize().getHeightMpt());
       
        img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE,
                    userAgent.getImageSessionContext());
        assertNotNull("Image must not be null", img);
        assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor());
        ImageRendered imgRed = (ImageRendered)img;
        assertNotNull(imgRed.getRenderedImage());
        if (DEBUG_TARGET_DIR != null) {
            ImageWriterUtil.saveAsPNG(imgRed.getRenderedImage(),
                    (int)userAgent.getTargetResolution(),
View Full Code Here

       
        ImageManager manager = fopFactory.getImageManager();
        ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext());
        assertNotNull("ImageInfo must not be null", info);
       
        Image img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE,
                userAgent.getImageSessionContext());
        assertNotNull("Image must not be null", img);
        assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor());
        ImageRendered imgRed = (ImageRendered)img;
        assertNotNull(imgRed.getRenderedImage());
        if (DEBUG_TARGET_DIR != null) {
            ImageWriterUtil.saveAsPNG(imgRed.getRenderedImage(),
                    (int)userAgent.getTargetResolution(),
View Full Code Here

    public Image loadImage(ImageInfo info, Map hints, ImageSessionContext session)
                throws ImageException, IOException {
        if (!MimeConstants.MIME_SVG.equals(info.getMimeType())) {
            throw new IllegalArgumentException("ImageInfo must be from an SVG image");
        }
        Image img = info.getOriginalImage();
        if (!(img instanceof ImageXMLDOM)) {
            throw new IllegalArgumentException(
                    "ImageInfo was expected to contain the SVG document as DOM");
        }
        ImageXMLDOM svgImage = (ImageXMLDOM)img;
View Full Code Here

TOP

Related Classes of org.apache.xmlgraphics.image.loader.Image

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.