home *** CD-ROM | disk | FTP | other *** search
- { GifUtl.pas - (c)Copyright 1993 Sean Wenzel
- Users are given the right to use/modify and distribute this source code as
- long as credit is given where due. I would also ask that anyone who makes
- use of this source/program drop me a line at my CompuServe address of
- 71736,1245. Just curious...
-
- The unit was written using Borland Pascal v7.0 but I think it should work
- with Turbo Pascal down to 5.5 at the most (or least?).
- This unit has only been tested on my system - an Everex Tempo 386DX
- with its built in SVGA adapter. If anyone finds/fixes any bugs please
- let me know. (Feel free to send a copy of any code too)
- I have also only tested 3 or 4 256,16, and 2 color interlaced and non-
- interlaced images. (was enough for my needs)
-
-
- Some of the code is very loosely based on DECODER.C (availble online)
- so credit should be given to Steven A. Bennett and Steve Wilhite
-
- The unit is set up to use BGI256.BGI (inlcuded) which is available on CIS
- in the BPASCAL forum library. The graphics initialization tries to start
- up in 640 by 480 mode. If an error occurs it'll go down to 320x200
- automatically (well - it should). For higher res modes change the variable
- GraphMode in the InitGraphics procedure to 3 for 800x600 and 4 for 1024x768.
-
- A sample program (GIF.PAS) is provided to demostrate the use of this unit.
- Basically declare a pointer to the TGIF object then initialize it using a
- line such as TheGif := New(PGif, Init('agif')); You can then check
- TheGif^.Status for any errors and/or view the GIF headers and ColorTables.
- To switch to Graphics mode and show the GIF image use TheGif^.Decode(True)
- True tells it to beep when done(or boop if some sort of error occured).
- When finished use Dispose(TheGif, Done) to switch back to textmode and get
- rid of the object.
-
-
- If anyone cares to speed up the image decoding I'd suggest writing
- TGIF.NextCode in assembler. The routine is the most heavily called in the
- unit while decoding and on my sytem took up about 5 seconds out of 12 when
- I profiled it. (send me a copy if you can)
-
- I have practically commented every line so that the source should be very
- readable and easy to follow. Great for learning about GIF's and LZW
- decompression.
-
-
- Any problems or suggestions drop me a line
-
- Good luck...
- -Sean
-
- (almost forgot)
- "The Graphics Interchange Format(c) is the Copyright property of
- CompuServe Incorporated. GIF(sm) is a Service Mark property of
- CompuServe Incorporated."
-
- }
- program Gif;
-
- uses GifUnit, CRT, Dos;
-
- var
- A: string;
- ElGif: PGif;
- Horas, Minutos, Segundos, Sec100: word;
- H, M, S, S100: word;
- begin
- D := 0; (* Determina que se va usar el VGA256.BGI *)
- M := 1; (* Modo Gráfico *)
- Writeln;
- TextColor(15);
- Writeln('VERGIF Versión 1.00 para DOS');
- Writeln('Shareware 1993 David Carrero Fernández-Baillo');
- TextColor(7);
- Writeln;
- Writeln('Ejemplo para usar librería GIFUNIT.PAS');
- Writeln('Este Ejemplo requiere VGA256.BGI');
- Writeln('');
-
- if ParamCount <> 1 then
- begin
- Writeln('uso: C:>gif <nombregif>[.gif] a ejecutar...');
- Exit;
- end;
- ElGif := New(PGif, Init(paramstr(1)));
-
- GetTime(Horas, Minutos, Segundos, Sec100);
- ElGif^.Decode(True);
- GetTime(H, M, S, S100);
- Readln(A);
- Dispose(ElGif, Done);
-
- Writeln('Comienzo : ',Horas,':',Minutos,':',Segundos,':',Sec100);
- Writeln('Terminado: ',H,':',M,':',S,':',S100);
- while not(KeyPressed) do;
-
- Writeln('"Este formato gráfico es Copyright del propietario');
- Writeln('CompuServe Incorporated. GIF(sm) es propiedad de');
- Writeln('CompuServe Incorporated."');
- Writeln('Créditos:');
- Writeln('Esta Librería es (c)Copyright 1993 Sean Wenzel');
- Writeln('Users are given the right to use/modify and distribute this');
- Writeln('source code as long as credit is given where due.');
- Writeln('Ver principio de VERGIF.PAS.');
-
- end.