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: 12345[6]78910 ]


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

Date Posted: 04:58:11 01/18/02 Fri
Author: Dmitri
Subject: Re: How to select a part of a picture und paste the selection as a new picture...
In reply to: Michel 's message, "Re: How to select a part of a picture und paste the selection as a new picture..." on 18:03:08 01/17/02 Thu

Hi Michel,
we had found the solution for my 1. question already, but although thank you very much for your answer and the code!
I will try to find a solution for my 2. question...

Thank you for your realy good support!

Best regards,
Dmitri

>Hi Dmitri,
>
>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.
>
>Best regards,
>
>Michel
>
>procedure TRubberbandMouseHandler.CropToSelection;
>var
> Rect : TRect;
> Graphic : TDibGraphic;
> CropTransform : TCropTransform;
> DisplayedGraphic : TDibGraphic;
> SourceWidth : Integer;
> SourceHeight : Integer;
>begin
> if not SelectionActive then
> raise
>ERubberbandError.Create(msgRegionNotSelected);
>
> 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;
>
> AdjustRect(Rect);
>
> if ((Rect.Right - Rect.Left) >= 1) and
> ((Rect.Bottom - Rect.Top) >= 1) then
> begin
> Graphic := TDibGraphic.Create;
> CropTransform := TCropTransform.Create;
> try
> CropTransform.Top := Rect.Top;
> CropTransform.Left := Rect.Left;
> CropTransform.Bottom := SourceHeight -
>Rect.Bottom;
> CropTransform.Right := SourceWidth -
>Rect.Right;
>
> CropTransform.ApplyOnDest(
>FImageScrollBox.FSourceGraphic, Graphic);
> FImageScrollBox.Graphic.Assign(Graphic);
> FImageScrollBox.Redraw ( True );
> finally
> CropTransform.Free;
> Graphic.Free;
> end;
> end;
>end;
>
>
>>Hi Michel,
>>
>>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?
>>
>>Best regards,
>>Dmitri
>>
>>
>>>Hi Dmitri,
>>>
>>>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
>>>ImageScrollBox.
>>>
>>>DibGraphic := TDibGraphic.Create;
>>>DibGraphic.Assign(Clipboard);
>>>
>>>ImageScrollBox.Graphic.Canvas.Draw(DibGraphic);
>>>ImageScrollBox.Redraw(True);
>>>
>>>DibGraphic.Free;
>>>
>>>Best regards,
>>>
>>>Michel
>>>
>>>>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
>>it;
>>>>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
>>>>pictures.
>>>>
>>>>With best regards, Dmitri

[ 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.