I'm trying to use the MagickWand API to create an image that's composed of multiple layers. The first layer should have an opaque background but all layers after that should have transparent backgrounds.
This is more or less how the code looks:
Code: Select all
MagickWand *mw1 = NewMagickWand();
PixelWand *bgw1 = NewPixelWand();
MagickNewImage(mw1, 100, 100, bgw1); // this image should have an opaque background
//... paint on the image
// now create another layer
MagickWand mw2 = NewMagickWand();
PixelWand *bgw2 = NewPixelWand();
MagickNewImage(mw2, 100, 100, bgw2); // this image should have a transparent background
// ... paint on the second image
// create the final image
MagickAddImage(mw1, mw2);
MagickWand *merged = MagickMergeImageLayers(mw1, MergeLayer);
MagickWriteImage(merged, "foo.png");
Thanks,
Bob