/* * Moonlight|3D Copyright (C) 2005 The Moonlight|3D team * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library 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 Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Created on Oct 31, 2005 */ package ml.image; import ml.core.helper.FileType; import ml.core.helper.NamedObject; /** * The image format handler interface. This interface provides services * needed for loading and saving images of a certain format. All image * format handlers implement this interface. * * @author gregor */ public interface ImageFormat extends NamedObject { /** * Return the file type for this image format. * * @return the FileType describing this image format * @see ml.core.helper.FileType */ public FileType getFileType(); /** * Returns true if files of this format can be loaded by * this image format handler. * * @return true if loading is supported. */ public boolean isLoadable(); /** * Returns true if files of this format can be saved by * this image format handler. * * @return true if saving is supported. */ public boolean isSaveable(); /** * Load an image from the file given by filename and return the * resulting Framebuffer. * * @param filename the filename of the file to load * @return the framebuffer with the loaded image * @throws ml.core.exceptions.Exception */ public Framebuffer loadFile(String filename) throws ml.core.exceptions.Exception; /** * Save the image in the given framebuffer to the file given by filename. * * @param filename the filename of the file to save the image to * @param buffer the framebuffer to save * @throws ml.core.exceptions.Exception */ public void saveFile(String filename, Framebuffer buffer) throws ml.core.exceptions.Exception; }