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

FXGIFIcon.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * G I F 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: FXGIFIcon.h,v 1.24 2006/01/22 17:58:02 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXGIFICON_H
25 #define FXGIFICON_H
26 
27 #ifndef FXICON_H
28 #include "FXIcon.h"
29 #endif
30 
31 namespace FX {
32 
33 /// GIF Icon class
34 class FXAPI FXGIFIcon : public FXIcon {
36 protected:
38 private:
39  FXGIFIcon(const FXGIFIcon&);
40  FXGIFIcon &operator=(const FXGIFIcon&);
41 public:
42  static const FXchar fileExt[];
43  static const FXchar mimeType[];
44 public:
45 
46  /// Construct an icon from memory stream formatted as GIF format
47  FXGIFIcon(FXApp* a,const void *pix=NULL,FXColor clr=FXRGB(192,192,192),FXuint opts=0,FXint w=1,FXint h=1);
48 
49  /// Save pixels into stream in GIF format
50  virtual bool savePixels(FXStream& store) const;
51 
52  /// Load pixels from stream in GIF format
53  virtual bool loadPixels(FXStream& store);
54 
55  /// Destroy
56  virtual ~FXGIFIcon();
57  };
58 
59 
60 
61 #ifndef FXLOADGIF
62 #define FXLOADGIF
63 
64 /**
65 * Check if stream contains a GIF, return TRUE if so.
66 */
67 extern FXAPI bool fxcheckGIF(FXStream& store);
68 
69 
70 /**
71 * Load an GIF (Graphics Interchange Format) file from a stream.
72 * Upon successful return, the pixel array and size are returned.
73 * If an error occurred, the pixel array is set to NULL.
74 */
75 extern FXAPI bool fxloadGIF(FXStream& store,FXColor*& data,FXint& width,FXint& height);
76 
77 
78 /**
79 * Save an GIF (Graphics Interchange Format) file to a stream. The flag
80 * "fast" is used to select the faster Floyd-Steinberg dither method instead
81 * of the slower Wu quantization algorithm.
82 */
83 extern FXAPI bool fxsaveGIF(FXStream& store,const FXColor *data,FXint width,FXint height,bool fast=true);
84 
85 #endif
86 
87 }
88 
89 #endif
char FXchar
Definition: fxdefs.h:380
unsigned int FXuint
Definition: fxdefs.h:389
#define FXAPI
Definition: fxdefs.h:122
bool fxcheckGIF(FXStream &store)
Check if stream contains a GIF, return TRUE if so.
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
bool fxsaveGIF(FXStream &store, const FXColor *data, FXint width, FXint height, bool fast=true)
Save an GIF (Graphics Interchange Format) file to a stream.
GIF Icon class.
Definition: FXGIFIcon.h:34
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 fxloadGIF(FXStream &store, FXColor *&data, FXint &width, FXint &height)
Load an GIF (Graphics Interchange Format) file from a stream.
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp