2006/12/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> Ok, no problem, attached is a small sample program which illustrates my
problem.
Send the program directly to us. The mailling list does not permit attachments.
Thanks for the speedy replys.
Here is some code, I run Ubuntu 6.10 and compile with g++ `sdl-config
--cflags --libs` `Magick++-config --cppflags --cxxflags --ldflags
--libs` magicksample.cpp -o magicksample
Contents of magicksample.cpp
#include <iostream>
#include "Magick++.h"
#include "SDL.h"
using namespace std;
using namespace Magick;
void display(Image &image)
{
unsigned int width, height;
// Get width and height of image.
width = image.columns();
height = image.rows();
// Initialize SDL.
SDL_Init(SDL_INIT_VIDEO);
// Create SDL_Surface to draw image onto.
SDL_Surface *surface;
surface = SDL_SetVideoMode(width, height, 32, SDL_HWSURFACE);
// Get pointer to pixels of image.
const PixelPacket *imagepixels = image.getConstPixels(0, 0, width,
height);
// Get pointer to pixels of surface.
Uint32 *surfacepixels = (Uint32 *)surface->pixels;
// Copy image pixels to surface.
Uint32 color;
SDL_LockSurface(surface);
for (int row = 0; row < surface->h; row++) {
for(int column = 0; column < surface->w; column++) {
color = SDL_MapRGB(surface->format,
imagepixels->red,
imagepixels->green,
imagepixels->blue);
*surfacepixels = color;
// Increment pointers.
surfacepixels++;
imagepixels++;
}
}
SDL_UnlockSurface(surface);
// Update surface.
SDL_UpdateRect(surface, 0, 0, surface->w, surface->h);
SDL_Delay(5000);
return;
}
int main(int argc, char **argv)
{
// Initialize ImageMagick install location for Windows
InitializeMagick(*argv);
Image image;
try {
// Read file into image object.
image.read( "logo:" );
// Display image for 5 seconds.
display(image);
// Set image modifiable.
image.modifyImage();
// Scale image to smaller size.
image.scale( "50x50%" );
// Display scaled image for 5 seconds.
display(image);
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}
_______________________________________________
Magick-developers mailing list
Magick-developers@imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-developers