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 assign a layer image to Image control?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
725 Posts

Posted - Aug 17 2018 :  08:52:44  Show Profile  Reply
Hello,

I want to assign current layer's content to Delphi's ImageControl?

But I am not able to do this.


      //Load the bitmap here
      MyBitmap := TIEBitmap.Create;
      MyBitmap.Assign(ImageEnViewMain.Layers[LayerNum].Bitmap);

      if MyBitmap.Width > MyBitmap.Height then
        MyBitmap.Resample(80, -1,rfNone,True)
      else
        MyBitmap.Resample(-1, 80,rfNone,True);

      //Assign the bitmat to StringGrid Cell
      MyCanvas := TImage(CurrentControl).Canvas;  //TCanvas.Create;

      MyBitmap.RenderToCanvas(MyCanvas, Rect.Left, Rect.Top,
          Rect.Right - Rect.Left, Rect.Bottom - Rect.Top, rfFastLinear, 0);

      MyBitmap.Free;


What mistake am I making in this code?

TIA


Yogi Yang

xequte

38176 Posts

Posted - Aug 23 2018 :  20:08:41  Show Profile  Reply
I don't know TImage well, but why not just assign the TIEBitmap to the TBitmap of the TImage control?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

yogiyang

India
725 Posts

Posted - Aug 30 2018 :  07:36:41  Show Profile  Reply
Hello,

Thanks for suggestion.

Actually Image Control has only TCanvas available.

But assigning anything to this does not show in Image Control.

TIA


Yogi Yang
Go to Top of Page

xequte

38176 Posts

Posted - Aug 30 2018 :  15:14:26  Show Profile  Reply
Hi Yogi

TImage also has a Picture property, so you can also use:

MyIEBitmap.CopyToTBitmap( Image1.Picture.Bitmap );


e.g.

// Load a RAW image into a TImage
myBmp := TIEBitmap.create;
myBmp.Read( 'C:\camera.dng' );
myBmp.CopyToTBitmap( Image1.Picture.Bitmap );
myBmp.Free;



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