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
 copy iebitmap rect to another iebitmap

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
kowal Posted - Jul 25 2025 : 14:50:26
hello,
I'm trying to copy imageEnView VisibleBitmapRect to another ieBitmap
the problem is that nothing is copied to the dest.
what is my fault?

here is the snippet of my code

ipor is the name of my imageEnView

 function copy_iebitmap_rect_2_iebitmap: boolean;
  var   iebmp: tieBitmap;
        rect: TRect;
  begin
      iebmp := tiebitmap.Create;
      rect.left   := ipor.VisibleBitmapRect.Left;
      rect.top    := ipor.VisibleBitmapRect.Top;
      rect.Right  := ipor.VisibleBitmapRect.Right;
      rect.Bottom := ipor.VisibleBitmapRect.Bottom;
      rect.width  := ipor.VisibleBitmapRect.Width;
      rect.height := ipor.VisibleBitmapRect.Height;

      // from IE Help:
	  // CopyRectTo(Dest: TIEBitmap; SrcX, SrcY, DstX, DstY: integer; RectWidth, RectHeight: integer; CopyAlpha: boolean = false);

      iebmp.PixelFormat := ipor.ieBitmap.PixelFormat;  // added to help but with no effect
      ipor.ieBitmap.CopyRectTo(iebmp,           // dest
                        rect.Left, rect.Top,    // src =  605, 504
                        0, 0,                   // dest
                        rect.Width, rect.Height  //  = 801, 429
                        );
      result := (iebmp.Width>0);   //  iebmp.Width = 0
  end;

--
regards, Kowal

2   L A T E S T    R E P L I E S    (Newest First)
kowal Posted - Jul 28 2025 : 02:45:21
Hi Nigel,
It works ok, thank you for your help!

Kowalski
xequte Posted - Jul 27 2025 : 20:25:32
Hi Kowal

There are two issues here. Firstly, you don't set the size of the destination bitmap, so it will remain 0x0. Secondly, there is an issue with VisibleBitmapRect Left and Top positions.

The following code will work:

      iebmp := TIEBitmap.Create;
      rect.Left   := Round( ipor.ViewX / ipor.ZoomX * 100 );
      rect.Top    := Round( ipor.ViewY / ipor.ZoomY * 100 );
      rect.width  := ipor.VisibleBitmapRect.Width;
      rect.height := ipor.VisibleBitmapRect.Height;

      iebmp.Allocate( rect.width, rect.Height );

      iebmp.PixelFormat := ipor.ieBitmap.PixelFormat;  // added to help but with no effect
      ipor.ieBitmap.CopyRectTo(iebmp,           // dest
                        rect.Left, rect.Top,    // src =  605, 504
                        0, 0,                   // dest
                        rect.Width, rect.Height  //  = 801, 429
                        );
      result := (iebmp.Width>0);


Nigel
Xequte Software
www.imageen.com