delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/17/23:11:31

Message-ID: <379144D0.18D06DB9@vetec.com>
Date: Sat, 17 Jul 1999 22:06:56 -0500
From: Andy Goth <andygoth AT vetec DOT com>
X-Mailer: Mozilla 4.61 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Whats up with the pink?
References: <7mo6hn$o8i$1 AT autumn DOT news DOT rcn DOT net>
Reply-To: djgpp AT delorie DOT com

> I'm trying to make a quick application that uses Allegro.  I made it and the
> only problem is the background is that bright pink used for transparency.

Bright pink doesn't have to be your background color!  Use it only to
make "holes" in images.  Whenever you draw one of these images using a
masked copy function, then these holes will be skipped over.

> How do i make the background black or another color other than pink? here is
> the code:
> 
> #include <iostream.h>
> #include "allegro.h"
> 
> //Availible Res: 300x200, 640x480, 800x600, 1024x768, 1152x864
> 
> #define WIDTH 640
> #define HEIGHT 480
> #define PIC1 "omega.bmp"
> #define SND1 "test.wav"
> 
> int main()
> {
> 
>  SAMPLE *sound1;
>  BITMAP *allegro;
>  PALLETE pal;
> 
>  allegro_init();
>  install_keyboard();
>  set_gfx_mode(GFX_AUTODETECT, WIDTH, HEIGHT, 0, 0);
>  install_sound (DIGI_AUTODETECT, MIDI_AUTODETECT, NULL);
> 
>     // Load Bitmap Into Memory
>  allegro = load_bitmap(PIC1, pal);
>  set_palette(pal);
> 
>  //Display Bitmap
>  blit(allegro, screen, 0, 0, 0, 0, WIDTH, HEIGHT);

First off, are you sure that "allegro" is WIDTH wide and HEIGHT tall? 
You should use a stretch_blit to make sure that it's the right size.

Second, you don't even have to worry about using magic pink in "allegro"
since it won't be drawn using masked_blit or draw_sprite.
 
>  //Play Scary Music
>  sound1 = load_sample( SND1 );
> 
>  readkey();
>  play_sample(sound1, 255, 128, 1000, 0);
>  fade_out(1);
>  stop_sample(sound1);
>  destroy_bitmap(allegro);
> 
>  return 0;
> }

-- 
  ___  _   _ ____  _   _
 / _ \| \ | |  _ \\ \_/ / .--------[ ICQ#: 35256413 ]--------.
| |_| |  \| | | | |\   /  | 01001000011001010110110001101100 |
|  _  | \ \ | | | | | |   | 01101111001011000010000001110111 |
| | | | |\  | |_| | | |   | 01101111011100100110110001100100 |
|_| |_|_| \_|____/  |_|   `--[ mailto:andygoth AT vetec DOT com ]---'
<http://zap.to/andygoth/>           <http://andygoth.cjb.net/>

- Raw text -


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