Dillo
fltkimgbuf.hh
Go to the documentation of this file.
1 #ifndef __DW_FLTKIMGBUF_HH__
2 #define __DW_FLTKIMGBUF_HH__
3 
4 #ifndef __INCLUDED_FROM_DW_FLTK_CORE_HH__
5 # error Do not include this file directly, use "fltkcore.hh" instead.
6 #endif
7 
8 namespace dw {
9 namespace fltk {
10 
11 class FltkImgbuf: public core::Imgbuf
12 {
13 private:
15  {
16  public:
17  double gamma;
18  uchar map[256];
19  };
20 
22  int refCount;
25 
26  int width, height;
28  double gamma;
29 
30 //{
31  int bpp;
32  uchar *rawdata;
33 //}
34 
35  // This is just for testing drawing, it has to be replaced by
36  // the image buffer.
38 
41 
42  static uchar *findGammaCorrectionTable (double gamma);
43  static bool excessiveImageDimensions (int width, int height);
44 
45  FltkImgbuf (Type type, int width, int height, double gamma,
46  FltkImgbuf *root);
47  void init (Type type, int width, int height, double gamma, FltkImgbuf *root);
48  int scaledY(int ySrc);
49  int backscaledY(int yScaled);
50  int isRoot() { return (root == NULL); }
51  void detachScaledBuf (FltkImgbuf *scaledBuf);
52 
53 protected:
54  ~FltkImgbuf ();
55 
56 public:
57  FltkImgbuf (Type type, int width, int height, double gamma);
58 
59  static void freeall ();
60 
61  void setCMap (int *colors, int num_colors);
62  inline void scaleRow (int row, const core::byte *data);
63  inline void scaleRowSimple (int row, const core::byte *data);
64  inline void scaleRowBeautiful (int row, const core::byte *data);
65  inline static void scaleBuffer (const core::byte *src, int srcWidth,
66  int srcHeight, core::byte *dest,
67  int destWidth, int destHeight, int bpp,
68  double gamma);
69 
70  void newScan ();
71  void copyRow (int row, const core::byte *data);
72  core::Imgbuf* getScaledBuf (int width, int height);
73  void getRowArea (int row, dw::core::Rectangle *area);
74  int getRootWidth ();
75  int getRootHeight ();
76  core::Imgbuf *createSimilarBuf (int width, int height);
77  void copyTo (Imgbuf *dest, int xDestRoot, int yDestRoot,
78  int xSrc, int ySrc, int widthSrc, int heightSrc);
79  void ref ();
80  void unref ();
81 
82  bool lastReference ();
83  void setDeleteOnUnref (bool deleteOnUnref);
84  bool isReferred ();
85 
86  void draw (Fl_Widget *target, int xRoot, int yRoot,
87  int x, int y, int width, int height);
88 };
89 
90 } // namespace fltk
91 } // namespace dw
92 
93 #endif // __DW_FLTK_IMGBUF_HH__
~FltkImgbuf()
Definition: fltkimgbuf.cc:170
Typed version of container::untyped::Vector.
Definition: container.hh:425
bool lastReference()
Definition: fltkimgbuf.cc:547
FltkImgbuf * root
Definition: fltkimgbuf.hh:21
core::Imgbuf * getScaledBuf(int width, int height)
Definition: fltkimgbuf.cc:395
static bool excessiveImageDimensions(int width, int height)
Definition: fltkimgbuf.cc:66
void scaleRowBeautiful(int row, const core::byte *data)
Definition: fltkimgbuf.cc:249
dw::core::Shape implemtation for simple rectangles.
Definition: types.hh:69
static lout::container::typed::Vector< GammaCorrectionTable > * gammaCorrectionTables
Definition: fltkimgbuf.hh:40
lout::container::typed::List< FltkImgbuf > * scaledBuffers
Definition: fltkimgbuf.hh:24
int isRoot()
Definition: fltkimgbuf.hh:50
int scaledY(int ySrc)
Definition: fltkimgbuf.cc:566
This is the base class for many other classes, which defines very common virtual methods.
Definition: object.hh:24
void getRowArea(int row, dw::core::Rectangle *area)
Definition: fltkimgbuf.cc:441
uchar map[256]
Definition: fltkimgbuf.hh:18
int backscaledY(int yScaled)
Definition: fltkimgbuf.cc:573
static uchar * findGammaCorrectionTable(double gamma)
Definition: fltkimgbuf.cc:43
Type
Definition: imgbuf.hh:164
int getRootHeight()
Definition: fltkimgbuf.cc:476
void scaleRow(int row, const core::byte *data)
Definition: fltkimgbuf.cc:208
int height
Definition: fltkimgbuf.hh:26
uchar * rawdata
Definition: fltkimgbuf.hh:32
unsigned char byte
Definition: core.hh:25
lout::misc::BitSet * copiedRows
Definition: fltkimgbuf.hh:37
double gamma
Definition: fltkimgbuf.hh:28
Definition: fltkimgbuf.hh:11
void scaleRowSimple(int row, const core::byte *data)
Definition: fltkimgbuf.cc:218
void setDeleteOnUnref(bool deleteOnUnref)
Definition: fltkimgbuf.cc:553
void detachScaledBuf(FltkImgbuf *scaledBuf)
This method is called for the root buffer, when a scaled buffer removed.
Definition: fltkimgbuf.cc:190
static void scaleBuffer(const core::byte *src, int srcWidth, int srcHeight, core::byte *dest, int destWidth, int destHeight, int bpp, double gamma)
Definition: fltkimgbuf.cc:315
bool deleteOnUnref
Definition: fltkimgbuf.hh:23
Definition: fltkimgbuf.hh:14
void unref()
Definition: fltkimgbuf.cc:523
Imgbuf()
Definition: imgbuf.hh:166
static void freeall()
Definition: fltkimgbuf.cc:72
int bpp
Definition: fltkimgbuf.hh:31
The platform independent interface for image buffers.
Definition: imgbuf.hh:161
double gamma
Definition: fltkimgbuf.hh:17
int width
Definition: fltkimgbuf.hh:26
void ref()
Definition: fltkimgbuf.cc:512
int getRootWidth()
Definition: fltkimgbuf.cc:471
bool isReferred()
Definition: fltkimgbuf.cc:559
FltkImgbuf(Type type, int width, int height, double gamma, FltkImgbuf *root)
Definition: fltkimgbuf.cc:87
Dw is in this namespace, or sub namespaces of this one.
Definition: alignedtablecell.cc:28
void setCMap(int *colors, int num_colors)
Definition: fltkimgbuf.cc:204
void draw(Fl_Widget *target, int xRoot, int yRoot, int x, int y, int width, int height)
Definition: fltkimgbuf.cc:584
Type type
Definition: fltkimgbuf.hh:27
void copyTo(Imgbuf *dest, int xDestRoot, int yDestRoot, int xSrc, int ySrc, int widthSrc, int heightSrc)
Definition: fltkimgbuf.cc:486
A bit set, which automatically reallocates when needed.
Definition: misc.hh:604
int refCount
Definition: fltkimgbuf.hh:22
void newScan()
Definition: fltkimgbuf.cc:379
void init(Type type, int width, int height, double gamma, FltkImgbuf *root)
Definition: fltkimgbuf.cc:96
Typed version of container::untyped::List.
Definition: container.hh:463
void copyRow(int row, const core::byte *data)
Definition: fltkimgbuf.cc:354
core::Imgbuf * createSimilarBuf(int width, int height)
Definition: fltkimgbuf.cc:481