Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXBMPImage.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            B M P   I m a g e   O b j e c t                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2010 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXBMPIMAGE_H
00022 #define FXBMPIMAGE_H
00023 
00024 #ifndef FXIMAGE_H
00025 #include "FXImage.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00031 /**
00032 * The BMP Image class is a convenience class for working with images in the
00033 * Microsoft Bitmap (.bmp) graphics file format.  This makes it possible to
00034 * use resources created with Windows development tools inside FOX without
00035 * need for graphics file format translators.  The bitmap loaded handles
00036 * 1, 4, and 8 bit paletted bitmaps, 16 and 24 bit RGB bitmaps, and
00037 * 32 bit RGBA bitmaps.
00038 */
00039 class FXAPI FXBMPImage : public FXImage {
00040   FXDECLARE(FXBMPImage)
00041 protected:
00042   FXBMPImage(){}
00043 private:
00044   FXBMPImage(const FXBMPImage&);
00045   FXBMPImage &operator=(const FXBMPImage&);
00046 public:
00047   static const FXchar fileExt[];
00048   static const FXchar mimeType[];
00049 public:
00050 
00051   /// Construct image from memory stream formatted in Microsoft BMP format
00052   FXBMPImage(FXApp* a,const void *pix=NULL,FXuint opts=0,FXint w=1,FXint h=1);
00053 
00054   /// Save pixels into stream in Microsoft bitmap format
00055   virtual FXbool savePixels(FXStream& store) const;
00056 
00057   /// Load pixels from stream in Microsoft bitmap format
00058   virtual FXbool loadPixels(FXStream& store);
00059 
00060   /// Destroy icon
00061   virtual ~FXBMPImage();
00062   };
00063 
00064 
00065 /**
00066 * Check if stream contains a bitmap, return true if so.
00067 */
00068 extern FXAPI FXbool fxcheckBMP(FXStream& store);
00069 
00070 
00071 /**
00072 * Load an BMP (Microsoft Bitmap) file from a stream.
00073 * Upon successful return, the pixel array and size are returned.
00074 * If an error occurred, the pixel array is set to NULL.
00075 */
00076 extern FXAPI FXbool fxloadBMP(FXStream& store,FXColor*& data,FXint& width,FXint& height);
00077 
00078 
00079 /**
00080 * Save an BMP (Microsoft Bitmap) file to a stream.
00081 */
00082 extern FXAPI FXbool fxsaveBMP(FXStream& store,const FXColor *data,FXint width,FXint height);
00083 
00084 }
00085 
00086 #endif

Copyright © 1997-2010 Jeroen van der Zijp