Quote
L. Cleven wrote in message <34de0b2...@news.total.net>...
>Hello,
>Does anyone know how to take a VESA screen shot? Im making a game
>(available at www.total.net/~lcleven) and want to take a screen shot of it
>so i can put it up on my page. Any ideas on how to do this? Thanx for
Most decent image-processors these days support RAW-image loading (including
Paint Shop Pro) so it is very easy to take a screenshot without worrying
about saving to a complicated format... To save a 24-bit RAW file, simply
use this procedure (it's not the fastest, but it works and is quite easy to
understand). The procedure below will work for VESA units that support
"Getpixel" and "GetRGBPalette" (if your VESA unit has other names, simply
change these). This specifies top-left and bottom-right coordinates to grab
from. (Origin: 0,0).
Procedure ScreenGrab(SX,SY,EX,EY: word; FileName: string);
Const BufSize = 3000;
Var
R,G,B,Q : byte;
X,Y,BufUsed : word;
Buf : Array[1..BufSize] of byte;
F : file;
Done,BufFull : boolean;
Begin
Assign(F,Filename);
Rewrite(F,1);
Done:=False;
R:=0; G:=0; B:=0;
Y:=SY; X:=SX;
Repeat
BufUsed:=1; BufFull:=False;
Repeat
Q:=Getpixel(X,Y);
GetRGBPalette(Q,R,G,B);
R:=R*4; G:=G*4; B:=B*4;
Buf[BufUsed]:=R;
Buf[BufUsed+1]:=G;
Buf[BufUsed+2]:=B;
Inc(BufUsed,3);
Inc(X);
If X>EX Then Begin X:=SX; Inc(Y); End;
If Y>EY Then Done:=True;
If BufUsed>BufSize-3 Then BufFull:=True;
Until (BufFull)or(Done);
{*** Delay(10);}
BlockWrite(F,Buf,BufUsed-1);
Until Done;
Close(F);
End;
If some pixels are shown the wrong colour, uncomment the "Delay". Some gfx
cards (such as my ViRGE) are affected by this, for some reason. Increasing
the size of the buffer may speed it up a little...
Note that when loading it into your image processor, you will have to
specify the following parameters: (E.G. In Paint Shop Pro)
Width: (the width of the picture you grabbed)
Height: (the height of the picture you grabbed)
Colour Channels: Three Channel (RGB)
Header Size: 0 Bytes
Interleaved - RGB RGB RGB (as opposed to RRR GGG BBB)
Order - RGB (as opposed to BGR)
--
Lors, Paradice Softare
Christchurch, New Zealand
parad...@thevortex.com
http://www.fortunecity.com/underworld/mdk/81/
Creators of the cool new graphical RPG, Howl From Beyond.
Take the creature-creation competition!
P.S. Don't blame me for the sloppy code - I wrote it a couple of months ago,
when I had never heard of pointers, and this was my first ever usage of
Pascal arrays...