Exemple #1
0
void set_palette(INFO_IMAGE *inf)
{
  int rgb[3] ;

  if (Truecolor || (nb_plane == 1) || (inf->palette == NULL)) return ;

  if (config.color_protect && (nb_colors == 256))
  {
    set_stospalette(inf->palette, nb_colors-17, 16) ;
    set_tospalette(old_pal, 16) ;
    return ;
  }
  else
    set_tospalette(inf->palette, nb_colors) ;

  if (config.color_protect)
  {
    rgb[0] = rgb[1] = rgb[2] = 1000 ;
    vs_color(handle, 0, rgb) ;
    rgb[0] = rgb[1] = rgb[2] = 0 ;
    vs_color(handle, 1, rgb) ;
    rgb[0] = rgb[1] = rgb[2] = 753 ;
    vs_color(handle, 8, rgb) ;
    rgb[0] = rgb[1] = rgb[2] = 502 ;
    vs_color(handle, 9, rgb) ;
  }
}
static void GEM_ClearRect(_THIS, short *rect)
{
	short oldrgb[3], rgb[3]={0,0,0};

	vq_color(VDI_handle, vdi_index[0], 0, oldrgb);
	vs_color(VDI_handle, vdi_index[0], rgb);

	vsf_color(VDI_handle,0);
	vsf_interior(VDI_handle,1);
	vsf_perimeter(VDI_handle,0);
	v_bar(VDI_handle, rect);

	vs_color(VDI_handle, vdi_index[0], oldrgb);
}
Exemple #3
0
void compute_colors(VSS_INFO *vss_info, INFO_IMAGE *inf)
{
  int rvb[3] ;

  /* Prend la couleur inverse du fond */
  if ( vss_info->back == BACK_WHITE )
  {
    rvb[0] = rvb[1] = rvb[2] = 0 ;
    txt_color = 20 ;
  }
  else
  {
    rvb[0] = rvb[1] = rvb[2] = 1000 ;
    txt_color = 21 ;
  }
  if ( !Truecolor && ( inf->palette != NULL ) )
  {
    txt_color = get_nearest_vdi_index( rvb, inf->palette, inf->nb_cpal ) ;
  }
  else
  {
    txt_color = 18 ;
    vs_color( handle, txt_color, rvb ) ;
  }

  if ( vss_info->back == BACK_WHITE )
  {
    rvb[0] = rvb[1] = rvb[2] = 1000 ;
    back_color = 20 ;
  }
  else
  {
    rvb[0] = rvb[1] = rvb[2] = 0 ;
    back_color = 21 ;
  }
  if ( !Truecolor )
  {
    if ( inf->palette != NULL )
      back_color = get_nearest_vdi_index( rvb, inf->palette, inf->nb_cpal ) ;
    else
      back_color = 0 ;
  }
  else
  {
    back_color = 20 ;
    vs_color( handle, back_color, rvb ) ;
  }
}
Exemple #4
0
static int dtor( GEM_PLOTTER self )
{
	int i=0;
	LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));

	if( VIEW(self).mem )
		free( VIEW(self).mem );

#ifdef WITH_8BPP_SUPPORT
	if( DUMMY_PRIV(self)->vfmt.indexed ){
		for( i=OFFSET_WEB_PAL; i<OFFSET_CUST_PAL+16; i++){
			vs_color( self->vdi_handle, i, &sys_pal[i][0] );
		}
	}
#endif

	/* close Hermes stuff: */
	Hermes_ConverterReturn( hermes_cnv_h );

	Hermes_Done();

	if( self->priv_data != NULL ){
		if( DUMMY_PRIV(self)->buf_packed )
			free( DUMMY_PRIV(self)->buf_packed );
		if( DUMMY_PRIV(self)->buf_planar )
			free( DUMMY_PRIV(self)->buf_planar );
		free( self->priv_data );
	}
	snapshot_destroy( self );
	return( 1 );
}
Exemple #5
0
void cree_degrade(int start, int end)
{
  float r, g, b ;
  float c ;
  int   rgb[3] ;
  int   srgb[3] ;
  int   ergb[3] ;
  int   i ;
  int   nb ;

  if (start > end)
  {
    i     = start ;
    start = end ;
    end   = i ;
  }

  vq_color(handle, start, 0, srgb) ;
  vq_color(handle, end, 0, ergb) ;
  nb = 1+end-start ;
  r = (float)(ergb[0]-srgb[0])/(float)nb ;
  g = (float)(ergb[1]-srgb[1])/(float)nb ;
  b = (float)(ergb[2]-srgb[2])/(float)nb ;
  for (i = start; i <= end; i++)
  {
    c      = (float)srgb[0]+(float)(i-start)*r ;
    rgb[0] = (int) c ;
    c      = (float)srgb[1]+(float)(i-start)*g ;
    rgb[1] = (int) c ;
    c      = (float)srgb[2]+(float)(i-start)*b ;
    rgb[2] = (int) c ;
    vs_color(handle, i, rgb) ;
  }
}
Exemple #6
0
/*
 * Adjust color of selected color pen with
 * RGB gun values requested.
 *
 * Force the redraw of the currently selected pen box.
 */
void
adjcol( void )
{
	GRECT obrect;
	WORD  clip[4];

	(curnew+curcol)->rint = curscrn[R];
	(curnew+curcol)->gint = curscrn[G];
	(curnew+curcol)->bint = curscrn[B];
        
	slidtext();
	open_vwork();
	rc_2xy( &desk, clip );	
	vs_clip( vhandle, 1, ( int *)clip );

	vs_color(vhandle, curcol, (int *)(curnew+curcol) );

	/* cjg - force a redraw fo the curbox */
	vsf_color( vhandle, curcol );	/* fill with color of obj */
	obrect = ObRect( curbox );
	objc_offset(tree, curbox, &obrect.g_x, &obrect.g_y);
	pxyarray[0] = obrect.g_x;
	pxyarray[1] = obrect.g_y;
	pxyarray[2] = obrect.g_x + obrect.g_w - 1;
	pxyarray[3] = obrect.g_y + obrect.g_h - 1;
	v_bar(vhandle, pxyarray);

	close_vwork();
	*( curdirt+curcol ) = touch_bnk = DIRTY;
}
Exemple #7
0
void img_set_colors(int handle, short *palette, int col)
{
    int i, idx, end;

    /* set color palette */
    end=min(1<<col,1<<planes);
    for(i=0; i<end; i++) {
        switch(planes) {	/* MAR -- war col 10.01.2001 */
        case 1:
            idx=i;
            break;
        case 2:
            idx=vdi2dev2[i];
            break;
        case 4:
            idx=vdi2dev4[i];
            break;
        default:
            if(i<16)
                idx=vdi2dev4[i];
            else
                idx= i==255 ? 1 : i;
        }
        vs_color(handle, i, (int *)palette + idx * 3);
    }
}
Exemple #8
0
void set_colors(int *colors)
{
	int i, *h = colors;

	for (i = 0; i < ncolors; i++)
	{
		vs_color(vdi_handle, i, h);
		h += 3;
	}
}
Exemple #9
0
/*******************************************************************************
	Charge les n premiŠres couleurs de la palette systŠme
*******************************************************************************/
void _loadPal(int n)
{
	typedef int		t_rgb[3];
	t_rgb				*col;
	int				i;

	if (glb.vdi.pal)
	{
		col=(t_rgb *)glb.mem.adr[glb.vdi.pal];
		for (i=0;i<min(n,glb.vdi.out[13]);i++)
			vs_color(glb.vdi.ha,i,(int *)col[i]);
	}
}
Exemple #10
0
/*
 * Adjust color of selected color pen with
 * RGB gun values requested.
 */
