FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Fl_Image.H

    00001 //
    00002 // "$Id: Fl_Image.H 9709 2012-11-09 16:02:08Z manolo $"
    00003 //
    00004 // Image header file for the Fast Light Tool Kit (FLTK).
    00005 //
    00006 // Copyright 1998-2011 by Bill Spitzak and others.
    00007 //
    00008 // This library is free software. Distribution and use rights are outlined in
    00009 // the file "COPYING" which should have been included with this file.  If this
    00010 // file is missing or damaged, see the license at:
    00011 //
    00012 //     http://www.fltk.org/COPYING.php
    00013 //
    00014 // Please report all bugs and problems on the following page:
    00015 //
    00016 //     http://www.fltk.org/str.php
    00017 //
    00018
    00019 /* \file
    00020    Fl_Image, Fl_RGB_Image classes . */
    00021
    00022 #ifndef Fl_Image_H
    00023 #  define Fl_Image_H
    00024
    00025 #  include "Enumerations.H"
    00026 #include <stdlib.h>
    00027
    00028 class Fl_Widget;
    00029 struct Fl_Menu_Item;
    00030 struct Fl_Label;
    00031
    00043 class FL_EXPORT Fl_Image {
    00044   int w_, h_, d_, ld_, count_;
    00045   const char * const *data_;
    00046
    00047   // Forbid use of copy contructor and assign operator
    00048   Fl_Image & operator=(const Fl_Image &);
    00049   Fl_Image(const Fl_Image &);
    00050
    00051   protected:
    00052
    00056   void w(int W) {w_ = W;}
    00060   void h(int H) {h_ = H;}
    00064   void d(int D) {d_ = D;}
    00068   void ld(int LD) {ld_ = LD;}
    00072   void data(const char * const *p, int c) {data_ = p; count_ = c;}
    00073   void draw_empty(int X, int Y);
    00074
    00075   static void labeltype(const Fl_Label *lo, int lx, int ly, int lw, int lh, Fl_Align la);
    00076   static void measure(const Fl_Label *lo, int &lw, int &lh);
    00077
    00078   public:
    00079
    00083   int w() const {return w_;}
    00086   int h() const {return h_;}
    00092   int d() const {return d_;}
    00098   int ld() const {return ld_;}
    00105   int count() const {return count_;}
    00110   const char * const *data() const {return data_;}
    00111
    00118   Fl_Image(int W, int H, int D) {w_ = W; h_ = H; d_ = D; ld_ = 0; count_ = 0; data_ = 0;}
    00119   virtual ~Fl_Image();
    00120   virtual Fl_Image *copy(int W, int H);
    00128   Fl_Image *copy() { return copy(w(), h()); }
    00129   virtual void color_average(Fl_Color c, float i);
    00136   void inactive() { color_average(FL_GRAY, .33f); }
    00137   virtual void desaturate();
    00138   virtual void label(Fl_Widget*w);
    00139   virtual void label(Fl_Menu_Item*m);
    00147   virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); // platform dependent
    00152   void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} // platform dependent
    00153   virtual void uncache();
    00154 };
    00155
    00167 class FL_EXPORT Fl_RGB_Image : public Fl_Image {
    00168   friend class Fl_Quartz_Graphics_Driver;
    00169   friend class Fl_GDI_Graphics_Driver;
    00170   friend class Fl_Xlib_Graphics_Driver;
    00171   static size_t max_size_;
    00172 public:
    00173
    00174   const uchar *array;
    00175   int alloc_array; // Non-zero if array was allocated
    00176
    00177   private:
    00178
    00179 #if defined(__APPLE__) || defined(WIN32)
    00180   void *id_; // for internal use
    00181   void *mask_; // for internal use (mask bitmap)
    00182 #else
    00183   unsigned id_; // for internal use
    00184   unsigned mask_; // for internal use (mask bitmap)
    00185 #endif // __APPLE__ || WIN32
    00186
    00187   public:
    00188
    00204   Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
    00205     Fl_Image(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {data((const char **)&array, 1); ld(LD);}
    00206   virtual ~Fl_RGB_Image();
    00207   virtual Fl_Image *copy(int W, int H);
    00208   Fl_Image *copy() { return copy(w(), h()); }
    00209   virtual void color_average(Fl_Color c, float i);
    00210   virtual void desaturate();
    00211   virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
    00212   void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
    00213   virtual void label(Fl_Widget*w);
    00214   virtual void label(Fl_Menu_Item*m);
    00215   virtual void uncache();
    00225   static void max_size(size_t size) { max_size_ = size;}
    00230   static size_t max_size() {return max_size_;}
    00231 };
    00232
    00233 #endif // !Fl_Image_H
    00234
    00235 //
    00236 // End of "$Id: Fl_Image.H 9709 2012-11-09 16:02:08Z manolo $".
    00237 //