⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 w32g_subwin2.c

📁 linux上播放midi音乐,但是要一些设置.可网上查找. 软件名称: TiMidity++-2.13.0.tar
💻 C
📖 第 1 页 / 共 5 页
字号:
				}			}			SetRect ( &rc[rc_max++], x1, y1, x2+1, y2+1 );		}	}	wrd_wnd_unlock();	if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) {		for ( i = 0; i < rc_max; i ++ ) {			wrd_graphic_apply ( &rc[i], w32g_wrd_wnd.index_display, TRUE );			wrd_graphic_update ( &rc[i], TRUE );			InvalidateRect ( w32g_wrd_wnd.hwnd, &rc[i], FALSE );		}	}}void wrd_graphic_gcircle ( int x, int y, int r, int p1, int sw, int p2 ){	if ( WrdWndInfo.GraphicStop ) return;	if ( !w32g_wrd_wnd.active ) return;	wrd_wnd_lock();	wrd_wnd_unlock();	// w32g_wrd_wnd.gmode}void wrd_graphic_pload ( char *path ){	int res;	if ( WrdWndInfo.GraphicStop ) return;	if ( !w32g_wrd_wnd.active ) return;	wrd_wnd_lock();	GdiFlush ();	res = pho_load_pixel ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits, w32g_wrd_wnd.width, w32g_wrd_wnd.height, path );	wrd_wnd_unlock();	if ( res && w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) {		RECT rc;		SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height );		wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE );		wrd_graphic_update ( &rc, TRUE );		InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE );	}}static COLORREF g4r4b4_to_rgb ( int g4r4b4 ){	return RGB ( ((g4r4b4 & 0x00F0) >> 4 ) << 4, 		((g4r4b4 & 0x0F00) >> 8 ) << 4, 		((g4r4b4 & 0x000F) >> 0 ) << 4 );}void wrd_graphic_pal_g4r4b4 ( int p, int *g4r4b4, int max ){	int i;	if ( WrdWndInfo.GraphicStop ) return;	if ( !w32g_wrd_wnd.active ) return;	if ( p < 0 ) return;	if ( p >= W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX )		return;	wrd_wnd_lock();	if ( max > W32G_WRDWND_GRAPHIC_PALLETE_MAX ) {		max = W32G_WRDWND_GRAPHIC_PALLETE_MAX;	}	for ( i = 0; i < max; i++ ) {		w32g_wrd_wnd.gpal_buff[p][i] = RGBtoRGBQUAD ( g4r4b4_to_rgb( g4r4b4[i] ) );	}	wrd_wnd_unlock();	if ( p == 0 ) {		RECT rc;#if 1		for ( i = 0; i < W32G_WRDWND_GRAPHIC_PLANE_MAX; i++ ) {			dib_set_pals ( w32g_wrd_wnd.graphic_dib[i], w32g_wrd_wnd.gpal_buff[p], max );		}#else		dib_set_pals ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display], w32g_wrd_wnd.gpal_buff[p], max );#endif		SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height );		wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE );		wrd_graphic_update ( &rc, TRUE );		InvalidateRect(w32g_wrd_wnd.hwnd, &rc, FALSE);	}}extern DWORD volatile dwMainThreadId;void wrd_graphic_palrev ( int p ){	int i;	if ( WrdWndInfo.GraphicStop ) return;	if ( !w32g_wrd_wnd.active ) return;	if ( p < 0 ) return;	if ( p >= W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX )		return;	wrd_wnd_lock();	for ( i = 0; i <W32G_WRDWND_GRAPHIC_PALLETE_MAX; i++ ) {		w32g_wrd_wnd.gpal_buff[p][i].rgbBlue = 0xFF - w32g_wrd_wnd.gpal_buff[p][i].rgbBlue;		w32g_wrd_wnd.gpal_buff[p][i].rgbGreen = 0xFF - w32g_wrd_wnd.gpal_buff[p][i].rgbGreen;		w32g_wrd_wnd.gpal_buff[p][i].rgbRed = 0xFF - w32g_wrd_wnd.gpal_buff[p][i].rgbRed;	}	wrd_wnd_unlock();	if ( p == 0 ) {		RECT rc;#if 1		for ( i = 0; i < W32G_WRDWND_GRAPHIC_PLANE_MAX; i++ ) {			dib_set_pals ( w32g_wrd_wnd.graphic_dib[i], w32g_wrd_wnd.gpal_buff[p], W32G_WRDWND_GRAPHIC_PALLETE_MAX );		}#else		dib_set_pals ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display], w32g_wrd_wnd.gpal_buff[p], W32G_WRDWND_GRAPHIC_PALLETE_MAX );#endif		SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height );		wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE );		wrd_graphic_update ( &rc, TRUE );		InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE );	}}void wrd_graphic_apply_pal ( int p ){	int i;	RECT rc;	if ( WrdWndInfo.GraphicStop ) return;	if ( !w32g_wrd_wnd.active ) return;	if ( p < 0 ) return;	if ( p >= W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX )		return;	wrd_wnd_lock();#if 1	for ( i = 0; i < W32G_WRDWND_GRAPHIC_PLANE_MAX; i++ ) {		dib_set_pals ( w32g_wrd_wnd.graphic_dib[i], w32g_wrd_wnd.gpal_buff[p], W32G_WRDWND_GRAPHIC_PALLETE_MAX );	}#else	dib_set_pals ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display], w32g_wrd_wnd.gpal_buff[p], W32G_WRDWND_GRAPHIC_PALLETE_MAX );#endif	SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height );	wrd_wnd_unlock();	wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE );	wrd_graphic_update ( &rc, TRUE );	InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE );}void wrd_graphic_fade ( int p1, int p2, int speed ){	if ( WrdWndInfo.GraphicStop ) return;	if ( !w32g_wrd_wnd.active ) return;	if ( p1 < 0 ) return;	if ( p1 >= W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX ) return;	if ( p2 < 0 ) return;	if ( p2 >= W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX ) return;	wrd_wnd_lock();	w32g_wrd_wnd.fade_from = p1;	w32g_wrd_wnd.fade_to = p2;	wrd_wnd_unlock();	if ( speed == 0 ) {		wrd_graphic_apply_pal ( p2 );	} else{//		wrd_graphic_apply_pal ( p1 );	}}void wrd_graphic_fadestep ( int v ){	int i;	RECT rc;	RGBQUAD gpal[W32G_WRDWND_GRAPHIC_PALLETE_MAX];	double v1, v2;	if ( WrdWndInfo.GraphicStop ) return;	if ( !w32g_wrd_wnd.active ) return;	if ( w32g_wrd_wnd.fade_from < 0 || w32g_wrd_wnd.fade_to < 0 )		return;	wrd_wnd_lock();	v2 = (double) v / WRD_MAXFADESTEP;	v1 = 1.0 - v2;	for ( i = 0; i < W32G_WRDWND_GRAPHIC_PALLETE_MAX; i++ ) {		RGBQUAD *rq1 = &w32g_wrd_wnd.gpal_buff[w32g_wrd_wnd.fade_from][i];		RGBQUAD *rq2 = &w32g_wrd_wnd.gpal_buff[w32g_wrd_wnd.fade_to][i];		gpal[i].rgbBlue = (char) ( v1 * rq1->rgbBlue + v2 * rq2->rgbBlue ); 		gpal[i].rgbGreen = (char) ( v1 * rq1->rgbGreen + v2 * rq2->rgbGreen );		gpal[i].rgbRed = (char) ( v1 * rq1->rgbRed + v2 * rq2->rgbRed );		gpal[i].rgbReserved = 0;	}#if 1	for ( i = 0; i < W32G_WRDWND_GRAPHIC_PLANE_MAX; i++ ) {		dib_set_pals ( w32g_wrd_wnd.graphic_dib[i], gpal, W32G_WRDWND_GRAPHIC_PALLETE_MAX );	}#else	dib_set_pals ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display], gpal, W32G_WRDWND_GRAPHIC_PALLETE_MAX );#endif	SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height );	wrd_wnd_unlock();	wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE );	wrd_graphic_update ( &rc, TRUE );#if 1	InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE );#else	{ // 僷儗僢僩偺曄壔偱慡夋柺傪峏怴偟側偄偱嵪傓傛偆偵僠僃僢僋偟偰傒傞丅偗偳丄廳偄偺偱晄嵦梡丅#define BITS_DIV 10		int j;		char *bits;		int mod_pal[W32G_WRDWND_GRAPHIC_PALLETE_MAX];		char bits_use_pal[BITS_DIV][BITS_DIV];		for ( i = 0; i < W32G_WRDWND_GRAPHIC_PALLETE_MAX; i++ ) {			if ( memcmp ( &w32g_wrd_wnd.gpal_buff[w32g_wrd_wnd.fade_from][i],				&w32g_wrd_wnd.gpal_buff[w32g_wrd_wnd.fade_to][i], sizeof (RGBQUAD) ) != 0 )				mod_pal[i] = 1;			else				mod_pal[i] = 0;		}		bits = w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display]->bits;		for ( i = 0; i < BITS_DIV; i ++ ) {			for ( j = 0; j < BITS_DIV; j ++ ) {				bits_use_pal[i][j] = 0;			}		}		for ( i = 0; i < 640; i ++ ) {			for ( j = 0; j < 400; j ++ ) {				char c = bits [ j * w32g_wrd_wnd.width + i ];				if ( c >= 0 && c <= 0x0F && mod_pal[ c ] )					bits_use_pal[BITS_DIV*i/640][BITS_DIV*j/400] = 1;			}		}		for ( i = 0; i < BITS_DIV; i ++ ) {			for ( j = 0; j < BITS_DIV; j ++ ) {				if ( bits_use_pal[i][j] )					SetRect ( &rc, i * 640/BITS_DIV, j * 400/BITS_DIV, ( i + 1) * 640/BITS_DIV, ( j + 1) * 400/BITS_DIV );					InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE );			}		}	}#endif}void wrd_graphic_gmode ( int sw ){	w32g_wrd_wnd.gmode = sw;}void wrd_graphic_gmove ( int x1, int y1, int x2, int y2, int xd, int yd, int vs, int vd, int sw ){	int x, y;	if ( WrdWndInfo.GraphicStop ) return;	if ( !w32g_wrd_wnd.active ) return;	if ( vs < 0 || vs >= 2 || vd < 0 || vd >= 2 ) return;	if ( x1 < 0 || x1 >= w32g_wrd_wnd.width ) return;	if ( y1 < 0 || y1 >= w32g_wrd_wnd.height ) return;	if ( xd < 0 || xd >= w32g_wrd_wnd.width ) return;	if ( yd < 0 || yd >= w32g_wrd_wnd.height ) return;	wrd_wnd_lock();	GdiFlush ();	x1 = ( ( x1 + 7 ) / 8 ) * 8;	x2 = ( ( x2 + 7 ) / 8 ) * 8;	xd = ( ( xd + 7 ) / 8 ) * 8;	if ( xd + x2 - x1 >= w32g_wrd_wnd.width ) {		int d =  w32g_wrd_wnd.width - 1 - xd;		x2 = x1 + d; 	}	if ( yd + y2 - y1 >= w32g_wrd_wnd.height ) {		int d =  w32g_wrd_wnd.height - 1 - yd;		y2 = y1 + d; 	}	switch ( sw ) {	default:	case 0:	// COPY		for ( y = y1; y <= y2; y ++ ) {			int i_src = y * w32g_wrd_wnd.width;			int i_dest = (yd + y - y1) * w32g_wrd_wnd.width;			if ( w32g_wrd_wnd.gmode >= 0x0F ) {				memcpy ( &w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest + xd],					&w32g_wrd_wnd.graphic_dib[vs]->bits[i_src + x1], x2 - x1 + 1 );			} else {				for ( x = x1; x <= x2; x ++ ) {					int i_dest_tmp = i_dest + xd + x - x1;					int i_src_tmp = i_src + x;					w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest_tmp]						= w32g_wrd_wnd.graphic_dib[vs]->bits[i_src_tmp] & w32g_wrd_wnd.gmode;				}			}		}		break;	case 1:	// SWAP		for ( y = y1; y <= y2; y ++ ) {			int i_src = y * w32g_wrd_wnd.width;			int i_dest = (yd + y - y1) * w32g_wrd_wnd.width;			if ( w32g_wrd_wnd.gmode >= 0x0F ) {				char buff[640+1];				int d = x2 - x1 + 1;				memcpy ( buff, &w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest + xd], d );				memcpy ( &w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest + xd],					&w32g_wrd_wnd.graphic_dib[vs]->bits[i_src + x1], d );				memcpy ( &w32g_wrd_wnd.graphic_dib[vs]->bits[i_src + x1], buff, d );			} else {				for ( x = x1; x <= x2; x ++ ) {					int i_dest_tmp = i_dest + xd + x - x1;					int i_src_tmp = i_src + x;					char t = w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest_tmp];					w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest_tmp]						= ( w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest_tmp] & ~w32g_wrd_wnd.gmode )							| ( w32g_wrd_wnd.graphic_dib[vs]->bits[i_src_tmp] & w32g_wrd_wnd.gmode );					w32g_wrd_wnd.graphic_dib[vs]->bits[i_src_tmp]						= ( w32g_wrd_wnd.graphic_dib[vs]->bits[i_src_tmp]  & ~w32g_wrd_wnd.gmode )							| t & w32g_wrd_wnd.gmode;				}			}		}		break;	}	wrd_wnd_unlock();	if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) {		RECT rc;		SetRect ( &rc, xd, yd, xd + x2 - x1, yd + y2 - y1 );		wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE );		wrd_graphic_update ( &rc, TRUE );		InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE );	}}void wrd_graphic_mag ( char *path, int x, int y, int s, int p ){	int x_orig = x, y_orig = y;	int size = w32g_wrd_wnd.width * w32g_wrd_wnd.height;	magdata *mh;	int width, height;	if ( WrdWndInfo.GraphicStop ) return;	if ( !w32g_wrd_wnd.active ) return;	mh = mag_create ( path );	if ( x_orig == WRD_NOARG )		x_orig = 0;	if ( y_orig == WRD_NOARG )		y_orig = 0;	if ( mh == NULL )		return;	width = mh->xend - mh->xorig + 1;	height = mh->yend - mh->yorig + 1;	if (MAG_WORK_WIDTH < width )		return;	if ( MAG_WORK_HEIGHT < height )		return;	if ( s <= 0 )		return;	wrd_wnd_lock();	GdiFlush ();	if ( wrd_graphic_pal_init_flag == 0 ) { /* MIMPI BUG ? */		if ( p == 1 ) p = 0;		wrd_graphic_pal_init_flag = 1;	}	if ( p == 0 || p == 1 ) {		if ( s == 1 && x_orig == 0 && y_orig == 0 && width <= w32g_wrd_wnd.width && height <= w32g_wrd_wnd.height ) {			mag_load_pixel ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits,				w32g_wrd_wnd.width, w32g_wrd_wnd.height, mh );		} else {#if 1			mag_load_pixel ( w32g_wrd_wnd.bits_mag_work,				MAG_WORK_WIDTH, MAG_WORK_HEIGHT, mh );			for ( y = 0; y < height; y ++ ) {				int dest_index = (y_orig + y/s) * w32g_wrd_wnd.width;				int src_index = y * MAG_WORK_WIDTH;				long v[MAG_WORK_WIDTH];				for ( x = 0; x < width; x ++ )					v[x] = 0;				for ( x = 0; x < width; x ++ ) {					v[x/s] += w32g_wrd_wnd.bits_mag_work[ src_index + x ];				}				for ( x = 0; x < width; x ++ ) {					if ( v[x/s] >= 0 ) {						int i_tmp = dest_index + x_orig + x/s;						if ( i_tmp < MAG_WORK_WIDTH * MAG_WORK_HEIGHT )							w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits[i_tmp] = ( v[x/s] / s / s ) & 0x0F;						v[x/s] = -1;					}				}			}			width /= s;			height /= s;#else			mag_load_pixel ( w32g_wrd_wnd.bits_mag_work,				MAG_WORK_WIDTH, MAG_WORK_HEIGHT, mh );			for ( y = 0; y < height; y ++ ) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -