Magick++.h and Code::Blocks ++ gcc (mingw)
Posted: 2013-04-12T09:47:52-07:00
Even though Magick++.h is found and CORE* has been added to libs dir:
M:\DEV\Empire - Codeblocks\Empire In The Sky\ImageLoaders.cpp|14|error: request for member 'read' in 'magick', which is of non-class type 'Magick::Image()'|
Code:
M:\DEV\Empire - Codeblocks\Empire In The Sky\ImageLoaders.cpp|14|error: request for member 'read' in 'magick', which is of non-class type 'Magick::Image()'|
Code:
Code: Select all
#include <Magick++.h>
bool LoadPNG( string filename, Indexed<GLubyte> *pixels, int *w, int *h ) {
Magick::Image magick();
magick.read(filename.c_str());
*w=(int) magick.GetWidth();
*h=(int) magick.GetHeight();
Magick::Color sample;
(*pixels).Size( (size_t) w * 4, (size_t) h );
MagickCore::PixelPacket *pix=magick.getPixels(0,0,w,h);
for ( int x=0; x<w; x++ ) for ( int y=0; y<h; y++ ) {
sample = pix[w*y+x];
(*pixels)(x ,y) = (GLubyte) ( iratiod((double)sample.blueQuantum(), (double) MaxRGB)*255.0 );
(*pixels)(x + 1,y) = (GLubyte) ( iratiod((double)sample.greenQuantum(), (double) MaxRGB)*255.0 );
(*pixels)(x + 2,y) = (GLubyte) ( iratiod((double)sample.redQuantum(), (double) MaxRGB)*255.0 );
(*pixels)(x + 3,y) = (GLubyte) ( 1.0 / iratiod((double)sample.alphaQuantum(), (double) MaxRGB)*255.0 );
}
return true;
}