PDA

View Full Version : zoom



anubis79
13-10-2003, 05:28 PM
1) I'm working on a zoom effect. My code is like that:

var
Form1: TForm1;
BitmapX: TBitmap;

implementation

procedure TForm1.DXDraw1Initialize(Sender: TObject);
begin
MySurface:=TDirectDrawSurface.Create(Dxdraw1.DDraw );
BitmapX := TBitmap.Create;
BitmapX.Width := 25;
BitmapX.Height := 25;
BitmapX.Canvas.LineTo(25,25);
MySurface.LoadFromGraphic(BitmapX);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
DXDraw1.Surface.StretchDraw(DXDraw1.ClientRect, MySurface.ClientRect, MySurface, False);
DXDraw1.Flip;
end;

procedure TForm1.DXDraw1Finalize(Sender: TObject);
begin
MySurface.Free;
end;

end.


Also ;
I'm working on windowed mode.
DXDraw1.Width := 500;
DXDraw1.Height := 500;
doSystemMemory := False;
doStretch := True;
doHardware := False;

When I compile the code and click Button1 MySurface and its BitmapX is on the screen but the effect is quite blur (not clear). I can say that the effect is like anti-aliasing. I'd like to view it clearly. I want an aliasing effect for zooming. However, I've only changed doSystemMemory option to True and compile it. It was so clear. But as you know using SystemMemory is slow down the game too much. Do you think blur effect's for using VideoMemory? My Video Card is NVidia TNT2 M64 32MB.
May be it supports automatic anti-aliasing. I don't know but I need to use VideoMemory and have a clear effect on DXDraw1 component. Can you give me an advice? (I think doStretch and doHardware are not an effective options for this matter.)

2) While doStretch option was True instead of StretchDraw I tried Draw procedure:

DXDraw1.Surface.Draw(0, 0, MySurface.ClientRect, MySurface, False);

It didn't work. Stretch was unsuccessful. If Delphi's TImage component stertch property is True and if image(or Bitmap) is smaller than TImage, image is stretched automatically. DoStretch and TImage stretch concepts are different. How can I see the benefits of doStretch and use it ? There must be a way :D to see its effect. Can you help me?