VoyForums

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 12[3]45678910 ]


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

Date Posted: 06:38:58 06/02/03 Mon
Author: Michel
Subject: Re: ResizeTransform: Another Problem
In reply to: Kai 's message, "ResizeTransform: Another Problem" on 10:33:44 05/30/03 Fri


Hi Kai,

Yes, you should get the dimensions after loading an image.

This is somewhat strange as your code looks straight forward.

In ...LoadClick if you look at DibGraphic.Width, Height are they correct?

Also, try loading the file in the Demo.Exe program and check if the dimensions are correctly displayed.

Best regards,

Michel

>
>Hi Michel ~
>
>thanks for answering. Reworked my code a little (see
>entire relevant section below) and now I get an
>exception: Source graphic too small.
>
>When I check DIBGraphic after loading, its size is 0 x
>0?
>
>After working with TPixelGraphic and Graphics32 I'd
>have expected it to have the dimensions of the loaded
>image...
>
>Please help me again.
>
>Thanks,
>Kai
>
>
>//-----------------------------------------------------
>procedure TForm1.FormCreate(Sender: TObject);
>begin
> DIBGraphic := TDIBGraphic.Create;
>end;
>
>//-----------------------------------------------------
>procedure TForm1.FormClose(Sender: TObject; var
>Action: TCloseAction);
>begin
> DIBGraphic.Free;
>end;
>
>//-----------------------------------------------------
>procedure Tform1.StretchDraw(SrcGraphic, DstGraphic:
>TDIBGraphic; const DstWidth, DstHeight: Integer);
>var
> StrDrawTransform: TResizeTransform;
>
>begin
> StrDrawTransform := nil;
> try
> StrDrawTransform :=
>TResizeTransform.Create;
> StrDrawTransform.Interpolated := True;
> StrDrawTransform.Filter := ifTriangle;
> StrDrawTransform.Height := DstHeight;
> StrDrawTransform.Width := DstWidth;
> //
> if ( SrcGraphic.ImageFormat <>
>DstGraphic.ImageFormat ) then
> begin
> StrDrawTransform.OverrideDestFormat := True;
> StrDrawTransform.DestFormat :=
>DstGraphic.ImageFormat;
> end;
> StrDrawTransform.ApplyOnDest( SrcGraphic,
>DstGraphic);
> finally
> StrDrawTransform.Free;
> end;
>end;
>
>//-----------------------------------------------------
>procedure TForm1.button_LoadClick(Sender: TObject);
>begin
> (Sender as TButton).Enabled := False;
> DIBGraphic.LoadFromFile('c:\girl.jpg');
> // loads ok, I can do a SaveToFile here and check it
>with an imageeditor
>end;
>
>//-----------------------------------------------------
>procedure TForm1.button_StretchDrawClick(Sender:
>TObject);
>begin
> (Sender as TButton).Enabled := False;
> StretchDraw( DIBGraphic, imagescrollbox.Graphic,
>imagescrollbox.Width, imagescrollbox.Height);
> imagescrollbox.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.