/* ********************************************************************* This source file is a part of the standard library of Scol For the latest info, see http://www.scolring.org Copyright (c) 2013 Stephane Bisaro aka Iri, based on a work of Marc BARILLEY. This program 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 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser 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, or go to http://www.gnu.org/copyleft/lesser.txt ********************************************************************* */ /* * 2D functions for bitmaps manipulations * See http://redmine.scolring.org/projects/tutorials/wiki/Scol_usage * for more informations */ /*! \file bitmap.pkg * \author Scol team * \version 0.1 * \copyright GNU Lesser General Public License 2.0 or later * \brief Scol 2D Library - Bitmap API * **/ /*! \brief Load a bitmap from a file (PNG, JPEG, TARGA or BMP) in * the current channel. * * \ingroup _2dos_bitmap * To load in another channel, use the Scol API directly. * * Prototype : fun [S] ObjBitmap * * \param S : a path name * * \return ObjBitmap : the loaded ObjBitmap or nil if error **/ fun lib2d_bmpLoad (sFile)= let _checkpack sFile -> pFile in if pFile == nil then nil else let _LDbitmap _channel pFile -> bmp in if bmp == nil then let _LDjpeg _channel pFile -> jpg in if jpg == nil then let _LDtga _channel pFile -> tga in if tga == nil then let _LDalphaBitmap _channel pFile -> png in if png == nil then nil else let _GETalphaBitmaps png -> [b _] in b else tga else jpg else bmp;; /*! \brief Load a 8-bits bitmap from a file (BMP only or the mask of a PNG) in * the current channel. * * \ingroup _2dos_bitmap * To load in another channel, use the Scol API directly. * * Prototype : fun [S] ObjBitmap8 * * \param S : a path name * * \return ObjBitmap8 : the loaded ObjBitmap8 or nil if error **/ fun lib2d_bmp8Load (sFile)= let _checkpack sFile -> pFile in if pFile == nil then nil else let _LDbitmap8 _channel pFile -> bmp8 in if bmp8 == nil then let _LDalphaBitmap _channel pFile -> png in if png == nil then nil else let _GETalphaBitmaps png -> [_ b8] in b8 else bmp8;;