Fl_Bitmap.H 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // "$Id: Fl_Bitmap.H 10110 2014-02-22 14:51:50Z manolo $"
  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_GDI_Printer_Graphics_Driver;
  33. friend class Fl_Xlib_Graphics_Driver;
  34. public:
  35. /** pointer to raw bitmap data */
  36. const uchar *array;
  37. /** Non-zero if array points to bitmap data allocated internally */
  38. int alloc_array;
  39. private:
  40. int start(int XP, int YP, int WP, int HP, int &cx, int &cy,
  41. int &X, int &Y, int &W, int &H);
  42. #if defined(__APPLE__) || defined(WIN32)
  43. /** for internal use */
  44. void *id_;
  45. #else
  46. /** for internal use */
  47. unsigned id_;
  48. #endif // __APPLE__ || WIN32
  49. public:
  50. /** The constructors create a new bitmap from the specified bitmap data */
  51. Fl_Bitmap(const uchar *bits, int W, int H) :
  52. Fl_Image(W,H,0), array(bits), alloc_array(0), id_(0) {data((const char **)&array, 1);}
  53. /** The constructors create a new bitmap from the specified bitmap data */
  54. Fl_Bitmap(const char *bits, int W, int H) :
  55. Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0) {data((const char **)&array, 1);}
  56. virtual ~Fl_Bitmap();
  57. virtual Fl_Image *copy(int W, int H);
  58. Fl_Image *copy() { return copy(w(), h()); }
  59. virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
  60. void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
  61. virtual void label(Fl_Widget*w);
  62. virtual void label(Fl_Menu_Item*m);
  63. virtual void uncache();
  64. DECLARE_CLASS_CHEAP_RTTI_2(Fl_Bitmap, Fl_Image)
  65. };
  66. #endif
  67. //
  68. // End of "$Id: Fl_Bitmap.H 10110 2014-02-22 14:51:50Z manolo $".
  69. //