/* * AppleCommander - An Apple ][ image utility. * Copyright (C) 2002-2003 by Robert Greene * robgreene at users.sourceforge.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package com.webcodepro.applecommander.storage.filters.imagehandlers; import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Constructor; /** * AppleImage is an abstract class that represents a generic interface * for handing graphic images. This abstraction is needed because not * all graphic routines use BufferedImage. AppleImage itself acts as * a factory for creating "the best" AppleImage subclass. *

* Date Created: Mar 25, 2003 * @author Rob Greene */ public abstract class AppleImage { /** * The specific file extension to use. */ private String fileExtension; /** * All available image formats. This is instance specific since * (in theory) there could be different AppleImages being used. */ private String[] availableExtensions; /** * Create a specific instance of AppleImage. This has been coded * using Reflection to ease native compilation for the most part. */ public static AppleImage create(int width, int height) { String[] classes = { "ImageIoImage", "SunJpegImage", "SwtImage" }; Class[] constructorArgClasses = new Class[] { int.class, int.class }; Object[] constructorArgs = new Object[] { new Integer(width), new Integer(height) }; for (int i=0; i