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

FXJPGImage.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * J P E G I m a g e 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: FXJPGImage.h,v 1.20 2006/01/24 13:53:11 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXJPGIMAGE_H
25 #define FXJPGIMAGE_H
26 
27 #ifndef FXIMAGE_H
28 #include "FXImage.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// JPEG Image class
35 class FXAPI FXJPGImage : public FXImage {
37 protected:
38  FXint quality;
39 protected:
40  FXJPGImage(){}
41 private:
42  FXJPGImage(const FXJPGImage&);
43  FXJPGImage &operator=(const FXJPGImage&);
44 public:
45  static const FXchar fileExt[];
46  static const FXchar mimeType[];
47 public:
48 
49  /// Construct an image from memory stream formatted in JPEG format
50  FXJPGImage(FXApp *a,const void *pix=NULL,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 loadPixels(FXStream& store);
63 
64  /// Load pixels from stream in JPEG format
65  virtual bool savePixels(FXStream& store) const;
66 
67  /// Destroy
68  virtual ~FXJPGImage();
69  };
70 
71 
72 /**
73 * Check if stream contains a JPG, return TRUE if so.
74 */
75 extern FXAPI bool fxcheckJPG(FXStream& store);
76 
77 
78 /**
79 * Load an JPEG (Joint Photographics Experts Group) file from a stream.
80 * Upon successful return, the pixel array and size are returned.
81 * If an error occurred, the pixel array is set to NULL.
82 */
83 extern FXAPI bool fxloadJPG(FXStream& store,FXColor*& data,FXint& width,FXint& height,FXint& quality);
84 
85 
86 /**
87 * Save an JPEG (Joint Photographics Experts Group) file to a stream.
88 */
89 extern FXAPI bool fxsaveJPG(FXStream& store,const FXColor* data,FXint width,FXint height,FXint quality);
90 
91 }
92 
93 #endif
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: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
FXuint FXColor
Definition: fxdefs.h:447
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
JPEG Image class.
Definition: FXJPGImage.h:35
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