Esempio n. 1
0
void init_palette(void)
{
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	/*  0:崟 */
		0xff, 0x00, 0x00,	/*  1:柧傞偄愒 */
		0x00, 0xff, 0x00,	/*  2:柧傞偄椢 */
		0xff, 0xff, 0x00,	/*  3:柧傞偄墿怓 */
		0x00, 0x00, 0xff,	/*  4:柧傞偄惵 */
		0xff, 0x00, 0xff,	/*  5:柧傞偄巼 */
		0x00, 0xff, 0xff,	/*  6:柧傞偄悈怓 */
		0xff, 0xff, 0xff,	/*  7:敀 */
		0xc6, 0xc6, 0xc6,	/*  8:柧傞偄奃怓 */
		0x84, 0x00, 0x00,	/*  9:埫偄愒 */
		0x00, 0x84, 0x00,	/* 10:埫偄椢 */
		0x84, 0x84, 0x00,	/* 11:埫偄墿怓 */
		0x00, 0x00, 0x84,	/* 12:埫偄惵 */
		0x84, 0x00, 0x84,	/* 13:埫偄巼 */
		0x00, 0x84, 0x84,	/* 14:埫偄悈怓 */
		0x84, 0x84, 0x84	/* 15:埫偄奃怓 */
	};
	unsigned char table2[216 * 3];
	int r, g, b;
	set_palette(0, 15, table_rgb);
	for (b = 0; b < 6; b++) {
		for (g = 0; g < 6; g++) {
			for (r = 0; r < 6; r++) {
				table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;
				table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;
				table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;
			}
		}
	}
	set_palette(16, 231, table2);
	return;
}
Esempio n. 2
0
File: graphic.c Progetto: barmi/bxos
void init_palette(void)
{
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	/*  0:흑 */
		0xff, 0x00, 0x00,	/*  1:밝은 빨강 */
		0x00, 0xff, 0x00,	/*  2:밝은 초록 */
		0xff, 0xff, 0x00,	/*  3:밝은 황색 */
		0x00, 0x00, 0xff,	/*  4:밝은 파랑 */
		0xff, 0x00, 0xff,	/*  5:밝은 보라색 */
		0x00, 0xff, 0xff,	/*  6:밝은 물색 */
		0xff, 0xff, 0xff,	/*  7:흰색 */
		0xc6, 0xc6, 0xc6,	/*  8:밝은 회색 */
		0x84, 0x00, 0x00,	/*  9:어두운 빨강 */
		0x00, 0x84, 0x00,	/* 10:어두운 초록 */
		0x84, 0x84, 0x00,	/* 11:어두운 황색 */
		0x00, 0x00, 0x84,	/* 12:어두운 파랑 */
		0x84, 0x00, 0x84,	/* 13:어두운 보라색 */
		0x00, 0x84, 0x84,	/* 14:어두운 물색 */
		0x84, 0x84, 0x84	/* 15:어두운 회색 */
	};
	unsigned char table2[216 * 3];
	int r, g, b;
	set_palette(0, 15, table_rgb);
	for (b = 0; b < 6; b++) {
		for (g = 0; g < 6; g++) {
			for (r = 0; r < 6; r++) {
				table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;
				table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;
				table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;
			}
		}
	}
	set_palette(16, 231, table2);
	return;
}
Esempio n. 3
0
void init_palette(void)
{
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	/*  0:黒 */
		0xff, 0x00, 0x00,	/*  1:明るい赤 */
		0x00, 0xff, 0x00,	/*  2:明るい緑 */
		0xff, 0xff, 0x00,	/*  3:明るい黄色 */
		0x00, 0x00, 0xff,	/*  4:明るい青 */
		0xff, 0x00, 0xff,	/*  5:明るい紫 */
		0x00, 0xff, 0xff,	/*  6:明るい水色 */
		0xff, 0xff, 0xff,	/*  7:白 */
		0xc6, 0xc6, 0xc6,	/*  8:明るい灰色 */
		0x84, 0x00, 0x00,	/*  9:暗い赤 */
		0x00, 0x84, 0x00,	/* 10:暗い緑 */
		0x84, 0x84, 0x00,	/* 11:暗い黄色 */
		0x00, 0x00, 0x84,	/* 12:暗い青 */
		0x84, 0x00, 0x84,	/* 13:暗い紫 */
		0x00, 0x84, 0x84,	/* 14:暗い水色 */
		0x84, 0x84, 0x84	/* 15:暗い灰色 */
	};
	unsigned char table2[216 * 3];
	int r, g, b;
	set_palette(0, 15, table_rgb);
	for (b = 0; b < 6; b++) {
		for (g = 0; g < 6; g++) {
			for (r = 0; r < 6; r++) {
				table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;
				table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;
				table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;
			}
		}
	}
	set_palette(16, 231, table2);
	return;
}
Esempio n. 4
0
/**
 * Renders the output of the logos handler's current game state.
 *
 * The drawing routines are all blocking, meaning one "frame" is enough
 * to fade all logos in and out.
 */
