VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1234567[8]910 ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 09:31:34 03/09/01 Fri
Author: Bill Miller
Subject: Re: Continue.. Obtaining coordinates for cropping an Image
In reply to: Jason Offrey 's message, "Continue.. Obtaining coordinates for cropping an Image" on 01:40:16 03/08/01 Thu

Jason:

Cropping is pretty easy with Envision once you get used to it. I have an Image Capture component I developed called Apprehend. It has demos with some of the Delphi image libaries including Envision. It also supports cropping. I'll sent it to you tonight....

Regards
Bill


>I have played with both the Image.Graphic and
>Image.DisplayedGraphic Height and Width values but
>both result in a cropped image which is either to
>large or to small; not an exact crop of the viewable
>screen image.
>
>I have included the Crop function I am currently
>trying to get working.
>
>Again, any help will be greatly appreciated.
>
>Jason
>
>
>>Hi Jason,
>>
>>Have you tried adding the Width and Height of the
>scroll >box to your upper left corner? The you could
>calculate the >crop transform coordinates
>>from the size of the DisplayedImage.Width/Height
>>properties.
>>
>
>procedure TFormEditor.Crop;
>var
> Transform : TCropTransform;
> Graphic : TDibGraphic;
>
> Left : LongInt;
> Top : LongInt;
> Right : LongInt;
> Bottom : LongInt;
>
> StartXPos,
> StartYPos,
> StopXPos,
> StopYPos : Longint;
>begin
> StartXPos:=Image.HorzScrollBar.Position;
> StartYPos:=Image.VertScrollBar.Position;
> StopXPos:=Round(
>(StartXPos+Image.DisplayedGraphic.Width));
> StopYPos:=Round(
>(StartYPos+Image.DisplayedGraphic.Height) );
>
> Top:=Round(StartYPos+1);
> Left:=Round(StartXPos+1);
> Bottom:=Round(Image.Graphic.Height-StopYPos);
> Right:=Round(Image.Graphic.Width-StopXPos);
>//
>Bottom:=Round(Image.DisplayedGraphic.Height-StopYPos);
>//
>Right:=Round(Image.DisplayedGraphic.Width-StopXPos);
>
> Graphic := Image.Graphic;
>
> FUndoGraphic.Assign(Graphic);
>
> Transform := TCropTransform.Create;
> try
> Transform.Left := Left;
> Transform.Right := Right;
> Transform.Top := Top;
> Transform.Bottom := Bottom;
>
> Transform.ApplyOnDest(FUndoGraphic, Graphic);
> finally
> Transform.Free;
> end;
>
> Image.Redraw(True);
>end;

[ Next Thread | Previous Thread | Next Message | Previous Message ]

[ Contact Forum Admin ]


Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.