Dillo v3.1.1-111-gd4f56d0d
|
#include <fltkimgbuf.hh>
Classes | |
class | GammaCorrectionTable |
Public Member Functions | |
FltkImgbuf (Type type, int width, int height, double gamma) | |
void | setCMap (int *colors, int num_colors) |
void | scaleRow (int row, const core::byte *data) |
void | scaleRowSimple (int row, const core::byte *data) |
void | scaleRowBeautiful (int row, const core::byte *data) |
void | newScan () |
void | copyRow (int row, const core::byte *data) |
core::Imgbuf * | getScaledBuf (int width, int height) |
void | getRowArea (int row, dw::core::Rectangle *area) |
int | getRootWidth () |
int | getRootHeight () |
core::Imgbuf * | createSimilarBuf (int width, int height) |
Creates an image buffer with same parameters (type, gamma etc.) except size. | |
void | copyTo (Imgbuf *dest, int xDestRoot, int yDestRoot, int xSrc, int ySrc, int widthSrc, int heightSrc) |
void | ref () |
void | unref () |
bool | lastReference () |
void | setDeleteOnUnref (bool deleteOnUnref) |
bool | isReferred () |
void | draw (Fl_Widget *target, int xRoot, int yRoot, int x, int y, int width, int height) |
Public Member Functions inherited from dw::core::Imgbuf | |
Imgbuf () | |
~Imgbuf () | |
virtual void | copyTo (Imgbuf *dest, int xDestRoot, int yDestRoot, int xSrc, int ySrc, int widthSrc, int heightSrc)=0 |
Copies another image buffer into this image buffer. | |
Public Member Functions inherited from lout::object::Object | |
virtual | ~Object () |
The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly. | |
virtual bool | equals (Object *other) |
Returns, whether two objects are equal. | |
virtual int | hashValue () |
Return a hash value for the object. | |
virtual Object * | clone () |
Return an exact copy of the object. | |
virtual void | intoStringBuffer (misc::StringBuffer *sb) |
Store a textual representation of the object in a misc::StringBuffer. | |
const char * | toString () |
Use object::Object::intoStringBuffer to return a textual representation of the object. | |
virtual size_t | sizeOf () |
Return the number of bytes, this object totally uses. | |
Public Member Functions inherited from lout::signal::ObservedObject | |
virtual | ~ObservedObject () |
void | connectDeletion (DeletionReceiver *receiver) |
Static Public Member Functions | |
static void | freeall () |
static void | scaleBuffer (const core::byte *src, int srcWidth, int srcHeight, core::byte *dest, int destWidth, int destHeight, int bpp, double gamma) |
General method to scale an image buffer. | |
Protected Member Functions | |
~FltkImgbuf () | |
Private Member Functions | |
FltkImgbuf (Type type, int width, int height, double gamma, FltkImgbuf *root) | |
void | init (Type type, int width, int height, double gamma, FltkImgbuf *root) |
int | scaledY (int ySrc) |
int | backscaledY (int yScaled) |
int | isRoot () |
void | detachScaledBuf (FltkImgbuf *scaledBuf) |
This method is called for the root buffer, when a scaled buffer removed. | |
Static Private Member Functions | |
static uchar * | findGammaCorrectionTable (double gamma) |
static bool | excessiveImageDimensions (int width, int height) |
Private Attributes | |
FltkImgbuf * | root |
int | refCount |
bool | deleteOnUnref |
lout::container::typed::List< FltkImgbuf > * | scaledBuffers |
int | width |
int | height |
Type | type |
double | gamma |
int | bpp |
uchar * | rawdata |
lout::misc::BitSet * | copiedRows |
Static Private Attributes | |
static lout::container::typed::Vector< GammaCorrectionTable > * | gammaCorrectionTables = new Vector <FltkImgbuf::GammaCorrectionTable> (true, 2) |
Additional Inherited Members | |
Public Types inherited from dw::core::Imgbuf | |
enum | Type { RGB , RGBA , GRAY , INDEXED , INDEXED_ALPHA } |
Definition at line 11 of file fltkimgbuf.hh.
|
private |
Definition at line 87 of file fltkimgbuf.cc.
References _MSG, DBG_OBJ_CREATE, gamma, height, init(), root, type, and width.
|
protected |
Definition at line 170 of file fltkimgbuf.cc.
References _MSG, copiedRows, DBG_OBJ_DELETE, detachScaledBuf(), isRoot(), rawdata, root, and scaledBuffers.
dw::fltk::FltkImgbuf::FltkImgbuf | ( | Type | type, |
int | width, | ||
int | height, | ||
double | gamma | ||
) |
Definition at line 79 of file fltkimgbuf.cc.
References _MSG, DBG_OBJ_CREATE, gamma, height, init(), type, and width.
|
private |
Definition at line 575 of file fltkimgbuf.cc.
Referenced by scaleRowBeautiful().
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 356 of file fltkimgbuf.cc.
References bpp, copiedRows, DBG_IF_RTFL, DBG_OBJ_SET_SYM, lout::misc::StringBuffer::getChars(), height, lout::misc::BitSet::intoStringBuffer(), isRoot(), rawdata, scaledBuffers, scaleRow(), lout::misc::BitSet::set(), and width.
void dw::fltk::FltkImgbuf::copyTo | ( | Imgbuf * | dest, |
int | xDestRoot, | ||
int | yDestRoot, | ||
int | xSrc, | ||
int | ySrc, | ||
int | widthSrc, | ||
int | heightSrc | ||
) |
Definition at line 488 of file fltkimgbuf.cc.
References bpp, height, lout::misc::min(), rawdata, and width.
|
virtual |
Creates an image buffer with same parameters (type, gamma etc.) except size.
Implements dw::core::Imgbuf.
Definition at line 483 of file fltkimgbuf.cc.
|
private |
This method is called for the root buffer, when a scaled buffer removed.
Definition at line 190 of file fltkimgbuf.cc.
References _MSG, deleteOnUnref, refCount, and scaledBuffers.
Referenced by ~FltkImgbuf().
void dw::fltk::FltkImgbuf::draw | ( | Fl_Widget * | target, |
int | xRoot, | ||
int | yRoot, | ||
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
|
staticprivate |
Definition at line 66 of file fltkimgbuf.cc.
References height, IMAGE_MAX_AREA, and width.
Referenced by getScaledBuf(), and init().
|
staticprivate |
Definition at line 43 of file fltkimgbuf.cc.
References _MSG, dw::fltk::FltkImgbuf::GammaCorrectionTable::gamma, gamma, gammaCorrectionTables, and dw::fltk::FltkImgbuf::GammaCorrectionTable::map.
Referenced by scaleBuffer().
|
static |
Definition at line 72 of file fltkimgbuf.cc.
References _MSG, and gammaCorrectionTables.
Referenced by dw::fltk::freeall().
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 478 of file fltkimgbuf.cc.
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 473 of file fltkimgbuf.cc.
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 443 of file fltkimgbuf.cc.
References _MSG, height, dw::core::Rectangle::height, isRoot(), root, scaledY(), width, dw::core::Rectangle::width, dw::core::Rectangle::x, and dw::core::Rectangle::y.
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 397 of file fltkimgbuf.cc.
References DBG_OBJ_ASSOC_CHILD, excessiveImageDimensions(), gamma, getScaledBuf(), height, isRoot(), MAX_HEIGHT, MAX_WIDTH, MSG, ref(), root, scaledBuffers, type, and width.
Referenced by getScaledBuf().
|
private |
Definition at line 96 of file fltkimgbuf.cc.
References _MSG, bpp, copiedRows, DBG_IF_RTFL, DBG_OBJ_SET_NUM, DBG_OBJ_SET_SYM, deleteOnUnref, excessiveImageDimensions(), gamma, lout::misc::BitSet::get(), lout::misc::StringBuffer::getChars(), height, init(), lout::misc::BitSet::intoStringBuffer(), isRoot(), MAX_HEIGHT, MAX_WIDTH, MSG, rawdata, refCount, dw::core::Imgbuf::RGB, dw::core::Imgbuf::RGBA, root, scaledBuffers, scaleRow(), type, and width.
Referenced by FltkImgbuf(), FltkImgbuf(), and init().
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 561 of file fltkimgbuf.cc.
References refCount, and scaledBuffers.
|
inlineprivate |
Definition at line 50 of file fltkimgbuf.hh.
References root.
Referenced by copyRow(), getRowArea(), getScaledBuf(), init(), newScan(), setDeleteOnUnref(), unref(), and ~FltkImgbuf().
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 549 of file fltkimgbuf.cc.
References refCount, and scaledBuffers.
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 381 of file fltkimgbuf.cc.
References lout::misc::BitSet::clear(), copiedRows, DBG_IF_RTFL, DBG_OBJ_SET_SYM, lout::misc::StringBuffer::getChars(), lout::misc::BitSet::intoStringBuffer(), isRoot(), and scaledBuffers.
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 514 of file fltkimgbuf.cc.
References refCount.
Referenced by getScaledBuf().
|
inlinestatic |
General method to scale an image buffer.
Used to scale single lines in scaleRowBeautiful.
The algorithm is rather simple. If the scaled buffer is smaller (both width and height) than the original buffer, each pixel in the scaled buffer is assigned a rectangle of pixels in the original buffer; the resulting pixel value (red, green, blue) is simply the average of all pixel values. This is pretty fast and leads to rather good results.
Nothing special (like interpolation) is done when scaling up.
If scaleMode is set to BEAUTIFUL_GAMMA, gamma correction is considered, see http://www.4p8.com/eric.brasseur/gamma.html.
TODO Could be optimized as in scaleRowSimple: when the destination image is larger, calculate only one row/column, and copy it to the other rows/columns.
Definition at line 315 of file fltkimgbuf.cc.
References dw::fltk::BEAUTIFUL_GAMMA, bpp, findGammaCorrectionTable(), gamma, lout::misc::max(), and dw::fltk::scaleMode.
Referenced by scaleRowBeautiful().
|
private |
Definition at line 568 of file fltkimgbuf.cc.
Referenced by getRowArea(), scaleRowBeautiful(), and scaleRowSimple().
|
inline |
Definition at line 208 of file fltkimgbuf.cc.
References height, dw::fltk::scaleMode, scaleRowBeautiful(), scaleRowSimple(), and dw::fltk::SIMPLE.
|
inline |
Definition at line 249 of file fltkimgbuf.cc.
References backscaledY(), bpp, copiedRows, DBG_IF_RTFL, DBG_OBJ_SET_SYM, gamma, lout::misc::BitSet::get(), lout::misc::StringBuffer::getChars(), height, lout::misc::BitSet::intoStringBuffer(), rawdata, root, scaleBuffer(), scaledY(), lout::misc::BitSet::set(), and width.
Referenced by scaleRow().
|
inline |
Definition at line 218 of file fltkimgbuf.cc.
References bpp, copiedRows, DBG_IF_RTFL, DBG_OBJ_SET_SYM, lout::misc::BitSet::get(), lout::misc::StringBuffer::getChars(), lout::misc::BitSet::intoStringBuffer(), rawdata, root, scaledY(), lout::misc::BitSet::set(), and width.
Referenced by scaleRow().
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 204 of file fltkimgbuf.cc.
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 555 of file fltkimgbuf.cc.
References deleteOnUnref, and isRoot().
|
virtual |
Implements dw::core::Imgbuf.
Definition at line 525 of file fltkimgbuf.cc.
References _MSG, deleteOnUnref, isRoot(), refCount, and scaledBuffers.
|
private |
Definition at line 31 of file fltkimgbuf.hh.
Referenced by copyRow(), copyTo(), draw(), init(), scaleBuffer(), scaleRowBeautiful(), and scaleRowSimple().
|
private |
Definition at line 37 of file fltkimgbuf.hh.
Referenced by copyRow(), init(), newScan(), scaleRowBeautiful(), scaleRowSimple(), and ~FltkImgbuf().
|
private |
Definition at line 23 of file fltkimgbuf.hh.
Referenced by detachScaledBuf(), init(), setDeleteOnUnref(), and unref().
|
private |
Definition at line 28 of file fltkimgbuf.hh.
Referenced by createSimilarBuf(), findGammaCorrectionTable(), FltkImgbuf(), FltkImgbuf(), getScaledBuf(), init(), scaleBuffer(), and scaleRowBeautiful().
|
staticprivate |
Definition at line 40 of file fltkimgbuf.hh.
Referenced by findGammaCorrectionTable(), and freeall().
|
private |
Definition at line 26 of file fltkimgbuf.hh.
Referenced by backscaledY(), copyRow(), copyTo(), createSimilarBuf(), draw(), excessiveImageDimensions(), FltkImgbuf(), FltkImgbuf(), getRootHeight(), getRowArea(), getScaledBuf(), init(), scaledY(), scaleRow(), and scaleRowBeautiful().
|
private |
Definition at line 32 of file fltkimgbuf.hh.
Referenced by copyRow(), copyTo(), draw(), init(), scaleRowBeautiful(), scaleRowSimple(), and ~FltkImgbuf().
|
private |
Definition at line 22 of file fltkimgbuf.hh.
Referenced by detachScaledBuf(), init(), isReferred(), lastReference(), ref(), and unref().
|
private |
Definition at line 21 of file fltkimgbuf.hh.
Referenced by backscaledY(), FltkImgbuf(), getRootHeight(), getRootWidth(), getRowArea(), getScaledBuf(), init(), isRoot(), scaledY(), scaleRowBeautiful(), scaleRowSimple(), and ~FltkImgbuf().
|
private |
Definition at line 24 of file fltkimgbuf.hh.
Referenced by copyRow(), detachScaledBuf(), getScaledBuf(), init(), isReferred(), lastReference(), newScan(), unref(), and ~FltkImgbuf().
|
private |
Definition at line 27 of file fltkimgbuf.hh.
Referenced by createSimilarBuf(), FltkImgbuf(), FltkImgbuf(), getScaledBuf(), and init().
|
private |
Definition at line 26 of file fltkimgbuf.hh.
Referenced by copyRow(), copyTo(), createSimilarBuf(), draw(), excessiveImageDimensions(), FltkImgbuf(), FltkImgbuf(), getRootWidth(), getRowArea(), getScaledBuf(), init(), scaleRowBeautiful(), and scaleRowSimple().