Re: Code::Blocks and Magick++.h
Herbert Elwood Gilliland III <[email protected]> Sun, 14 Apr 2013 12:12:05 -0400
| Newsgroups | gmane.comp.video.graphicsmagick.apis |
|---|---|
| Message-ID | <CAG+GTicxZY96Vts2hUd7-cS0twcw+3guh2+uMypcfofA7OuwGw@mail.gmail.com> |
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()'| This is not GraphicsMagick, it is ImageMagick, which is why those methods may not be found. Where can i get prebuilt mingw-compatible binaries for graphicsmagick? On Sun, Apr 14, 2013 at 10:47 AM, Bob Friesenhahn < [email protected]> wrote: > On Fri, 12 Apr 2013, Herbert Elwood Gilliland III wrote: > > I want to use ImageMagick / GraphicsMagick to load texture data into >> OpenGL as a cross-platform solution. I'm >> using Code::Blocks. I cannot find good information regarding use of >> ImageMagick in Code::Blocks. >> >> 1) Does anyone have a working, relatively recent and definitive guide to >> getting Code::Blocks to find and >> properly use Magick++.h? I am using the OpenGL template for mingw/gcc on >> Windows platform. >> 2) I have written this code for Loading, which loads an image into a "CPU >> Image" based from data collected by >> Magick++.h -- I have another version that uses GDI+ as a fallback for >> MSVC++. Is this what it should be? >> > > This code can not compile. > > > >> bool Load( string filename, Indexed<GLubyte> *pixels, int *w, int *h ) { >> Magick::Image magick(); >> magick.read(filename.c_str())**; >> > > The filename argument is already a std::string so you should remove the > .c_str() bit since it is just doing more work. > > *w=(int) magick.GetWidth(); >> *h=(int) magick.GetHeight(); >> > > There are no GetWidth() and GetHeight() methods, however there are > columns() and rows() methods which behave as you expect. > > > Magick::Color sample; >> (*pixels).Size( (size_t) w * 4, (size_t) h ); >> > > I am not familiar with the GLU API but the above can likely be written > > pixels->Size( (size_t) w * 4, (size_t) h ); > > since pixels is a pointer. > > > PixelPacket *pix=magick.getPixels(0,0,w,h)**; >> for ( int x=0; x<w; x++ ) for ( int y=0; y<h; y++ ) { >> > > This strategy is not good. It is much better to use getPixels() to get > just one row at a time rather than the whole image. This is more scalable > to larger images, works better with the CPU cache, is likely to optimize > better, and simplifies the using code. So move the getPixels() into the > loop. If you need to do something like change the row order, then you can > simply change the 'y' loop: > > > for ( int x=0; x<w; x++ ) > { > PixelPacket *pix=getPixels(x,0,w,1); > > for ( int y=0; y<h; y++ ) > { > ... > > > sample = pix[w*y+x]; >> (*pixels)(x ,y) = (GLubyte) ( iratiod(sample.blueQuantum(), >> (double) MaxRGB)*255.0 ); >> (*pixels)(x + 1,y) = (GLubyte) ( iratiod(sample.greenQuantum(), >> (double) MaxRGB)*255.0 ); >> (*pixels)(x + 2,y) = (GLubyte) ( iratiod(sample.redQuantum(), >> (double) MaxRGB)*255.0 ); >> (*pixels)(x + 3,y) = (GLubyte) ( 1.0 / iratiod(sample.alphaQuantum(), >> (double) MaxRGB)*255.0 ); >> } >> return true; >> } >> >> The Indexed template is similar to a stl vector. >> > > It looks interesting. Make sure to post your final working solution. > > Bob > -- > Bob Friesenhahn > [email protected], http://www.simplesystems.org/** > users/bfriesen/ <http://www.simplesystems.org/users/bfriesen/> > GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Graphicsmagick-apis mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/graphicsmagick-apis