Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

OVGABUF2.CPP Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

OVGABUF2.CPP

Go to the documentation of this file.
00001 //Filename    : OVGABUF2.CPP
00002 //Description : OVGABUF direct draw surface class - part 2
00003 
00004 #include <ALL.H>
00005 #include <IMGFUN.H>
00006 #include <OMOUSE.H>
00007 #include <OPOWER.H>
00008 #include <OCOLTBL.H>
00009 #include <OVGA.H>
00010 #include <OVGABUF.H>
00011 #include <OIMGRES.H>
00012 #include <OSYS.H>
00013 #include <OFONT.H>
00014 #include <OBITMAP.H>
00015 #include <OBITMAPW.H>
00016 
00017 //------- Define static class member vars ---------//
00018 
00019 short VgaBuf::color_scheme;
00020 char  VgaBuf::color_light;
00021 char  VgaBuf::color_dark;
00022 char  VgaBuf::color_up;
00023 char  VgaBuf::color_down;
00024 char  VgaBuf::color_push;
00025 char  VgaBuf::color_border;
00026 
00027 //---------- Begin of function VgaBuf::set_color ---------//
00033 void VgaBuf::set_color(int colorScheme) {
00034     color_scheme = colorScheme;
00035 
00036     color_light  = colorScheme;
00037     color_dark   = colorScheme+8;
00038     color_up     = colorScheme+4;                   // color_up   = colorScheme+2
00039     color_down   = colorScheme+2;                   // color_down = colorScheme
00040     color_push   = colorScheme+6;
00041     color_border = colorScheme+10;
00042 }
00043 
00044 //------------ End of function VgaBuf::set_color ---------//
00045 
00046 //------------- Begin of function VgaBuf::bar --------------//
00056 void VgaBuf::bar(int x1,int y1,int x2,int y2,int colorCode) {
00057     err_when( !buf_locked );
00058 
00059     if(sys.no_true_output_flag)
00060         if( is_front )
00061             return;
00062 
00063     if( is_front )
00064         mouse.hide_area(x1,y1,x2,y2);
00065 
00066     //  IMGbar(buf_ptr(), buf_true_pitch(), x1, y1, x2, y2, translate_color(colorCode) );
00067 
00068     for(int j=y1;j<=y2;j++)
00069         for(int i=x1;i<=x2;i++) {
00070             short readpixel=(*(buf_ptr()+buf_pitch()*j+i));
00071 
00072             if(((colorCode!=5)&&(colorCode!=Vga::active_buf->color_dark))
00073                ||(readpixel!=translate_color(193)))
00074                 draw_pixel(i,j,colorCode);
00075         }
00076 
00077     if( is_front )
00078         mouse.show_area();
00079 }
00080 
00081 //--------------- End of function VgaBuf::bar --------------//
00082 
00083 /*
00084 //------------- Begin of function VgaBuf::pixelize --------------//
00092 void VgaBuf::pixelize(int x1,int y1,int x2,int y2,int colorCode)
00093 {
00094 err_when( !buf_locked );
00095 
00096 if( is_front )
00097 mouse.hide_area(x1,y1,x2,y2);
00098 
00099 //---------------------------------------//
00100 
00101 // ###### begin Gilbert 7/7 #########//
00102 int     bufPitch = buf_pitch();
00103 int   x, y, lineRemainBytes = bufPitch - (x2-x1+1);
00104 char* writePtr = buf_ptr() + bufPitch * y1 + x1;
00105 
00106 for( y=y1 ; y<=y2 ; y++ )
00107 {
00108 if( y&1 )
00109 {
00110 writePtr+=bufPitch;
00111 }
00112 else
00113 {
00114 for( x=x1 ; x<=x2 ; x++, writePtr++ )
00115 {
00116 if( x&1 )
00117 *writePtr = colorCode;
00118 }
00119 
00120 writePtr+=lineRemainBytes;
00121 }
00122 }
00123 // ###### end Gilbert 7/7 #########//
00124 
00125 //---------------------------------------//
00126 
00127 if( is_front )
00128 mouse.show_area();
00129 }
00130 //--------------- End of function VgaBuf::pixelize --------------//
00131 */
00132 
00133 //------------- Begin of function VgaBuf::rect --------------//
00144 void VgaBuf::rect(int x1,int y1,int x2,int y2,int lt, int color) {
00145     lt--;
00146 
00147     bar(x1,y1,x2,y1+lt,color);
00148     bar(x1,y1,x1+lt,y2,color);
00149     bar(x1,y2-lt,x2,y2,color);
00150     bar(x2-lt,y1,x2,y2,color);
00151 }
00152 
00153 //--------------- End of function VgaBuf::rect --------------//
00154 
00155 //------------- Start of function VgaBuf::d3_rect --------------//
00156 //
00157 // Draw a d3 rect on VGA screen
00158 //
00159 // Syntax : d3_rect( x1, y1, x2, y2, lineWidth, color )
00160 //
00161 // int x1,y1       - the top left vertex of the d3_rect
00162 // int x2,y2       - the bottom right vertex of the d3_rect
00163 
00164 void VgaBuf::d3_rect(int x1,int y1,int x2,int y2) {
00165     rect( x1+1, y1+1, x2, y2, 1, V_WHITE );
00166     rect( x1, y1, x2-1, y2-1, 1, VGA_GRAY+8 );
00167 }
00168 
00169 //--------------- End of function VgaBuf::d3_rect --------------//
00170 
00171 //------------- Start of function VgaBuf::tile --------------//
00172 //
00173 // Fill an area with a specific tile
00174 //
00175 // <int>   x1,y1    - the top left vertex of the tile
00176 // <int>   x2,y2    - the bottom right vertex of the tile
00177 // <char*> tileName - the name of the tile
00178 //
00179 void VgaBuf::tile(int x1,int y1,int x2,int y2,char* tileName) {
00180     err_if( x1>x2 || y1>y2 || x1<0 || y1<0 || x2>=VGA_WIDTH || y2>=VGA_HEIGHT )
00181         err_now( "VgaBuf::tile" );
00182     /*
00183       if( is_front )
00184       mouse.hide_area( x1,y1,x2,y2 );
00185 
00186       char* tilePtr = image_tile.get_ptr(tileName);
00187 
00188       if( tilePtr )
00189       VGAtile(x1,y1,x2,y2,tilePtr);
00190 
00191       if( is_front )
00192       mouse.show_area();
00193     */
00194 }
00195 
00196 //--------------- End of function VgaBuf::tile --------------//
00197 
00198 //------------- Start of function VgaBuf::separator --------------//
00199 //
00200 // Draw a VGA separator line
00201 //
00202 // Syntax : separator( x1, y1, x2, y2 )
00203 //
00204 // int x1,y1       - the top left vertex of the separator
00205 // int x2,y2       - the bottom right vertex of the separator
00206 //
00207 void VgaBuf::separator(int x1, int y1, int x2, int y2) {
00208     if( y1+1==y2 ) {                                // horizontal line
00209         bar( x1, y1, x2, y1, V_WHITE        );
00210         bar( x1, y2, x2, y2, color_dark );
00211     }
00212     else {
00213         bar( x1, y1, x1, y2, V_WHITE        );
00214         bar( x2, y1, x2, y2, color_dark );
00215     }
00216 }
00217 
00218 //--------------- End of function VgaBuf::separator --------------//
00219 
00220 //------------- Start of function VgaBuf::indicator --------------//
00221 //
00222 // <int>   x1, y1, x2, y2 = coordination of the indicator
00223 // <float> curValue       = the value of the bar
00224 // <float> maxValue       = max value, the bar width = maxBarWidth * curValue / maxValue
00225 // <int>   indiColor      = color of the indicator
00226 // [int]   backColor      = background color
00227 //                          (default : vga.color_down)
00228 //                          (-2 if don't paint background color)
00229 //
00230 void VgaBuf::indicator(int x1, int y1, int x2, int y2, float curValue,
00231                        float maxValue, int indiColor, int backColor) {
00232     if(sys.no_true_output_flag)
00233         if( is_front )
00234             return;
00235 
00236     if( backColor == -1 )
00237         backColor = color_down;
00238 
00239     if( curValue > maxValue )
00240         curValue = maxValue;
00241 
00242     if( curValue > 0 ) {
00243         int barWidth = (int) ((float)(x2-x1) * curValue / maxValue);
00244 
00245         int halfHeight = (y2-y1+1)/2-1;
00246         int tx2        = x1+barWidth;
00247         int y;
00248         double ic=indiColor;
00249 
00250         ic+=halfHeight;
00251 
00252         bar( x1-1, y1-1, x1+barWidth+1, y2+1, V_BLACK );
00253 
00254         for( y=y1 ; y<y1+(halfHeight/2) ; y++, ic-=2.0 )
00255             bar( x1, y, tx2, y, (int)ic);
00256 
00257         for( ; y<=y2 ; y++, ic+=0.75 )
00258             bar( x1, y, tx2, y, (int)ic );
00259 
00260         if( backColor != -2 ) {                       // -2 if don't paint background color
00261             if( x1+barWidth < x2 )
00262                 bar( x1+barWidth+1, y1, x2, y2, backColor );
00263         }
00264     }
00265     else {
00266         if( backColor != -2 )                         // -2 if don't paint background color
00267             bar( x1, y1, x2, y2, backColor );
00268     }
00269 
00270 }
00271 
00272 //--------------- End of function VgaBuf::indicator --------------//
00273 
00274 //------------- Start of function VgaBuf::v_indicator --------------//
00275 //
00276 // <int>   x1, y1, x2, y2 = coordination of the indicator
00277 // <float> curValue       = the value of the bar
00278 // <float> maxValue       = max value, the bar width = maxBarWidth * curValue / maxValue
00279 // <int>   indiColor      = color of the indicator
00280 // [int]   backColor      = background color
00281 //                          (default : vga.color_down)
00282 //                          (-2 if don't paint background color)
00283 //
00284 void VgaBuf::v_indicator(int x1, int y1, int x2, int y2, float curValue,
00285                          float maxValue, int indiColor, int backColor) {
00286     if(sys.no_true_output_flag)
00287         if( is_front )
00288             return;
00289 
00290     if( backColor == -1 )
00291         backColor = color_down;
00292 
00293     if( curValue > maxValue )
00294         curValue = maxValue;
00295 
00296     if( curValue > 0 ) {
00297         int barHeight = (int) ((float)(y2-y1) * curValue / maxValue);
00298 
00299         int halfWidth = (x2-x1+1)/2-1;
00300         int ty2        = y1+barHeight;
00301         int x;
00302 
00303         indiColor+=halfWidth;
00304 
00305         for( x=x1 ; x<x1+halfWidth; x++, indiColor-- )
00306             bar( x, y1, x, ty2, indiColor );
00307 
00308         for( ; x<=x2 ; x++, indiColor++ )
00309             bar( x, y1, x, ty2, indiColor );
00310 
00311         if( backColor != -2 ) {                       // -2 if don't paint background color
00312             if( y1+barHeight < y2 )
00313                 bar( x1, y1+barHeight+1, x2, y2, backColor );
00314         }
00315     }
00316     else {
00317         if( backColor != -2 )                         // -2 if don't paint background color
00318             bar( x1, y1, x2, y2, backColor );
00319     }
00320 }
00321 
00322 //--------------- End of function VgaBuf::v_indicator --------------//
00323 
00324 /*
00325 //------------- Start of function VgaBuf::indicator --------------//
00326 //
00327 // <int>   barType        = bar style, bit 0 = disp curValue, bit 1 =  disp '/' and maxValue, bit 2 = longer bar, bit 3 = use another back buffer
00328 // <int>   x1, y1         = coordination of the indicator
00329 // <float> curValue       = the value of the bar
00330 // <float> maxValue       = max value, the bar width = maxBarWidth * curValue / maxValue
00331 // <int>   colorScheme    = color of the indicator // not used
00332 //
00333 void VgaBuf::indicator(int barType, int x1, int y1, float curValue, float maxValue, int colorScheme)
00334 {
00335 // -------- get indicator bar background ------------//
00336 
00337 const TEMP_BUFFER_SIZE = 0x2000;
00338 static short tempBuffer[TEMP_BUFFER_SIZE];
00339 
00340 char *bgPtr = image_button.get_ptr(barType & 4 ? "V_HP-BX" : "V_PW-BX");
00341 if( !bgPtr )
00342 {
00343 err_here();
00344 return;
00345 }
00346 
00347 // -------- calculate the boundary or the indicator ---------//
00348 int width = ((Bitmap *)bgPtr)->get_width();
00349 int height = ((Bitmap *)bgPtr)->get_height();
00350 
00351 int bufferX1 = x1;
00352 int bufferY1 = y1;
00353 
00354 short *destPtr = buf_ptr();
00355 int destPitch = buf_true_pitch();
00356 
00357 if(barType & 8)
00358 {
00359 if( ((Bitmap *)bgPtr)->size() < TEMP_BUFFER_SIZE )
00360 {
00361 bufferX1 = 0;
00362 bufferY1 = 0;
00363 ((BitmapW *)tempBuffer)->init(width, height);
00364 destPtr = ((BitmapW *)tempBuffer)->bitmap;
00365 destPitch = ((BitmapW *)tempBuffer)->get_true_pitch();
00366 }
00367 else
00368 {
00369 barType &= ~8;          // indicator too big, directly write to the buffer
00370 }
00371 }
00372 
00373 int x2 = x1 + width -1;
00374 int y2 = y1 + height -1;
00375 int bufferX2 = bufferX1 + width -1;
00376 int bufferY2 = bufferY1 + height -1;
00377 
00378 // -------- draw background ---------//
00379 
00380 if( is_front )
00381 mouse.hide_area(x1, y1, x2, y2 );
00382 
00383 IMGbltRemap( destPtr, destPitch, bufferX1, bufferY1, bgPtr, default_remap_table);
00384 
00385 const barLeftMargin = 5;
00386 const barRightMargin = 5;
00387 const barTopMargin = 5;
00388 const barBottomMargin = 5;
00389 
00390 // ---------- draw energy bar ----------//
00391 
00392 if( curValue > maxValue )
00393 curValue = maxValue;
00394 int barWidth = int( (width - barLeftMargin - barRightMargin ) * curValue / maxValue);
00395 int barX1 = bufferX1 + barLeftMargin;
00396 int barX2 = barX1 + barWidth - 1;
00397 int barHeight = height - (barTopMargin + barBottomMargin);
00398 int barY1 = bufferY1 + barTopMargin;
00399 
00400 unsigned int lc = 0;
00401 static unsigned char lineColor[8] =
00402 { VGA_LIGHT_BLUE, VGA_LIGHT_BLUE+1, VGA_DARK_BLUE, VGA_LIGHT_BLUE+2,
00403 VGA_DARK_BLUE+1, VGA_LIGHT_BLUE+3, VGA_DARK_BLUE+2, VGA_DARK_BLUE+3 };
00404 
00405 if( barWidth > 0 )
00406 {
00407 if(barHeight >= 8)
00408 {
00409 int bY1 = barY1;
00410 for( int c = 0; c < 8; ++c)
00411 {
00412 int bY2 = bY1 + (lc+ barHeight -1)/8;
00413 IMGbar(destPtr, destPitch, barX1, bY1, barX2, bY2, translate_color(lineColor[c]) );
00414 lc += barHeight;
00415 bY1 += lc / 8;
00416 lc %= 8;
00417 }
00418 }
00419 else
00420 {
00421 for( int y = 0; y < barHeight; ++y)
00422 {
00423 int c = lc/barHeight;
00424 IMGbar(destPtr, destPitch, barX1, barY1+y, barX2, barY1+y, translate_color(lineColor[c]));
00425 lc += 8;
00426 }
00427 }
00428 }
00429 
00430 // ---------- display value ----------//
00431 
00432 if( barType & 3)
00433 {
00434 String str;
00435 
00436 if( barType & 1)
00437 str  = (int) curValue;
00438 if( barType & 2)
00439 {
00440 str += "/";
00441 str += (int) maxValue;
00442 }
00443 
00444 font_hitpoint.center_put_to_bufferW( destPtr, destPitch, bufferX1, bufferY1, bufferX2, bufferY2, str);
00445 }
00446 
00447 if(barType & 8)
00448 {
00449 put_bitmapW(x1, y1, tempBuffer);
00450 }
00451 // ---------------------------------- //
00452 
00453 if( is_front )
00454 mouse.show_area();
00455 
00456 }
00457 //------------- End of function VgaBuf::indicator --------------//
00458 
00459 //------------- Start of function VgaBuf::v_indicator --------------//
00460 //
00461 // Vertical indicator, all parameters are same as indicator() except
00462 // it is vertical.
00463 //
00464 // <int>   x1, y1, x2, y2 = coordination of the indicator
00465 // <float> curValue       = the value of the bar
00466 // <float> maxValue       = max value, the bar width = maxBarWidth * curValue / maxValue
00467 // <int>   indiColor      = color of the indicator
00468 // [int]   backColor      = background color
00469 //                          (default : vga.color_down)
00470 //
00471 void VgaBuf::v_indicator(int x1, int y1, int x2, int y2, float curValue,
00472 float maxValue, int indiColor, int backColor)
00473 {
00474 if( backColor == -1 )
00475 backColor = color_down;
00476 
00477 if( curValue > 0 )
00478 {
00479 int barHeight = (int) ((float)(y2-y1) * curValue / maxValue);
00480 
00481 int halfWidth = (x2-x1+1)/2-1;
00482 int ty1        = max(y2-barHeight,y1); // when curValue>0, even the actual bar width < 1, one pixel will also be painted
00483 int x;
00484 
00485 indiColor+=halfWidth;
00486 
00487 for( x=x1 ; x<x1+halfWidth ; x++, indiColor-- )
00488 bar( x, ty1, x, y2, indiColor );
00489 
00490 for( ; x<=x2 ; x++, indiColor++ )
00491 bar( x, ty1, x, y2, indiColor );
00492 
00493 if( y1 < y2-barHeight )
00494 bar( x1, y1, x2, y2-barHeight-1, backColor );
00495 }
00496 else
00497 {
00498 bar( x1, y1, x2, y2, backColor );
00499 }
00500 }
00501 //--------------- End of function VgaBuf::v_indicator --------------//
00502 */
00503 
00504 //---------- Begin of function VgaBuf::line -------------//
00511 void VgaBuf::line(int x1,int y1,int x2,int y2,int lineColor) {
00512     if( is_front )
00513         mouse.hide_area( x1,y1,x2,y2 );               // if the mouse cursor is in that area, hide it
00514 
00515     IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1, y1, x2, y2, lineColor);
00516 
00517     if( is_front )
00518         mouse.show_area();
00519 }
00520 
00521 //------------ End of function VgaBuf::line -------------//
00522 
00523 //---------- Begin of function VgaBuf::thick_line -------------//
00530 void VgaBuf::thick_line(int x1,int y1,int x2,int y2,int lineColor) {
00531     err_when( x1<0 || y1<0 || x2>=VGA_WIDTH || y2>=VGA_HEIGHT );
00532 
00533     if( is_front )
00534         mouse.hide_area( x1,y1,x2,y2 );               // if the mouse cursor is in that area, hide it
00535 
00536     if( y1-y2 > abs(x2-x1) ) {                      // keep thickness of the line to 3
00537         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1  , y1-1, x2  , y2-1, lineColor );
00538         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1  , y1  , x2  , y2  , lineColor );
00539         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1  , y1+1, x2  , y2+1, lineColor );
00540         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1+1, y1+1, x2+1, y2+1, lineColor );
00541     }
00542 
00543     else if( y2-y1 > abs(x2-x1) ) {
00544         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1+1, y1-1, x2+1, y2-1, lineColor );
00545         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1  , y1-1, x2  , y2-1, lineColor );
00546         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1  , y1  , x2  , y2  , lineColor );
00547         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1  , y1+1, x2  , y2+1, lineColor );
00548     }
00549 
00550     else {
00551         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1, y1-1, x2, y2-1, lineColor );
00552         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1, y1  , x2, y2  , lineColor );
00553         IMGline(buf_ptr(), buf_true_pitch(), buf_width(), buf_height(), x1, y1+1, x2, y2+1, lineColor );
00554     }
00555 
00556     if( is_front )
00557         mouse.show_area();
00558 }
00559 
00560 //------------ End of function VgaBuf::thick_line -------------//
00561 
00562 //----------- Begin of function VgaBuf::d3_panel_up ------------//
00577 void VgaBuf::d3_panel_up(int x1,int y1,int x2,int y2,int t,int paintCentre, char* tileName) {
00578     err_when( x1>x2 || y1>y2 || x1<0 || y1<0 || x2>=VGA_WIDTH || y2>=VGA_HEIGHT );
00579 
00580     if(sys.no_true_output_flag)
00581         if( is_front )
00582             return;
00583     if( is_front )
00584         mouse.hide_area( x1,y1,x2,y2 );
00585 
00586     //------------------------------------------------//
00587 
00588     if( paintCentre )
00589     {
00590         if( tileName )
00591             tile( x1+t, y1+t, x2-t, y2-t, tileName);
00592         else
00593             bar_fast(x1+t, y1+t, x2-t, y2-t, 193/*color_up*/ );  // center
00594     }
00595 
00596     int i, x, y;
00597 
00598     for( i=t-1, y=y1+t-1 ; y>=y1 ; y--,i-- )
00599         bar_fast( x1+i,y,x2-i,y, i==0?V_WHITE:193//color_light 
00600             );     // top side
00601 
00602     for( i=t-1, x=x1+t-1 ; x>=x1 ; x--,i-- )
00603         bar_fast( x,y1+i,x,y2-i, i==0?V_WHITE:193 );     // left side
00604 
00605     for( i=t-1, y=y2-t+1 ; y<=y2 ; y++,i-- )
00606         bar_fast( x1+i,y,x2-i,y, i==0?color_dark+2:color_dark-2 );   // bottom side
00607 
00608     for( i=t-1, x=x2-t+1 ; x<=x2 ; x++,i-- )                          // right side
00609         bar_fast( x,y1+i,x,y2-i, i==0?color_dark+2:color_dark-2 );
00610 
00611     //-------------------------------------------//
00612 
00613     if( is_front )
00614         mouse.show_area();
00615 }
00616 //------------- End of function VgaBuf::d3_panel_up ------------//
00617 
00618 
00619 //----------- Begin of function VgaBuf::d3_panel_down ------------//
00632 void VgaBuf::d3_panel_down(int x1,int y1,int x2,int y2,int t,int paintCentre, char* tileName)
00633 {
00634     err_when( x1>x2 || y1>y2 || x1<0 || y1<0 || x2>=VGA_WIDTH || y2>=VGA_HEIGHT );
00635 
00636     if(sys.no_true_output_flag)
00637         if( is_front )
00638             return;
00639 
00640     if( is_front )
00641         mouse.hide_area( x1,y1,x2,y2 );
00642 
00643     //---------- main center area -----------//
00644 
00645     // ####### begin Gilbert 12/7 ##########//
00646     if( paintCentre )
00647     {
00648         if( tileName )
00649             tile( x1+t, y1+t, x2-t, y2-t, tileName );
00650         else
00651             bar_fast(x1+t, y1+t, x2-t, y2-t, color_down );  // center
00652     }
00653 
00654     if( t == 2 ) // when thickness==2, use four different color for the down panel
00655     {
00656         // outer lines
00657 
00658         bar_fast( x1,y1,x2-1,y1,color_scheme+8  );     // top
00659         bar_fast( x1+1,y2,x2,y2,V_WHITE         );     // bottom
00660         bar_fast( x1,y1,x1,y2-1,color_scheme+8  );     // left
00661         bar_fast( x2,y1+1,x2,y2,V_WHITE         );     // right
00662 
00663         // inner lines
00664 
00665         bar_fast( x1+1,y1+1,x2-1,y1+1,color_scheme+15 );  // bottom
00666         bar_fast( x1+1,y2-1,x2-1,y2-1,color_scheme+1  );  // top
00667         bar_fast( x1+1,y1+1,x1+1,y2-1,color_scheme+15 );  // left
00668         bar_fast( x2-1,y1+1,x2-1,y2-1,color_scheme+1  );  // right
00669     }
00670     else         // one unit thickness
00671     {
00672         int i, x, y;
00673 
00674         for( i=t-1, y=y2-t+1 ; y<=y2 ; y++,i-- )
00675             bar_fast( x1+i,y,x2-i,y,i==0?V_WHITE:color_light );     // bottom
00676 
00677         for( i=t-1, x=x2-t+1 ; x<=x2 ; x++,i-- )          // left
00678             bar_fast( x,y1+i,x2,y2-i,i==0?V_WHITE:color_light );     // right
00679 
00680         for( i=t-1, y=y1+t-1 ; y>=y1 ; y--,i-- )          // top
00681             bar_fast( x1+i,y,x2-i,y,i==0?color_dark+2:color_dark-2 );
00682 
00683         for( i=t-1, x=x1+t-1 ; x>=x1 ; x--,i-- )          // left
00684             bar_fast( x,y1+i,x,y2-i,i==0?color_dark+2:color_dark-2 );
00685     }
00686 
00687     //----------- show mouse ----------//
00688 
00689     if( is_front )
00690         mouse.show_area();
00691 }
00692 //------------- End of function VgaBuf::d3_panel_down ------------//
00693 
00694 
00695 //----------- Begin of function VgaBuf::d3_panel_up_clear ------------//
00705 void VgaBuf::d3_panel_up_clear(int x1,int y1,int x2,int y2,int t, char *tileName)
00706 {
00707     if(sys.no_true_output_flag)
00708         if( is_front )
00709             return;
00710 
00711     if( tileName )
00712         tile( x1+t, y1+t, x2-t, y2-t, tileName );
00713     else
00714         bar(x1+t, y1+t, x2-t, y2-t, color_up );
00715 }
00716 //------------- End of function VgaBuf::d3_panel_up_clear ------------//
00717 
00718 
00719 //----------- Begin of function VgaBuf::d3_panel_down_clear ------------//
00729 void VgaBuf::d3_panel_down_clear(int x1,int y1,int x2,int y2,int t, char *tileName)
00730 {
00731     if(sys.no_true_output_flag)
00732         if( is_front )
00733             return;
00734     if( tileName )
00735         tile( x1+t, y1+t, x2-t, y2-t, tileName );
00736     else
00737         bar(x1+t, y1+t, x2-t, y2-t, color_down );
00738 }
00739 //------------- End of function VgaBuf::d3_panel_down_clear ------------//
00740 
00741 
00742 //----------- Begin of function VgaBuf::adjust_brightness ------------//
00750 void VgaBuf::adjust_brightness(int x1,int y1,int x2,int y2,int adjustDegree)
00751 {
00752     if( is_front )
00753         mouse.hide_area( x1,y1,x2,y2 );
00754 
00755 #if( MAX_BRIGHTNESS_ADJUST_DEGREE > 10 )
00756     adjustDegree *= MAX_BRIGHTNESS_ADJUST_DEGREE / 10;
00757 #endif
00758 
00759     err_when( adjustDegree < -MAX_BRIGHTNESS_ADJUST_DEGREE ||
00760               adjustDegree >  MAX_BRIGHTNESS_ADJUST_DEGREE );
00761 
00762 //      unsigned char* colorRemapTable = vga.vga_color_table->get_table(adjustDegree);
00763 //      remap_bar(x1, y1, x2, y2, colorRemapTable);
00764     IMGbrightBar( buf_ptr(), buf_true_pitch(), x1, y1, x2, y2, adjustDegree);
00765 
00766     if( is_front )
00767         mouse.show_area();
00768 }
00769 //------------- End of function VgaBuf::adjust_brightness ------------//
00770 
00771 
00772 //----------- Begin of function VgaBuf::blt_buf_bright ----------//
00776 void VgaBuf::blt_buf_bright( VgaBuf *srcBuf, int srcX1, int srcY1, int srcX2, int srcY2, int adjustDegree)
00777 {
00778 #if( MAX_BRIGHTNESS_ADJUST_DEGREE > 10 )
00779     adjustDegree *= MAX_BRIGHTNESS_ADJUST_DEGREE / 10;
00780 #endif
00781 
00782     err_when( adjustDegree < -MAX_BRIGHTNESS_ADJUST_DEGREE ||
00783               adjustDegree >  MAX_BRIGHTNESS_ADJUST_DEGREE );
00784 
00785     IMGcopyWbright( buf_ptr(), buf_true_pitch(), srcBuf->buf_ptr(), srcBuf->buf_true_pitch(), srcX1, srcY1, srcX2, srcY2, adjustDegree); 
00786 }
00787 //----------- End of function VgaBuf::blt_buf_bright ----------//
00788 
00789 
00790 //------------- Begin of function VgaBuf::blt_buf ------------//
00792 void VgaBuf::blt_buf( VgaBuf *srcBuf, int x1, int y1 )
00793 {
00794     short *srcPtr = srcBuf->buf_ptr();
00795     int srcWidth = srcBuf->buf_width();
00796     int srcPitch = srcBuf->buf_true_pitch();
00797     int srcHeight = srcBuf->buf_height();
00798     short *destPtr = buf_ptr();
00799     int destPitch = buf_true_pitch();
00800 
00801     _asm
00802         {
00803             mov eax, y1
00804                 imul    destPitch
00805                 add     eax, x1
00806                 add     eax, x1
00807                 mov     edi, eax
00808                 add     edi, destPtr
00809 
00810                 mov     esi, srcPtr
00811 
00812                 mov     ecx, srcHeight
00813                 blt_buf_1:
00814             push        ecx
00815                 push    esi
00816                 push    edi
00817                 mov     ecx, srcWidth
00818                 rep movsw
00819                 pop     edi
00820                 pop     esi
00821                 pop     ecx
00822                 add     edi, destPitch
00823                 add     esi, srcPitch
00824                 loop    blt_buf_1
00825                 }
00826 }
00827 //------------- End of function VgaBuf::blt_buf ------------//

Generated on Fri Aug 23 01:38:35 2002 for VirtualU by doxygen1.2.17