Board index » delphi » How do I display Gif or PCX files

How do I display Gif or PCX files

I am making a project for school and I have a nice give for opening
the program, but I don'w know how to display them in TP or BP 7.0.

Please help me,

email MAR...@PI.NET

 

Re:How do I display Gif or PCX files


In article <4b75st$...@neptunus.pi.net>, mar...@pi.net says...

Quote

>I am making a project for school and I have a nice give for opening
>the program, but I don'w know how to display them in TP or BP 7.0.

>Please help me,

>email MAR...@PI.NET

        This source code/explanation was posted some time ago, by the person,
"TayX", (their EMail address is at the bottom).  Hope it helps!

                                        Jeff

Posted awhile ago:

read in a 128 byte header of the following type :

type header_type = record
       manufacturer, {this is always 10}
       version, {0 - ver 2.5 paintbrush, 2 - ver 2.8 with palette,
                 3 - ver 2.8 use default palette, 5 - ver 3.0 or better of
                 paintbrush}
       encoding, {this is always 1; RLE encoding}
       bits_per_pixel : byte;   {number of bits per pixel}
       x,y,     {upper left corner of image}
       width,height, {the size of the image}
       horz_res, {number of pixels in the x direction}
       vert_res : integer; {number of pixels in the y direction}
       ega_palette : array[1..48] of byte; {the EGA palette}
       reserved, {nothing important}
       num_color_planes : byte; {number of planes in the image}
       bytes_per_line, {number of bytes per single horizontal line}
       palette_type : integer; {not important}
       padding : array[1..58] of byte; {extra stuff, not too important}
     end;

then read in the last 768 bytes of the file to obtain the palette(for a
256 color image), read in each color's red, green, and blue values
respectively....

start reading in bytes from the file starting with byte 129 and keep
reading until the total number of pixels drawn equals the size of the image

each time you read a byte do this :

check to see if the number is > 191.  if it is, subtract 192 from it and
your new number(for example 195-192=3) is the number of times the next
byte(color) repeats.  read the next byte and draw that color whatever
number of times is needed(remember to make sure you are incrementing the
row you are drawing to when necessary).  if the number is < 192, then
draw a pixel in that color once.

hope that helps

  TayX
slut...@ccnet.com

Other Threads