void logos_render(BITMAP *buffer) {
    // We're going to draw text on top of the image,
    // so add the text palette to the image.
    add_flim_palette_colors(LOGOS_DAT[ASLOGO_PALETTE].dat);

    // Display the main logo with text drawn on top.
    set_palette(black_palette);
    blit(LOGOS_DAT[ASLOGO_IMG].dat, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
    draw_text(screen, 160, 154, TXT_WHITE, -1, -1,
        TXT_REGULAR, TXT_CENTER, "(C) 2016, Avalanche Studios");
    draw_text(screen, 160, 154 + FLIM_HEIGHT + 2, TXT_WHITE, -1, -1,
        TXT_REGULAR, TXT_CENTER, "www.avalanchestudios.net");
    if (DEBUG) {
        draw_text(screen, 160, 154 + FLIM_HEIGHT + 18, TXT_GRAY, -1, -1,
            TXT_SMALL, TXT_CENTER, (char *)get_short_version());
    }
    fade_from(black_palette, LOGOS_DAT[ASLOGO_PALETTE].dat, FADE_SPEED);

    // Wait for any key, then draw the second logo.
    readkey();
    fade_out(FADE_SPEED);
    set_palette(black_palette);
    blit(LOGOS_DAT[TEST_IMG].dat, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
    fade_from(black_palette, LOGOS_DAT[TEST_PALETTE].dat, FADE_SPEED);

    // Wait for any key, then finish. This handler immediately exits
    // after running the logos_render() function once, so this code
    // is guaranteed to only run once.
    readkey();
    fade_out(FADE_SPEED);
}
Esempio n. 5
0
void main()
{
  BITMAP bmp;
  int i;

  load_bmp("mset.bmp",&bmp);          /* open the file */

  set_mode(VGA_256_COLOR_MODE);       /* set the video mode. */

  set_palette(bmp.palette);           /* set the palette */

  draw_bitmap(&bmp,                   /* draw the bitmap centered */
    (SCREEN_WIDTH-bmp.width) >>1,
    (SCREEN_HEIGHT-bmp.height) >>1);

  wait(25);

  for(i=0;i<510;i++)                  /* rotate the palette at 30hz */
  {
    wait_for_retrace();
    wait_for_retrace();
    rotate_palette(bmp.palette);
  }

  wait(25);

  free(bmp.data);                     /* free up memory used */

  set_mode(TEXT_MODE);                /* set the video mode back to
                                         text mode. */

  return;
}
Esempio n. 6
0
/* Pops a dialog asking for language. Returns -1 if no object was selected.
 * Else returns zero and writes in string the ID of the selected language.
 */
void select_language(void)
{
   int f = -1;
   const char *lang = "en"; /* default language */
   
   set_palette(desktop_palette);
   clear_bitmap(virtual_screen);
   stretch_virtual_screen();
   _retrieve_available_languages();

   if (!_num_available_languages) {
      //alert("No languages", "to choose from!", "Will use english", "Oh", 0, 'o', 0);
      goto finish;
   }

   while ((f = virtual_do_dialog(_select_lang_dialog, 0)) < 0);
   lang = _available_languages[_select_lang_dialog[0].d1*2];

   finish:
   TRACE("select_language: '%s'\n", lang);
   set_config_string("system", "language", lang);
   reload_config_texts(0);
   text_mode(-1);
   _free_available_languages();

   clear_bitmap(virtual_screen);
   stretch_virtual_screen();
}
Esempio n. 7
0
/*
	palette maps int and rgb color, we defined 16 colors, needs to be written to cpus
*/
void init_palette(void) 
{
	/* declaring static will make this table value bound to the file */
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	/* black 		*/
		0xff, 0x00, 0x00,	/* light red 	*/
		0x00, 0xff, 0x00,	/* light green 	*/
		0xff, 0xff, 0x00,	/* light yellow */
		0x00, 0x00, 0xff,	/* light blue 	*/
		0xff, 0x00, 0xff,	/* light purple */
		0x00, 0xff, 0xff,	/* light light blue */
		0xff, 0xff, 0xff,	/* white */
		0xc6, 0xc6, 0xc6, 	/* light grey */
		0x84, 0x00, 0x00, 	/* dark red */
		0x00, 0x84, 0x00,	/* dark green */
		0x84, 0x84, 0x00, 	/* dark yellow */
		0x00, 0x00, 0x84,	/* dark green-blue */
		0x84, 0x00, 0x84, 	/* dark purple */
		0x00, 0x84, 0x84, 	/* light dark blue */
		0x84, 0x84, 0x84	/* light grey */
	};
	
	set_palette(0, 15, table_rgb);
	return;
}
Esempio n. 8
0
static void fb_switch_signal_acq(void *data)
{
	struct vt_stat st;
	struct rect r;
	int rs;

	EINTRLOOP(rs, ioctl(TTY,VT_GETSTATE,&st));
	if (rs) return;
	if (st.v_active != fb_console) return;
	INC_IN_GR
	fb_active=1;
	EINTRLOOP(rs, ioctl(TTY,VT_RELDISP,VT_ACKACQ));
	/*
	 * There is a race condition in Linux NVidia framebuffer driver
	 * It still draws into a framebuffer here, so we have to sleep
	 */
	portable_sleep(10);
	if (have_cmap && current_virtual_device)
		set_palette(&global_pal);
	END_GR
	r.x1=0;
	r.y1=0;
	r.x2=fb_xsize;
	r.y2=fb_ysize;
	if (border_left | border_top | border_right | border_bottom) fb_clear_videoram();
	if (current_virtual_device) current_virtual_device->redraw_handler(current_virtual_device,&r);
}
Esempio n. 9
0
VNGError VngoDirect3D::reinit(Flx16 brightness)
{
    if (!pal)
        return VNGO_NOT_SUPPORTED;

    return set_palette(pal,brightness);
}
Esempio n. 10
0
Gobby::ColorSelectionDialog::
	ColorSelectionDialog(Config::ParentEntry& config_entry)
 : Gtk::ColorSelectionDialog(),
   m_config_entry(config_entry)
{
	set_palette(config_entry, *get_colorsel() );
}
int main() {
    
   /* initialize */
   if (allegro_init() != 0) {
      return 1;
   }
      
   install_keyboard(); 
   install_mouse();
   install_timer();
   
   if (set_gfx_mode(GFX_AUTODETECT, 340, 380, 0, 0) != 0) {
      if (set_gfx_mode(GFX_SAFE, 340, 380, 0, 0) != 0) {
	      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
	      allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
	      return 1;
      }
   }
   
   set_palette(default_palette); 

   /* run the dialog */
   do_dialog(color_builder, -1);

   return 0;
}
Esempio n. 12
0
/*
 * IOCTL entry point -- This method is called to carry
 * all services of this interface.
 */
rtems_device_driver frame_buffer_control(
  rtems_device_major_number  major,
  rtems_device_minor_number  minor,
  void                      *arg
)
{
  rtems_libio_ioctl_args_t *args = arg;

  printk( "FBVGA ioctl called, cmd=%x\n", args->command  );

  switch( args->command ) {
    case FBIOGET_FSCREENINFO:
      args->ioctl_return =  get_fix_screen_info( ( struct fb_fix_screeninfo * ) args->buffer );
      break;
    case FBIOGET_VSCREENINFO:
      args->ioctl_return =  get_var_screen_info( ( struct fb_var_screeninfo * ) args->buffer );
      break;
    case FBIOPUT_VSCREENINFO:
      /* not implemented yet*/
      args->ioctl_return = -1;
      return RTEMS_UNSATISFIED;
    case FBIOGETCMAP:
      args->ioctl_return =  get_palette( ( struct fb_cmap * ) args->buffer );
      break;
    case FBIOPUTCMAP:
      args->ioctl_return =  set_palette( ( struct fb_cmap * ) args->buffer );
      break;

    default:
     args->ioctl_return = 0;
     break;
  }
  return RTEMS_SUCCESSFUL;
}
static int
load_proc(void)
{
	char buffer[256], *p;
	BITMAP *bmp;
	PALETTE palette;

	if (file_select_ex("Load image", last_path, "bmp;pcx;lbm;tga;jpg;jpeg", 1024, (SCREEN_W * 2) / 3, (SCREEN_H * 2) / 3)) {
		bmp = load_jpg_ex(last_path, palette, progress_cb);
		if (!bmp)
			bmp = load_bitmap(last_path, palette);
		settings_dialog[PREVIEW].dp = bmp;
		if (!bmp) {
			sprintf(buffer, "Error loading image (JPG error code: %d)", jpgalleg_error);
			alert("", buffer, "", "Ok", NULL, 0, 0);
			return 0;
		}
		for (p = last_path + strlen(last_path); (p >= last_path) && (*p != '/') && (*p != '\\'); p--)
			;
		*(p + 1) = '\0';
		sx = sy = old_sx = old_sy = 0;
		set_palette(palette);
		popup_menu[1].flags = 0;
	}
	return 0;
}
Esempio n. 14
0
void init_palette(void)
{
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	
		0xff, 0x00, 0x00,	
		0x00, 0xff, 0x00,	
		0xff, 0xff, 0x00,	
		0x00, 0x00, 0xff,	
		0xff, 0x00, 0xff,	
		0x00, 0xff, 0xff,	
		0xff, 0xff, 0xff,	
		0xc6, 0xc6, 0xc6,	
		0x84, 0x00, 0x00,	
		0x00, 0x84, 0x00,	
		0x84, 0x84, 0x00,	
		0x00, 0x00, 0x84,	
		0x84, 0x00, 0x84,	
		0x00, 0x84, 0x84,	
		0x84, 0x84, 0x84	
	};
	set_palette(0, 15, table_rgb);
	return;

	
}
Esempio n. 15
0
void initialise_screen() {

   if (have_allegro_window) {
      set_gfx_mode(GFX_SAFE, 320, 200, 0, 0);
      set_palette(desktop_palette);

      acquire_screen();
      textout_centre(screen, font, "Type Here!!",
		     SCREEN_W/2, SCREEN_H/2-60, 255);
      textout(screen, font, "Ctrl-M: switch between comm ports",
	      0, SCREEN_H/2-32, 255);
      textout(screen, font, "Ctrl-B: send a half second break signal",
	      0, SCREEN_H/2-16, 255);
      textout(screen, font, "Ctrl-C: quit", 0, SCREEN_H/2, 255);
      textout(screen, font, "Other key presses sent to current port.",
	      0, SCREEN_H/2+16, 255);
      textout(screen, font, "Current port:", 0, SCREEN_H/2+40, 255);
      textout(screen, font, cur_port->szName,
	      SCREEN_W/2, SCREEN_H/2+40, 255);
      release_screen();
   }
   else {
      printf("Ctrl-M: switch between comm ports\n");
      printf("Ctrl-B: send a half second break signal\n");
      printf("Ctrl-C: quit\n");
      printf("Other key presses sent to current port.\n");
      printf("\nCurrent port: %s\n\n", cur_port->szName);
   }
}
Esempio n. 16
0
static void
nullterm_open(void)
{
#if OPT_COLOR
    int pass;
    int nc;
    char *value = 0;
    char temp[80];
    size_t need = 3;

    /*
     * The -F option needs a palette, in case we want to apply a color-scheme.
     */
    for (pass = 0; pass < 2; ++pass) {
	for (nc = 0; nc < ncolors; ++nc) {
	    sprintf(temp, (nc ? " %d" : "%d"), nc);
	    if (pass) {
		strcat(value, temp);
	    } else {
		need += strlen(temp);
	    }
	}
	if (pass) {
	    set_palette(value);
	    set_ctrans(value);
	    free(value);
	} else {
	    value = malloc(need);
	    if (value == 0)
		break;
	    *value = EOS;
	}
    }
#endif
}
Esempio n. 17
0
/* switch_in_fullscreen:
 *  Handles screen switched in.
 */
