Magick++.h and Code::Blocks ++ gcc (mingw)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Posts: 6
Joined: 2013-04-12T09:46:23-07:00
Authentication code: 6789

Magick++.h and Code::Blocks ++ gcc (mingw)

Post by merv »

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: Select all

#include <Magick++.h>

bool LoadPNG( string filename, Indexed<GLubyte> *pixels, int *w, int *h ) {
 Magick::Image magick();;
 *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;
Post Reply