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_Pixmap.H
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Pixmap header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2012 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 
19 /* \file
20  Fl_Pixmap widget . */
21 
22 #ifndef Fl_Pixmap_H
23 #define Fl_Pixmap_H
24 # include "Fl_Image.H"
25 #if defined(WIN32)
26 # include "x.H"
27 #endif
28 
29 class Fl_Widget;
30 struct Fl_Menu_Item;
31 
32 // Older C++ compilers don't support the explicit keyword... :(
33 # if defined(__sgi) && !defined(_COMPILER_VERSION)
34 # define explicit
35 # endif // __sgi && !_COMPILER_VERSION
36 
41 class FL_EXPORT Fl_Pixmap : public Fl_Image {
42  friend class Fl_Quartz_Graphics_Driver;
43  friend class Fl_GDI_Graphics_Driver;
44  friend class Fl_GDI_Printer_Graphics_Driver;
46  void copy_data();
47  void delete_data();
48  void set_data(const char * const *p);
49  int prepare(int XP, int YP, int WP, int HP, int &cx, int &cy,
50  int &X, int &Y, int &W, int &H);
51 
52  protected:
53 
54  void measure();
55 
56  public:
57 
58  int alloc_data; // Non-zero if data was allocated
59 
60  private:
61 
62 #if defined(WIN32)
63 #if FLTK_ABI_VERSION < 10301
64  static // a static member is needed for ABI compatibility
65 #endif
66  UINT pixmap_bg_color; // RGB color used for pixmap background
67 #endif // WIN32
68 #if defined(__APPLE__) || defined(WIN32)
69  void *id_; // for internal use
70  void *mask_; // for internal use (mask bitmap)
71 #else
72  unsigned id_; // for internal use
73  unsigned mask_; // for internal use (mask bitmap)
74 #endif // __APPLE__ || WIN32
75 
76  public:
77 
79  explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
81  explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
83  explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
85  explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
86  virtual ~Fl_Pixmap();
87  virtual Fl_Image *copy(int W, int H);
88  Fl_Image *copy() { return copy(w(), h()); }
89  virtual void color_average(Fl_Color c, float i);
90  virtual void desaturate();
91  virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
92  void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
93  virtual void label(Fl_Widget*w);
94  virtual void label(Fl_Menu_Item*m);
95  virtual void uncache();
96 };
97 
98 #endif
99 
100 //
101 // End of "$Id$".
102 //
Fl_Color
unsigned int Fl_Color
Definition: Enumerations.H:934
Fl_Pixmap::Fl_Pixmap
Fl_Pixmap(const uchar *const *D)
Definition: Fl_Pixmap.H:85
Fl_Image
Base class for image caching and drawing.
Definition: Fl_Image.H:55
Fl_Pixmap::Fl_Pixmap
Fl_Pixmap(uchar *const *D)
Definition: Fl_Pixmap.H:81
Fl_Image::uncache
virtual void uncache()
Definition: Fl_Image.cxx:63
Fl_Pixmap::Fl_Pixmap
Fl_Pixmap(const char *const *D)
Definition: Fl_Pixmap.H:83
x.H
H
static int H
Definition: Fl_Tooltip.cxx:76
FL_EXPORT
#define FL_EXPORT
Definition: Fl_Export.H:35
Fl_Xlib_Graphics_Driver
The Xlib-specific graphics class.
Definition: Fl_Device.H:507
Fl_Pixmap::draw
void draw(int X, int Y)
Definition: Fl_Pixmap.H:92
Fl_Image::color_average
virtual void color_average(Fl_Color c, float i)
Definition: Fl_Image.cxx:106
p
static menustate * p
Definition: Fl_Menu.cxx:606
Fl_Image::measure
static void measure(const Fl_Label *lo, int &lw, int &lh)
Definition: Fl_Image.cxx:207
Fl_Pixmap::copy
Fl_Image * copy()
Definition: Fl_Pixmap.H:88
Fl_Pixmap
Definition: Fl_Pixmap.H:41
Fl_Image::copy
Fl_Image * copy()
Definition: Fl_Image.H:150
Fl_Pixmap::Fl_Pixmap
Fl_Pixmap(char *const *D)
Definition: Fl_Pixmap.H:79
Fl_Image::h
int h() const
Definition: Fl_Image.H:115
Fl_Pixmap::mask_
unsigned mask_
Definition: Fl_Pixmap.H:73
Fl_Widget
Definition: Fl_Widget.H:101
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_Menu_Item
Definition: Fl_Menu_Item.H:112
Fl_Image::w
int w() const
Definition: Fl_Image.H:111
Fl_Pixmap::alloc_data
int alloc_data
Definition: Fl_Pixmap.H:58
Y
static int Y
Definition: Fl_Tooltip.cxx:76
Fl_Image.H
Fl_Image::label
virtual void label(Fl_Widget *w)
Definition: Fl_Image.cxx:127
uchar
unsigned char uchar
Definition: fl_types.h:30
Fl_Graphics_Driver::m
matrix m
Definition: Fl_Device.H:123
Fl_Pixmap::id_
unsigned id_
Definition: Fl_Pixmap.H:72
Fl_Image::desaturate
virtual void desaturate()
Definition: Fl_Image.cxx:117