Package org.apache.xmlgraphics.image.loader.spi

Examples of org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory


        }
    }
   
    private void runReaders(List profiles, ImageSessionContext isc, String uri,
            String mime, ImageFlavor rawFlavor) throws Exception {
        ImageLoaderFactory ilfs[] = ImageImplRegistry.getDefaultInstance()
                .getImageLoaderFactories(mime);
        if (ilfs != null) {
            for (int i = 0; i < ilfs.length; i++) {
                ImageLoaderFactory ilf = ilfs[i];
                try {
                    final ImageLoader il = ilf.newImageLoader(rawFlavor);
                    if (il instanceof ImageLoaderRawPNG || il instanceof ImageLoaderPNG) {
                        // temporary measure until ImageLoaderRawPNG and ImageLoader PNG handle ICC profiles
                        continue;
                    }
                    final ImageInfo im = new ImageInfo(uri, mime);
                    final Image img = il.loadImage(im, isc);
                    final ICC_Profile icc = img.getICCProfile();
                    // Assume the profile can only be correct if the image could
                    // actually be interpreted.
                    if (img.getColorSpace() != null) {
                        profiles.add(icc);
                    }
                } catch (IllegalArgumentException e) {
                    // Ignore. This imageLoader does not support RAW
                }
                try {
                    final ImageLoader il = ilf.newImageLoader(ImageFlavor.BUFFERED_IMAGE);
                    final ImageInfo im = new ImageInfo(uri, mime);
                    final Image img = il.loadImage(im, isc);
                    final ICC_Profile icc = img.getICCProfile();
                    profiles.add(icc);
                } catch (IllegalArgumentException e) {
View Full Code Here


            loaderFactories = registry.getImageLoaderFactories(originalMime);
            if (loaderFactories != null) {
                SortedSet candidates = new java.util.TreeSet(new PipelineComparator());
                //Find best pipeline -> best loader
                for (int i = 0, ci = loaderFactories.length; i < ci; i++) {
                    ImageLoaderFactory loaderFactory = loaderFactories[i];
                    ImageFlavor[] flavors = loaderFactory.getSupportedFlavors(originalMime);
                    for (int j = 0, cj = flavors.length; j < cj; j++) {
                        pipeline = findPipeline(dir, flavors[j], destination);
                        if (pipeline != null) {
                            ImageLoader loader = loaderFactory.newImageLoader(flavors[j]);
                            pipeline.setImageLoader(loader);
                            candidates.add(pipeline);
                        }
                    }
                }
View Full Code Here

    }
   
    public void testImageLoaderFactory() throws Exception {
        ImageManager manager = imageContext.getImageManager();
        ImageInfo info = new ImageInfo(null, MimeConstants.MIME_PNG);
        ImageLoaderFactory ilf = manager.getRegistry().getImageLoaderFactory(
                info, ImageFlavor.BUFFERED_IMAGE);
        assertNotNull(ilf);
    }
View Full Code Here

        }
    }
   
    private void runReaders(List profiles, ImageSessionContext isc, String uri,
            String mime, ImageFlavor rawFlavor) throws Exception {
        ImageLoaderFactory ilfs[] = ImageImplRegistry.getDefaultInstance()
                .getImageLoaderFactories(mime);
        if (ilfs != null)
            for (int i = 0; i < ilfs.length; i++) {
                ImageLoaderFactory ilf = ilfs[i];
                try {
                    final ImageLoader il = ilf.newImageLoader(rawFlavor);
                    final ImageInfo im = new ImageInfo(uri, mime);
                    final Image img = il.loadImage(im, isc);
                    final ICC_Profile icc = img.getICCProfile();
                    // Assume the profile can only be correct if the image could
                    // actually be interpreted.
                    if (img.getColorSpace() != null) {
                        profiles.add(icc);
                    }
                } catch (IllegalArgumentException e) {
                    // Ignore. This imageLoader does not support RAW
                }
                try {
                    final ImageLoader il = ilf
                            .newImageLoader(ImageFlavor.BUFFERED_IMAGE);
                    final ImageInfo im = new ImageInfo(uri, mime);
                    final Image img = il.loadImage(im, isc);
                    final ICC_Profile icc = img.getICCProfile();
                    profiles.add(icc);
View Full Code Here

    }

    public void testImageLoaderFactory() throws Exception {
        ImageManager manager = imageContext.getImageManager();
        ImageInfo info = new ImageInfo(null, MimeConstants.MIME_PNG);
        ImageLoaderFactory ilf = manager.getRegistry().getImageLoaderFactory(
                info, ImageFlavor.BUFFERED_IMAGE);
        assertNotNull(ilf);
    }
View Full Code Here

            loaderFactories = registry.getImageLoaderFactories(originalMime);
            if (loaderFactories != null) {

                //Find best pipeline -> best loader
                for (int i = 0, ci = loaderFactories.length; i < ci; i++) {
                    ImageLoaderFactory loaderFactory = loaderFactories[i];
                    ImageFlavor[] flavors = loaderFactory.getSupportedFlavors(originalMime);
                    for (int j = 0, cj = flavors.length; j < cj; j++) {
                        ImageProviderPipeline pipeline = findPipeline(dir, flavors[j], destination);
                        if (pipeline != null) {
                            ImageLoader loader = loaderFactory.newImageLoader(flavors[j]);
                            pipeline.setImageLoader(loader);
                            candidates.add(pipeline);
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory

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.