www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/10/16:39:38

From: "Damian Yerrick" <web DOT poison AT pineight DOT 8m DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: bmp question
Date: Sun, 10 Oct 1999 12:16:23 -0500
Organization: Rose-Hulman Institute of Technology
Lines: 75
Message-ID: <7tqhoo$mou$1@solomon.cs.rose-hulman.edu>
References: <37FD87FA DOT 26D2C261 AT infoave DOT net>
NNTP-Posting-Host: yerricde.laptop.rose-hulman.edu
X-Trace: solomon.cs.rose-hulman.edu 939575896 23326 137.112.205.146 (10 Oct 1999 17:18:16 GMT)
X-Complaints-To: news AT cs DOT rose-hulman DOT edu
NNTP-Posting-Date: 10 Oct 1999 17:18:16 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

James <jpendarvis AT infoave DOT net> wrote in message
news:37FD87FA DOT 26D2C261 AT infoave DOT net...
> Hi all. I made a simple bmp routine for practice (I am using Allegro)
> and the image displayed during the program is not showing the same
> colors as the image I saved. I saved the bmp file in paint shop pro and
> used these lines:
>
> set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
> set_pallete(desktop_pallete);
>
> Are there any suggested bmp editors that may help or is there something
> that I am doing wrong in saving the file? Thanks for any help.

You're setting the palette to the Atari palette not the image's
palette. You should be setting the palette to the palette you
got when you loaded the picture.


This is the C source file to load and display a bitmap,
specifically your startup logo. Feel free to change it.

>8 >8 >8

/* FakeRestart.c for DJGPP and Allegro*/

#include <allegro.h>

/* in your program, you'll want to delete these two lists */

BEGIN_GFX_DRIVER_LIST
  GFX_DRIVER_MODEX
END_GFX_DRIVER_LIST

BEGIN_COLOR_DEPTH_LIST
  COLOR_DEPTH_8
END_COLOR_DEPTH_LIST

/* these just keep the executable size down because
 * this is a noddy program to fool newbies into thinking
 * their computer has restarted */

int main(void)
{
  BITMAP *bmp;
  PALETTE pal;

  allegro_init();
  install_keyboard();
  if(set_gfx_mode(GFX_AUTODETECT, 320, 400, 0, 0) < 0)
  {
    exit(105);
  }

  bmp = load_bmp("C:\\logo.sys", pal);
  if(bmp == NULL)
  {
    exit(69);
  }

  clear(screen);
  blit(bmp, screen, 0, 0, 0, 0, 320, 400);
  set_palette(pal);
  readkey();

  destroy_bitmap(bmp);
  return 0;
}


This code has been tested and approved by
Damian Yerrick
http://come.to/yerrick


- Raw text -


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