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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to use RenderToTBitmap properly?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
yogiyang Posted - Feb 06 2019 : 08:06:08
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
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 06 2019 : 17:53:26
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