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

FXBMPImage.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * B M P I m a g e O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,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: FXBMPImage.h,v 1.22 2006/01/22 17:57:59 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXBMPIMAGE_H
25 #define FXBMPIMAGE_H
26 
27 #ifndef FXIMAGE_H
28 #include "FXImage.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /**
35 * The BMP Image class is a convenience class for working with images 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 FXBMPImage : public FXImage {
44 protected:
46 private:
47  FXBMPImage(const FXBMPImage&);
48  FXBMPImage &operator=(const FXBMPImage&);
49 public:
50  static const FXchar fileExt[];
51  static const FXchar mimeType[];
52 public:
53 
54  /// Construct image from memory stream formatted in Microsoft BMP format
55  FXBMPImage(FXApp* a,const void *pix=NULL,FXuint opts=0,FXint w=1,FXint h=1);
56 
57  /// Save pixels into stream in Microsoft bitmap format
58  virtual bool savePixels(FXStream& store) const;
59 
60  /// Load pixels from stream in Microsoft bitmap format
61  virtual bool loadPixels(FXStream& store);
62 
63  /// Destroy icon
64  virtual ~FXBMPImage();
65  };
66 
67 
68 /**
69 * Check if stream contains a bitmap, return TRUE if so.
70 */
71 extern FXAPI bool fxcheckBMP(FXStream& store);
72 
73 
74 /**
75 * Load an BMP (Microsoft Bitmap) file from a stream.
76 * Upon successful return, the pixel array and size are returned.
77 * If an error occurred, the pixel array is set to NULL.
78 */
79 extern FXAPI bool fxloadBMP(FXStream& store,FXColor*& data,FXint& width,FXint& height);
80 
81 
82 /**
83 * Save an BMP (Microsoft Bitmap) file to a stream.
84 */
85 extern FXAPI bool fxsaveBMP(FXStream& store,const FXColor *data,FXint width,FXint height);
86 
87 }
88 
89 #endif
bool fxloadBMP(FXStream &store, FXColor *&data, FXint &width, FXint &height)
Load an BMP (Microsoft Bitmap) file from a stream.
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
The BMP Image class is a convenience class for working with images in the Microsoft Bitmap (...
Definition: FXBMPImage.h:42
int FXint
Definition: fxdefs.h:397
bool fxcheckBMP(FXStream &store)
Check if stream contains a bitmap, return TRUE if so.
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
bool fxsaveBMP(FXStream &store, const FXColor *data, FXint width, FXint height)
Save an BMP (Microsoft Bitmap) file to a stream.
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp