class GBitmapScaler: public GScaler

Fast rescaling code for gray level images.

Inheritance:


Public Methods

[more] GBitmapScaler()
Constructs an empty GBitmapScaler.
[more] GBitmapScaler(int inw, int inh, int outw, int outh)
Constructs a GBitmapScaler.
[more]void scale( const GRect &provided_input, const GBitmap &input, const GRect &desired_output, GBitmap &output )
Computes a segment of the rescaled output image.


Inherited from GScaler:

Public Methods

ovoid set_input_size(int w, int h)
ovoid set_output_size(int w, int h)
ovoid set_horz_ratio(int numer, int denom)
ovoid set_vert_ratio(int numer, int denom)
ovoid get_input_rect( const GRect &desired_output, GRect &required_input )


Documentation

Fast rescaling code for gray level images. This class augments the base class GScaler with a function for rescaling gray level images. Function scale computes an arbitrary segment of the output image given the corresponding pixels in the input image.

Example --- The following functions returns an gray level image (sixteen gray levels, size nw by nh) containing a rescaled version of the input image

    GBitmap *rescale_bitmap(const GBitmap &in, int nw, int nh)
    {
      int w = in.columns();       // Get input width
      int h = in.raws();          // Get output width
      GBitmapScaler scaler(w,h,nw,nh);  // Creates bitmap scaler
      GRect desired(0,0,nw,nh);   // Desired output = complete bitmap
      GRect provided(0,0,w,h);    // Provided input = complete bitmap
      GBitmap *out = new GBitmap;
      scaler.scale(provided, in, desired, *out);  // Rescale
      out->change_grays(16);      // Reduce to 16 gray levels
      return out;
    }
    
o GBitmapScaler()
Constructs an empty GBitmapScaler. You must call functions set_input_size and set_output_size before calling any of the scaling functions.

o GBitmapScaler(int inw, int inh, int outw, int outh)
Constructs a GBitmapScaler. The size of the input image is given by

set_input_size and set_output_size. The size of the output image is given by outw and outh. .

ovoid scale( const GRect &provided_input, const GBitmap &input, const GRect &desired_output, GBitmap &output )
Computes a segment of the rescaled output image. The GBitmap object 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 by the GBitmap object rectangle provided_input is smaller then the rectangle required_input returned by function get_input_rect. Note that the output image always contain 256 gray levels. You may want to use function change_grays to reduce the number of gray levels.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.