Re: fast drawing in delphi
- From: "Maldona8" <maldona8@xxxxxxxxxxxx>
- Date: Tue, 20 Dec 2005 16:47:28 +0100
OK Bjørge,
here is the code I use for a simply 10x10 map
Please modify it so it can make use of the
off-screen bitmap with BitBlt functions?
procedure TForm1.Button1Click(Sender: TObject);
const
CellSizeX = 12;
CellSizeY = 12;
var
x0,y0,i,j : integer;
xPoints : array[0..5] of TPoint;
xD : integer;
begin
With Image1.canvas do
begin
xD := (CellSizeY div 4)*3;
For i:=0 to 9 do
begin
For j:=0 to 9 do
begin
x0:=i;
y0:=j;
if (round(y0) mod 2)=0 then
x0:= x0*CellSizeX
else
x0:= x0*CellSizeX + (CellSizeX div 2);
y0 := round(y0*xD);
xPoints[0].x := round(x0+CellSizeX div 2);
xPoints[0].y := round(y0);
xPoints[1].x := round(x0+CellSizeX);
xPoints[1].y := round(y0+CellSizeY div 4);
xPoints[2].x := round(x0+CellSizeX);
xPoints[2].y := round(y0+xD);
xPoints[3].x := round(x0+CellSizeX div 2);
xPoints[3].y := round(y0+CellSizeY);
xPoints[4].x := round(x0);
xPoints[4].y := round(y0+xD);
xPoints[5].x := round(x0);
xPoints[5].y := round(y0+CellSizeY div 4);
Polygon(xPoints);
inc(y0);
end;
end;
end;
end;
Thanks for your help!!!
Ronald
"Bjørge" <bjorge@xxxxxxxxxxxxxxx> a écrit dans le message de news:
U-idnYjnFMDh7zveRVnzvA@xxxxxxxxxxxxxx
> Maldona8 wrote:
>> Looking for algorithms, source codes for fast drawing routines in
>> Delphi I have a hexagonal grid of 100x100 hexagons, each hexagon
>> having its own color.
>> I need to draw this map in a very very fast way, the faster possible.
>> What Delphi technology would you recommend to do this job?
>> Thanks in advance for your help!
>
> No matter what you do, don't do a large number of point/draw operatrions
> onto a visible canvas. Do rather create an invisible ("off-screen")
> bitmap,
> do all painting on this one, and copy the entire image onto the visibla
> canvas by BitBlt() WinAPI. This is\t as magic as e.g. DirectX, but it
> speeds
> up painting substantially.
> --
> Bjørge
> bjorge@xxxxxxxxxxxx
>
>
.
- Follow-Ups:
- Re: fast drawing in delphi
- From: Bjorge Sæther
- Re: fast drawing in delphi
- References:
- fast drawing in delphi
- From: Maldona8
- Re: fast drawing in delphi
- From: Bjørge
- fast drawing in delphi
- Prev by Date: Re: fast drawing in delphi
- Next by Date: Re: fast drawing in delphi
- Previous by thread: Re: fast drawing in delphi
- Next by thread: Re: fast drawing in delphi
- Index(es):