void doUpdateWindow(EventRecord *eventStrucPtr) { IMAGE *img; WindowRef windowRef; Rect srcRect, destRect, fillRect; PixMapHandle srcPixmapHdl, destPixmapHdl; RGBColor grayColour = { 0xC000,0xC000,0xC000 }; SInt32 hScroll, vScroll; windowRef = (WindowRef) eventStrucPtr->message; img = (IMAGE*)GetWRefCon(windowRef); srcPixmapHdl = img->pixmapHdl; destPixmapHdl = GetPortPixMap(GetWindowPort(windowRef)); hScroll = GetControl32BitValue(img->scrollbarHorizRef); vScroll = GetControl32BitValue(img->scrollbarVertRef); if (srcPixmapHdl) { PixMap *pixmap = *srcPixmapHdl; PixPatHandle hdlPixPat = NewPixPat(); MakeRGBPat(hdlPixPat, &grayColour); GetWindowPortBounds(windowRef,&destRect); destRect.right -= kScrollBarWidth; destRect.bottom -= kScrollBarWidth; if (destRect.right > pixmap->bounds.right) { fillRect.top = destRect.top; fillRect.bottom = destRect.bottom; fillRect.left = pixmap->bounds.right; fillRect.right = destRect.right; FillCRect(&fillRect, hdlPixPat); destRect.right = pixmap->bounds.right; } if (destRect.bottom > pixmap->bounds.bottom) { fillRect.top = pixmap->bounds.bottom; fillRect.bottom = destRect.bottom; fillRect.left = destRect.left; fillRect.right = destRect.right; FillCRect(&fillRect, hdlPixPat); destRect.bottom = pixmap->bounds.bottom; } DisposePixPat(hdlPixPat); srcRect = destRect; srcRect.left += hScroll; srcRect.right += hScroll; srcRect.top += vScroll; srcRect.bottom += vScroll; CopyBits((BitMap*)*srcPixmapHdl, (BitMap*)*destPixmapHdl, &srcRect, &destRect, srcCopy, NULL); } DrawGrowIcon(windowRef); }
void _HYPlatformGraphicPane::_SetColor (_HYColor c) { RGBColor sysColor; sysColor.red = c.R*256; sysColor.green = c.G*256; sysColor.blue = c.B*256; MakeRGBPat (fillColor,&sysColor); RGBForeColor (&sysColor); }
void TkMacSetUpGraphicsPort( GC gc) /* GC to apply to current port. */ { RGBColor macColor; if (gPenPat == NULL) { gPenPat = NewPixPat(); } if (TkSetMacColor(gc->foreground, &macColor) == true) { /* TODO: cache RGBPats for preformace - measure gains... */ MakeRGBPat(gPenPat, &macColor); } PenNormal(); if(gc->function == GXxor) { PenMode(patXor); } if (gc->line_width > 1) { PenSize(gc->line_width, gc->line_width); } if (gc->line_style != LineSolid) { unsigned char *p = (unsigned char *) &(gc->dashes); /* * Here the dash pattern should be set in the drawing, * environment, but I don't know how to do that for the Mac. * * p[] is an array of unsigned chars containing the dash list. * A '\0' indicates the end of this list. * * Someone knows how to implement this? If you have a more * complete implementation of SetUpGraphicsPort() for * the Mac (or for Windows), please let me know. * * Jan Nijtmans * CMG Arnhem, B.V. * email: [email protected] (private) * [email protected] (work) * url: http://purl.oclc.org/net/nijtmans/ */ } }