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

FXXBMImage.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            X B M   I m a g e   O b j e c t                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2003,2009 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 * $Id: FXXBMImage.h,v 1.17 2009/01/06 13:07:29 fox Exp $                        *
00022 ********************************************************************************/
00023 #ifndef FXXBMIMAGE_H
00024 #define FXXBMIMAGE_H
00025 
00026 #ifndef FXIMAGE_H
00027 #include "FXImage.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 /// X Bitmap image
00034 class FXAPI FXXBMImage : public FXImage {
00035   FXDECLARE(FXXBMImage)
00036 protected:
00037   FXXBMImage(){}
00038 private:
00039   FXXBMImage(const FXXBMImage&);
00040   FXXBMImage &operator=(const FXXBMImage&);
00041 public:
00042   static const FXchar fileExt[];
00043   static const FXchar mimeType[];
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-2009 Jeroen van der Zijp