/** * Indicates whether a particular image flavor is compatible with this one. * @param flavor the other image flavor * @return true if the two are compatible */ public boolean isCompatible(ImageFlavor flavor) { return this.equals(flavor); }
/** * Main constructor. * @param targetFlavor the target flavor */ public ImageLoaderImageIO(ImageFlavor targetFlavor) { if (!(ImageFlavor.BUFFERED_IMAGE.equals(targetFlavor) || ImageFlavor.RENDERED_IMAGE.equals(targetFlavor))) { throw new IllegalArgumentException("Unsupported target ImageFlavor: " + targetFlavor); } this.targetFlavor = targetFlavor; }
/** * Main constructor. */ public ImageLoaderJLaTeXMath(final ImageFlavor target) { if (!(ImageJLaTeXMath.FLAVOR.equals(target))) { throw new IllegalArgumentException("Unsupported target ImageFlavor: " + target); } this.targetFlavor = target; }
/** * Main constructor. * @param targetFlavor the target flavor */ public ImageLoaderWMF(ImageFlavor targetFlavor) { if (!(ImageWMF.WMF_IMAGE.equals(targetFlavor))) { throw new IllegalArgumentException("Unsupported target ImageFlavor: " + targetFlavor); } this.targetFlavor = targetFlavor; }
/** * Returns the MIME type for a given ImageFlavor if it is from a format that is consumed * without being undecoded. If the ImageFlavor is no raw flavor, an IllegalArgumentException * is thrown. * @param flavor the image flavor * @return the associated MIME type */ public static String getMimeForRawFlavor(ImageFlavor flavor) { for (int i = 0, ci = FLAVORS.length; i < ci; i++) { for (int j = 0, cj = FLAVORS[i].length; j < cj; j++) { if (FLAVORS[i][j].equals(flavor)) { return MIMES[i]; } } } throw new IllegalArgumentException("ImageFlavor is not a \"raw\" flavor: " + flavor); }
/** * Returns the MIME type for a given ImageFlavor if it is from a format that is consumed * without being undecoded. If the ImageFlavor is no raw flavor, an IllegalArgumentException * is thrown. * @param flavor the image flavor * @return the associated MIME type */ public static String getMimeForRawFlavor(ImageFlavor flavor) { for (int i = 0, ci = FLAVORS.length; i < ci; i++) { for (int j = 0, cj = FLAVORS[i].length; j < cj; j++) { if (FLAVORS[i][j].equals(flavor)) { return MIMES[i]; } } } throw new IllegalArgumentException("ImageFlavor is not a \"raw\" flavor: " + flavor); }
/** {@inheritDoc} */ public ImageLoader newImageLoader(ImageFlavor targetFlavor) { if (targetFlavor.equals(ImageFlavor.RAW_CCITTFAX)) { return new ImageLoaderRawCCITTFax(); } else { throw new IllegalArgumentException("Unsupported image flavor: " + targetFlavor); } }
/** {@inheritDoc} */ public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ImageKey other = (ImageKey)obj; if (!uri.equals(other.uri)) { return false; } if (!flavor.equals(other.flavor)) { return false; } return true; }
/** {@inheritDoc} */ public ImageLoader newImageLoader(ImageFlavor targetFlavor) { if (targetFlavor.equals(ImageFlavor.RAW_JPEG)) { return new ImageLoaderRawJPEG(); } else if (targetFlavor.equals(ImageFlavor.RAW_PNG)) { return new ImageLoaderRawPNG(); } else { return new ImageLoaderRaw(targetFlavor); } }
/** * Checks if the source flavor of the given image is compatible with this ImageConverter. * @param img the image to check */ protected void checkSourceFlavor(Image img) { if (!getSourceFlavor().equals(img.getFlavor())) { throw new IllegalArgumentException("Incompatible image: " + img); } }
/** * Main constructor. * @param loaders the contained image loaders */ public CompositeImageLoader(ImageLoader[] loaders) { if (loaders == null || loaders.length == 0) { throw new IllegalArgumentException("Must at least pass one ImageLoader as parameter"); } for (int i = 1, c = loaders.length; i < c; i++) { if (!loaders[0].getTargetFlavor().equals(loaders[i].getTargetFlavor())) { throw new IllegalArgumentException( "All ImageLoaders must produce the same target flavor"); } } this.loaders = loaders; }
if (ImageFlavor.BUFFERED_IMAGE.equals(this.targetFlavor)) { return new ImageBuffered(info, (BufferedImage)imageData, transparentColor); } else {
if (image.getFlavor().equals(flavor)) {
return formFlavor == null || !formFlavor.equals(inlineFlavor);