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

FXJPGIcon.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * J P E G I c o n O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2000,2006 by David Tyree. 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: FXJPGIcon.h,v 1.20 2006/01/24 13:53:11 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXJPGICON_H
25 #define FXJPGICON_H
26 
27 #ifndef FXICON_H
28 #include "FXIcon.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// JPEG Icon class
35 class FXAPI FXJPGIcon : public FXIcon {
37 protected:
38  FXint quality;
39 protected:
40  FXJPGIcon(){}
41 private:
42  FXJPGIcon(const FXJPGIcon&);
43  FXJPGIcon &operator=(const FXJPGIcon&);
44 public:
45  static const FXchar fileExt[];
46  static const FXchar mimeType[];
47 public:
48 
49  /// Construct an icon from memory stream formatted in JPEG format
50  FXJPGIcon(FXApp *a,const void *pix=NULL,FXColor clr=FXRGB(192,192,192),FXuint opts=0,FXint w=1,FXint h=1,FXint q=75);
51 
52  /// True if format is supported
53  static const bool supported;
54 
55  /// Set image quality to save with
56  void setQuality(FXint q){ quality=q; }
57 
58  /// Get image quality setting
59  FXint getQuality() const { return quality; }
60 
61  /// Save pixels into stream in JPEG format
62  virtual bool savePixels(FXStream& store) const;
63 
64  /// Load pixels from stream in JPEG format
65  virtual bool loadPixels(FXStream& store);
66 
67  /// Destroy
68  virtual ~FXJPGIcon();
69  };
70 
71 
72 
73 /**
74 * Check if stream contains a JPG, return TRUE if so.
75 */
76 extern FXAPI bool fxcheckJPG(FXStream& store);
77 
78 
79 /**
80 * Load an JPEG (Joint Photographics Experts Group) file from a stream.
81 * Upon successful return, the pixel array and size are returned.
82 * If an error occurred, the pixel array is set to NULL.
83 */
84 extern FXAPI bool fxloadJPG(FXStream& store,FXColor*& data,FXint& width,FXint& height,FXint& quality);
85 
86 
87 /**
88 * Save an JPEG (Joint Photographics Experts Group) file to a stream.
89 */
90 extern FXAPI bool fxsaveJPG(FXStream& store,const FXColor* data,FXint width,FXint height,FXint quality);
91 
92 }
93 
94 #endif
JPEG Icon class.
Definition: FXJPGIcon.h:35
bool fxloadJPG(FXStream &store, FXColor *&data, FXint &width, FXint &height, FXint &quality)
Load an JPEG (Joint Photographics Experts Group) 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 FXRGB(r, g, b)
Make RGB color.
Definition: fxdefs.h:579
#define NULL
Definition: fxdefs.h:41
FXuint FXColor
Definition: fxdefs.h:454
int FXint
Definition: fxdefs.h:397
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
bool fxcheckJPG(FXStream &store)
Check if stream contains a JPG, return TRUE if so.
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
bool fxsaveJPG(FXStream &store, const FXColor *data, FXint width, FXint height, FXint quality)
Save an JPEG (Joint Photographics Experts Group) file to a stream.

Copyright © 1997-2005 Jeroen van der Zijp