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

FXXBMImage.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * X B M I m a g e O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2003,2006 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: FXXBMImage.h,v 1.12 2006/01/22 17:58:12 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXXBMIMAGE_H
25 #define FXXBMIMAGE_H
26 
27 #ifndef FXIMAGE_H
28 #include "FXImage.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// X Bitmap image
35 class FXAPI FXXBMImage : public FXImage {
37 protected:
39 private:
40  FXXBMImage(const FXXBMImage&);
41  FXXBMImage &operator=(const FXXBMImage&);
42 public:
43  static const FXchar fileExt[];
44  static const FXchar mimeType[];
45 public:
46 
47  /// Construct image from memory stream formatted in X Bitmap format
48  FXXBMImage(FXApp* a,const FXuchar *pixels=NULL,const FXuchar *mask=NULL,FXuint opts=0,FXint w=1,FXint h=1);
49 
50  /// Save pixels into stream in X Bitmap format
51  virtual bool savePixels(FXStream& store) const;
52 
53  /// Load pixels from stream in X Bitmap format
54  virtual bool loadPixels(FXStream& store);
55 
56  /// Destroy icon
57  virtual ~FXXBMImage();
58  };
59 
60 
61 #ifndef FXLOADXBM
62 #define FXLOADXBM
63 
64 /**
65 * Check if stream contains a XBM, return TRUE if so.
66 */
67 extern FXAPI bool fxcheckXBM(FXStream& store);
68 
69 /**
70 * Load an XBM (X Bitmap) from pixel array and mask array.
71 * Upon successful return, the pixel array and size are returned.
72 * If an error occurred, the pixel array is set to NULL.
73 */
74 extern FXAPI bool fxloadXBM(FXColor*& data,const FXuchar *pix,const FXuchar *msk,FXint width,FXint height);
75 
76 
77 /**
78 * Load an XBM (X Bitmap) file from a stream.
79 * Upon successful return, the pixel array and size, and hot-spot are returned.
80 * If an error occurred, the pixel array is set to NULL.
81 */
82 extern FXAPI bool fxloadXBM(FXStream& store,FXColor*& data,FXint& width,FXint& height,FXint& hotx,FXint& hoty);
83 
84 
85 /**
86 * Save an XBM (X Bitmap) file to a stream; if the parameters hotx and hoty are set
87 * to -1, no hotspot location is saved.
88 */
89 extern FXAPI bool fxsaveXBM(FXStream& store,const FXColor *data,FXint width,FXint height,FXint hotx=-1,FXint hoty=-1);
90 
91 /**
92 * Save a PostScript file to a stream; format the picture to the maximal
93 * size that fits within the given margins of the indicated paper size.
94 */
95 extern FXAPI bool fxsavePS(FXStream& store,const FXColor *data,FXint width,FXint height,FXint paperw=612,FXint paperh=792,FXint margin=35,bool color=true);
96 
97 #endif
98 
99 }
100 
101 #endif
bool fxloadXBM(FXColor *&data, const FXuchar *pix, const FXuchar *msk, FXint width, FXint height)
Load an XBM (X Bitmap) from pixel array and mask array.
char FXchar
Definition: fxdefs.h:387
unsigned int FXuint
Definition: fxdefs.h:396
#define FXAPI
Definition: fxdefs.h:122
Application Object.
Definition: FXApp.h:158
#define NULL
Definition: fxdefs.h:41
FXuint FXColor
Definition: fxdefs.h:454
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
bool fxsavePS(FXStream &store, const FXColor *data, FXint width, FXint height, FXint paperw=612, FXint paperh=792, FXint margin=35, bool color=true)
Save a PostScript file to a stream; format the picture to the maximal size that fits within the given...
int FXint
Definition: fxdefs.h:397
bool fxcheckXBM(FXStream &store)
Check if stream contains a XBM, return TRUE if so.
unsigned char FXuchar
Definition: fxdefs.h:392
X Bitmap image.
Definition: FXXBMImage.h:35
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
bool fxsaveXBM(FXStream &store, const FXColor *data, FXint width, FXint height, FXint hotx=-1, FXint hoty=-1)
Save an XBM (X Bitmap) file to a stream; if the parameters hotx and hoty are set to -1...
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp