[ Show ]
[ Shrink ]
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.)
Donate to VoyForums (PayPal):
[ Next Thread |
Previous Thread |
Next Message |
Previous Message ]
Date Posted: 18:03:08 01/17/02 Thu
Subject: Re: How to select a part of a picture und paste the selection as a new picture...
In reply to:
's message, "Re: How to select a part of a picture und paste the selection as a new picture..." on 04:08:28 01/17/02 Thu
For question 1,
Replace the .CropToSelection method in EnRubber.Pas with the one below.
For question 2,
Envision does not have support to drag with the mouse a sub image onto another one. This is not trivial to do. The EnRubber.Pas file shows how to use a Canvas on the image scroll box directly to draw on it without drawing on the source image itself. You would need to use a similar technique to drag on screen the image, then paste the image in the graphic once the user is done.
Rect : TRect;
Graphic : TDibGraphic;
CropTransform : TCropTransform;
DisplayedGraphic : TDibGraphic;
SourceWidth : Integer;
SourceHeight : Integer;
if not SelectionActive then
DisplayedGraphic := TDibGraphic(FImageScrollBox.FImage.Picture.Graphic);
SourceWidth := FImageScrollBox.FSourceGraphic.Width;
SourceHeight := FImageScrollBox.FSourceGraphic.Height;
Rect.Top := FY1 * SourceHeight div DisplayedGraphic.Height;
Rect.Bottom := FY2 * SourceHeight div DisplayedGraphic.Height;
Rect.Left := FX1 * SourceWidth div DisplayedGraphic.Width;
Rect.Right := FX2 * SourceWidth div DisplayedGraphic.Width;
if ((Rect.Right - Rect.Left) >= 1) and
((Rect.Bottom - Rect.Top) >= 1) then
Graphic := TDibGraphic.Create;
CropTransform := TCropTransform.Create;
CropTransform.Top := Rect.Top;
CropTransform.Left := Rect.Left;
CropTransform.Bottom := SourceHeight - Rect.Bottom;
CropTransform.Right := SourceWidth - Rect.Right;
CropTransform.ApplyOnDest( FImageScrollBox.FSourceGraphic, Graphic);
FImageScrollBox.Redraw ( True );
>Thank you for your answer, I will try your suggestion.
>I still have 2 questions:
>1)In your DemoProject is the selected graphic, that I
>paste as a new graphic smaller then the original. If I
>resize the new graphic then the quality is worse. How
>can I get the original size?
>2)How can I drag the selection to the other graphic?
>>I am not sure I understand the complete details, but
>>you can use the ImageScrollBox.Graphic.Canvas.Draw
>>method to paste a graphic onto another graphic.
>>For example you can create a DibGraphic, assign it
>>contents from the clipboard and then paste it to an
>>DibGraphic := TDibGraphic.Create;
>>>Hi, can anybody say me how I can select a part of a
>>>picture (to get the coords) and:
>>>1) paste the selection as a new picture and resize
>>>2) paste the selection into a new ImageScrollBox A,
>>>then select a part of an other picture and paste the
>>>second selection into the same ImageScrollBox A, so I
>>>have a new picture builded up from parts of other
>>>With best regards, Dmitri
Next Thread |
Previous Thread |
Next Message |
[ Contact Forum Admin ]
Forum timezone: GMT-5|
VF Version: 3.00b, ConfDB:
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.