delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/26/06:45:33

From: "Alan McFarlane" <amcfarlane AT bigfoot DOT com>
Subject: Converting TrueColor images
Date: Wed, 25 Feb 1998 08:59:00 -0000
Lines: 32
Message-ID: <#wHA9JlQ9GA.90@nih2naac.prod2.compuserve.com>
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Okay guys,

I'm in the process of writing a game - no, don't laugh - using djgpp and
allegro. The graphics have been created using povray, and are currently
saved as 24bit truecolor images.

Now the problem is, how do I display these images - some overlaying others -
in 8 bit color mode without trashing the images?

Example:

    ...
    BITMAP *bmp1,*bmp2;
    RGB pal1[256],pal2[256];
    set_color_depth(8);
    set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
    bmp1=load_bitmap("640x480.bmp", pal1);
    set_palette(pal);
    blit(bmp1, screen, 0, 0, 0, 0, 640, 480);
    bmp2 = load_bitmap(100x32.bmp",pal2);
    blit(bmp2, screen, 0, 0, 50, 50, 100, 32);                //    now I've
realy buggered up the colors of bmp2!
    ...

I understand that I may have to convert all my 24 bit truecolor targas to
use a common palette - say netscapes "universal" palette cube, but how? - I
certainly ain't doing it by hand!

Ta



- Raw text -


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