void
adjcol( void )
{
	(curnew+curcol)->rint = curscrn[R];
	(curnew+curcol)->gint = curscrn[G];
	(curnew+curcol)->bint = curscrn[B];
        
	slidtext();
	open_vwork();
	vs_color(vhandle, curcol, (int *)(curnew+curcol) );
	close_vwork();
	*( curdirt+curcol ) = touch_bnk = DIRTY;
}
Exemple #11
0
static inline void vst_rgbcolor( short vdih, uint32_t cin )
{
	if( vdi_sysinfo.scr_bpp > 8 ) {
		unsigned short c[4];
		rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c );
		vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0] );
		vst_color( vdih, OFFSET_CUSTOM_COLOR );
	} else {
		if( vdi_sysinfo.scr_bpp >= 4 )
			vst_color( vdih, RGB_TO_VDI(cin) );
		else
			vst_color( vdih, BLACK );
	}
}
Exemple #12
0
/*
 * Re-initialize color registers with the last requested values
 */
void
reinitcol(void)
{
	int i, *ptr;		/* index */
	
	open_vwork();
	for (i = 0, ptr = (int *)curnew; 
		i < numcol; 
		i++, ptr = (int *)(curnew+i)) {
		vq_color(vhandle, i, 0, ptr);
		vs_color(vhandle, i, ptr);
	}
	close_vwork();
}
Exemple #13
0
static void GEM_ClearScreen(_THIS)
{
    short rgb[3]= {0,0,0};
    short oldrgb[3];
    short pxy[4];

    v_hide_c(VDI_handle);

    vq_color(VDI_handle, vdi_index[0], 0, oldrgb);
    vs_color(VDI_handle, vdi_index[0], rgb);

    pxy[0] = pxy[1] = 0;
    pxy[2] = VDI_w - 1;
    pxy[3] = VDI_h - 1;
    vsf_color(VDI_handle,0);
    vsf_interior(VDI_handle,1);
    vsf_perimeter(VDI_handle,0);
    v_bar(VDI_handle,pxy);

    vs_color(VDI_handle, vdi_index[0], oldrgb);

    v_show_c(VDI_handle, 1);
}
Exemple #14
0
/*
 * Set VDI color lookup table with the given RGB intensities
 * Passed:
 *			RGB col_array[] - array of RGB intensities
 */
void
slamcol(RGB col_array[])
{
	int i;		/* counter */
	
	open_vwork();
 	for (i = 0; i < numcol; i++) {
 		if (col_array[i].rint == -1) {
 			vq_color(vhandle, i, 0, (int *)&col_array[i]);
		}
		vs_color(vhandle, i, (int *)&col_array[i]);
	}
	close_vwork();
}
Exemple #15
0
/*
 * Cancel changes made to current bank
 */
void
cnclbnk(void)
{
	int j;
	
	open_vwork();
	for (j = 0; j < numcol; j++) {		/* for all colors */
		if (*(curdirt+j) == DIRTY) {	/* if color modified */
										/* reset it */
			vs_color(vhandle, j, (int *)(curold+j));
			*(curnew+j) = *(curold+j);
		}
	}
	close_vwork();
}
static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3])
{
	int i;
	short rgb[3];

	if (VDI_oldnumcolors==0)
		return;

	for(i = 0; i < VDI_oldnumcolors; i++) {
		rgb[0] = newpal[i][0];
		rgb[1] = newpal[i][1];
		rgb[2] = newpal[i][2];

		vs_color(VDI_handle, i, rgb);
	}
}
Exemple #17
0
void OnDrawRTZoom(void *wnd, int xycoords[4])
{
  int xy[8] ;
  int index ;
  int must_fill = ( rtoffx > 0 ) || ( rtoffy > 0 ) ;

  if ( must_fill )
  {
    if ( !Truecolor ) index = 0 ;
    else
    {
      int rgb[3] = { 1000, 1000, 1000 } ;

      index = 19 ;
      vs_color( handle, index, rgb ) ;
    }
    vswr_mode( handle, MD_REPLACE ) ;
    vsf_color( handle, index ) ;
    vsf_interior( handle, FIS_SOLID ) ;
    vsf_perimeter( handle, 0 ) ;
  }

  if ( intersect( rtx + rtoffx, rty + rtoffy, rtw - rtoffx, rth - rtoffy,
                  xycoords[0], xycoords[1], xycoords[2], xycoords[3],
                  &xy[4] )
     )
  {
    xy[0] = smart_offx + xy[4] - rtx - rtoffx ;
    xy[1] = xy[5] - rty - rtoffy ;
    xy[2] = smart_offx + xy[6] - rtx - rtoffx ;
    xy[3] = xy[7] - rty - rtoffy ;
    vro_cpyfm( handle, S_ONLY, xy, &RTZoomDst, &screen ) ;

    if ( must_fill )
    {
      if ( intersect( rtx, rty, rtoffx, rth, xycoords[0], xycoords[1], xycoords[2], xycoords[3], xy ) )
        vr_recfl( handle, xy ) ;
      if ( intersect( rtx, rty, rtw, rtoffy, xycoords[0], xycoords[1], xycoords[2], xycoords[3], xy ) )
        vr_recfl( handle, xy ) ;
    }
  }
}
Exemple #18
0
/*
 * Adjust color of selected color pen with
 * RGB gun values requested.
 */
