delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/25/02:23:00

Message-Id: <01BD87B6.A44AB900@secp6071.mlg.cit.alcatel.es>
From: =?iso-8859-1?Q?Diego_Dom=EDnguez_Cazorla?=
<ddomingu AT mlg DOT cit DOT alcatel DOT es>
To: "'djgpp'" <djgpp AT delorie DOT com>
Subject: Transparent pixel in mouse pointer (16bit color mode)
Date: Mon, 25 May 1998 08:25:11 +-300
Mime-Version: 1.0

Hello, again!!!

	I posted a question about How to make a pointer with transparent pixels in 16 bit color mode, some days ago, but got NO answer!?!. I swear I have tried everything my little brain gives out, but always get to similar results: a solid color (mostly BLUE!!!).

I'm using cool ALLEGRO 3.0 and BGUI (an extension to make allegro controls more similar to WIN95).

I tried to do it with the RGB bright_pink={255,0,255} but it is showed as BLUE!!! By the way, why do I have to (and how) use palettes in >256 color modes???

Thanx in advance. (And please? say something? even if you aren't sure about it, maybe it helps!!!).

	(I have appended at the end my code related with this stuff to see if that helps you in helping me)


	==> Diego Domínguez <==			ddomingu AT cit DOT alcatel DOT es





	*************************************************************************************
					    CODE
	*************************************************************************************

BITMAP * mouse_busy;
#define p0 3			// shape of the pointer
#define p1 1
#define p2 2
char mouse_busy_char[256]=
{
 p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,
......................
 p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2,p2
};


int main()
{
 char color;
 RGB brigth_pink = {255, 0, 255};

 allegro_init();		// magic starts
???..
 
 set_color_conversion(COLORCONV_TOTAL);
 set_color_depth(16);

 set_gfx_mode(GFX_AUTODETECT, SCR_W, SCR_H, 0, 0);	//  640 X 480 (X 65536colors)

 bill_init();
 bill_init_pal();	// initialize palette

 clear_to_color(screen, 0);
 set_gui_mode(TRUE);		// to make controls more similar to WIN95
....
 mouse_busy = create_bitmap(16,16);

drawing_mode(DRAW_MODE_MASKED_PATTERN, mouse_busy, 0, 0);  // to allow transparent 
    //pixels

 for (i=0; i<16; i++){	// taken from an BGUI example
    for (j=0; j<16; j++){
     	switch(mouse_busy_char[i+16*j]){
       		case 1:  color=255; break;
  		case 2:  color=0; break;
       		default: color=get_billcolor(bright_pink);break;	// also tried with makecol16(255, 0, 255);
      	}
      	putpixel(mouse_busy, i, j, color);
    }
 }

 do_dialog(main_window, 0);
/* and in do_dialog  I do:
 show_mouse(NULL);
 set_mouse_sprite(mouse_busy);
 show_mouse(screen);
 */
 return(0);
}

- Raw text -


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