source: NonGTP/glut/FLTK/include/fltk/Image.h @ 814

Revision 814, 2.3 KB checked in by gumbau, 18 years ago (diff)

Glut initial import used by Geometry modules

Line 
1// "$Id: Image.h 4571 2005-09-16 08:02:58Z spitzak $"
2//
3// Copyright 1998-2005 by Bill Spitzak and others.
4//
5// This library is free software; you can redistribute it and/or
6// modify it under the terms of the GNU Library General Public
7// License as published by the Free Software Foundation; either
8// version 2 of the License, or (at your option) any later version.
9//
10// This library is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13// Library General Public License for more details.
14//
15// You should have received a copy of the GNU Library General Public
16// License along with this library; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18// USA.
19//
20// Please report all bugs and problems to "fltk-bugs@fltk.org".
21
22#ifndef fltk_Image_h
23#define fltk_Image_h
24
25#include "Symbol.h"
26# undef OPAQUE // fix for windows.h
27
28namespace fltk {
29
30class FL_API Widget;
31class FL_API xbmImage;
32class DrawImageHelper;
33
34class FL_API Image : public Symbol {
35
36  void* picture;        // system-specific data for the drawn image
37  int flags;            // flags indicating the state of picture
38  friend class xbmImage;
39  friend class DrawImageHelper;
40  enum {DRAWN=1, OPAQUE=2, MASK=4, USES_FG=8, USES_BG=16};
41
42protected:
43  int w_, h_;
44
45public:
46  Image(const char* name=0) : Symbol(name), picture(0), flags(0), w_(-1), h_(-1) {}
47  Image(int w, int h, const char* name=0) : Symbol(name), picture(0), flags(0), w_(w), h_(h) {}
48
49  int w() const {return w_;}
50  int width() const {return w_;}
51  int h() const {return h_;}
52  int height() const {return h_;}
53
54  virtual void update() = 0;
55  bool drawn() const;
56  void redraw() {flags &= ~DRAWN;}
57  void destroy();
58  void setsize(int w, int h);
59  void make_current();
60  void over(const Rectangle& from, const Rectangle& to) const;
61
62  // implementation as Symbol subclass:
63  void _draw(const Rectangle&) const;
64  void _measure(int& W, int& H) const;
65  bool fills_rectangle() const;
66
67  void draw(int x, int y) const;
68  void draw(const Rectangle& r) const {_draw(r);} // un-hide the base class
69
70  // for back compatability with fltk1 only:
71  void label(Widget* o);
72
73};
74
75}
76
77#endif
78
79//
80// End of "$Id: Image.h 4571 2005-09-16 08:02:58Z spitzak $".
81//
Note: See TracBrowser for help on using the repository browser.