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

FXBMPIcon.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * B M P I c o n O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,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: FXBMPIcon.h,v 1.22 2006/01/22 17:57:59 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 {
44 protected:
46 private:
47  FXBMPIcon(const FXBMPIcon&);
48  FXBMPIcon &operator=(const FXBMPIcon&);
49 public:
50  static const FXchar fileExt[];
51  static const FXchar mimeType[];
52 public:
53 
54  /// Construct icon from memory stream formatted in Microsoft BMP format
55  FXBMPIcon(FXApp* a,const void *pix=NULL,FXColor clr=FXRGB(192,192,192),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 ~FXBMPIcon();
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:380
unsigned int FXuint
Definition: fxdefs.h:389
#define FXAPI
Definition: fxdefs.h:122
Application Object.
Definition: FXApp.h:158
#define NULL
Definition: fxdefs.h:41
#define FXRGB(r, g, b)
Make RGB color.
Definition: fxdefs.h:572
FXuint FXColor
Definition: fxdefs.h:447
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
bool fxcheckBMP(FXStream &store)
Check if stream contains a bitmap, return TRUE if so.
The BMP Icon class is a convenience class for working with icons in the Microsoft Bitmap (...
Definition: FXBMPIcon.h:42
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