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

FXXBMImage.h

00001 /******************************************************************************** 00002 * * 00003 * X B M I m a g e O b j e c t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2003,2005 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (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 GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXXBMImage.h,v 1.9 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXXBMIMAGE_H 00025 #define FXXBMIMAGE_H 00026 00027 #ifndef FXIMAGE_H 00028 #include "FXImage.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 /// X Bitmap image 00035 class FXAPI FXXBMImage : public FXImage { 00036 FXDECLARE(FXXBMImage) 00037 protected: 00038 FXXBMImage(){} 00039 private: 00040 FXXBMImage(const FXXBMImage&); 00041 FXXBMImage &operator=(const FXXBMImage&); 00042 public: 00043 static const FXchar fileExt[]; 00044 public: 00045 00046 /// Construct image from memory stream formatted in X Bitmap format 00047 FXXBMImage(FXApp* a,const FXuchar *pixels=NULL,const FXuchar *mask=NULL,FXuint opts=0,FXint w=1,FXint h=1); 00048 00049 /// Save pixels into stream in X Bitmap format 00050 virtual FXbool savePixels(FXStream& store) const; 00051 00052 /// Load pixels from stream in X Bitmap format 00053 virtual FXbool loadPixels(FXStream& store); 00054 00055 /// Destroy icon 00056 virtual ~FXXBMImage(); 00057 }; 00058 00059 00060 #ifndef FXLOADXBM 00061 #define FXLOADXBM 00062 00063 /** 00064 * Check if stream contains a XBM, return TRUE if so. 00065 */ 00066 extern FXAPI FXbool fxcheckXBM(FXStream& store); 00067 00068 /** 00069 * Load an XBM (X Bitmap) from pixel array and mask array. 00070 * Upon successful return, the pixel array and size are returned. 00071 * If an error occurred, the pixel array is set to NULL. 00072 */ 00073 extern FXAPI FXbool fxloadXBM(FXColor*& data,const FXuchar *pix,const FXuchar *msk,FXint width,FXint height); 00074 00075 00076 /** 00077 * Load an XBM (X Bitmap) file from a stream. 00078 * Upon successful return, the pixel array and size, and hot-spot are returned. 00079 * If an error occurred, the pixel array is set to NULL. 00080 */ 00081 extern FXAPI FXbool fxloadXBM(FXStream& store,FXColor*& data,FXint& width,FXint& height,FXint& hotx,FXint& hoty); 00082 00083 00084 /** 00085 * Save an XBM (X Bitmap) file to a stream; if the parameters hotx and hoty are set 00086 * to -1, no hotspot location is saved. 00087 */ 00088 extern FXAPI FXbool fxsaveXBM(FXStream& store,const FXColor *data,FXint width,FXint height,FXint hotx=-1,FXint hoty=-1); 00089 00090 /** 00091 * Save a PostScript file to a stream; format the picture to the maximal 00092 * size that fits within the given margins of the indicated paper size. 00093 */ 00094 extern FXAPI FXbool fxsavePS(FXStream& store,const FXColor *data,FXint width,FXint height,FXint paperw=612,FXint paperh=792,FXint margin=35,FXbool color=TRUE); 00095 00096 #endif 00097 00098 } 00099 00100 #endif

Copyright © 1997-2005 Jeroen van der Zijp