1 /********************************************************************************
2 *                                                                               *
3 *                      I R I S   R G B   I c o n   O b j e c t                  *
4 *                                                                               *
5 *********************************************************************************
6 * Copyright (C) 2002,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: FXRGBIcon.h,v 1.14 2006/01/22 17:58:07 fox Exp $                         *
23 ********************************************************************************/
24 #ifndef FXRGBICON_H
25 #define FXRGBICON_H
26 
27 #ifndef FXICON_H
28 #include "FXIcon.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// IRIS RGB icon
35 class FXAPI FXRGBIcon : public FXIcon {
FXDECLARE(FXRGBIcon)36   FXDECLARE(FXRGBIcon)
37 protected:
38   FXRGBIcon(){}
39 private:
40   FXRGBIcon(const FXRGBIcon&);
41   FXRGBIcon &operator=(const FXRGBIcon&);
42 public:
43   static const FXchar fileExt[];
44   static const FXchar mimeType[];
45 public:
46 
47   /// Construct icon from memory stream formatted in IRIS-RGB format
48   FXRGBIcon(FXApp* a,const void *pix=NULL,FXColor clr=FXRGB(192,192,192),FXuint opts=0,FXint w=1,FXint h=1);
49 
50   /// Save pixels into stream in IRIS-RGB format
51   virtual bool savePixels(FXStream& store) const;
52 
53   /// Load pixels from stream in IRIS-RGB format
54   virtual bool loadPixels(FXStream& store);
55 
56   /// Destroy icon
57   virtual ~FXRGBIcon();
58   };
59 
60 
61 /**
62 * Check if stream contains a RGB, return TRUE if so.
63 */
64 extern FXAPI bool fxcheckRGB(FXStream& store);
65 
66 
67 /**
68 * Load an RGB (SGI IRIS RGB) file from a stream.
69 * Upon successful return, the pixel array and size are returned.
70 * If an error occurred, the pixel array is set to NULL.
71 */
72 extern FXAPI bool fxloadRGB(FXStream& store,FXColor*& data,FXint& width,FXint& height);
73 
74 
75 /**
76 * Save an RGB (SGI IRIS RGB) file to a stream.
77 */
78 extern FXAPI bool fxsaveRGB(FXStream& store,const FXColor *data,FXint width,FXint height);
79 
80 }
81 
82 #endif
83