2 // "$Id: Fl_Image.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
4 // Image header file for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2002 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
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 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library 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
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
34 class FL_EXPORT Fl_Image {
35 int w_, h_, d_, ld_, count_;
36 const char * const *data_;
38 // Forbid use of copy contructor and assign operator
39 Fl_Image & operator=(const Fl_Image &);
40 Fl_Image(const Fl_Image &);
44 void w(int W) {w_ = W;}
45 void h(int H) {h_ = H;}
46 void d(int D) {d_ = D;}
47 void ld(int LD) {ld_ = LD;}
48 void data(const char * const *p, int c) {data_ = p; count_ = c;}
49 void draw_empty(int X, int Y);
51 static void labeltype(const Fl_Label *lo, int lx, int ly, int lw, int lh, Fl_Align la);
52 static void measure(const Fl_Label *lo, int &lw, int &lh);
56 int w() const {return w_;}
57 int h() const {return h_;}
58 int d() const {return d_;}
59 int ld() const {return ld_;}
60 int count() const {return count_;}
61 const char * const *data() const {return data_;}
63 Fl_Image(int W, int H, int D) {w_ = W; h_ = H; d_ = D; ld_ = 0; count_ = 0; data_ = 0;}
65 virtual Fl_Image *copy(int W, int H);
66 Fl_Image *copy() { return copy(w(), h()); }
67 virtual void color_average(Fl_Color c, float i);
68 void inactive() { color_average(FL_GRAY, .33f); }
69 virtual void desaturate();
70 virtual void label(Fl_Widget*w);
71 virtual void label(Fl_Menu_Item*m);
72 virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
73 void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
74 virtual void uncache();
77 class FL_EXPORT Fl_RGB_Image : public Fl_Image {
81 int alloc_array; // Non-zero if array was allocated
83 Fl_Offscreen id; // for internal use
84 Fl_Bitmask mask; // for internal use (mask bitmap)
86 Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
87 Fl_Image(W,H,D), array(bits), alloc_array(0), id(0), mask(0) {data((const char **)&array, 1); ld(LD);}
88 virtual ~Fl_RGB_Image();
89 virtual Fl_Image *copy(int W, int H);
90 Fl_Image *copy() { return copy(w(), h()); }
91 virtual void color_average(Fl_Color c, float i);
92 virtual void desaturate();
93 virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
94 void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
95 virtual void label(Fl_Widget*w);
96 virtual void label(Fl_Menu_Item*m);
97 virtual void uncache();
100 #endif // !Fl_Image_H
103 // End of "$Id: Fl_Image.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".