Package com.volantis.mcs.policies.variants.image

Examples of com.volantis.mcs.policies.variants.image.ImageMetaDataBuilder


     * @param file The image file for which to create the builder
     * @return The builder
     */
    private VariantBuilder createVariant(File file) {
        VariantBuilder variant = POLICY_FACTORY.createVariantBuilder(VariantType.IMAGE);
        ImageMetaDataBuilder metaData = POLICY_FACTORY.createImageMetaDataBuilder();

        ImageData data = getImageData(file);
        if (data != null) {
            metaData.setHeight(data.height);
            metaData.setWidth(data.width);
            metaData.setPixelDepth(data.depth);
        }

        String extension = IOUtils.getExtension(file);
        Encoding imageEncoding = ImageEncoding.COLLECTION.
                getEncodingForExtension(extension);
        if (imageEncoding != null) {
            metaData.setImageEncoding((ImageEncoding) imageEncoding);
        }

        File root = new File(folderSelector.getText().getText());
        if (root.getPath().length() < file.getPath().length()) {
            String url = file.getPath().substring(root.getPath().length());
View Full Code Here


        TargetedSelectionBuilder targeted =
                factory.createTargetedSelectionBuilder();
        targeted.addDevice(deviceName);
        variantBuilder.setSelectionBuilder(targeted);

        ImageMetaDataBuilder image = createImageMetaData(imageFile);
        variantBuilder.setMetaDataBuilder(image);

        URLContentBuilder content = createURLContent(assetGroup, imageFile);
        variantBuilder.setContentBuilder(content);
View Full Code Here

        GenericImageSelectionBuilder generic =
                factory.createGenericImageSelectionBuilder();
        generic.setWidthHint(widthHint);
        variantBuilder.setSelectionBuilder(generic);

        ImageMetaDataBuilder image = createImageMetaData(imageFile);
        variantBuilder.setMetaDataBuilder(image);

        URLContentBuilder content = createURLContent(assetGroup, imageFile);
        variantBuilder.setContentBuilder(content);
View Full Code Here

        DefaultSelectionBuilder defaultSelection =
                factory.createDefaultSelectionBuilder();
        variantBuilder.setSelectionBuilder(defaultSelection);

        ImageMetaDataBuilder image = createImageMetaData(imageFile);
        image.setConversionMode(ImageConversionMode.ALWAYS_CONVERT);
        variantBuilder.setMetaDataBuilder(image);

        URLContentBuilder content = createURLContent(assetGroup, imageFile);
        variantBuilder.setContentBuilder(content);
View Full Code Here

     * @throws IOException if there was a problem reading the image file.
     */
    private ImageMetaDataBuilder createImageMetaData(File imageFile)
            throws IOException {

        ImageMetaDataBuilder builder;

        // Calculate the extension for this image.
        String imageName = imageFile.getName();
        String extension = getExtension(imageName);
        if (extension != null) {
            // And figure out the official encoding for this extension.
            ImageEncoding encoding = (ImageEncoding)
                    ImageEncoding.COLLECTION.getEncodingForExtension(extension);
            // If we support this extension
            if (encoding != null) {

                // Then read in the image...
                RenderedImage image = javax.imageio.ImageIO.read(imageFile);
                ColorModel color = image.getColorModel();

                // ... create the metaData ...
                builder = factory.createImageMetaDataBuilder();

                // ... and then use the image meta data to populate it.
                builder.setWidth(image.getWidth());
                builder.setHeight(image.getHeight());
                builder.setPixelDepth(color.getPixelSize());
                ImageRendering rendering;

                // todo pixel size is not enough, sometime there are levels of gray.
                if (color.getPixelSize() > 1) {
                    rendering = ImageRendering.COLOR;
                } else {
                    rendering = ImageRendering.GRAYSCALE;
                }
                builder.setRendering(rendering);
                builder.setImageEncoding(encoding);
                if (logger.isDebugEnabled()) {
                    logger.debug("Created metaData: " + builder);
                }

            } else {
View Full Code Here

                .createVariantBuilder(VariantType.IMAGE);

        variantBuilder.setSelectionBuilder(POLICY_FACTORY
                .createDefaultSelectionBuilder());

        ImageMetaDataBuilder builder = POLICY_FACTORY
                .createImageMetaDataBuilder();
        builder.setWidth(100);
        builder.setHeight(200);
        builder.setImageEncoding(ImageEncoding.JPEG);
        builder.setPixelDepth(24);

        URLContentBuilder urlContentBuilder = POLICY_FACTORY
                .createURLContentBuilder();
        urlContentBuilder.setURL("/foo.jpeg");
        variantBuilder.setContentBuilder(urlContentBuilder);
View Full Code Here

        targeted.addDevice("Master");

        variantBuilder.setSelectionBuilder(targeted);

        // Meta Data.
        ImageMetaDataBuilder imageBuilder =
                factory.createImageMetaDataBuilder();
        imageBuilder.setConversionMode(ImageConversionMode.NEVER_CONVERT);
        imageBuilder.setImageEncoding(ImageEncoding.GIF);
        imageBuilder.setWidth(10);
        imageBuilder.setHeight(50);
        imageBuilder.setPixelDepth(12);

        variantBuilder.setMetaDataBuilder(imageBuilder);

        // Content.
        URLContentBuilder content = factory.createURLContentBuilder();
View Full Code Here

        targeted.addCategory("Good");

        variantBuilder.setSelectionBuilder(targeted);

        // Meta Data.
        ImageMetaDataBuilder imageBuilder =
                factory.createImageMetaDataBuilder();
        imageBuilder.setConversionMode(ImageConversionMode.NEVER_CONVERT);
        imageBuilder.setImageEncoding(ImageEncoding.GIF);
        imageBuilder.setWidth(10);
        imageBuilder.setHeight(50);
        imageBuilder.setPixelDepth(12);

        variantBuilder.setMetaDataBuilder(imageBuilder);

        // Content.
        URLContentBuilder content = factory.createURLContentBuilder();
View Full Code Here

TOP

Related Classes of com.volantis.mcs.policies.variants.image.ImageMetaDataBuilder

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.