static void switch_in_fullscreen(void)
{
   restore_all_ddraw_surfaces();

   if (_color_depth == 8)
     set_palette(wddfull_saved_palette);
}
Esempio n. 18
0
void init_palette(void){
	//16种color,每个color三个字节。
	static unsigned char table_rgb[16*3]=
	{
		0x00,0x00,0x00,   /*0:black*/
		0xff,0x00,0x00,   /*1:light red*/ 
		0x00,0xff,0x00,   /*2:light green*/   
		0xff,0xff,0x00,   /*3:light yellow*/

		0x00,0x00,0xff,   /*4:light blue*/
		0xff,0x00,0xff,   /*5:light purper*/ 
		0x00,0xff,0xff,   /*6:light blue*/
		0xff,0xff,0xff,   /*7:white*/

		0xc6,0xc6,0xc6,   /*8:light gray*/
		0x84,0x00,0x00,   /*9:dark red*/
		0x00,0x84,0x00,   /*10:dark green*/ 
		0x84,0x84,0x00,   /*11:dark yellow*/

		0x00,0x00,0x84,   /*12:dark 青*/
		0x84,0x00,0x84,   /*13:dark purper*/
		0x00,0x84,0x84,   /*14:light blue*/
		0x84,0x84,0x84,   /*15:dark gray*/
	};  
	set_palette(0,15,table_rgb);
	return;
}
Esempio n. 19
0
void init_palette(void)
{
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	/*  0:崟 */
		0xff, 0x00, 0x00,	/*  1:柧傞偄愒 */
		0x00, 0xff, 0x00,	/*  2:柧傞偄椢 */
		0xff, 0xff, 0x00,	/*  3:柧傞偄墿怓 */
		0x00, 0x00, 0xff,	/*  4:柧傞偄惵 */
		0xff, 0x00, 0xff,	/*  5:柧傞偄巼 */
		0x00, 0xff, 0xff,	/*  6:柧傞偄悈怓 */
		0xff, 0xff, 0xff,	/*  7:敀 */
		0xc6, 0xc6, 0xc6,	/*  8:柧傞偄奃怓 */
		0x84, 0x00, 0x00,	/*  9:埫偄愒 */
		0x00, 0x84, 0x00,	/* 10:埫偄椢 */
		0x84, 0x84, 0x00,	/* 11:埫偄墿怓 */
		0x00, 0x00, 0x84,	/* 12:埫偄惵 */
		0x84, 0x00, 0x84,	/* 13:埫偄巼 */
		0x00, 0x84, 0x84,	/* 14:埫偄悈怓 */
		0x84, 0x84, 0x84	/* 15:埫偄奃怓 */
	};
	set_palette(0, 15, table_rgb);
	return;

	/* static char 柦椷偼丄僨乕僞偵偟偐巊偊側偄偗偳DB柦椷憡摉 */
}
Esempio n. 20
0
void init_palette(void)
{
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	/*  0:黒 */
		0xff, 0x00, 0x00,	/*  1:明るい赤 */
		0x00, 0xff, 0x00,	/*  2:明るい緑 */
		0xff, 0xff, 0x00,	/*  3:明るい黄色 */
		0x00, 0x00, 0xff,	/*  4:明るい青 */
		0xff, 0x00, 0xff,	/*  5:明るい紫 */
		0x00, 0xff, 0xff,	/*  6:明るい水色 */
		0xff, 0xff, 0xff,	/*  7:白 */
		0xc6, 0xc6, 0xc6,	/*  8:明るい灰色 */
		0x84, 0x00, 0x00,	/*  9:暗い赤 */
		0x00, 0x84, 0x00,	/* 10:暗い緑 */
		0x84, 0x84, 0x00,	/* 11:暗い黄色 */
		0x00, 0x00, 0x84,	/* 12:暗い青 */
		0x84, 0x00, 0x84,	/* 13:暗い紫 */
		0x00, 0x84, 0x84,	/* 14:暗い水色 */
		0x84, 0x84, 0x84	/* 15:暗い灰色 */
	};
	set_palette(0, 15, table_rgb);
	return;

	/* static char 命令は、データにしか使えないけどDB命令相当 */
}
Esempio n. 21
0
void internal_set_gfx_mode(){
    // Actually sets the graphics mode.
    int error,n=player_gfx_mode-1;

    // Try to set the graphics mode (unless we're allready in it).
    if(n!=old_gfx_mode){
        error=set_gfx_mode(GFX_AUTODETECT,gfx_mode_info[n].width,gfx_mode_info[n].height,0,0);
        if(error<0){
            // DEBUG: Will this error even appear in a bad graphics mode?
            con_printf("Couldn't initiate the graphics mode!");
        }
        else{
            // Get the new screen width/height.
            screen_width=gfx_mode_info[n].width;
            screen_height=gfx_mode_info[n].height;
            set_palette(gamma_pal);

            // DEBUG: Shouldn't we free the old VGABUF?!!
            vgabuf=create_bitmap(screen_width,screen_height);
            sprintf(saybuf,"%d x %d mode set (%dk vgabuf)",screen_width,screen_height,screen_width*screen_height/1024);
            con_printf(saybuf);

            // Reset the console height, if the console is down.
            if(player_connected==1&&player_con==1){
                con_height=screen_height/2;
            }
        }
    }

    // Save the old mode.
    old_gfx_mode=n;
}
Esempio n. 22
0
void init_palette(void)
{
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	/*  0: */
		0xff, 0x00, 0x00,	/*  1: */
		0x00, 0xff, 0x00,	/*  2: */
		0xff, 0xff, 0x00,	/*  3: */
		0x00, 0x00, 0xff,	/*  4: */
		0xff, 0x00, 0xff,	/*  5: */
		0x00, 0xff, 0xff,	/*  6: */
		0xff, 0xff, 0xff,	/*  7: */
		0xc6, 0xc6, 0xc6,	/*  8: */
		0x84, 0x00, 0x00,	/*  9: */
		0x00, 0x84, 0x00,	/* 10: */
		0x84, 0x84, 0x00,	/* 11: */
		0x00, 0x00, 0x84,	/* 12: */
		0x84, 0x00, 0x84,	/* 13: */
		0x00, 0x84, 0x84,	/* 14: */
		0x84, 0x84, 0x84	/* 15: */
	};
	set_palette(0, 15, table_rgb);
	return;


}
Esempio n. 23
0
int main(void)
{
   int i;

   allegro_init();
   install_keyboard();
   install_mouse();
   install_timer();

   if (set_gfx_mode(GFX_SAFE, 640, 480, 0, 0) != 0) {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
      allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
      exit(EXIT_FAILURE);
   }
   set_palette(desktop_palette);
   gui_fg_color = palette_color[255];
   gui_bg_color = palette_color[16];

   black = makecol(0, 0, 0);
   white = makecol(255, 255, 255);
   red = makecol(255, 0, 0);
   yellow = makecol(255, 255, 0);

   /* Clear key mappings.  */
   for (i = 0; i < 256; i++)
      keycode_to_scancode[i] = -1;

   /* Hook the X keyboard callback.  */
   _xwin_keyboard_callback = get_raw_keycode;

   show_main_dialog();

   return 0;
}
Esempio n. 24
0
void
pngquant_tiny(FILE *src, FILE *dest)
{
    liq_attr *attr;
    liq_result *rv;
    liq_image *input_image = NULL;
    png24_image input_png = {};
    png8_image output_png = {};

    attr = liq_attr_create();
    read_image(attr, src, &input_png, &input_image);

    rv = liq_quantize_image(attr, input_image);

    liq_set_output_gamma(rv, GAMMA);
    prepare_output_image(rv, input_image, &output_png);
    liq_write_remapped_image_rows(rv, input_image, output_png.row_pointers);
    set_palette(rv, &output_png);
    output_png.fast_compression = FAST_COMPRESSION;

    rwpng_write_image8(dest, &output_png);

    liq_result_destroy(rv);
    liq_image_destroy(input_image);
    png24_image_destroy(&input_png);
    png8_image_destroy(&output_png);
}
Esempio n. 25
0
/* main program */
int main(void)
{
   int c;

   if (allegro_init() != 0)
      return 1;
   install_keyboard();
   install_mouse();
   install_timer();

   if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0) {
      if (set_gfx_mode(GFX_SAFE, 640, 480, 0, 0) != 0) {
	 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
	 allegro_message("Unable to set any graphic mode\n%s\n",
			 allegro_error);
	 return 1;
      }
   }

   set_palette(desktop_palette);

   input_nodes();
   calc_tangents();

   curviness = ftofix(0.25);
   show_tangents = FALSE;
   show_control_points = FALSE;

   draw_splines();

   for (;;) {
      if (keypressed()) {
	 c = readkey() >> 8;
	 if (c == KEY_ESC)
	    break;
	 else if (c == KEY_UP) {
	    curviness += ftofix(0.05);
	    draw_splines();
	 }
	 else if (c == KEY_DOWN) {
	    curviness -= ftofix(0.05);
	    draw_splines();
	 }
	 else if (c == KEY_SPACE) {
	    walk();
	    draw_splines();
	 }
	 else if (c == KEY_T) {
	    show_tangents = !show_tangents;
	    draw_splines();
	 }
	 else if (c == KEY_C) {
	    show_control_points = !show_control_points;
	    draw_splines();
	 }
      }
   }

   return 0;
}
Esempio n. 26
0
void init_palette(void)
{
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	/*  0:black */
		0xff, 0x00, 0x00,	/*  1:light red */
		0x00, 0xff, 0x00,	/*  2:light green */
		0xff, 0xff, 0x00,	/*  3:light yellow */
		0x00, 0x00, 0xff,	/*  4:light blue */
		0xff, 0x00, 0xff,	/*  5:light purple */
		0x00, 0xff, 0xff,	/*  6:light cyan */
		0xff, 0xff, 0xff,	/*  7:white */
		0xc6, 0xc6, 0xc6,	/*  8:light gray */
		0x84, 0x00, 0x00,	/*  9:dark red */
		0x00, 0x84, 0x00,	/* 10:dark green */
		0x84, 0x84, 0x00,	/* 11:dark yellow */
		0x00, 0x00, 0x84,	/* 12:dark blue */
		0x84, 0x00, 0x84,	/* 13:dark purple */
		0x00, 0x84, 0x84,	/* 14:dark cyan */
		0x84, 0x84, 0x84	/* 15:dark gray */
	};
	set_palette(0, 15, table_rgb);
	return;

	/* static char is corrensponding to DB directive */
}
Esempio n. 27
0
void init_palette(void)
{
	static unsigned char table_rgb[16 * 3] = {
		0x00, 0x00, 0x00,	/*  0:• */
		0xff, 0x00, 0x00,	/*  1:–О‚щ‚Ђд */
		0x00, 0xff, 0x00,	/*  2:–О‚щ‚Ђ—Ю */
		0xff, 0xff, 0x00,	/*  3:–О‚щ‚Ђ‰ЉF */
		0x00, 0x00, 0xff,	/*  4:–О‚щ‚ЂТ */
		0xff, 0x00, 0xff,	/*  5:–О‚щ‚ЂŽ‡ */
		0x00, 0xff, 0xff,	/*  6:–О‚щ‚Ђ…F */
		0xff, 0xff, 0xff,	/*  7:”’ */
		0xc6, 0xc6, 0xc6,	/*  8:–О‚щ‚ЂŠDF */
		0x84, 0x00, 0x00,	/*  9:ˆУ‚Ђд */
		0x00, 0x84, 0x00,	/* 10:ˆУ‚Ђ—Ю */
		0x84, 0x84, 0x00,	/* 11:ˆУ‚Ђ‰ЉF */
		0x00, 0x00, 0x84,	/* 12:ˆУ‚ЂТ */
		0x84, 0x00, 0x84,	/* 13:ˆУ‚ЂŽ‡ */
		0x00, 0x84, 0x84,	/* 14:ˆУ‚Ђ…F */
		0x84, 0x84, 0x84	/* 15:ˆУ‚ЂŠDF */
	};
	set_palette(0, 15, table_rgb);
	return;

	/* static char –Н—п‚ЭAƒf[ƒ^‚Щ‚Е‚ЉŽg‚І‚Ш‚Ђ‚Џ‚ЧDB–Н—п‘Š“– */
}
Esempio n. 28
0
void init_palette(void)
{
    static unsigned char table_rgb[16 * 3] = {
        0x00, 0x00, 0x00,	/*  0:흑 */
        0xff, 0x00, 0x00,	/*  1:밝은 빨강 */
        0x00, 0xff, 0x00,	/*  2:밝은 초록 */
        0xff, 0xff, 0x00,	/*  3:밝은 황색 */
        0x00, 0x00, 0xff,	/*  4:밝은 파랑 */
        0xff, 0x00, 0xff,	/*  5:밝은 보라색 */
        0x00, 0xff, 0xff,	/*  6:밝은 물색 */
        0xff, 0xff, 0xff,	/*  7:흰색 */
        0xc6, 0xc6, 0xc6,	/*  8:밝은 회색 */
        0x84, 0x00, 0x00,	/*  9:어두운 빨강 */
        0x00, 0x84, 0x00,	/* 10:어두운 초록 */
        0x84, 0x84, 0x00,	/* 11:어두운 황색 */
        0x00, 0x00, 0x84,	/* 12:어두운 파랑 */
        0x84, 0x00, 0x84,	/* 13:어두운 보라색 */
        0x00, 0x84, 0x84,	/* 14:어두운 물색 */
        0x84, 0x84, 0x84	/* 15:어두운 회색 */
    };
    set_palette(0, 15, table_rgb);
    return;

    /* static char 명령은 데이터 밖에 사용할 수 없지만 DB명령에 상당 */
}
Esempio n. 29
0
Gobby::ColorSelectionDialog::
	ColorSelectionDialog(Config::ParentEntry& config_entry,
	                     const Glib::ustring& title)
 : Gtk::ColorSelectionDialog(title),
   m_config_entry(config_entry)
{
	set_palette(config_entry, *get_colorsel() );
}
Esempio n. 30
0
VNGError VngoClear3D::reinit(Flx16 brightness)
{
    if (!pal)
        return VNGO_INTERNAL_ERROR;

    set_palette(pal,brightness);
    return VNGO_NO_ERROR;
}