static void InvertPlayer(Int player) { /* This is from namePlayerX in cwimp.rcp.in */ RectangleType r = { {36, 0}, {64, 10} };; r.topLeft.y = 52 + player * 10; WinInvertRectangle( &r, 0 ); }
// Equivalent of "at". static void put_char_at(Short row, Short col, Char ch, Boolean bold) { Short cheat, vcheat = DunTopY + (itsy_on ? 0 : 0);//center the map vertically RectangleType r; Short vc_w = itsy_on ? visible_char_w_itsy : visible_char_w; Short vc_h = itsy_on ? visible_char_h_itsy : visible_char_h; RctSetRectangle(&r, col * vc_w, row*vc_h+vcheat, vc_w, vc_h); if (!my_prefs.black_bg || IsColor) WinEraseRectangle(&r, 0); else WinDrawRectangle(&r, 0); // calculate pixel position of "row, col" and put char there cheat = vc_w - FntCharWidth(ch); // center the variable width characters if (cheat <= 1) cheat = 0; else cheat /= 2; if (ch != ' ') { #ifdef I_AM_COLOR // if (IsColor) { // WinSetTextColor(get_color(ch, col+visible_x, row+visible_y)); // } #endif if (!itsy_on && (ch== 'g' || ch== 'j' || ch== 'p' ||ch == 'q' ||ch == 'y')) vcheat--; // unfortunately, letters with dangling bits are a pain. if (!my_prefs.black_bg || IsColor) WinDrawChars(&ch, 1, col * vc_w + cheat, row * vc_h+vcheat); else WinDrawInvertedChars(&ch, 1, col * vc_w + cheat, row * vc_h+vcheat); if (bold) WinInvertRectangle(&r, 0); /* 0 for square corners */ } terminal[row][col] = ch; }
/* Draw the actual buttons onto blank bitmaps, and set them as valid templates on the silkscreen */ static void DrawButtons( void ) { Err err; BitmapPtr silkBitmap; BitmapPtr silkBitmapInv; WinHandle silkWindow; WinHandle silkWindowInv; WinHandle origWindow; UInt16 i; Coord currentX; Coord currentY; Coord silkX; Coord silkY; origWindow = WinGetDrawWindow(); if ( currentSilkStatus == HANDERA_SILK_UP ) { SilkGetTemplateBitmaps( &silkBitmap, &silkBitmapInv, NULL, NULL ); } else { SilkGetTemplateBitmaps( NULL, NULL, &silkBitmap, &silkBitmapInv ); } BmpGlueGetDimensions( silkBitmap, &silkX, &silkY, NULL ); silkWindow = WinCreateOffscreenWindow( silkX, silkY, screenFormat, &err ); silkWindowInv = WinCreateOffscreenWindow( silkX, silkY, screenFormat, &err); WinSetDrawWindow( silkWindow ); WinDrawBitmap( silkBitmap, 0, 0 ); WinSetDrawWindow( silkWindowInv ); WinDrawBitmap( silkBitmapInv, 0, 0 ); /* We need to move down the existing silkscreen to make room for our own toolbar's buttons */ if ( currentSilkStatus == HANDERA_SILK_UP ) { RectangleType area; UInt16 moveY; area.topLeft.x = 40; area.topLeft.y = 1; area.extent.x = 200; area.extent.y = 18; moveY = 14; WinCopyRectangle( silkWindow, silkWindow, &area, area.topLeft.x, moveY, winPaint ); WinCopyRectangle( silkWindowInv, silkWindowInv, &area, area.topLeft.x, moveY, winPaint ); area.extent.y = moveY; WinSetDrawWindow( silkWindow ); WinEraseRectangle( &area, 0 ); WinSetDrawWindow( silkWindowInv ); WinEraseRectangle( &area, 0 ); } currentX = TOOLBAR_START_X; currentY = TOOLBAR_START_Y; for ( i = 0; i < TOTAL_ICONS; i++ ) { MemHandle bitmapH; BitmapPtr bitmap; Coord width; Coord height; if ( iconList[ i ].resourceId == 0 ) { /* This is just a placeholder for our '0' resourced offset image */ width = 22; height = 13; } else { bitmapH = DmGetResource( bitmapRsc, iconList[ i ].resourceId ); bitmap = MemHandleLock( bitmapH ); BmpGlueGetDimensions( bitmap, &width, &height, NULL ); WinSetDrawWindow( silkWindow ); WinDrawBitmap( bitmap, currentX, currentY ); WinSetDrawWindow( silkWindowInv ); WinDrawBitmap( bitmap, currentX, currentY ); MemPtrUnlock( bitmap ); DmReleaseResource( bitmapH ); } iconList[ i ].bounds[ currentSilkStatus ].topLeft.x = currentX; iconList[ i ].bounds[ currentSilkStatus ].topLeft.y = currentY; iconList[ i ].bounds[ currentSilkStatus ].extent.x = width; iconList[ i ].bounds[ currentSilkStatus ].extent.y = height; WinInvertRectangle( &( iconList[ i ].bounds[ currentSilkStatus ]), 0 ); /* Because some icons are meant to appear right beside each other, they're defined here up top. Everything else is spaced so it fits nicely */ switch ( iconList[ i ].resourceId ) { case bmpFind: case bmpAutoscrollDecr: case bmpAutoscrollStop: case bmpLeft: case bmpHome: currentX += width; break; default: currentX += width; if ( currentSilkStatus == HANDERA_SILK_UP ) currentX += 3; else if ( currentSilkStatus == HANDERA_SILK_DOWN ) currentX += 7; break; } } WinSetDrawWindow( origWindow ); silkBitmap = WinGetBitmap( silkWindow ); silkBitmapInv = WinGetBitmap( silkWindowInv ); if ( currentSilkStatus == HANDERA_SILK_UP ) SilkSetTemplateBitmaps( silkBitmap, silkBitmapInv, NULL, NULL ); else SilkSetTemplateBitmaps( NULL, NULL, silkBitmap, silkBitmapInv ); WinDeleteWindow( silkWindow, false ); WinDeleteWindow( silkWindowInv, false ); }
void Graphics::invertRectangle(const Rect& rect) { WinInvertRectangle(&rect.native(), 0); }