fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Image.H
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Image header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2016 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
22 #ifndef Fl_Image_H
23 # define Fl_Image_H
24 
25 # include "Enumerations.H"
26 #include <stdlib.h>
27 
28 class Fl_Widget;
29 class Fl_Pixmap;
30 struct Fl_Menu_Item;
31 struct Fl_Label;
32 
33 
40 };
41 
42 
56 
57 public:
58  static const int ERR_NO_IMAGE = -1;
59  static const int ERR_FILE_ACCESS = -2;
60  static const int ERR_FORMAT = -3;
61 
62 private:
63  int w_, h_, d_, ld_, count_;
64  const char * const *data_;
66 
67  // Forbid use of copy constructor and assign operator
68  Fl_Image & operator=(const Fl_Image &);
69  Fl_Image(const Fl_Image &);
70 
71 protected:
72 
76  void w(int W) {w_ = W;}
80  void h(int H) {h_ = H;}
84  void d(int D) {d_ = D;}
96  void ld(int LD) {ld_ = LD;}
100  void data(const char * const *p, int c) {data_ = p; count_ = c;}
101  void draw_empty(int X, int Y);
102 
103  static void labeltype(const Fl_Label *lo, int lx, int ly, int lw, int lh, Fl_Align la);
104  static void measure(const Fl_Label *lo, int &lw, int &lh);
105 
106 public:
107 
111  int w() const {return w_;}
115  int h() const {return h_;}
121  int d() const {return d_;}
126  int ld() const {return ld_;}
133  int count() const {return count_;}
138  const char * const *data() const {return data_;}
139  int fail();
140  Fl_Image(int W, int H, int D);
141  virtual ~Fl_Image();
142  virtual Fl_Image *copy(int W, int H);
150  Fl_Image *copy() { return copy(w(), h()); }
151  virtual void color_average(Fl_Color c, float i);
160  void inactive() { color_average(FL_GRAY, .33f); }
161  virtual void desaturate();
162  virtual void label(Fl_Widget*w);
163  virtual void label(Fl_Menu_Item*m);
175  virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); // platform dependent
180  void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} // platform dependent
181  virtual void uncache();
182 
183  // set RGB image scaling method
184  static void RGB_scaling(Fl_RGB_Scaling);
185 
186  // get RGB image scaling method
187  static Fl_RGB_Scaling RGB_scaling();
188 };
189 
190 
203  friend class Fl_Quartz_Graphics_Driver;
204  friend class Fl_GDI_Graphics_Driver;
205  friend class Fl_GDI_Printer_Graphics_Driver;
207  static size_t max_size_;
208 public:
209 
212  const uchar *array;
216 
217  private:
218 
219 #if defined(__APPLE__) || defined(WIN32)
220  void *id_; // for internal use
221  void *mask_; // for internal use (mask bitmap)
222 #else
223  unsigned id_; // for internal use
224  unsigned mask_; // for internal use (mask bitmap)
225 #endif // __APPLE__ || WIN32
226 
227 public:
228 
229  Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0);
230  Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY);
231  virtual ~Fl_RGB_Image();
232  virtual Fl_Image *copy(int W, int H);
233  Fl_Image *copy() { return copy(w(), h()); }
234  virtual void color_average(Fl_Color c, float i);
235  virtual void desaturate();
236  virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
237  void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
238  virtual void label(Fl_Widget*w);
239  virtual void label(Fl_Menu_Item*m);
240  virtual void uncache();
250  static void max_size(size_t size) { max_size_ = size;}
255  static size_t max_size() {return max_size_;}
256 };
257 
258 #endif // !Fl_Image_H
259 
260 //
261 // End of "$Id$".
262 //
Fl_Image::d
void d(int D)
Definition: Fl_Image.H:84
Fl_Graphics_Driver::Fl_RGB_Image
friend class Fl_RGB_Image
Definition: Fl_Device.H:154
Fl_Color
unsigned int Fl_Color
Definition: Enumerations.H:934
Fl_Image::data
void data(const char *const *p, int c)
Definition: Fl_Image.H:100
Fl_RGB_Image::max_size_
static size_t max_size_
Definition: Fl_Image.H:207
Fl_Image::data
const char *const * data() const
Definition: Fl_Image.H:138
Fl_Image::h
void h(int H)
Definition: Fl_Image.H:80
Fl_Image::d
int d() const
Definition: Fl_Image.H:121
Fl_Image
Base class for image caching and drawing.
Definition: Fl_Image.H:55
Fl_RGB_Image::id_
unsigned id_
Definition: Fl_Image.H:223
Fl_Image::count
int count() const
Definition: Fl_Image.H:133
Fl_Image::uncache
virtual void uncache()
Definition: Fl_Image.cxx:63
Fl_RGB_Scaling
Fl_RGB_Scaling
Definition: Fl_Image.H:37
Fl_RGB_Image::mask_
unsigned mask_
Definition: Fl_Image.H:224
H
static int H
Definition: Fl_Tooltip.cxx:76
FL_RGB_SCALING_NEAREST
default RGB image scaling algorithm
Definition: Fl_Image.H:38
Fl_Image::w
void w(int W)
Definition: Fl_Image.H:76
FL_EXPORT
#define FL_EXPORT
Definition: Fl_Export.H:35
Fl_Image::ld
int ld() const
Definition: Fl_Image.H:126
Fl_Xlib_Graphics_Driver
The Xlib-specific graphics class.
Definition: Fl_Device.H:507
Fl_Image::data_
const char *const * data_
Definition: Fl_Image.H:64
Fl_Image::color_average
virtual void color_average(Fl_Color c, float i)
Definition: Fl_Image.cxx:106
Fl_Image::RGB_scaling_
static Fl_RGB_Scaling RGB_scaling_
Definition: Fl_Image.H:65
p
static menustate * p
Definition: Fl_Menu.cxx:606
Fl_RGB_Image::alloc_array
int alloc_array
Definition: Fl_Image.H:215
Fl_Image::inactive
void inactive()
Definition: Fl_Image.H:160
draw
static void draw(int which, int x, int y, int w, int h, int inset)
Definition: fl_gtk.cxx:166
Fl_Pixmap
Definition: Fl_Pixmap.H:41
Fl_RGB_Image::copy
Fl_Image * copy()
Definition: Fl_Image.H:233
Fl_RGB_Image::draw
void draw(int X, int Y)
Definition: Fl_Image.H:237
Fl_Label
Definition: Fl_Widget.H:65
Fl_Image::copy
Fl_Image * copy()
Definition: Fl_Image.H:150
Fl_Image::h
int h() const
Definition: Fl_Image.H:115
Fl_Image::w_
int w_
Definition: Fl_Image.H:63
Fl_Widget
Definition: Fl_Widget.H:101
Fl_RGB_Image::max_size
static void max_size(size_t size)
Definition: Fl_Image.H:250
Fl_RGB_Image::array
const uchar * array
Definition: Fl_Image.H:212
measure
static Fl_Label_Measure_F * measure[16]
Definition: fl_labeltype.cxx:66
Fl_Image::draw
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0)
Definition: Fl_Image.cxx:66
Fl_Image::draw
void draw(int X, int Y)
Definition: Fl_Image.H:180
FL_RGB_SCALING_BILINEAR
more accurate, but slower RGB image scaling algorithm
Definition: Fl_Image.H:39
Fl_Graphics_Driver::size
Fl_Fontsize size()
see fl_size().
Definition: Fl_Device.H:390
Fl_Menu_Item
Definition: Fl_Menu_Item.H:112
Fl_RGB_Image::max_size
static size_t max_size()
Definition: Fl_Image.H:255
Fl_Image::w
int w() const
Definition: Fl_Image.H:111
FL_GRAY
#define FL_GRAY
Definition: Enumerations.H:978
f
Fl_Box_Draw_F * f
Definition: fl_boxtype.cxx:285
Y
static int Y
Definition: Fl_Tooltip.cxx:76
Fl_Image::label
virtual void label(Fl_Widget *w)
Definition: Fl_Image.cxx:127
Fl_Image::ld
void ld(int LD)
Definition: Fl_Image.H:96
Fl_Align
unsigned Fl_Align
Definition: Enumerations.H:828
uchar
unsigned char uchar
Definition: fl_types.h:30
Fl_Graphics_Driver::m
matrix m
Definition: Fl_Device.H:123
Fl_RGB_Image
Definition: Fl_Image.H:202
Enumerations.H
Fl_Image::desaturate
virtual void desaturate()
Definition: Fl_Image.cxx:117