fmw42 wrote:mbatra wrote:Hi,
I have a MFC dialog based application with a picture control on it. I want to draw an image in the picture control using ImageMagick. Can anybody give a sample code for the same.
Regards,
mbatra
Can you elaborate or provide some examples. I for one do not have clue what MFC dialog based application is nor what a picture control is.
Hi,
I created an MFC dialog based application. On the dialog, I am using a Picture control (MFC's picture control) in which we can draw an image using its device context handle. Now I am using ImageMagick (Magick++) library to Flip/rotate an image. Please find below the sample code.
try
{
string srcdir("");
if(getenv("SRCDIR") != 0)
srcdir = getenv("SRCDIR");
// Read images into STL list
list<Image> imageList;
//readImages( &imageList, srcdir + "smile_anim.miff" );
readImages( &imageList, srcdir + "t-shirt.png" );
// Flip images
for_each( imageList.begin(), imageList.end(), flipImage() );
//for_each( imageList.begin(), imageList.end(), cropImage(Geometry(220,220,500,200)) );
// Create a morphed version, adding three frames between each existing frame.
list<Image> morphed;
morphImages( &morphed, imageList.begin(), imageList.end(), 1 );
// Write out images
writeImages( morphed.begin(), morphed.end(), "flip_image11.png" );
}
catch( exception &error_ )
{
//cout << "Caught exception: " << error_.what() << endl;
}
This will read the image from the specified directory, provide the feature and then save it into the same dir. Now I want to Draw/Display that output image in the MFC picture control on the dialog using ImageMagick (Magick++) library functions.
Please let me know if u want me to elaborate this in more detail.
Also when I use read function of Image class to read an image from the dir, it throws an error in std::basic_string (Elem *) function of xstring.h.
Please hellp me if I can use read , write , draw functions of Image class.
Thanx & Regards,
mbatra.