Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

ImageMagicKSource.cpp

Go to the documentation of this file.
00001 /*************************************************************************
00008  *
00009  * Source code for Real Time Image Library (libRTImage)
00010  *
00011  * Leeds Vision Group give permission for this code to be copied, modified
00012  * and distributed within the University of Leeds subject to the following
00013  * conditions:-
00014  *
00015  * - The code is not to be used for commercial gain.
00016  * - The code and use thereof will be attributed to the authors where
00017  *   appropriate (including demonstrations which rely on it's use).
00018  * - All modified, distributions of the source files will retain this header.
00019  *
00020  ****************************************************************************/
00021 
00022 #include <ImageMagicKSource.h>
00023 #include <im_magick.h>
00024 
00025 ImageMagicKSource::ImageMagicKSource(char *filename, char* prog_path)
00029 {
00030     if((img=im_load(filename, width, height, prog_path))==NULL) ok = false ;
00031     else ok = true ; 
00032 }
00033 
00034 ImageMagicKSource::ImageMagicKSource(char *filename)
00038 {
00039     if((img=im_load(filename, width, height, NULL))==NULL) ok = false ;
00040     else ok = true ; 
00041 }
00042 
00043 ImageMagicKSource::~ImageMagicKSource()
00047 {
00048     im_free(img) ;
00049 }
00050 
00051 ImageSource& ImageMagicKSource::operator>> (ImageRGB &image)
00055 {
00056     im_get_data(img, (int*)image.data) ;
00057 
00058     return *this ;
00059 }
00060 
00061 void ImageMagicKSource::get_size(unsigned int &w, unsigned int &h) 
00065 {
00066     w = width ;
00067     h = height ;
00068 }  
00069 
00070 ImageSource& ImageMagicKSource::operator>> (ImageGrey &image)
00074 {
00075     im_get_data_grey(img, image.brightness) ;
00076     return *this ;
00077 }
00078 
00079 ImageSource& ImageMagicKSource::operator>> (Image &image)
00083 {
00084     (type == Image::COLOUR) ? *this >> (ImageRGB&)image
00085                             : *this >> (ImageGrey&)image;
00086     return *this ;
00087 }
00088 
00089 

Generated at Fri Aug 13 17:29:21 2004 for libRTImage by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001