delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/02/04:15:50

From: Walter Luke <NightWatchman AT Sacrilege DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro, Bitmaps, and Palettes
Date: Fri, 02 Jan 1998 04:03:09 -0500
Organization: http://shadows.sacrilege.com
Lines: 28
Message-ID: <68iaj1$f64@bgtnsc03.worldnet.att.net>
Reply-To: NightWatchman AT Sacrilege DOT com
NNTP-Posting-Host: 12.68.12.188
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

   I'm experimenting with reading 256 color bitmaps from disk and
displaying them on the screen using Allegro. The problem is that the
colors come out wrong, which I assume could only be because the palette
is wrong. If this is true, then allegro must not automatically set the
palette to whatever is appropriate for that image, which kind of
surprises me...But anyway... I would greatly appreciate it if someone
could fill me in on how to set the correct palette for a given bitmap
(e.g. how to create a variable of type PALETTE from the bitmap).

Just to make sure my problem isn't something completely different, I'm
including the source code below. I get the same
result when I use a datafile.

#include <allegro.h>

BITMAP *thing;
PALETTE pte;

main () {

  set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0);

  thing = load_bmp("rose.bmp", pte);

  blit(thing, screen, 1, 1, 1, 1, 100, 100);

}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019