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
 StretchRectTo goes crazy
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Xylit

13 Posts

Posted - Jul 04 2012 :  03:53:13  Show Profile  Reply
Hi,

I want to shrink the left-most 40 columns and the right-most 40 columns of an image to each 30 columns. The middle of the image should stay the same.
This method is working fine for the left side and the middle. But the right side does not shrink. What am I missing?
procedure TRoboScreenManager.BendPanelPicture(const sourcePic: TIEBitmap);
var
  destPic : TIEBItmap;
const
  d = 30;   // destination 
  s = 40;   // source
begin
  destPic := TIEBItmap.Create(sourcePic.Width - (s-d)*2, sourcePic.Height);

  sourcepic.CopyRectTo(destPic, s,0, d,0 ,DestPic.Width - d*2 ,sourcePic.Height);
  sourcePic.StretchRectTo(destPic, 0,0,d,destPic.Height-1, 0,0,s,sourcePic.Height-1, rfNone, 255);
  sourcePic.StretchRectTo(destPic, destPic.Width-d,0,destPic.Width-1,destPic.Height-1, sourcePic.Width-s,0,sourcePic.Width-1,sourcePic.Height-1, rfNone, 255);

  sourcePic.Assign(destPic);
  destPic.Free;
end;


I am using the actual version of ImageEn

fab

1310 Posts

Posted - Jul 04 2012 :  08:02:06  Show Profile  Reply
Hi,
change the second StrectRectTo to:
sourcePic.StretchRectTo(destPic, destPic.Width-d-1,0,d,destPic.Height-1, sourcePic.Width-s-1,0,s,sourcePic.Height-1, rfNone, 255);
Go to Top of Page

Xylit

13 Posts

Posted - Jul 04 2012 :  08:25:04  Show Profile  Reply
Okay thanks, makes sense if you know that dxDst and dyDst is not a second set of coordinates but a size.
Please add this information to the methods documentation.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: