ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to use RenderToTBitmap properly?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
727 Posts

Posted - Feb 06 2019 :  08:06:08  Show Profile  Reply
Hello,

I have an image which is when assigned to TBitmap comes us so large that user cannot see the whole image. Currently I am using this code:
MyBitmap := TBitmap.Create;
ImageEnViewMain.CurrentLayer.Bitmap.CopyToTBitmap(MyBitmap);


For that I think I will have to use RenderToTBitmap to get ImageEn to render the image to TBitmap at a given size. I trying the following code but it is not getting compiled.
ImageEnViewMain.CurrentLayer.Bitmap.RenderToTBitmap(MyBitmap,0,0,rect,0,0,640,660,0,0,640,660,true,False,0,rfNone,True);


Is there any sample that show as to how we can use it?

I also want to maintain the aspect ratio of the original image.

TIA


Yogi Yang

xequte

38610 Posts

Posted - Feb 06 2019 :  17:53:26  Show Profile  Reply
Hi Yogi

Please use RenderToTBitmapEx, it has less parameters:

// Render an image in a TImageEnView to a TBitmap at half-size
bmp.Width  := ImageEnView1.IEBitmap.Width div 2;
bmp.Height :=  ImageEnView1.IEBitmap.Height div 2;
ImageEnView1.IEBitmap.RenderToTIEBitmapEx( bmp,
                                           0, 0, bmp.Width, bmp.Height,
                                           0, 0, ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height,
                                           255, rfLanczos3 );


You can use GetImageSizeWithinArea to maintain the AR:

http://www.imageen.com/help/GetImageSizeWithinArea.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: