📄 w32g_subwin2.c
字号:
for ( x = 0; x < width; x ++ ) { w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits[(y_orig + y) * w32g_wrd_wnd.width + x_orig + x] = w32g_wrd_wnd.bits_mag_work[ y * MAG_WORK_WIDTH + x]; } }#endif } } wrd_wnd_unlock(); wrd_graphic_pal_g4r4b4 ( 17, mh->pal, 16 ); if ( w32g_wrd_wnd.index_active == 0 ) wrd_graphic_pal_g4r4b4 ( 18, mh->pal, 16 ); if ( w32g_wrd_wnd.index_active == 1 ) wrd_graphic_pal_g4r4b4 ( 19, mh->pal, 16 ); if ( p == 0 || p == 2 ) { wrd_graphic_pal_g4r4b4 ( 0, mh->pal, 16 ); } else { // wrd_graphic_pal_g4r4b4() 傪幚峴偟側偄偲椞堟偑峏怴偝傟側偄丅 if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { RECT rc; SetRect ( &rc, x_orig, y_orig, width, 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_text_ton ( int sw ){ int sw_old = w32g_wrd_wnd.flag & WRD_FLAG_TEXT; if ( !w32g_wrd_wnd.active ) return; if ( sw && !sw_old ) { w32g_wrd_wnd.flag |= WRD_FLAG_TEXT; // 愭偵愝掕 if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { wrd_text_update ( 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height, TRUE ); } } else if ( !sw && sw_old ) { if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { wrd_text_update ( 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height, TRUE ); } } if ( sw ) w32g_wrd_wnd.flag |= WRD_FLAG_TEXT; else w32g_wrd_wnd.flag &= ~WRD_FLAG_TEXT;}void wrd_text_scroll ( int x1, int y1, int x2, int y2, int mode, int color, int c ){ int x, y; x1--; x2--; y1--; y2--; if ( !w32g_wrd_wnd.active ) return; if ( x1 > x2 ) return; if ( y1 > y2 ) return; if ( x1 < 0 ) x1 = 0; if ( x2 < 0 ) x2 = 0; if ( x1 >= w32g_wrd_wnd.row ) x1 = w32g_wrd_wnd.row - 1; if ( x2 >= w32g_wrd_wnd.row ) x2 = w32g_wrd_wnd.row - 1; if ( y1 < 0 ) y1 = 0; if ( y2 < 0 ) y2 = 0; if ( y1 >= w32g_wrd_wnd.row ) y1 = w32g_wrd_wnd.col - 1; if ( y2 >= w32g_wrd_wnd.row ) y2 = w32g_wrd_wnd.col - 1; wrd_wnd_lock(); if ( mode == 0 ) { int dx = x2 - x1 + 1; for ( y = y1+1; y <= y2; y ++ ) { memcpy ( &w32g_wrd_wnd.textbuf [ y - 1 ][x1], &w32g_wrd_wnd.textbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.forecolorbuf [ y - 1 ][x1], &w32g_wrd_wnd.forecolorbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.backcolorbuf [ y - 1 ][x1], &w32g_wrd_wnd.backcolorbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.attrbuf [ y - 1 ][x1], &w32g_wrd_wnd.attrbuf [ y ][x1], dx ); } WrdWndCurStateSaveAndRestore ( 1 ); WrdWndSetAttr98 ( color ); for ( x = x1; x <= x2; x ++ ) { w32g_wrd_wnd.textbuf [ y2][x] = c; w32g_wrd_wnd.forecolorbuf [ y2][x] = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.backcolorbuf [ y2][x] = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.attrbuf [ y2][x] = w32g_wrd_wnd.curattr; } WrdWndCurStateSaveAndRestore ( 0 ); } else if ( mode == 1 ) { int dx = x2 - x1 + 1; for ( y = y2 - 1; y >= y1; y -- ) { memcpy ( &w32g_wrd_wnd.textbuf [ y + 1 ][x1], &w32g_wrd_wnd.textbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.forecolorbuf [ y + 1 ][x1], &w32g_wrd_wnd.forecolorbuf [ y ], dx ); memcpy ( &w32g_wrd_wnd.backcolorbuf [ y + 1 ][x1], &w32g_wrd_wnd.backcolorbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.attrbuf [ y + 1 ][x1], &w32g_wrd_wnd.attrbuf [ y ][x1], dx ); } WrdWndCurStateSaveAndRestore ( 1 ); WrdWndSetAttr98 ( color ); for ( x = x1; x <= x2; x ++ ) { w32g_wrd_wnd.textbuf [ y1][x] = c; w32g_wrd_wnd.forecolorbuf [ y1][x] = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.backcolorbuf [ y1][x] = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.attrbuf [ y1][x] = w32g_wrd_wnd.curattr; } WrdWndCurStateSaveAndRestore ( 0 ); } else if ( mode == 2 ) { for ( y = y1; y <= y2; y ++ ) { for ( x = x1+1; x <= x2; x ++ ) { w32g_wrd_wnd.textbuf [ y ][ x ] = w32g_wrd_wnd.textbuf [ y ][ x - 1]; w32g_wrd_wnd.forecolorbuf[ y ][ x ] = w32g_wrd_wnd.forecolorbuf [ y ][ x - 1]; w32g_wrd_wnd.backcolorbuf [ y ][ x ] = w32g_wrd_wnd.backcolorbuf [ y ][ x - 1]; w32g_wrd_wnd.attrbuf [ y ][ x ] = w32g_wrd_wnd.attrbuf [ y ][ x - 1]; } } WrdWndCurStateSaveAndRestore ( 1 ); WrdWndSetAttr98 ( color ); for ( y = y1; y <= y2; y ++ ) { w32g_wrd_wnd.textbuf [ y ][ x1] = c; w32g_wrd_wnd.forecolorbuf [ y ][ x1] = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.backcolorbuf [ y ][ x1] = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.attrbuf [ y ][ x1] = w32g_wrd_wnd.curattr; } WrdWndCurStateSaveAndRestore ( 0 ); } else if ( mode == 3 ) { for ( y = y1; y <= y2; y ++ ) { for ( x = x2 - 1; x >= x1; x -- ) { w32g_wrd_wnd.textbuf [ y ][ x ] = w32g_wrd_wnd.textbuf [ y ][ x + 1]; w32g_wrd_wnd.forecolorbuf[ y ][ x ] = w32g_wrd_wnd.forecolorbuf [ y ][ x + 1]; w32g_wrd_wnd.backcolorbuf [ y ][ x ] = w32g_wrd_wnd.backcolorbuf [ y ][ x + 1]; w32g_wrd_wnd.attrbuf [ y ][ x ] = w32g_wrd_wnd.attrbuf [ y ][ x + 1]; } } WrdWndCurStateSaveAndRestore ( 1 ); WrdWndSetAttr98 ( color ); for ( y = y1; y <= y2; y ++ ) { w32g_wrd_wnd.textbuf [ y ][ x2] = c; w32g_wrd_wnd.forecolorbuf [ y ][ x2] = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.backcolorbuf [ y ][ x2] = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.attrbuf [ y ][ x2] = w32g_wrd_wnd.curattr; } WrdWndCurStateSaveAndRestore ( 0 ); } wrd_wnd_unlock(); wrd_text_update ( x1, y1, x2, y2, TRUE );}void wrd_start_skip ( void ){ wrd_wnd_lock(); w32g_wrd_wnd.draw_skip = 1; wrd_wnd_unlock();}void wrd_end_skip ( void ){ w32g_wrd_wnd.draw_skip = 0; wrd_text_update ( 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height, TRUE );}void wrd_graphic_xcopy ( int sx1, int sy1, int sx2, int sy2, int tx, int ty, int ss, int ts, int method, int opt1, int opt2, int opt3, int opt4, int opt5 ){#if 0 int x, y, d, size = w32g_wrd_wnd.width * w32g_wrd_wnd.height; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( ss < 0 || ss >= 2 || ts < 0 || ts >= 2 ) return; if ( sx1 < 0 || sx1 >= w32g_wrd_wnd.width ) return; if ( sy1 < 0 || sy1 >= w32g_wrd_wnd.height ) return; if ( tx < 0 || tx >= w32g_wrd_wnd.width ) return; if ( ty < 0 || ty >= w32g_wrd_wnd.height ) return; wrd_wnd_lock(); GdiFlush (); if ( tx + sx2 - sx1 >= w32g_wrd_wnd.width ) { d = w32g_wrd_wnd.width - 1 - tx; sx2 = sx1 + d; } if ( ty + sy2 - sy1 >= w32g_wrd_wnd.height ) { d = w32g_wrd_wnd.height - 1 - ty; sy2 = sy1 + d; } switch ( method ) { case 0: // COPY d = sx2 - sx1 + 1; for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; memcpy ( &w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest + tx], &w32g_wrd_wnd.graphic_dib[ss]->bits[i_src + sx1], d ); } break; case 1: // COPY EXCEPT 0 for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; char c = w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; if ( c != 0 ) w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] = c; } } break; case 2: // XOR for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] ^= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 3: // AND for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] &= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 4: // OR for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] |= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 5: // X REVERSE for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + sx2 - x; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] |= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 6: // Y REVERSE d = sx2 - sx1 + 1; for ( y = sy1; y <= sy2; y ++ ) { int i_src = ( sy1 + sy2 - y ) * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; memcpy ( &w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest + tx], &w32g_wrd_wnd.graphic_dib[ss]->bits[i_src + sx1], d ); } break; case 7: // X Y REVERSE for ( y = sy1; y <= sy2; y ++ ) { int i_src = ( sy1 + sy2 - y ) * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + sx2 - x; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] |= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 8: // COPY2 for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; char c = w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; if ( c != 0 ) w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] = c; else { i_src_tmp = ( opt2 + y - sy1) * w32g_wrd_wnd.width + opt1 + x - sx1; if ( 0 <= i_src_tmp && i_src_tmp < size ) w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] = w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } } break; case 9: // 偪傚偭偲傢偐傜側偐偭偨丅 break; case 10: // COPY opt1, opt2 if ( opt1 < 0 || opt2 < 0 ) break; d = sx2 - sx1 + 1; for ( y = sy1; y <= sy2; y ++ ) { int i_src, i_dest; if ( (y - sy1) % ( opt1 + opt2 ) >= opt2 ) continue; i_src = y * w32g_wrd_wnd.width; i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; memcpy ( &w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest + tx], &w32g_wrd_wnd.graphic_dib[ss]->bits[i_src + sx1], d ); } break; case 11: // Clipping Copy 傆偮偆偺僐僺乕偱戙梡丅 d = sx2 - sx1 + 1; for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; memcpy ( &w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest + tx], &w32g_wrd_wnd.graphic_dib[ss]->bits[i_src + sx1], d ); } break; case 12: // PLANE COPY if ( opt1 < 0 || opt1 >= 4 || opt2 < 0 || opt2 >= 4 ) break; for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; char c = w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; c = ( ( c & ( 1 << opt1) ) >> opt1 ) << opt2; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] = c; } } break; default: break; } wrd_wnd_unlock(); if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { RECT rc; SetRect ( &rc, tx, ty, tx + sx2 - sx1, ty + sy2 - sy1 ); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); }#endif}void WrdWndReset(void){ int i; wrd_wnd_lock(); w32g_wrd_wnd.curposx = 0; w32g_wrd_wnd.curposy = 0; w32g_wrd_wnd.curforecolor = W32G_WRDWND_WHITE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; for ( i = 0; i < w32g_wrd_wnd.col; i++ ) { memset ( w32g_wrd_wnd.textbuf[i], 0x20, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.forecolorbuf[i], w32g_wrd_wnd.curforecolor, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.backcolorbuf[i], w32g_wrd_wnd.curbackcolor, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.attrbuf[i], w32g_wrd_wnd.curattr, w32g_wrd_wnd.row); } wrd_graphic_pal_init_flag = 0; wrd_wnd_unlock(); wrd_text_update ( 0, 0, w32g_wrd_wnd.row - 1, w32g_wrd_wnd.col - 1, TRUE ); wrd_graphic_ginit ();}void WrdWndCurStateSaveAndRestore(int saveflag){ static int saved_curposx = 0; static int saved_curposy = 0; static int saved_curforecolor = W32G_WRDWND_WHITE; static int saved_curbackcolor = W32G_WRDWND_BLACK; static int saved_curattr = 0; if ( saveflag ) { saved_curforecolor = w32g_wrd_wnd.curforecolor; saved_curbackcolor = w32g_wrd_wnd.curbackcolor;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -