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
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
 Printer Friendly
Author Previous Topic Topic Next Topic  


537 Posts

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

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;

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.

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.


Yogi Yang


4651 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:

Xequte Software
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To: