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
 Copying bitmap to an object
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

bmesser

United Kingdom
222 Posts

Posted - Apr 25 2014 :  05:25:51  Show Profile  Reply
Hi

I'm trying to grab the canvas of a GridPanel component which contains a couple of graphs (in two panels) and add them as an object of the same size to a TImageENVect component. I've got it to work, but the image I grab is not as good as the original. Am I missing something with this code or maybe there is a better way to do this?

Bruce.

var
  bmp   : TBitMap;
  obj   : integer;
begin
  bmp:=TBitmap.Create;

  try
    bmp.Width:=GridPanel1.Width;
    bmp.Height:=GridPanel1.Height;
    bmp.PixelFormat:=pf32bit;

    bmp.Canvas.CopyRect(Rect(0,0,bmp.Width,bmp.Height),Canvas,Rect(GridPanel1.Left,GridPanel1.Top,GridPanel1.Left+GridPanel1.Width,GridPanel1.Top+GridPanel1.Height));
    obj:=Image.AddNewObject;
    Image.ObjKind[obj]:=iekBITMAP;
    Image.ObjSetTBitmap(obj,bmp);
    Image.SetObjRect(obj,Rect(30,30,GridPanel1.Width,GridPanel1.Height),True);
  finally
    bmp.Free
  end;

bmesser

United Kingdom
222 Posts

Posted - Apr 25 2014 :  08:18:04  Show Profile  Reply
I eventually found the property BitmapResampleFilter which has fixed the problem!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: