Fl_Bitmap.H 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // "$Id: Fl_Bitmap.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
  3. //
  4. // Bitmap header file for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2010 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. /* \file
  19. Fl_Bitmap widget . */
  20. #ifndef Fl_Bitmap_H
  21. #define Fl_Bitmap_H
  22. # include "Fl_Image.H"
  23. class Fl_Widget;
  24. class Fl_Menu_Item;
  25. /**
  26. The Fl_Bitmap class supports caching and drawing of mono-color
  27. (bitmap) images. Images are drawn using the current color.
  28. */
  29. class FL_EXPORT Fl_Bitmap : public Fl_Image {
  30. friend class Fl_Quartz_Graphics_Driver;
  31. friend class Fl_GDI_Graphics_Driver;
  32. friend class Fl_Xlib_Graphics_Driver;
  33. public:
  34. /** pointer to raw bitmap data */
  35. const uchar *array;
  36. /** Non-zero if array points to bitmap data allocated internally */
  37. int alloc_array;
  38. private:
  39. #if defined(__APPLE__) || defined(WIN32)
  40. /** for internal use */
  41. void *id_;
  42. #else
  43. /** for internal use */
  44. unsigned id_;
  45. #endif // __APPLE__ || WIN32
  46. public:
  47. /** The constructors create a new bitmap from the specified bitmap data */
  48. Fl_Bitmap(const uchar *bits, int W, int H) :
  49. Fl_Image(W,H,0), array(bits), alloc_array(0), id_(0) {data((const char **)&array, 1);}
  50. /** The constructors create a new bitmap from the specified bitmap data */
  51. Fl_Bitmap(const char *bits, int W, int H) :
  52. Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0) {data((const char **)&array, 1);}
  53. virtual ~Fl_Bitmap();
  54. virtual Fl_Image *copy(int W, int H);
  55. Fl_Image *copy() { return copy(w(), h()); }
  56. virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
  57. void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
  58. virtual void label(Fl_Widget*w);
  59. virtual void label(Fl_Menu_Item*m);
  60. virtual void uncache();
  61. DECLARE_CLASS_CHEAP_RTTI_2(Fl_Bitmap, Fl_Image)
  62. };
  63. #endif
  64. //
  65. // End of "$Id: Fl_Bitmap.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
  66. //