Board index » delphi » displaying gifs and/or jpgs

displaying gifs and/or jpgs

does anyone know how to display pictures on pascal?  is it even possible?
JEn
 

Re:displaying gifs and/or jpgs


yes it is possible.

look in the online help for the command initgraph.
it's in the graph unit.

once you have initialised the graphics system
you can set pixels for each pixel in the image.

starting with bitmaps is a good way to go for just displaying images as
jpegs and gif require decoding.

check out www.wotsit.org for image file formats.

if you are not using borland/turbo pascal you might have to use inline
assembler to initialise
the graphics system.

heres some demo code i can't remember the bgi stuff so have used assembler
to initialise
the graphics card but using the bgi/graph unit would be easier as using
higher resolutions and colour depths requires learning vesa(easy) and
switching banks(also easy but takes some time to learn).

program display;

procedure initialisePallette
begin
{ initialize to vga cards pallette so it is the same as the images }
{ require writing to ports on the graphics card see ralph browns interrupt
list if you are
interested. also vgadoc is worth looking at.}
end;

function getimagepixel(x:byte;y:byte):byte
begin
{  get pixel from image and return it}
end;

type scrArray = array[0..63999];

var p:^scrArray;
x:byte;
y:byte;

begin
  asm
    mov ax,$113;   { mode $13 (320x200x 256col }
    int $10;      { get card to set mode}
  end;
  initialisePallette;
  p := ptr($a000:0000); { point to graphics card bank}
  for y := 0 to 319 do
    for x := 0 to 199 do
     p^[y*320+x] := getimagepixel(x,y);
  readkey;
  asm
    mov ax,$03;  { text mode 80x25}
    int $10;    {get card to set mode }
  end;
end;

Bevyn

Jen *smiles* =T <smil...@home.com> wrote in article
<z1Wr6.51804$x27.3428...@news1.rdc2.on.home.com>...

Quote
> does anyone know how to display pictures on pascal?  is it even possible?
> JEn

Re:displaying gifs and/or jpgs


i think you can display a bitmap, im not entirely sure, but i think you can
display a picture format which is uncommon, i think it is .pix or something?
i saw it in a simple pascal game once, so i take it can be done!
Quote
Jen *smiles* =T wrote in message ...
>does anyone know how to display pictures on pascal?  is it even possible?
>JEn

Other Threads