delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/18/10:20:22

Message-Id: <199811181519.PAA15302@remus.clara.net>
From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: Coding problems from an extreme C newbie...
Date: Wed, 18 Nov 1998 15:18:44 -0000
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <36523fe9.208662@news.flash.net>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

> >Or you suddenly find that you should have put an & in front etc.
> >
> >Happens to the best of us :-(
>
> Hehe..
>
> Okay, one quick q: I'm messing around with data files.  After about 3
> hours and a couple taunts at my monitor, I finally got a font imported
> and displayed on the screen.  The only prob now is I need to get a
> palette displayed from a datafile.  I tried a few things myself, none
> of which worked.  Then I looked at the demo.c source in
> allegro/demo... yeesh...scary stuff..  I still couldn't get it to load
> a pelette.  What am I doing wrong here?

Ahh yes. This problem occurs regularly every month or so on the Allegro
Mailing List. You see, a datafile stores an image as a BITMAP structure.
This allows you to use it like this:

bitmap = (BITMAP*)data[IMAGE].dat;

But has the disadvantage of not storing the palette with the image. If you
click on "New..." in the grabber Edit menu, you'll see an entry to create a
palette. If you right-click on the palette entry you can grab it from a
bitmap. You can save this and use something like:

set_palette((PALETTE)data[PALETTE].dat);

(I think).

James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819


- Raw text -


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