Package javax.imageio

Examples of javax.imageio.ImageTypeSpecifier$Indexed


        boolean wantHTables = true;
        float quality = JPEG.DEFAULT_QUALITY;
        byte[] componentIDs = { 1, 2, 3, 4};
        int numComponents = 0;

        ImageTypeSpecifier destType = null;

        if (param != null) {
            destType = param.getDestinationType();
            if (destType != null) {
                if (imageType != null) {
                    // Ignore the destination type.
                    writer.warningOccurred
                        (JPEGImageWriter.WARNING_DEST_IGNORED);
                    destType = null;
                }
            }
            // The only progressive mode that makes sense here is MODE_DEFAULT
            if (param.canWriteProgressive()) { 
                // the param may not be one of ours, so it may return false.
                // If so, the following would throw an exception
                if (param.getProgressiveMode() == ImageWriteParam.MODE_DEFAULT) {
                    wantProg = true;
                    wantOptimized = true;
                    wantHTables = false;
                }
            }

            if (param instanceof JPEGImageWriteParam) {
                JPEGImageWriteParam jparam = (JPEGImageWriteParam) param;
                if (jparam.areTablesSet()) {
                    wantQTables = false// If the param has them, metadata shouldn't
                    wantHTables = false;
                    if ((jparam.getDCHuffmanTables().length > 2)
                            || (jparam.getACHuffmanTables().length > 2)) {
                        wantExtended = true;
                    }
                }
                // Progressive forces optimized, regardless of param setting
                // so consult the param re optimized only if not progressive
                if (!wantProg) {
                    wantOptimized = jparam.getOptimizeHuffmanTables();
                    if (wantOptimized) {
                        wantHTables = false;
                    }
                }
            }

            // compression quality should determine the q tables.  Note that this
            // will be ignored if we already decided not to create any.
            // Again, the param may not be one of ours, so we must check that it
            // supports compression settings
            if (param.canWriteCompressed()) {
                if (param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) {
                    quality = param.getCompressionQuality();
                }
            }               
        }
       
        // We are done with the param, now for the image types
       
        ColorSpace cs = null;
        if (destType != null) {
            ColorModel cm = destType.getColorModel();
            numComponents = cm.getNumComponents();
            boolean hasExtraComponents = (cm.getNumColorComponents() != numComponents);
            boolean hasAlpha = cm.hasAlpha();
            cs = cm.getColorSpace();
            int type = cs.getType();
View Full Code Here


       
        boolean writeGraphicsControlExtension;
        if (imageMetadata == null) {
            // Create default metadata.
            imageMetadata = (GIFWritableImageMetadata)getDefaultImageMetadata(
                new ImageTypeSpecifier(image), param);
           
            // Set GraphicControlExtension flag only if there is
            // transparency.
            writeGraphicsControlExtension = imageMetadata.transparentColorFlag;
        } else {
View Full Code Here

                thumbWriter.setOutput(mos);

                // get default metadata for the thumb
                JPEGMetadata metadata =
                    (JPEGMetadata) thumbWriter.getDefaultImageMetadata
                    (new ImageTypeSpecifier(thumb), null);

                // Remove the jfif segment, which should be there.
                MarkerSegment jfif = metadata.findMarkerSegment
                    (JFIFMarkerSegment.class, true);
                if (jfif == null) {
View Full Code Here

         return (theNext != null);
     }

     public ImageTypeSpecifier next() {
         if (theNext != null || hasNext()) {
             ImageTypeSpecifier t = theNext;
             theNext = null;
             return t;
         } else {
             throw new NoSuchElementException();
         }
View Full Code Here

        if (imageMetadata != null
            && imageMetadata instanceof BMPMetadata)
        {
            bmpImageMetadata = (BMPMetadata)imageMetadata;
        } else {
            ImageTypeSpecifier imageType =
                new ImageTypeSpecifier(colorModel, sampleModel);
           
            bmpImageMetadata = (BMPMetadata)getDefaultImageMetadata(imageType,
                                                                    param);
        }   
View Full Code Here

     *
     * NB: we probably need to extend this method if we encounter other image
     * types which can not be encoded with BI_RGB compression type.
     */
    protected int getPreferredCompressionType(ColorModel cm, SampleModel sm) {
        ImageTypeSpecifier imageType = new ImageTypeSpecifier(cm, sm);
        return getPreferredCompressionType(imageType);
    }
View Full Code Here

     *
     * NB: method should be extended if other cases when we can not encode
     *     with given compression will be discovered.
     */
    protected boolean canEncodeImage(int compression, ColorModel cm, SampleModel sm) {
        ImageTypeSpecifier imgType = new ImageTypeSpecifier(cm, sm);
        return canEncodeImage(compression, imgType);
    }
View Full Code Here

     */
    public static final void canEncodeImage(ImageWriter writer,
                                            ColorModel colorModel,
                                            SampleModel sampleModel)
        throws IIOException {
  ImageTypeSpecifier type = null;
  if (colorModel != null && sampleModel != null)
      type = new ImageTypeSpecifier(colorModel, sampleModel);
  canEncodeImage(writer, type);
    }
View Full Code Here

     */
    public static boolean canCreatePalette(RenderedImage image) {
  if (image == null) {
      throw new IllegalArgumentException("image == null");
  }
  ImageTypeSpecifier type = new ImageTypeSpecifier(image);
  return canCreatePalette(type);
    }
View Full Code Here

    public Iterator getImageTypes(int imageIndex)
      throws IOException {
        checkIndex(imageIndex);
        readHeader();
        ArrayList list = new ArrayList(1);
        list.add(new ImageTypeSpecifier(originalColorModel,
                                        originalSampleModel));
        return list.iterator();
    }
View Full Code Here

TOP

Related Classes of javax.imageio.ImageTypeSpecifier$Indexed

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.