void
adjcol()
{
	switch (curslid) {
		
		case RSLID:
			(curnew+curcol)->rint = val2int(curscrn[R]);
 			break;
			
		case GSLID:
			(curnew+curcol)->gint = val2int(curscrn[G]);
			break;
			
		case BSLID:
			(curnew+curcol)->bint = val2int(curscrn[B]);
			break;
	}
	slidtext();
	open_vwork();
	vs_color(vhandle, curcol, (int *)(curnew+curcol));
	close_vwork();
	*(curdirt+curcol) = touch_bnk[curbnk] = DIRTY;
}
Exemple #19
0
int16	default_colors( int16 vdi_handle, COLOR_RGB *gslct )
{
	int32	no_colors;
	int16	work_out[272];
	int16	rgb_in[3];
	int16	index;
	
	vq_scrninfo( vdi_handle, work_out );							/* Pixelwerte erfragen */
	no_colors = *(int32 *) ( work_out + 3 );						/* Farbanzahl */

	for ( index = 0; index < 16; index++ )							/* neue Systemfarben, die f�r besseres Dithern sorgen */
	{
		rgb_in[0] = system_colors[index][0];
		rgb_in[1] = system_colors[index][1];
		rgb_in[2] = system_colors[index][2];
		vs_color( vdi_handle, index, rgb_in );
	}

	if ( no_colors >= 256 )												/* 256 Farben oder Direct Color? */
	{
		int16	gslct_red;
		int16	gslct_green;
		int16	gslct_blue;
		int16	red;
		int16	green;
		int16	blue;
		int16	gray;
		
		if ( gslct )
		{
			gslct_red = (int16) (((int32) gslct->red + 6553 ) / 13107 ) * 200;	/* Farbe innerhalb des 6*6*6-W�rfels ausw�hlen */
			gslct_green = (int16) (((int32) gslct->green + 6553 ) / 13107 ) * 200;
			gslct_blue = (int16) (((int32) gslct->blue + 6553 ) / 13107 ) * 200;
		}
		else																	/* Selektionsfarbe von Hellgrau: Voreinstellung */
		{
			gslct_red = 200;
			gslct_green = 200;
			gslct_blue = 600;
		}
		
		index = 16;

		for ( red = 0; red < 6; red++ )								/* VDI-Index 16 - 229: 6*6*6 Farbw�rfel (ohne Schwarz und Wei� => 214 Farbt�ne) */
		{
			for ( green = 0; green < 6; green++ )
			{
				for ( blue = 0; blue < 6; blue++ )
				{
					if ((( red != green ) || ( red != blue )) || (( red != 0 ) && ( red != 5 )))	/* nicht Schwarz und und nicht Wei�? */
					{
						rgb_in[0] = ( red * 1000 ) / 5;
						rgb_in[1] = ( green * 1000 ) / 5;
						rgb_in[2] = ( blue * 1000 ) / 5;
						if (( rgb_in[0] == gslct_red ) && ( rgb_in[1] == gslct_green ) && ( rgb_in[2] == gslct_blue )) /* Selektionsfarbe f�r Hellgrau? */
						{
							rgb_in[0] = 0;
							rgb_in[1] = 0;
							rgb_in[2] = scale[2];
						}
						
						vs_color( vdi_handle, index, rgb_in );
						index++;
					}
				}
			}
		}

		for ( red = 0; red < 7; red++ )								/* VDI-Index 230 - 236: 7 Rott�ne */
		{
			rgb_in[0] = scale[red];
			rgb_in[1] = 0;
			rgb_in[2] = 0;
			vs_color( vdi_handle, index, rgb_in );
			index++;
		}

		for ( green = 0; green < 7; green++ )						/* VDI-Index 237 - 243: 7 Gr�nt�ne */
		{
			rgb_in[0] = 0;
			rgb_in[1] = scale[green];
			rgb_in[2] = 0;
			vs_color( vdi_handle, index, rgb_in );
			index++;
		}

		for ( blue = 6; blue >= 0; blue-- )							/* VDI-Index 244 - 250: 6 Blaut�ne und die Selektionsfarbe */
		{
			if ( index == 248 )											/* Selektionsfarbe von Hellgrau? */
			{
				rgb_in[0] = gslct_red;
				rgb_in[1] = gslct_green;
				rgb_in[2] = gslct_blue;
			}
			else																/* Blauverlauf setzen */
			{
				rgb_in[0] = 0;
				rgb_in[1] = 0;
				rgb_in[2] = scale[blue];
			}
			vs_color( vdi_handle, index, rgb_in );
			index++;
		}

		for ( gray = 0; gray < 7; gray++ )							/* VDI-Index 251 - 255: 5 Graut�ne (die 16 Systemfarben enhalten zwei weitere Graut�ne) */
		{
			if (( scale[gray] != 502 ) && ( scale[gray] != 902 ))	/* Hellgrau und 50%grau werden aus den Systemfarben genommen */
			{
				rgb_in[0] = scale[gray];
				rgb_in[1] = scale[gray];
				rgb_in[2] = scale[gray];
				vs_color( vdi_handle, index, rgb_in );
				index++;
			}
		}
	}
	return( 1 );
}
Exemple #20
0
/* 
 * Show color panel
 * Passed:  GRECT *rect		= pointer to rectangle CPX resides in 
 * Returns: BOOLEAN	FALSE	= to exit CPX
 */
