1 /******************************************************************************** 2 * * 3 * B M P I c o n O b j e c t * 4 * * 5 ********************************************************************************* 6 * Copyright (C) 1997,2005 by Jeroen van der Zijp. All Rights Reserved. * 7 ********************************************************************************* 8 * This library is free software; you can redistribute it and/or * 9 * modify it under the terms of the GNU Lesser General Public * 10 * License as published by the Free Software Foundation; either * 11 * version 2.1 of the License, or (at your option) any later version. * 12 * * 13 * This library is distributed in the hope that it will be useful, * 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 16 * Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public * 19 * License along with this library; if not, write to the Free Software * 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 21 ********************************************************************************* 22 * $Id: FXBMPIcon.h,v 1.19 2005/01/16 16:06:06 fox Exp $ * 23 ********************************************************************************/ 24 #ifndef FXBMPICON_H 25 #define FXBMPICON_H 26 27 #ifndef FXICON_H 28 #include "FXIcon.h" 29 #endif 30 31 namespace FX { 32 33 34 /** 35 * The BMP Icon class is a convenience class for working with icons in the 36 * Microsoft Bitmap (.bmp) graphics file format. This makes it possible to 37 * use resources created with Windows development tools inside FOX without 38 * need for graphics file format translators. The bitmap loaded handles 39 * 1, 4, and 8 bit paletted bitmaps, 16 and 24 bit RGB bitmaps, and 40 * 32 bit RGBA bitmaps. 41 */ 42 class FXAPI FXBMPIcon : public FXIcon { FXDECLARE(FXBMPIcon)43 FXDECLARE(FXBMPIcon) 44 protected: 45 FXBMPIcon(){} 46 private: 47 FXBMPIcon(const FXBMPIcon&); 48 FXBMPIcon &operator=(const FXBMPIcon&); 49 public: 50 static const FXchar fileExt[]; 51 public: 52 53 /// Construct icon from memory stream formatted in Microsoft BMP format 54 FXBMPIcon(FXApp* a,const void *pix=NULL,FXColor clr=FXRGB(192,192,192),FXuint opts=0,FXint w=1,FXint h=1); 55 56 /// Save pixels into stream in Microsoft bitmap format 57 virtual FXbool savePixels(FXStream& store) const; 58 59 /// Load pixels from stream in Microsoft bitmap format 60 virtual FXbool loadPixels(FXStream& store); 61 62 /// Destroy icon 63 virtual ~FXBMPIcon(); 64 }; 65 66 67 /** 68 * Check if stream contains a bitmap, return TRUE if so. 69 */ 70 extern FXAPI FXbool fxcheckBMP(FXStream& store); 71 72 73 /** 74 * Load an BMP (Microsoft Bitmap) file from a stream. 75 * Upon successful return, the pixel array and size are returned. 76 * If an error occurred, the pixel array is set to NULL. 77 */ 78 extern FXAPI FXbool fxloadBMP(FXStream& store,FXColor*& data,FXint& width,FXint& height); 79 80 81 /** 82 * Save an BMP (Microsoft Bitmap) file to a stream. 83 */ 84 extern FXAPI FXbool fxsaveBMP(FXStream& store,const FXColor *data,FXint width,FXint height); 85 86 } 87 88 #endif 89