/** * Sorts the given list of file filters, keeping the "All supported * file types" combo filter (if any) at the front of the list. */ private static FileFilter[] sortFilters(Vector filterList) { FileFilter[] filters = ComboFileFilter.sortFilters(filterList); shuffleAllTypesToFront(filters); return filters; }
public BufferedImageSource(IFormatReader reader) throws CacheException { if (reader instanceof BufferedImageReader) { this.reader = (BufferedImageReader) reader; } else { this.reader = new BufferedImageReader(reader); } }
/** Convers an Index16ColorModel to a 2D short array. */ public static short[][] getLookupTable(ColorModel model) { if (!(model instanceof Index16ColorModel)) return null; Index16ColorModel m = (Index16ColorModel) model; short[][] lut = new short[3][]; lut[0] = m.getReds(); lut[1] = m.getGreens(); lut[2] = m.getBlues(); return lut; }
/** * Constructs a file chooser for the given file format handler. * If preview flag is set, chooser has an preview pane showing * a thumbnail and other information for the selected file. */ public static JFileChooser buildFileChooser(IFormatHandler handler, boolean preview) { return buildFileChooser(buildFileFilters(handler), preview); }
/** * Builds a file chooser with the given file filters, * as well as an "All supported file types" combo filter. */ public static JFileChooser buildFileChooser(final FileFilter[] filters) { return buildFileChooser(filters, true); }
@Override public int getAlpha(int pixel) { if (nChannels < 4) return 255; return rescale(pixel, max); }
/** Gets the currently displayed image. */ public BufferedImage getImage() { int ndx = getImageIndex(); return images == null || ndx >= images.length ? null : images[ndx]; }
/** Whether QuickTime is available to this JVM. */ public boolean canDoQT() { if (!initialized) initClass(); return !noQT; }
/** * Creates an "All supported file types" combo filter * encompassing all of the given filters. */ private static FileFilter makeComboFilter(FileFilter[] filters) { return filters.length > 1 ? new ComboFileFilter(filters, ALL_TYPES) : null; }
/** * Converts the given writer into a BufferedImageWriter, wrapping if needed. */ public static BufferedImageWriter makeBufferedImageWriter(IFormatWriter w) { if (w instanceof BufferedImageWriter) return (BufferedImageWriter) w; return new BufferedImageWriter(w); }
/** * Converts the given reader into a BufferedImageReader, wrapping if needed. */ public static BufferedImageReader makeBufferedImageReader(IFormatReader r) { if (r instanceof BufferedImageReader) return (BufferedImageReader) r; return new BufferedImageReader(r); }
/** * Sorts the given list of file filters, keeping the "All supported * file types" combo filter (if any) at the front of the list. */ private static FileFilter[] sortFilters(FileFilter[] filters) { filters = ComboFileFilter.sortFilters(filters); shuffleAllTypesToFront(filters); return filters; }
@Override public int getAlpha(int pixel) { if (nChannels < 4) return 255; return rescale(pixel, max); }
/** Gets the currently displayed image. */ public BufferedImage getImage() { int ndx = getImageIndex(); return images == null || ndx >= images.length ? null : images[ndx]; }
/** * Converts the given reader into a BufferedImageReader, wrapping if needed. */ public static BufferedImageReader makeBufferedImageReader(IFormatReader r) { if (r instanceof BufferedImageReader) return (BufferedImageReader) r; return new BufferedImageReader(r); }
/** * Sorts the given list of file filters, keeping the "All supported * file types" combo filter (if any) at the front of the list. */ private static FileFilter[] sortFilters(FileFilter[] filters) { filters = ComboFileFilter.sortFilters(filters); shuffleAllTypesToFront(filters); return filters; }
/** * Sorts the given list of file filters, keeping the "All supported * file types" combo filter (if any) at the front of the list. */ private static FileFilter[] sortFilters(Vector filterList) { FileFilter[] filters = ComboFileFilter.sortFilters(filterList); shuffleAllTypesToFront(filters); return filters; }