copying part of an image?

jexd99
jexd99 used Ask the Experts™
on
I am trying to copy part of an image from image1 component to image2. (bitmap to bitmap) I should be able to copy lets say point(25,25) to point(100,100) from image1 to image2, shouldn't I? Especially if it is an even square which I am trying to copy? (I am not trying to overlay the same points in image2, but trying to make image2 contain the portion of image1).  I also read here one other time an easy way to flip an image upside down, but of course, I didn't save that information.  Anyone know the solution to these?  
                   Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Hi jexd99,

Solution 1 :

But a button on a form and 3 images. Put in image1 an image, compile it. Push the button and I think that what you see then is what you need.

procedure TForm1.Button1Click(Sender: TObject);
var Rectangle : TRect;
begin
 Rectangle := Rect(10,10,500,500);
 Image2.Canvas.CopyRect(Rectangle,Image1.Picture.Bitmap.Canvas,Image1.BoundsRect);
 Image3.Canvas.CopyRect(Rectangle,Image1.Picture.Bitmap.Canvas,Rectangle);
end;

Solution 2:

 a) You can look at previous asked question

 b) get a freeware component which does all this and something more :

 http://intermid.com/delphi/download/fancyimg.zip

have fun,
c.u. ZifNab;
In Delphi3 when You copy 256color image in this way then in result you get 16color copied image not 256! In Delphi1 and 2 all works fine.

Commented:
Hi mirek!

Also browsing around? Thanks again for giving that comment. I don't have D3 so I don't know if it works in D3. Why doesn't it works in D3.


OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

ZifNab - Because VCL was changed and you must operate on Palette.

Commented:
mirek - 10x

Author

Commented:
Thanks.. unfortunately, I have D3.... sometimes I not sure why
I ever upgraded. :)

Commented:
If you have D3, why didn't you reject my answer???

Author

Commented:
I should have explained better in the original question I guess (that I was using D3), so as far as the question I asked goes, I got the answer. I will research the "palette" stuff to find out what I need to do, but at least I know where to go from here :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial