It would be something like:
// Load an image into the second layer while maintaining its aspect ratio
ImageEnView1.LockPaint();
ImageEnView1.LayersCurrent := 1;
ImageEnView1.IO.LoadFromFile( 'D:\image.jpeg' );
aRect := GetImageRectWithinArea( ImageEnView1.CurrentLayer.Bitmap.Width, ImageEnView1.CurrentLayer.Bitmap.Height,
ImageEnView1.CurrentLayer.Width, ImageEnView1.CurrentLayer.Height );
ImageEnView1.CurrentLayer.PosX := ImageEnView1.CurrentLayer.PosX + aRect.Left;
ImageEnView1.CurrentLayer.PosY := ImageEnView1.CurrentLayer.PoxY + aRect.Top;
ImageEnView1.CurrentLayer.Width := aRect.Right - aRect.Left;
ImageEnView1.CurrentLayer.Height := aRect.Bottom - aRect.Top;
ImageEnView1.UnlockPaint();
Nigel
Xequte Software
www.xequte.com
nigel@xequte.com