kviewshell
GPixmapScaler Class Reference
Fast rescaling code for color images. More...
#include <GScaler.h>
Public Member Functions | |
void | scale (const GRect &provided_input, const GPixmap &input, const GRect &desired_output, GPixmap &output) |
virtual | ~GPixmapScaler () |
Static Public Member Functions | |
static GP< GPixmapScaler > | create (const int inw, const int inh, const int outw, const int outh) |
static GP< GPixmapScaler > | create (void) |
Protected Member Functions | |
GPixel * | get_line (int, const GRect &, const GRect &, const GPixmap &) |
GPixmapScaler (int inw, int inh, int outw, int outh) | |
GPixmapScaler (void) | |
Protected Attributes | |
GPBufferBase | glbuffer |
GPBufferBase | gp1 |
GPBufferBase | gp2 |
int | l1 |
int | l2 |
GPixel * | lbuffer |
GPixel * | p1 |
GPixel * | p2 |
Detailed Description
Fast rescaling code for color images.This class augments the base class {GScaler} with a function for rescaling color images. Function {GPixmapScaler::scale} computes an arbitrary segment of the output image given the corresponding pixels in the input image.
{ Example} --- The following functions returns a color image of size nw# by nh# containing a rescaled version of the input image in#. {verbatim} GPixmap *rescale_pixmap(const GPixmap &in, int nw, int nh) { int w = in.columns(); // Get input width int h = in.raws(); // Get output width GPixmapScaler scaler(w,h,nw,nh); // Creates bitmap scaler GRect desired(0,0,nw,nh); // Desired output = complete image GRect provided(0,0,w,h); // Provided input = complete image GPixmap *out = new GPixmap; scaler.scale(provided, in, desired, *out); // Rescale return out; } {verbatim}
Definition at line 259 of file GScaler.h.
Constructor & Destructor Documentation
GPixmapScaler::GPixmapScaler | ( | void | ) | [protected] |
Definition at line 499 of file GScaler.cpp.
GPixmapScaler::GPixmapScaler | ( | int | inw, | |
int | inh, | |||
int | outw, | |||
int | outh | |||
) | [protected] |
Definition at line 507 of file GScaler.cpp.
GPixmapScaler::~GPixmapScaler | ( | ) | [virtual] |
Member Function Documentation
static GP<GPixmapScaler> GPixmapScaler::create | ( | const int | inw, | |
const int | inh, | |||
const int | outw, | |||
const int | outh | |||
) | [inline, static] |
Creates a GPixmapScaler.
The size of the input image is given by inw# and inh#. This function internally calls {GScaler::set_input_size} and {GScaler::set_output_size}. The size of the output image is given by outw# and outh#. .
static GP<GPixmapScaler> GPixmapScaler::create | ( | void | ) | [inline, static] |
Creates an empty GPixmapScaler.
You must call functions {GScaler::set_input_size} and {GScaler::set_output_size} before calling any of the scaling functions.
GPixel * GPixmapScaler::get_line | ( | int | fy, | |
const GRect & | required_red, | |||
const GRect & | provided_input, | |||
const GPixmap & | input | |||
) | [protected] |
Definition at line 523 of file GScaler.cpp.
void GPixmapScaler::scale | ( | const GRect & | provided_input, | |
const GPixmap & | input, | |||
const GRect & | desired_output, | |||
GPixmap & | output | |||
) |
Computes a segment of the rescaled output image.
The pixmap output# is overwritten with the segment of the output image specified by the rectangle desired_output#. The rectangle provided_input# specifies which segment of the input image is provided in the pixmap input#. An exception {GException} is thrown if the rectangle provided_input# is smaller then the rectangle required_input# returned by function {GScaler::get_input_rect}.
Definition at line 594 of file GScaler.cpp.
Member Data Documentation
GPBufferBase GPixmapScaler::glbuffer [protected] |
GPBufferBase GPixmapScaler::gp1 [protected] |
GPBufferBase GPixmapScaler::gp2 [protected] |
int GPixmapScaler::l1 [protected] |
int GPixmapScaler::l2 [protected] |
GPixel* GPixmapScaler::lbuffer [protected] |
GPixel* GPixmapScaler::p1 [protected] |
GPixel* GPixmapScaler::p2 [protected] |
The documentation for this class was generated from the following files: