/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM 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; only version 2 of the License.      
 * 
 * NMM 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 NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

module NMM {
  
  interface IBitmapReader {
    
    /** Bitmap format. */
    enum Format { RGBA=0, YV12=1, YV12A=2 };
    
    /**
     * loads a (PNG) image that can be accessed by the given identifier
     * @param id identifier for accessing image later
     * @param filename filename of the (png) image
     * @param f color format that should be used (RGBA, YV12, YV12A)
     * @returns true, if bitmap could be read
     * Note: an image that is already saved under the given id, will be deleted before automatically
     */
    nmm_bool loadImage( in string id, in string filename, in IBitmapReader::Format f = IBitmapReader::RGBA );
    
    /**
     * Get width and height of an image.
     * @param id identifier of the image
     * @param w width of the image
     * @param h width of the image
     */
    void getImage( in string id, out nmm_uint32 w, out nmm_uint32 h );
    
    /**
     * Creates an image with the given color.
     * @param id identifier for accessing image later
     * @param width width of the bitmap
     * @param height height of the bitmap
     * @param color color of the image (RGBA)
     * @param f color format that should be used (RGBA, YV12, YV12A)
     */
    nmm_bool createImage( in string id, in nmm_uint32 width, in nmm_uint32 height,
                      in nmm_uint32 color1, in nmm_uint32 color2, in nmm_uint32 color3,
                      in IBitmapReader::Format f = IBitmapReader::RGBA );
    
    /** Deletes image with the given id */
    void freeImage( in string id );
    
    /** Deletes all read images */
    void freeAll();
  };
  
}
