Mail Archives: djgpp/2001/06/18/15:00:40
From: | "Lionel Brits" <britsc AT cadvision DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: graphics question
|
Date: | Mon, 18 Jun 2001 12:55:48 -0600
|
Organization: | CADVision/PSINet
|
Lines: | 34
|
Message-ID: | <9gliss$q69$1@news3.cadvision.com>
|
References: | <nruaitgdch26oudmdtd5vdn28c0ct7mabu AT 4ax DOT com>
|
NNTP-Posting-Host: | h-207-148-141-121.dial.cadvision.com
|
X-Trace: | news3.cadvision.com 992890589 26825 207.148.141.121 (18 Jun 2001 18:56:29 GMT)
|
X-Complaints-To: | news AT cadvision DOT com
|
NNTP-Posting-Date: | Mon, 18 Jun 2001 18:56:29 +0000 (UTC)
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 6.00.2462.0000
|
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2462.0000
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi,
You have
const byte BIT[200] = {0, 0, 2, 3, 4, 6, 0, 0, ... }
If I understand you correctly, these numbers 0, 0, 2, 3, 4... are colours,
and don't represent 8 pixels as black or white bits. Now, images that are
stored as "bit maps" are just basic arrays of colours. They should actually
be called "byte maps", as most implimentations use one or more bytes per
pixel. The technical term is "raster image".
A program such as Microsoft Paint stores a 256-color image with resolution X
by Y as an array with X*Y elements. You can therefore read a .bmp file from
disk into an array and then display this array. The important part is
determining the characteristics of the image, which is stored in the file's
header.
You can find information on the .bmp format on www.wotsit.org.
Another format which is more commonly used is the targa .TGA format. It is
used because of its simplicity.
Finally, I don't think there is any sense in reinventing the wheel, though I
do recommend you try writing a program that displays a bmp file as an
execise. In the long run, it would be more effective to use a free library
such as OpenIL (www.openil.org / www.imagelib.org) since it is much more
powerful and will allow you time to work on other things.
HTH,
- Lionel Brits
- Raw text -