Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

converting .bmp for use in putimage() in Borland C++ BGI

161 views
Skip to first unread message

Mark Ottensmeyer

unread,
Mar 2, 1998, 3:00:00 AM3/2/98
to

Hi,
I'm trying to figure out how to load a bitmap (or other image format)
into a c program I'm writing, so that I can draw it on the screen with
the Borland Graphics Interface (BGI) function putimage(). By the looks
of things, the format taken up by getimage() isn't .gif, .bmp, .pbm,
.ppm, or any other one I've tested.
If you have a function or code snippet that does this, or something
similar, I'd really appreciate finding out how you did it.

thanks very much,
Mark

Leonardo Serni

unread,
Mar 7, 1998, 3:00:00 AM3/7/98
to

Mark Ottensmeyer <can...@ai.mit.edu> wrote:

> I'm trying to figure out how to load a bitmap (or other image format)
>into a c program I'm writing, so that I can draw it on the screen with
>the Borland Graphics Interface (BGI) function putimage(). By the looks
>of things, the format taken up by getimage() isn't .gif, .bmp, .pbm,
>.ppm, or any other one I've tested.

If I remember correctly, the getimage() format is a .BMP equivalent
where the first two words represent height and width.

Try getimaging() ;-) a rectangle, 300 x 200, then look at the first
data bytes with a hex editor. They should read "300 200" in hex.

Then, the image is not RGB type (say), it is organized in layers. A
chunk of all "red" bits, so that each byte is actually eight pixels
(0 or 1 if the pixel has a red component), then green, then blue.

This is not "exactly" how it is; the bit planes are 4, or 8, not 3.

Some BGIs in 256 color mode use the packed format, which is easier,
and is identical to a .BMP, except for header, reversing, and DWORD
alignment. You have two words with image size then the first row of
pixels and on to the last row, one after another, each byte a pixel
(or rather, each byte the palette index of the pixel). Palette info
is never saved.

Leonardo


".signature": bad command or file name

Stephan Weinberger

unread,
Mar 8, 1998, 3:00:00 AM3/8/98
to

> Hi,
hooooooooooooo (Disney)

> I'm trying to figure out how to load a bitmap (or other image format)
> into a c program I'm writing, so that I can draw it on the screen with
> the Borland Graphics Interface (BGI) function putimage(). By the looks
> of things, the format taken up by getimage() isn't .gif, .bmp, .pbm,
> .ppm, or any other one I've tested.

No, it's plain VGA-Memory-Data-Format.

> If you have a function or code snippet that does this, or something
> similar, I'd really appreciate finding out how you did it.

1. forget BGI, these drivers are damn slow..... try to get ANY
Graphics-TPU it will work a lot faster. Some of these TPUs support BMP,
GIF or an other format too.
2. if you really want to do it with BGI the simpliest way would be to
load the Graphics by yourself (e.g. BMP is rather simple), display it on
the screen an then store it with getimage().

> thanks very much,
> Mark

--
CU e-Mail: we...@sbox.tu-graz.ac.at
STEPHAN Fido: Stephan Weinberger@2:316/5.9
www: http://www.sbox.tu-graz.ac.at/home/weini

0 new messages