Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

Gil::ImageBase< Type > Class Template Reference

#include <gilImageBase.h>

List of all members.

Public Member Functions

 ImageBase (void)
 ImageBase (int w, int h, int c)
 ImageBase (const ImageBase< Type > &image)
 ~ImageBase (void)
int width (void) const
int height (void) const
int channels (void) const
int elements (void) const
int pitch (void) const
Type * data (void)
Type * rowp (int r)
void allocate (int w, int h, int c)
void allocate (const ImageBase< Type > &image)
void fillPixels (Type value)
void copyPixelsTo (ImageBase< Type > &dst)
PixelPtr< Type > getPixelPtr (int x, int y)
PixelPtr< Type > begin (void)
PixelPtr< Type > end (void)
Type & pixel (int x, int y, int channel=0)
bool inBounds (int x, int y)
void reverseRows ()
bool readFile (const char *filename)
bool writeFile (const char *filename)
ImageBase< Type > * subImage (int x, int y, int w, int h)
void cropImage (int x, int y, int w, int h)
void setSaveQuality (int q)
int getNumComments ()
void printComments ()
void addComment (string key, string text)
string getComment (string key)
void getOriginalSize (int &w, int &h)
void getOriginalPos (int &x, int &y)

template<typename Type>
class Gil::ImageBase< Type >


Constructor & Destructor Documentation

template<typename Type>
Gil::ImageBase< Type >::ImageBase (  void   ) 
 

template<typename Type>
Gil::ImageBase< Type >::ImageBase (  int  w,
int  h,
int  c
) 
 

Construct an image with width a, height h and c channels.

template<typename Type>
Gil::ImageBase< Type >::ImageBase (  const ImageBase< Type > &  image  ) 
 

Copy constructor: all pixels in image will be copied.

template<typename Type>
Gil::ImageBase< Type >::~ImageBase (  void   ) 
 


Member Function Documentation

template<typename Type>
void Gil::ImageBase< Type >::addComment (  string  key,
string  text
) 
 

template<typename Type>
void Gil::ImageBase< Type >::allocate (  const ImageBase< Type > &  image  )  [inline]
 

Allocate memories according to the size of the specified image. Note that original data will be lost after allocation.

template<typename Type>
void Gil::ImageBase< Type >::allocate (  int  w,
int  h,
int  c
) 
 

Allocate memories for the specified size. Note that original data will be lost after allocation.

template<typename Type>
PixelPtr<Type> Gil::ImageBase< Type >::begin (  void   )  [inline]
 

Get a pixel pointer pointing to the first pixel, which is ssually (0, 0).

template<typename Type>
int Gil::ImageBase< Type >::channels (  void   )  const [inline]
 

Get the channel number of the image.

template<typename Type>
void Gil::ImageBase< Type >::copyPixelsTo (  ImageBase< Type > &  dst  ) 
 

Exactly copy all pixels to another image.

template<typename Type>
void Gil::ImageBase< Type >::cropImage (  int  x,
int  y,
int  w,
int  h
) 
 

template<typename Type>
Type* Gil::ImageBase< Type >::data (  void   )  [inline]
 

Get the pointer pointing to the raw data.

template<typename Type>
int Gil::ImageBase< Type >::elements (  void   )  const [inline]
 

Get the number of elements of the image.
i.e. elements = width * height * channels

template<typename Type>
PixelPtr<Type> Gil::ImageBase< Type >::end (  void   )  [inline]
 

Get a pixel pointer which is next to the last pixel, so you can use the following code to iterate all pixels:

  for(PixelPtr<Type> ptr = img.begin(); ptr != img.end(); ptr++){
      //...
  }

template<typename Type>
void Gil::ImageBase< Type >::fillPixels (  Type  value  ) 
 

Fill the image with the same value.

template<typename Type>
string Gil::ImageBase< Type >::getComment (  string  key  ) 
 

template<typename Type>
int Gil::ImageBase< Type >::getNumComments (   )  [inline]
 

template<typename Type>
void Gil::ImageBase< Type >::getOriginalPos (  int &  x,
int &  y
) 
 

template<typename Type>
void Gil::ImageBase< Type >::getOriginalSize (  int &  w,
int &  h
) 
 

template<typename Type>
PixelPtr<Type> Gil::ImageBase< Type >::getPixelPtr (  int  x,
int  y
)  [inline]
 

Get a pixel pointer pointing to the (x, y) pixel.

template<typename Type>
int Gil::ImageBase< Type >::height (  void   )  const [inline]
 

Get the height of the image.

template<typename Type>
bool Gil::ImageBase< Type >::inBounds (  int  x,
int  y
)  [inline]
 

Check if the specified position is inside the image.

template<typename Type>
int Gil::ImageBase< Type >::pitch (  void   )  const [inline]
 

Get the number of elements of a row.
i.e. pitch = width * channels

template<typename Type>
Type& Gil::ImageBase< Type >::pixel (  int  x,
int  y,
int  channel = 0
)  [inline]
 

template<typename Type>
void Gil::ImageBase< Type >::printComments (   ) 
 

template<typename Type>
bool Gil::FloatImage::readFile (  const char *  filename  ) 
 

Read data from an image file. Currently PGM, PPM, JPG, BMP, PNG, TIF for ByteImage is supported. For FloatImage, HDR, FLT, PFM and UVE is supported. The filetype is determined by filename extensions.

template<typename Type>
void Gil::ImageBase< Type >::reverseRows (   ) 
 

template<typename Type>
Type* Gil::ImageBase< Type >::rowp (  int  r  )  [inline]
 

Get the pointer pointing to a specified row in this image.

template<typename Type>
void Gil::ImageBase< Type >::setSaveQuality (  int  q  )  [inline]
 

template<typename Type>
ImageBase< Type > * Gil::ImageBase< Type >::subImage (  int  x,
int  y,
int  w,
int  h
) 
 

template<typename Type>
int Gil::ImageBase< Type >::width (  void   )  const [inline]
 

Get the width of the image.

template<typename Type>
bool Gil::FloatImage::writeFile (  const char *  filename  ) 
 

Write data to an image file. The filetype is determined by filename extensions, too.


The documentation for this class was generated from the following files:
Generated on Tue Mar 8 17:46:18 2005 for libgil by  doxygen 1.4.1