#include <jpeg.hpp>
void LoadJpegFile(const AnsiString & Src,
Graphics::TBitmap * Bitmap)
{
TJPEGImage * Jpeg = new TJPEGImage();
Jpeg->Performance = jpBestQuality;
Jpeg->PixelFormat = jf24Bit;
Jpeg->Grayscale = false;
Jpeg->LoadFromFile(Src);
Bitmap->HandleType = bmDIB;
Bitmap->PixelFormat = pf32bit;
Bitmap->Width = Jpeg->Width;
Bitmap->Height = Jpeg->Height;;
Bitmap->Canvas->Draw(0,0,Jpeg);
delete Jpeg;
}
void __fastcall TForm1::FormPaint(TObject *Sender)
{
Graphics::TBitmap * Bitmap = new Graphics::TBitmap();
LoadJpegFile("C:\\a.jpg",Bitmap);
Canvas->Draw(0,0,Bitmap);
delete Bitmap;
}