I´m new to ImageMagic++, and just use it for some very simple image creation:
The first <for> loop generates an image (a single XY-plane) from a 3dimensional structure, and the second one contains all border elements of this structure.
Now to make sure my algorithm finds all border elements, they are drawn in a different color, but at the moment the color value is just set to a new one and overwrites the old color.
What I want, is to add a certain color value in the second <for> loop, so i can distinguish between "wrong" and "correct" border elements by just looking at the picture. It´s like in photoshop setting some transparency (or opacity?) to a line drawn over another one, but the first one being still visible.
I tried changing the alpha-lvl, but this only affects the background. Also, there seem to be no +, or == operators for the Color class, which would have made things easy enough.
Here is the code:
Code: Select all
Magick::Geometry g1(nx_,ny_);
Magick::Image image(g1, "white");
image.type( Magick::TrueColorMatteType );
image.modifyImage(); //
Magick::Pixels pixelcache(image); // allocate image pixel cache of "image"
Magick::PixelPacket *pixels; // pointer
pixels = pixelcache.get(0, 0, nx_, ny_); // allocate memory for the pixels-pointer
for(plint i=0; i<nx_; ++i) {
for(plint j=0; j<ny_; ++j) {
if (boolmask_->get(i,j,zpos_)) *(pixels+i+j*ny_) = Magick::Color(0,35000,0, 0);
}
}
for(list<BorderElement>::iterator i = bla_.begin(); i != bla_.end(); ++i) {
foo = i->get_pos();
*(pixels+foo.x+foo.y*ny_) = Magick::Color(35000,200,200, 0);
}
pixelcache.sync();
image.magick("png");
image.write(fname.c_str());
thanks for any help!
cheers,
Chris