BOOLEAN	
cdecl  colpnl(GRECT *rect)
{
    MRETS mk;
    int quit=0;
    int obj, ox, oy;
    WORD msg[8], clip[4];
	GRECT obrect;		/* object rectangle */
    
    
    Wind_get(0, WF_WORKXYWH, (WARGS *)&obrect);	/* set clipping to */
    rc_2xy(&obrect, clip);						/*   Desktop space */
    
    open_vwork();
    vs_clip(vhandle, 1, (int *)clip);
    
  	ObX(COLPNL) = rect->g_x;					/* position panel */
 	ObY(COLPNL) = rect->g_y;
    Objc_draw(tree, COLPNL, MAX_DEPTH, NULL);	/* draw panel */
   	draw_boxes();								/* draw the color boxes */
   	outline(curbox, HILITE);					/* show selected box */
    close_vwork();
    
    if (IsSelected(INVRSVDO))	/* if Invert button is selected */
    	Deselect(INVRSVDO);		/* deselect it */
    	
    do {
    if ((obj = (*xcpb->Xform_do)(tree, COLPNL, msg)) != -1) {
    	obj &= 0x7fff;				/* mask out double clicks */
 		switch(obj) {
			case RUP:
				curslid = RSLID;
	    		(*xcpb->Sl_arrow)(tree, RBASE, RSLID, RUP, 1, val_min, 
	    			val_max, &curscrn[R], VERTICAL, adjcol);
	    		break;
			case RDOWN:
				curslid = RSLID;
	    		(*xcpb->Sl_arrow)(tree, RBASE, RSLID, RDOWN, -1, 
	    			val_min, val_max, &curscrn[R], VERTICAL, adjcol);
	    		break;
			case RSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
				curslid = RSLID;
	    		(*xcpb->Sl_dragy)(tree, RBASE, RSLID, val_min, val_max, 
	    			&curscrn[R], adjcol);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case RBASE:
    	   		Graf_mkstate(&mk);
    	   		objc_offset(tree, RSLID, &ox, &oy);
    	   		if(mk.y < oy)
    	   			oy = VAL_PAGE;
    	   		else
    	       		oy = -VAL_PAGE;
				curslid = RSLID;
	    		(*xcpb->Sl_arrow)(tree, RBASE, RSLID, -1, oy, val_min, 
	    			val_max, &curscrn[R], VERTICAL, adjcol);
	    		break;
	        
			case GUP:
				curslid = GSLID;
	    		(*xcpb->Sl_arrow)(tree, GBASE, GSLID, GUP, 1, val_min, 
	    			val_max, &curscrn[G], VERTICAL, adjcol);
	    		break;
			case GDOWN:
				curslid = GSLID;
	    		(*xcpb->Sl_arrow)(tree, GBASE, GSLID, GDOWN, -1, 
	    			val_min, val_max, &curscrn[G], VERTICAL, adjcol);
	    		break;
			case GSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
				curslid = GSLID;
	    		(*xcpb->Sl_dragy)(tree, GBASE, GSLID, val_min, val_max, 
	    			&curscrn[G], adjcol);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case GBASE:
    	   		Graf_mkstate(&mk);
    	   		objc_offset(tree, GSLID, &ox, &oy);
    	   		if(mk.y < oy)
    	   			oy = VAL_PAGE;
    	   		else
    	   	    	oy = -VAL_PAGE;
				curslid = GSLID;
	    		(*xcpb->Sl_arrow)(tree, GBASE, GSLID, -1, oy, val_min, 
	    			val_max, &curscrn[G], VERTICAL, adjcol);
	    		break;
	        
			case BUP:
				curslid = BSLID;
	    		(*xcpb->Sl_arrow)(tree, BBASE, BSLID, BUP, 1, val_min, 
	    			val_max, &curscrn[B], VERTICAL, adjcol);
	    		break;
			case BDOWN:
				curslid = BSLID;
	    		(*xcpb->Sl_arrow)(tree, BBASE, BSLID, BDOWN, -1, 
	    			val_min, val_max, &curscrn[B], VERTICAL, adjcol);
	    		break;
			case BSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
				curslid = BSLID;
	    		(*xcpb->Sl_dragy)(tree, BBASE, BSLID, val_min, val_max, 
	    			&curscrn[B], adjcol);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case BBASE:
    			Graf_mkstate(&mk);
    			objc_offset(tree, BSLID, &ox, &oy);
    			if(mk.y < oy)
    	  				oy = VAL_PAGE;
    			else
					oy = -VAL_PAGE;
				curslid = BSLID;
	    		(*xcpb->Sl_arrow)(tree, BBASE, BSLID, -1, oy, val_min, 
	    			val_max, &curscrn[B], VERTICAL, adjcol);
	    		break;
	    		
	    	case COLUP:
	    		(*xcpb->Sl_arrow)(tree, COLBASE, COLSLID, COLUP, -1, 
	    			col_max, col_min, &curcol, VERTICAL, nxtrow);
	    		break;
			case COLDOWN:
	    		(*xcpb->Sl_arrow)(tree, COLBASE, COLSLID, COLDOWN, 1, 
	    			col_max, col_min, &curcol, VERTICAL, nxtrow);
	    		break;
			case COLSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
	    		(*xcpb->Sl_dragy)(tree, COLBASE, COLSLID, col_max, 
	    			col_min, &curcol, nxtgrp);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case COLBASE:
    			Graf_mkstate(&mk);
    			objc_offset(tree, COLSLID, &ox, &oy);
    			if(mk.y < oy)
    	   			oy = -col_page;
       			else
    	    		oy = col_page;
				curslid = COLSLID;
	    		(*xcpb->Sl_arrow)(tree, COLBASE, COLSLID, -1, oy, 
	    			col_max, col_min, &curcol, VERTICAL, nxtpage);
	    		break;
	    
			case BNKRIGHT:
	    		(*xcpb->Sl_arrow)(tree, BNKBASE, BNKSLID, BNKRIGHT, 1, 
	    			BNK_MIN, BNK_MAX, &curbnk, HORIZONTAL, nxtbnk);
	    		break;
			case BNKLEFT:
	    		(*xcpb->Sl_arrow)(tree, BNKBASE, BNKSLID, BNKLEFT, -1, 
	    			BNK_MIN, BNK_MAX, &curbnk, HORIZONTAL, nxtbnk);
	    		break;
			case BNKSLID:
				(*xcpb->MFsave)(MFSAVE, &orig_mf);
				if( AES_Version >= 0x0320 )
				    DRAG_MOUSE;
	    		(*xcpb->Sl_dragx)(tree, BNKBASE, BNKSLID, BNK_MIN, 
	    			BNK_MAX, &curbnk, nxtbnk);
	    		(*xcpb->MFsave)(MFRESTORE, &orig_mf);
	    		break;
			case BNKBASE:
    			Graf_mkstate(&mk);
    			objc_offset(tree, BNKSLID, &ox, &oy);
    			if(mk.x < ox)
    	   			oy = -BNK_PAGE;
    			else
    	    		oy = BNK_PAGE;
	    		(*xcpb->Sl_arrow)(tree, BNKBASE, BNKSLID, -1, oy, 
	    			BNK_MIN, BNK_MAX, &curbnk, HORIZONTAL, nxtbnk);
	    		break;
	
			case DUO0:			/* for ST High rez */
			case DUO1:
	
			case QUARTRO0:		/* for ST Medium rez */
			case QUARTRO1:
			case QUARTRO2:
			case QUARTRO3:
		
			case BOX0:    		/* for all other rez */
			case BOX1:
			case BOX2:
			case BOX3:
			case BOX4:
			case BOX5:
			case BOX6:
			case BOX7:
			case BOX8:
			case BOX9:
			case BOX10:
			case BOX11:
			case BOX12:
			case BOX13:
			case BOX14:
			case BOX15:
				if (obj != curbox) {	/* select requested color */
					curcol = obj - headbox + headcol;
					nxt_to_show(0);
					update_slid(VERTICAL, COLBASE, COLSLID, curcol, 
						col_max, col_min, 1);
				}
	   			break;
	    
	   		case INVRSVDO:
	   			Deselect(obj);				/* deselect button */
				flip(0, &curinv);			/* read invert state */
	   			if (curinv & NOT_FLIPPED) {	/* inverted? */
	   				curinv &= 0xfffe;		/* if not, invert it */
	   			} else {					/* else */
	   				curinv |= NOT_FLIPPED;	/* restore it */
	   				draw_button(obj);		/* redraw button */
	   			}
	   			flip(1, &curinv);			/* set new invert state */
	   			
	   			if (bpg) {						/* if color */
	   				swaprgb(curnew, curnew+1);	/* swap pen 0 and 1 */
	   				open_vwork();
	   				vs_color(vhandle, 0, (int *)curnew);
	   				vs_color(vhandle, 1, (int *)(curnew+1));
	   				close_vwork();
	   				*curdirt = *(curdirt+1) = *touch_bnk = DIRTY;
	   				update_rgb(1);			/* update RGB sliders */
	   			}
	   			break;
	    
	   		case SETGRAY:
	   		case SETCOL:
	   			Deselect(obj);			/* deselect selected button */
	   			HideObj(obj);			/* hide selected button */
	   			if (obj == SETGRAY) {
	   				obj = SETCOL;		/* change to Color button */
	   				curgray = TRUE;		/* turn on hypermono */
	   			} else {
	   				obj = SETGRAY;		/* change to Gray button */
	   				curgray = FALSE;	/* turn off hypermono */
	   			}
	   			ShowObj(obj);			/* show new button */
	   			draw_button(obj);		/* draw it */
	   			Vsync();
	   			EsetGray(curgray);		/* set to selected mode */
	   			reinitcol();			/* reinit color regs */
	   			break;
	   				
			case COLSAVE:				/* save current values */
				if ((*xcpb->XGen_Alert)(SAVE_DEFAULTS) == TRUE) {
					(*xcpb->MFsave)(MFSAVE, &orig_mf);
					if( AES_Version >= 0x0320 )
					    BEE_MOUSE;
					
					if (bpg) {					/* if color */
						usr_vals.bnk = curbnk;	/* save bank # */
						savergb();				/* save color info */
												/* update RGBs */
						cpyrgb((RGB *)&oldrgb, (RGB *)&newrgb, totcol);	
					}
			
					if (currez == STHI)			/* if in ST high rez */
						usr_vals.inv = curinv;	/* save invert state */
					
					/* if hypermono supported, save state */
					if (curmode == TTVDO && currez != TTHI)
						usr_vals.gray = curgray;
		
					/* save current data to file */
					saved = 1;
					(*xcpb->CPX_Save)((void *)&saved, sizeof(DEFAULTS)+2);
					
	    			(*xcpb->MFsave)(MFRESTORE, &orig_mf);
				}
				Deselect(obj);
				draw_button(obj);	
	   			break;
	   	
			case COLCNCEL:
				cnclchgs();			/* cancel all changes made */
	   	
			case COLOK:				/* accept all changes made */
				Deselect(obj);				/* deselect button */
	   			quit = TRUE;				/* ready to quit */
	   			break;
	   			
	   		case COLRLOAD:			/* reload saved user-preference */
	   			if (saved)
	   				init(&usr_vals);
	   			else
	   				init(&def_vals);
	   			Deselect(obj);
	   			draw_button(obj);
	   			break;
	   	}
	} else {
		switch(msg[0]) {
			case WM_REDRAW:				/* redraw cpx */
				do_redraw((GRECT *)&msg[4], (int *)clip);
				break;
			
			case KEY_CODE:
				switch(msg[3]) {	/* check which key is returned */
					case UNDO:				/* if Undo key */
						/* reset to original invert state */
						if (currez == STHI && oldinv != curinv) {
							flip(1, &oldinv);
							if (!(oldinv & NOT_FLIPPED))
								Select(INVRSVDO);
							draw_button(INVRSVDO);
							Deselect(INVRSVDO);
							curinv = oldinv;
						}
						
						if (bpg) {			/* if there is color */
							if ((int)curmode == TTVDO && currez != TTHI
								&& curgray != oldgray) {
								Vsync();
								EsetGray(oldgray);
								reinitcol();
								if (oldgray) {
									HideObj(SETGRAY);
									obj = SETCOL;
								} else {
									HideObj(SETCOL);
									obj = SETGRAY;
								}
								ShowObj(obj);
								draw_button(obj);
								curgray = oldgray;
							}
							cnclbnk();		/* cancel color changes */
							update_rgb(1);	/* update RGB on screen */
						}
						break;
						
					case HOME:					/* if Clr Home key */
						if (currez != TTHI)		/* if not in TT High rez */
							init(&def_vals);	/* init to system defs */
						break;
				}
				break;
						
			case AC_CLOSE:
				cnclchgs();			/* cancel changes made */
					
			case WM_CLOSED:
				quit = TRUE;				/* ready to quit */
				break;
		}
	}
    } while (!quit);

    return (FALSE);
}
Exemple #21
0
void vss_doslideshow( VSS_INFO *vss_info )
{
  GEM_WINDOW *wprog ;
  int        (*OnKeyPressed)(int key) ;
  INFO_IMAGE inf ;
  MFDB       mfdb ;
  CMD        *cmd ;
  int        fini = 0 ;
  int        current_pal[256*3] ;
  int        n ;
  int        load_ret ;

  OnKeyPressed        = GemApp.OnKeyPressed ;
  GemApp.OnKeyPressed = OnKeyPressedSldShow ;
  get_tospalette( current_pal ) ;
  cmd = vss_info->cmds ;
  if ( cmd == NULL ) fini = 1 ;
  if ( vss_info->do_not_show_mouse )
    v_hide_c( handle ) ;

  /* Prend la configuration courante */
  vss_info->wait_mini_sec     = config.wait_mini_sec ;
  vss_info->do_not_show_mouse = config.do_not_show_mouse ;
  vss_info->do_not_cls_scr    = config.do_not_cls_scr ;
  vss_info->back              = config.back ;
  vss_info->display_type      = config.display_type ;
  vss_info->transition        = config.transition ;
  vss_info->cycle             = config.cycle ;
  vss_info->ignore_vss        = config.ignore_vss ;
  vss_info->aff_name          = config.aff_name ;
  vss_info->aff_prog          = config.aff_prog ;

  if ( Truecolor )
  {
    int rvb_blanc[3] = { 1000, 1000, 1000 } ;
    int rvb_noir[3]  = {    0,    0,    0 } ;
  
    vs_color(handle, 20, rvb_blanc) ;
    vs_color(handle, 21, rvb_noir) ;
  }  
  stop_sldshow = 0 ;
  num_courant  = 0 ;
  wprog = DisplayStdProg( "", "", "", 0 ) ;
  GWShowWindow( wprog, 0 ) ;
  while ( !fini )
  {
    nb_steps = 0 ;
    switch( cmd->cmd_id )
    {
      case CMD_DISPLAY     : load_ret = load_nextimg( cmd->params, &mfdb, &inf, vss_info, wprog ) ;
                             if ( load_ret == 0 )
                             {
                               compute_colors( vss_info, &inf ) ;
                               if ( ( num_courant > 0 ) && ( wait_for_event( vss_info ) < 0 ) )
                                 fini = 1 ;
                               else
                               {
                                 sldcls_screen( vss_info, &inf ) ;
                                 display_img( &mfdb, &inf, vss_info, cmd->params ) ;
                               }
                             }
                             if ( load_ret == 0 )
                             {
                               if ( inf.palette != NULL ) free( inf.palette ) ;
                               if ( mfdb.fd_addr != NULL ) free( mfdb.fd_addr ) ;
                             }
                             nb_steps++ ;
                             break ;
      default              : /* Impossible */
                             break ;
    }

    for (n = 0; n < nb_steps; n++ )
    {
      if ( cmd != NULL )
      {
        cmd = cmd->next_cmd ;
        num_courant++ ;
      }

      if ( (cmd == NULL ) && vss_info->cycle )
      {
        cmd = vss_info->cmds ;
        num_courant = 0 ;
      }
    }
    if ( stop_sldshow || !cmd ) fini = 1 ;
  }

  if ( !cmd )
  {
    PerfInfo.total_load_time = 0 ;
    wait_for_event( vss_info ) ;
  }
  restore_gemscreen( GemApp.Menu ) ;
  set_tospalette( current_pal, nb_colors ) ;
  if ( vss_info->do_not_show_mouse )
    v_show_c( handle, 1 ) ;

  GWDestroyWindow( wprog ) ;
  GemApp.OnKeyPressed = OnKeyPressed ;
}
Exemple #22
0
int OnObjectNotifyPal(void *w, int obj)
{
  GEM_WINDOW     *wnd = (GEM_WINDOW *) w ;
  WEXTENSION_PAL *wext = wnd->DlgData->UserData ;
  OBJECT         *adr_mkpal = wnd->DlgData->BaseObject ;
  int            off_x, off_y ;
  int            xm, ym, dummy ;
  int            pb_x, pb_y ;
  int            x1, y1, x2, y2 ;
  int            code = -1 ;
  char           buf[15] ;

  graf_mkstate( &xm, &ym, &dummy, &dummy ) ;

  switch( obj )
  {
    case MKPAL_MRED      :
    case MKPAL_PRED      : if ( obj == MKPAL_PRED ) wext->curr_rgb[0]++ ;
                           else                     wext->curr_rgb[0]-- ;
                           if (wext->curr_rgb[0] < 1)    wext->curr_rgb[0] = 1 ;
                           if (wext->curr_rgb[0] > 1000) wext->curr_rgb[0] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[0])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_RED].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[0]) ;
                           write_text(adr_mkpal, MKPAL_TRED, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TRED ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_MGREEN    :
    case MKPAL_PGREEN    : if ( obj == MKPAL_PGREEN ) wext->curr_rgb[1]++ ;
                           else                       wext->curr_rgb[1]-- ;
                           if (wext->curr_rgb[1] < 1)    wext->curr_rgb[1] = 1 ;
                           if (wext->curr_rgb[1] > 1000) wext->curr_rgb[1] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[1])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[1]) ;
                           write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TGREEN ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_MBLUE     :
    case MKPAL_PBLUE     : if ( obj == MKPAL_PBLUE ) wext->curr_rgb[2]++ ;
                           else                      wext->curr_rgb[2]-- ;
                           if (wext->curr_rgb[2] < 1)    wext->curr_rgb[2] = 1 ;
                           if (wext->curr_rgb[2] > 1000) wext->curr_rgb[2] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[2])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[2]) ;
                           write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TBLUE ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_REDBOX    : 
                           objc_offset(adr_mkpal, MKPAL_RED, &off_x, &off_y) ;
                           if (ym > off_y) wext->curr_rgb[0] = wext->curr_rgb[0]-20 ;
                           else            wext->curr_rgb[0] = wext->curr_rgb[0]+20 ;
                           if (wext->curr_rgb[0] < 1)    wext->curr_rgb[0] = 1 ;
                           if (wext->curr_rgb[0] > 1000) wext->curr_rgb[0] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[0])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_RED].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[0]) ;
                           write_text(adr_mkpal, MKPAL_TRED, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TRED ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_GREENBOX  : 
                           objc_offset(adr_mkpal, MKPAL_GREEN, &off_x, &off_y) ;
                           if (ym > off_y) wext->curr_rgb[1] = wext->curr_rgb[1]-20 ;
                           else            wext->curr_rgb[1] = wext->curr_rgb[1]+20 ;
                           if (wext->curr_rgb[1] < 1)  wext->curr_rgb[1] = 1 ;
                           if (wext->curr_rgb[1] > 1000) wext->curr_rgb[1] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[1])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[1]) ;
                           write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TGREEN ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_BLUEBOX   : 
                           objc_offset(adr_mkpal, MKPAL_BLUE, &off_x, &off_y) ;
                           if (ym > off_y) wext->curr_rgb[2] = wext->curr_rgb[2]-20 ;
                           else            wext->curr_rgb[2] = wext->curr_rgb[2]+20 ;
                           if (wext->curr_rgb[2] < 1)    wext->curr_rgb[2] = 1 ;
                           if (wext->curr_rgb[2] > 1000) wext->curr_rgb[2] = 1000 ;
                           off_y = (int) ((1000-wext->curr_rgb[2])*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                           sprintf(buf, "%.4d", wext->curr_rgb[2]) ;
                           write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TBLUE ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_RED       : wext->curr_rgb[0] = (float) graf_slidebox(adr_mkpal, MKPAL_REDBOX, MKPAL_RED, 1) ;
                           off_y = (int) (wext->curr_rgb[0]*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_RED].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                           wext->curr_rgb[0] = 1000-wext->curr_rgb[0] ;
                           sprintf(buf, "%.4d", wext->curr_rgb[0]) ;
                           write_text(adr_mkpal, MKPAL_TRED, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TRED ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
     case MKPAL_GREEN    : wext->curr_rgb[1] = (float) graf_slidebox(adr_mkpal, MKPAL_GREENBOX, MKPAL_GREEN, 1) ;
                           off_y = (int) (wext->curr_rgb[1]*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                           wext->curr_rgb[1] = 1000-wext->curr_rgb[1] ;
                           sprintf(buf, "%.4d", wext->curr_rgb[1]) ;
                           write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TGREEN ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_BLUE      : wext->curr_rgb[2] = (float) graf_slidebox(adr_mkpal, MKPAL_BLUEBOX, MKPAL_BLUE, 1) ;
                           off_y = (int) (wext->curr_rgb[2]*(float)wext->hf/1000.0) ;
                           adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                           wext->curr_rgb[2] = 1000-wext->curr_rgb[2] ;
                           sprintf(buf, "%.4d", wext->curr_rgb[2]) ;
                           write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                           xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_TBLUE ) ;
                           vs_color(handle, wext->index, wext->curr_rgb) ;
                           break ;
    case MKPAL_LOAD     : charge_palette() ;
                          deselect(adr_mkpal, obj) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, obj ) ;
                          wext->flag_aff = 0 ;
                          break ;
    case MKPAL_SAVE     : sauve_palette() ;
                          deselect(adr_mkpal, obj) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, obj ) ;
                          wext->flag_aff = 0 ;
                          break ;
    case MKPAL_START    :
    case MKPAL_END      : if ( obj == MKPAL_START ) wext->stdeg  = wext->index ;
                          else                      wext->enddeg = wext->index ;
                          if (selected(adr_mkpal, MKPAL_START) && selected(adr_mkpal, MKPAL_END))
                          {
                            deselect(adr_mkpal, MKPAL_START) ;
                            deselect(adr_mkpal, MKPAL_END) ;
                            xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_START ) ;
                            xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_END ) ;
                            cree_degrade(wext->stdeg, wext->enddeg) ;
                            wext->stdeg = wext->enddeg = 500 ;
                          }
                          break ;
    case MKPAL_APPLIQUE : read_text(adr_mkpal, MKPAL_TRED, buf) ;
                          wext->rgb[0] = atoi(buf) ;
                          off_y = (int) ((1000-wext->rgb[0])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_RED].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                          read_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                          wext->rgb[1] = atoi(buf) ;
                          off_y = (int) ((1000-wext->rgb[1])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                          read_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                          wext->rgb[2] = atoi(buf) ;
                          off_y = (int) ((1000-wext->rgb[2])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                          vs_color(handle, wext->index, wext->rgb) ;
                          deselect(adr_mkpal, obj) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, obj ) ;
                          break ;
    case MKPAL_BOX      : objc_offset(adr_mkpal, obj, &pb_x, &pb_y) ;
                          if (wext->flag_aff)
                          {
                            x1 = pb_x+(wext->index % wext->nb_col_x)*wext->ww ;
                            y1 = pb_y+(wext->index / wext->nb_col_x)*wext->hh ;
                            x2 = x1+wext->ww-1 ;
                            y2 = y1+wext->hh-1 ;
                            vsf_color(handle, 1) ;
                            vswr_mode(handle, MD_XOR) ;
                            vsl_width(handle, 3) ;
                            v_hide_c(handle) ;
                            rectangle(x1, y1, x2, y2) ;
                            v_show_c(handle, 1) ;
                          }
                          else wext->flag_aff = 1 ;
                          graf_mkstate(&xm, &ym, &dummy, &dummy) ;
                          wext->index = (xm-pb_x)/wext->ww+ wext->nb_col_x*((ym-pb_y)/wext->hh) ;
                          vq_color(handle, wext->index, 0, wext->rgb) ;
                          sprintf(buf, "%.4d", wext->rgb[0]) ;
                          write_text(adr_mkpal, MKPAL_TRED, buf) ;
                          sprintf(buf, "%.4d", wext->rgb[1]) ;
                          write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
                          sprintf(buf, "%.4d", wext->rgb[2]) ;
                          write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_RGB ) ;
                          x1 = pb_x+wext->ww*((xm-pb_x)/wext->ww) ;
                          y1 = pb_y+wext->hh*((ym-pb_y)/wext->hh) ;
                          x2 = x1+wext->ww-1 ;
                          y2 = y1+wext->hh-1 ;
                          vsf_color(handle, 1) ;
                          v_hide_c(handle) ;
                          vswr_mode(handle, MD_XOR) ;
                          vsl_width(handle, 3) ;
                          rectangle(x1, y1, x2, y2) ;
                          v_show_c(handle, 1) ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_CURRCOL ) ;
                          off_y = (int) ((1000-wext->rgb[0])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_RED].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_REDBOX ) ;
                          off_y = (int) ((1000-wext->rgb[1])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_GREENBOX ) ;
                          off_y = (int) ((1000-wext->rgb[2])*(float)wext->hf/1000.0) ;
                          adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
                          xobjc_draw( wnd->window_handle,adr_mkpal, MKPAL_BLUEBOX ) ;
                          break ;
     case MKPAL_OK      : code = IDOK ;
                          break ;
     case MKPAL_CANCEL  : code = IDCANCEL ;
                          break ;
  }

  if ( code == IDOK )
  {

  }

  return( code ) ;
}
Exemple #23
0
int ctor_plotter_vdi( GEM_PLOTTER self , GRECT * loc_size )
{
	int retval = 0;
	int i;
	struct rect clip;

	self->dtor = dtor;
	self->resize= resize;
	self->move = move;
	self->lock = lock;
	self->unlock = unlock;
	self->put_pixel = put_pixel;
	self->copy_rect = copy_rect;
	self->set_clip = set_clip;
	self->get_clip = get_clip;
	self->arc = arc;
	self->disc = disc;
	self->line = line;
	self->rectangle = rectangle;
	self->polygon = polygon;
	self->path = path;
	self->bitmap = bitmap;
	self->bitmap_resize = bitmap_resize;
	/* override virtual bpp - must be in sync with screen for this driver: 	*/
	self->bpp_virt = app.nplanes;
#ifdef WITH_8BPP_SUPPORT
	self->bitmap_convert =(app.nplanes > 8) ? bitmap_convert : bitmap_convert_8;
#else
	self->bitmap_convert = bitmap_convert;
#endif
	self->plot_mfdb = plot_mfdb;
	self->text = text;
	LOG(("Screen: x: %d, y: %d\n", vdi_sysinfo.scr_w, vdi_sysinfo.scr_h));

	self->priv_data = malloc( sizeof(struct s_vdi_priv_data) );
	if( self->priv_data == NULL )
		return( 0-ERR_NO_MEM );
	memset( self->priv_data, 0, sizeof(struct s_vdi_priv_data) );
	memset( &VIEW(self), 0, sizeof( struct s_view) );
	VIEW( self ).x = loc_size->g_x;
	VIEW( self ).y = loc_size->g_y;
	VIEW( self ).w = loc_size->g_w;
	VIEW( self ).h = loc_size->g_h;
	DUMMY_PRIV(self)->bufops = 0;
	DUMMY_PRIV(self)->size_buf_packed = 0;
	DUMMY_PRIV(self)->size_buf_planar = 0;
	DUMMY_PRIV(self)->buf_packed = NULL;
	DUMMY_PRIV(self)->buf_planar = NULL;
	if( vdi_sysinfo.vdiformat == VDI_FORMAT_PACK  ) {
		self->bpp_virt = vdi_sysinfo.scr_bpp;
	} else {
		DUMMY_PRIV(self)->bufops = C2P;
		self->bpp_virt = 8;
	}

	VIEW(self).mem = NULL;
	update_visible_rect( self );

	clip.x0 = 0;
	clip.y0 = 0;
	clip.x1 = VIEW(self).w;
	clip.y1 = VIEW(self).h;
	self->set_clip( self, &clip );

	assert( Hermes_Init() );
	/* store system palette & setup the new (web) palette: */
#ifdef WITH_8BPP_SUPPORT
	i = 0;

	unsigned char * col;
	unsigned char rgbcol[4];
	unsigned char graytone=0;
	if( app.nplanes <= 8 ){
		for( i=0; i<=255; i++ ) {

			// get the current color and save it for restore:
			vq_color(self->vdi_handle, i, 1, (unsigned short*)&sys_pal[i][0] );
			if( i<OFFSET_WEB_PAL ) {
				pal[i][0] = sys_pal[i][0];
		 		pal[i][1] = sys_pal[i][1];
				pal[i][2] = sys_pal[i][2];
			} else if( app.nplanes >= 8 ) {
				if ( i < OFFSET_CUST_PAL ){
					pal[i][0] = vdi_web_pal[i-OFFSET_WEB_PAL][0];
					pal[i][1] = vdi_web_pal[i-OFFSET_WEB_PAL][1];
					pal[i][2] = vdi_web_pal[i-OFFSET_WEB_PAL][2];
					//set the new palette color to websafe value:
					vs_color( self->vdi_handle, i, &pal[i][0] );
				}
				if( i >= OFFSET_CUST_PAL && i<OFFSET_CUST_PAL+16 ) {
					/* here we define 20 additional gray colors... */
					rgbcol[1] = rgbcol[2] = rgbcol[3] = ((graytone&0x0F) << 4);
					rgb_to_vdi1000( &rgbcol[0], &pal[i][0] );
					vs_color( self->vdi_handle, i, &pal[i][0] );
					graytone++;
				}

			}
			vdi1000_to_rgb( &pal[i][0],  &rgb_lookup[i][0] );
		}

	} else {
		/* no need to change the palette - its application specific */
	}


#endif

	unsigned long flags = ( self->flags & PLOT_FLAG_DITHER ) ? HERMES_CONVERT_DITHER : 0;
	hermes_cnv_h = Hermes_ConverterInstance( flags );
	assert( hermes_cnv_h );
	hermes_res_h = Hermes_ConverterInstance( flags );
	assert( hermes_res_h );

	/* set up the src & dst format: */
	/* netsurf uses RGBA ... */
	DUMMY_PRIV(self)->nsfmt.a = 0xFFUL;
	DUMMY_PRIV(self)->nsfmt.b = 0x0FF00UL;
	DUMMY_PRIV(self)->nsfmt.g = 0x0FF0000UL;
	DUMMY_PRIV(self)->nsfmt.r = 0x0FF000000UL;
	DUMMY_PRIV(self)->nsfmt.bits = 32;
	DUMMY_PRIV(self)->nsfmt.indexed = false;
	DUMMY_PRIV(self)->nsfmt.has_colorkey = false;

	DUMMY_PRIV(self)->vfmt.r = vdi_sysinfo.mask_r;
	DUMMY_PRIV(self)->vfmt.g = vdi_sysinfo.mask_g;
	DUMMY_PRIV(self)->vfmt.b = vdi_sysinfo.mask_b;
	DUMMY_PRIV(self)->vfmt.a = vdi_sysinfo.mask_a;
	DUMMY_PRIV(self)->vfmt.bits = self->bpp_virt;
	DUMMY_PRIV(self)->vfmt.indexed = ( app.nplanes <= 8 ) ? 1 : 0;
	DUMMY_PRIV(self)->vfmt.has_colorkey = 0;

	return( 1 );
}
Exemple #24
0
void slideshow()
{
	VEIL				*tv;
	LEDP				*led;
	int				i,j,k,l;
	typedef int		t_rgb[3];
	t_rgb				*col;
	int				pal;
	long				len;
	int				wha,wx,wy,ww,wh;

	wind_update(BEG_MCTRL);
	graf_mouse(M_OFF,NULL);
	time(&t2);
	shift=(int)Kbshift(-1);

	if (glb.opt.deskfull)
	{
		wx=glb.aes.desk.x;		wy=glb.aes.desk.y;
		ww=glb.aes.desk.w;		wh=glb.aes.desk.h;
	}
	else
	{
		wx=0;							wy=0;
		ww=1+glb.vdi.wscr;		wh=1+glb.vdi.hscr;
	}
	wha=wind_create(0,0,0,1+glb.vdi.wscr,1+glb.vdi.hscr);
	if (wha<=0)
	{
		form_alert(1,glb.rsc.head.frstr[NOWIN]);
		graf_mouse(M_ON,NULL);
		graf_mouse(ARROW,NULL);
		wind_update(END_MCTRL);
		return;
	}

	_menuBar(glb.aes.tree.menu,FALSE);

	wind_open(wha,wx,wy,ww,wh);
	wind_get(wha,WF_CURRXYWH,&wx,&wy,&ww,&wh);

	if (glb.opt.is_tv && glb.opt.sl_tv)
	{
		tv=(VEIL *)_cookie('VeiL');
		j=(int)tv->stop;
		tv->stop=0xFF;
	}
	if (glb.opt.is_led && glb.opt.sl_led)
	{
		led=(LEDP *)_cookie('LEDP');
		k=led->active;
		led->active&=~1;
	}

	len=(long)glb.vdi.out[13]*(long)sizeof(t_rgb);
	pal=_mAlloc(len,FALSE);
	glb.opt.mask=0;
	if (pal!=NO_MEMORY)
	{
		col=(t_rgb *)glb.mem.adr[pal];
		for (i=0;i<glb.vdi.out[13];i++)
			vq_color(glb.vdi.ha,i,1,(int *)col[i]);
	}

	glb.div.slide=TRUE;

	l=Balaie_Path(glb.opt.sl_path,wx,wy,ww,wh);
	if (!l && glb.opt.sl_loop && num>0)
		do
		{
			l=Balaie_Path(glb.opt.sl_path,wx,wy,ww,wh);
		}	while (!l);

	glb.div.slide=FALSE;
	updFreeMem();

	if (pal!=NO_MEMORY)
	{
		col=(t_rgb *)glb.mem.adr[pal];
		for (i=0;i<glb.vdi.out[13];i++)
			vs_color(glb.vdi.ha,i,(int *)col[i]);
		_mFree(pal);
	}

	if (glb.opt.is_tv && glb.opt.sl_tv)
	{
		tv=(VEIL *)_cookie('VeiL');
		tv->stop=j;
	}
	if (glb.opt.is_led && glb.opt.sl_led)
	{
		led=(LEDP *)_cookie('LEDP');
		led->active=k;
	}

	wind_close(wha);
	wind_delete(wha);

	_menuBar(glb.aes.tree.menu,TRUE);

	graf_mouse(M_ON,NULL);
	graf_mouse(ARROW,NULL);
	wind_update(END_MCTRL);
}