• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

GBitmapScaler Class Reference

Fast rescaling code for gray level images. More...

#include <GScaler.h>

Inheritance diagram for GBitmapScaler:

Inheritance graph
[legend]

List of all members.


Public Member Functions

void scale (const GRect &provided_input, const GBitmap &input, const GRect &desired_output, GBitmap &output)
virtual ~GBitmapScaler ()

Static Public Member Functions

static GP< GBitmapScaler > create (const int inw, const int inh, const int outw, const int outh)
static GP< GBitmapScaler > create (void)

Protected Member Functions

 GBitmapScaler (int inw, int inh, int outw, int outh)
 GBitmapScaler (void)
unsigned char * get_line (int, const GRect &, const GRect &, const GBitmap &)

Protected Attributes

unsigned char * conv
GPBuffer< unsigned char > gconv
GPBuffer< unsigned char > glbuffer
GPBuffer< unsigned char > gp1
GPBuffer< unsigned char > gp2
int l1
int l2
unsigned char * lbuffer
unsigned char * p1
unsigned char * p2

Detailed Description

Fast rescaling code for gray level images.

This class augments the base class {GScaler} with a function for rescaling gray level images. Function {GBitmapScaler::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 in#. {verbatim} 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; } {verbatim}

Definition at line 185 of file GScaler.h.


Constructor & Destructor Documentation

GBitmapScaler::GBitmapScaler ( void   )  [protected]

Definition at line 305 of file GScaler.cpp.

GBitmapScaler::GBitmapScaler ( int  inw,
int  inh,
int  outw,
int  outh 
) [protected]

Definition at line 311 of file GScaler.cpp.

GBitmapScaler::~GBitmapScaler (  )  [virtual]

Virtual destructor.

Definition at line 319 of file GScaler.cpp.


Member Function Documentation

static GP<GBitmapScaler> GBitmapScaler::create ( const int  inw,
const int  inh,
const int  outw,
const int  outh 
) [inline, static]

Creates a GBitmapScaler.

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#. .

Definition at line 203 of file GScaler.h.

static GP<GBitmapScaler> GBitmapScaler::create ( void   )  [inline, static]

Creates an empty GBitmapScaler.

You must call functions {GScaler::set_input_size} and {GScaler::set_output_size} before calling any of the scaling functions.

Definition at line 197 of file GScaler.h.

unsigned char * GBitmapScaler::get_line ( int  fy,
const GRect &  required_red,
const GRect &  provided_input,
const GBitmap &  input 
) [protected]

Definition at line 325 of file GScaler.cpp.

void GBitmapScaler::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 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}. Note that the output image always contain 256 gray levels. You may want to use function {GBitmap::change_grays} to reduce the number of gray levels.

Definition at line 399 of file GScaler.cpp.


Member Data Documentation

unsigned char* GBitmapScaler::conv [protected]

Definition at line 225 of file GScaler.h.

GPBuffer<unsigned char> GBitmapScaler::gconv [protected]

Definition at line 226 of file GScaler.h.

GPBuffer<unsigned char> GBitmapScaler::glbuffer [protected]

Definition at line 224 of file GScaler.h.

GPBuffer<unsigned char> GBitmapScaler::gp1 [protected]

Definition at line 228 of file GScaler.h.

GPBuffer<unsigned char> GBitmapScaler::gp2 [protected]

Definition at line 230 of file GScaler.h.

int GBitmapScaler::l1 [protected]

Definition at line 231 of file GScaler.h.

int GBitmapScaler::l2 [protected]

Definition at line 232 of file GScaler.h.

unsigned char* GBitmapScaler::lbuffer [protected]

Definition at line 223 of file GScaler.h.

unsigned char* GBitmapScaler::p1 [protected]

Definition at line 227 of file GScaler.h.

unsigned char* GBitmapScaler::p2 [protected]

Definition at line 229 of file GScaler.h.


The documentation for this class was generated from the following files:
  • GScaler.h
  • GScaler.cpp

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal