Code: Select all
// mXPixels is the number of pixels in x
// mYPixels is the number of pixels in y
// allocate the data for the image
mImageSize = mXPixels * mYPixels * 3;
byte* bpImage = (byte*)malloc(mImageSize);
// Get the image from the stream
ReadImage(bpImage);
wxBitmap mBitmap(mXPixels, mYPixels);
wxImage mImage = bitmap.ConvertToImage();
mImage.SetType(wxBITMAP_TYPE_JPEG);
// pass the jpeg data to the image
mImage.SetData(bpImage);
// get a wxBitmap of the bImage
wxBitmap foo = wxBitmap(mImage);
// Draw as
dc.DrawBitmap(foo, 0, 0);
Code: Select all
if (wxFile::Exists(wxT("horse.jpg")))
{
wxLogError(wxT("JPG image Exists"));
}
else
{
wxLogError(wxT("JPG image Doesn't Exist"));
}
but
Code: Select all
if (!hImage.LoadFile(wxT("horse.jpg"), wxBITMAP_TYPE_JPEG,))
{
wxLogError(wxT("Can't load JPG image"));
}
I put the file in the same directory as the executable, I put it in the same directory as the source file. I tried "./horse.jpg", I tried ".\\horse.jpg" since it is windows . I can't load the jpg file and I don't know why it won't load.
I searched for how to find errors, are log files created? Something has to be there, this code has been around a long time.
Sorry to be a bother.