void _WinCopyRectangle(WinHandle srcWin, WinHandle dstWin, RectangleType *srcRect, Coord destX, Coord destY, WinDrawOperation mode) { if (hires) HRWinCopyRectangle(hires, srcWin, dstWin, srcRect, destX, destY, mode); else WinCopyRectangle(srcWin, dstWin, srcRect, destX, destY, mode); }
void WinMoveRectangle (int left, int top, int right, int bot, int dx, int dy, OSPictContext context) { int w, h; HWND hwnd; hwnd = WindowFromDC (context->hDC); if (hwnd != NULL) { RECT r; POINT p; GetClientRect (hwnd, &r); GetWindowOrgEx (context->hDC, &p); left = max (left, r.left + p.x); top = max (top, r.top + p.y); right = min (right, r.right + p.x); bot = min (bot, r.bottom + p.y); } w = right - left; h = bot - top; WinCopyRectangle (left, top, right, bot, dx, dy, context); StartErasing (context); if (dx > w || dy > h) { Rectangle (context->hDC, left, top, right + 1, bot + 1); return; } if (dx < 0) Rectangle (context->hDC, right - dx, top, right + 1, bot + 1); else Rectangle (context->hDC, left, top, left + dx + 1, bot + 1); if (dy < 0) Rectangle (context->hDC, left, bot - dy, right + 1, bot + 1); else Rectangle (context->hDC, left, top, right + 1, top + dy + 1); } /* WinMoveRectangle */
/* 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 WinCopyRectangleTo (int left, int top, int right, int bot, int x, int y, OSPictContext context) { WinCopyRectangle (left,top, right,bot, x-left,y-top, context); } /* WinCopyRectangleTo */
static void blit () { const RectangleType rect = { {0,0}, {160,160} }; WinCopyRectangle (buffer, WinGetDisplayWindow(), &rect, 0, 0, winPaint); }
void Graphics::copyArea(const Rect& sourceArea, Graphics& targetSystem, const Point& targetTopLeft) { WinCopyRectangle(handle_, targetSystem.handle_, &sourceArea.native(), targetTopLeft.x, targetTopLeft.y, winPaint); }