void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects) { CRASSERT(window); CRASSERT(window->window); /* Remember any additional clipping stuff e.g. seamless regions */ if (window->hVisibleRegion) { DisposeRgn(window->hVisibleRegion); window->hVisibleRegion = 0; } if (cRects>0) { int i; /* Create some temporary regions */ RgnHandle rgn = NewRgn(); SetEmptyRgn (rgn); RgnHandle tmpRgn = NewRgn(); for (i=0; i<cRects; ++i) { SetRectRgn (tmpRgn, pRects[4*i] , pRects[4*i+1], pRects[4*i+2], pRects[4*i+3]); //DEBUG_MSG_POETZSCH (("visible rect %d %d %d %d\n", pRects[4*i] , pRects[4*i+1], // pRects[4*i+2], pRects[4*i+3])); UnionRgn (rgn, tmpRgn, rgn); } DisposeRgn (tmpRgn); window->hVisibleRegion = rgn; } renderspu_SystemWindowApplyVisibleRegion(window); }
void setWindowTrackingRgn(int windowIndex) { Rect rgnRect; RgnHandle rgn = NewRgn(); MouseTrackingRegionID id; windowDescriptorBlock *windowBlock = windowBlockFromIndex(windowIndex); if (!windowBlock) return; if (windowBlock->windowTrackingRef) { GetWindowBounds(windowBlock->handle, kWindowContentRgn, &rgnRect); SetRectRgn( rgn, rgnRect.left, rgnRect.top, rgnRect.right, rgnRect.bottom ); ChangeMouseTrackingRegion(windowBlock->windowTrackingRef,rgn, NULL); DisposeRgn( rgn ); return; } GetWindowBounds(windowBlock->handle, kWindowContentRgn, &rgnRect); SetRectRgn( rgn, rgnRect.left, rgnRect.top, rgnRect.right, rgnRect.bottom ); id.signature = 'FAST'; id.id = windowIndex; OSStatus err = CreateMouseTrackingRegion(windowBlock->handle, rgn, NULL, kMouseTrackingOptionsGlobalClip, id, NULL, NULL, &windowBlock->windowTrackingRef); if ( noErr == err ) { RetainMouseTrackingRegion( windowBlock->windowTrackingRef); err = SetMouseTrackingRegionEnabled( windowBlock->windowTrackingRef, TRUE ); } DisposeRgn( rgn ); }
int TkRectInRegion( TkRegion region, int x, int y, unsigned int width, unsigned int height) { RgnHandle rgn = (RgnHandle) region; RgnHandle rectRgn, destRgn; int result; rectRgn = NewRgn(); destRgn = NewRgn(); SetRectRgn(rectRgn, x, y, x + width, y + height); SectRgn(rgn, rectRgn, destRgn); if (EmptyRgn(destRgn)) { result = RectangleOut; } else if (EqualRgn(rgn, destRgn)) { result = RectangleIn; } else { result = RectanglePart; } DisposeRgn(rectRgn); DisposeRgn(destRgn); return result; }
static void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects) { /* Remember the visible region of the root window if there is one */ if (render_spu.hRootVisibleRegion) { DisposeRgn(render_spu.hRootVisibleRegion); render_spu.hRootVisibleRegion = 0; } if (cRects>0) { int i; render_spu.hRootVisibleRegion = NewRgn(); SetEmptyRgn (render_spu.hRootVisibleRegion); RgnHandle tmpRgn = NewRgn(); for (i=0; i<cRects; ++i) { SetRectRgn (tmpRgn, pRects[4*i] , pRects[4*i+1], pRects[4*i+2], pRects[4*i+3]); UnionRgn (render_spu.hRootVisibleRegion, tmpRgn, render_spu.hRootVisibleRegion); } DisposeRgn (tmpRgn); } }
/* restores former dialog size and (on Mac) position */ bool CDlgItemProperties::RestoreState() { wxConfigBase* pConfig = wxConfigBase::Get(FALSE); int iWidth, iHeight; wxASSERT(pConfig); if (!pConfig) return false; pConfig->SetPath(m_strBaseConfigLocation); pConfig->Read(wxT("Width"), &iWidth, wxDefaultCoord); pConfig->Read(wxT("Height"), &iHeight, wxDefaultCoord); #ifndef __WXMAC__ // Set size to saved values or defaults if no saved values SetSize(iWidth, iHeight); #else int iTop, iLeft; pConfig->Read(wxT("YPos"), &iTop, wxDefaultCoord); pConfig->Read(wxT("XPos"), &iLeft, wxDefaultCoord); // If either co-ordinate is less then 0 then set it equal to 0 to ensure // it displays on the screen. if ((iLeft < 0) && (iLeft != wxDefaultCoord)) iLeft = 30; if ((iTop < 0) && (iTop != wxDefaultCoord)) iTop = 30; // Set size and position to saved values or defaults if no saved values SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING); // Now make sure window is on screen GetScreenPosition(&iLeft, &iTop); GetSize(&iWidth, &iHeight); Rect titleRect = {iTop, iLeft, iTop+22, iLeft+iWidth }; InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible RgnHandle displayRgn = NewRgn(); CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays Rect menuRect = ((**GetMainDevice())).gdRect; menuRect.bottom = GetMBarHeight() + menuRect.top; RgnHandle menuRgn = NewRgn(); RectRgn(menuRgn, &menuRect); // Region hidden by menu bar DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar region if (!RectInRgn(&titleRect, displayRgn)) { iTop = iLeft = 30; SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING); } DisposeRgn(menuRgn); DisposeRgn(displayRgn); #endif return true; }
void CDlgMessages::RestoreWindowDimensions() { wxString strBaseConfigLocation = wxString(wxT("/Simple/Messages")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); bool bWindowIconized = false; bool bWindowMaximized = false; int iHeight = 0; int iWidth = 0; int iTop = 0; int iLeft = 0; wxASSERT(pConfig); pConfig->SetPath(strBaseConfigLocation); pConfig->Read(wxT("YPos"), &iTop, 30); pConfig->Read(wxT("XPos"), &iLeft, 30); pConfig->Read(wxT("Width"), &iWidth, 640); pConfig->Read(wxT("Height"), &iHeight, 480); pConfig->Read(wxT("WindowIconized"), &bWindowIconized, false); pConfig->Read(wxT("WindowMaximized"), &bWindowMaximized, false); #ifndef __WXMAC__ Iconize(bWindowIconized); Maximize(bWindowMaximized); if (!IsIconized() && !IsMaximized()) { SetSize(-1, -1, iWidth, iHeight); } #else // ! __WXMAC__ // If the user has changed the arrangement of multiple // displays, make sure the window title bar is still on-screen. Rect titleRect = {iTop, iLeft, iTop+22, iLeft+iWidth }; InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible RgnHandle displayRgn = NewRgn(); CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays Rect menuRect = ((**GetMainDevice())).gdRect; menuRect.bottom = GetMBarHeight() + menuRect.top; RgnHandle menuRgn = NewRgn(); RectRgn(menuRgn, &menuRect); // Region hidden by menu bar DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar retion if (!RectInRgn(&titleRect, displayRgn)) iTop = iLeft = 30; DisposeRgn(menuRgn); DisposeRgn(displayRgn); SetSize(iLeft, iTop, iWidth, iHeight); #endif // ! __WXMAC__ }
void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackground ) { GrafPtr formerPort ; GetPort( &formerPort ) ; SetPortWindowPort( (WindowRef)m_macWindow ) ; m_macNeedsErasing |= eraseBackground ; // if we already know that we will have to erase, there's no need to track the rest if ( !m_macNeedsErasing) { // we end only here if eraseBackground is false // if we already have a difference between m_macNoEraseUpdateRgn and UpdateRgn // we will have to erase anyway RgnHandle updateRgn = NewRgn(); RgnHandle diffRgn = NewRgn() ; if ( updateRgn && diffRgn ) { GetWindowUpdateRgn( (WindowRef)m_macWindow , updateRgn ); Point pt = {0,0} ; LocalToGlobal( &pt ) ; OffsetRgn( updateRgn , -pt.h , -pt.v ) ; DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ; if ( !EmptyRgn( diffRgn ) ) { m_macNeedsErasing = true ; } } if ( updateRgn ) DisposeRgn( updateRgn ); if ( diffRgn ) DisposeRgn( diffRgn ); if ( !m_macNeedsErasing ) { RgnHandle rectRgn = NewRgn() ; SetRectRgn( rectRgn , ((Rect*)rect)->left , ((Rect*)rect)->top , ((Rect*)rect)->right , ((Rect*)rect)->bottom ) ; UnionRgn( (RgnHandle) m_macNoEraseUpdateRgn , rectRgn , (RgnHandle) m_macNoEraseUpdateRgn ) ; DisposeRgn( rectRgn ) ; } } InvalWindowRect( (WindowRef)m_macWindow , (Rect*)rect ) ; // turn this on to debug the refreshing cycle #if wxMAC_DEBUG_REDRAW PaintRect( rect ) ; #endif SetPort( formerPort ) ; }
// -------------------------------------------------------------------------------------- void HandleDrawContent(WindowRef prefsWindow) { RgnHandle visibleRegion; ListHandle iconList; GetWindowProperty(prefsWindow, kAppSignature, kIconListTag, sizeof(ListHandle), NULL, &iconList); visibleRegion = NewRgn(); GetPortVisibleRegion(GetWindowPort(prefsWindow), visibleRegion); if (visibleRegion != NULL) { Boolean active = IsWindowHilited(prefsWindow); SInt16 pixelDepth; Boolean isColorDevice; if (active) SetThemeWindowBackground(prefsWindow, kThemeBrushModelessDialogBackgroundActive, false); else SetThemeWindowBackground(prefsWindow, kThemeBrushModelessDialogBackgroundInactive, false); EraseRgn(visibleRegion); UpdateControls(prefsWindow, visibleRegion); GetWindowDeviceDepthAndColor(prefsWindow, &pixelDepth, &isColorDevice); SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice); LUpdate(visibleRegion, iconList); drawFrameAndFocus(iconList, active, prefsWindow); DisposeRgn(visibleRegion); } }
void handleMenuSelection(long result) { int menuID, menuItem; RgnHandle rgnHandle = NewRgn(); menuID = HiWord(result); menuItem = LoWord(result); if (menuID == FILE_MENU) { if (menuItem == FILE_SAVE) saveToPICTFile(); else if (menuItem == FILE_QUIT) gDone = true; else if (menuItem == FILE_CLOSE) { DisposeWindow(FrontWindow()); if (FrontWindow() == NULL) gDone = true; } else if (menuItem == FILE_NEW) { } else if (menuItem == FILE_REFRESH) { createImage(); drawImage(FrontWindow()); QDFlushPortBuffer(GetWindowPort(FrontWindow()), GetPortVisibleRegion(GetWindowPort(FrontWindow()), rgnHandle)); } } HiliteMenu(0); DisposeRgn(rgnHandle); }
boolean shellupdatenow (WindowPtr wupdate) { /* can be called from within one of the callbacks to force an update to happen immediately, without waiting for the OS to generate an update event. dmb 8/14/90: can't we just call the normal update routine? this should be fine from the toolbox's point of view, but will not limit the update to contentrect. */ #ifdef MACVERSION hdlregion rgn; rgn = getupdateregion (wupdate); if (!EmptyRgn (rgn)) shellupdatewindow (wupdate); #if ACCESSOR_CALLS_ARE_FUNCTIONS == 1 //Code change by Timothy Paustian Thursday, May 18, 2000 10:24:57 PM //Changed because calling getupdateregion returns a copy of the region //we have to dispose of it to prevent a memory leak DisposeRgn(rgn); #endif #endif #ifdef WIN95VERSION releasethreadglobals (); UpdateWindow ((HWND) wupdate); grabthreadglobals (); #endif return (true); } /*shellupdatenow*/
void TkDestroyRegion( TkRegion r) { RgnHandle rgn = (RgnHandle) r; DisposeRgn(rgn); }
bool wxTopLevelWindowMac::SetShape(const wxRegion& region) { wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE, _T("Shaped windows must be created with the wxFRAME_SHAPED style.")); #if TARGET_CARBON // The empty region signifies that the shape should be removed from the // window. if ( region.IsEmpty() ) { wxSize sz = GetClientSize(); wxRegion rgn(0, 0, sz.x, sz.y); return SetShape(rgn); } // Make a copy of the region RgnHandle shapeRegion = NewRgn(); CopyRgn( (RgnHandle)region.GetWXHRGN(), shapeRegion ); // Dispose of any shape region we may already have RgnHandle oldRgn = (RgnHandle)GetWRefCon( (WindowRef)MacGetWindowRef() ); if ( oldRgn ) DisposeRgn(oldRgn); // Save the region so we can use it later SetWRefCon((WindowRef)MacGetWindowRef(), (SInt32)shapeRegion); // Tell the window manager that the window has changed shape ReshapeCustomWindow((WindowRef)MacGetWindowRef()); return TRUE; #else return FALSE; #endif }
void QTCode_ForceMovieRedraw(Movie theMovie) { OSErr err = noErr; Rect movieRect; RgnHandle clipRegion = NULL; if (theMovie == NULL) goto bail; clipRegion = NewRgn(); if (clipRegion == NULL) goto bail; GetClip(clipRegion); GetMovieBox(theMovie, &movieRect); ClipRect(&movieRect); UpdateMovie(theMovie); MoviesTask(theMovie, 0); SetClip(clipRegion); /* Closure. Clean up if we have handles. */ bail: if (clipRegion != NULL) { DisposeRgn(clipRegion); } }
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor ) { OSStatus status = noErr ; switch( iMessage ) { case kControlMsgSetUpBackground : { wxControl* wx = (wxControl*) GetControlReference( iControl ) ; if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) ) { wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ; #if TARGET_CARBON // under classic this would lead to partial redraws RgnHandle clip = NewRgn() ; int x = 0 , y = 0; wx->MacWindowToRootWindow( &x,&y ) ; CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ; OffsetRgn( clip , x , y ) ; SetClip( clip ) ; DisposeRgn( clip ) ; #endif } else { status = paramErr ; } } break ; default : status = paramErr ; break ; } return status ; }
void LCD_resize(Lcd *x) { Rect r; short hor,ver; #ifdef debug post("LCD_Resize"); #endif r = x->lcd_box.b_rect; hor = x->cols = FixRound(FixRatio(((r.right-r.left-(2*BORDER_WIDTH))),x->f_width)); ver = x->rows = FixRound(FixRatio(((r.bottom-r.top-(2*BORDER_HEIGHT))),x->f_height)); #ifdef FORCEDResize x->lcd_box.b_rect.right = r.left + (2*BORDER_WIDTH) + hor*x->f_width; x->lcd_box.b_rect.bottom = r.top + (2*BORDER_HEIGHT) + ver*x->f_height; #endif if (x->lcd_region) DisposeRgn(x->lcd_region); x->lcd_oldRect = r = x->lcd_box.b_rect; InsetRect(&r,1,1); x->lcd_region = NewRgn(); RectRgn(x->lcd_region,&r); /* DDZ simpler way to make a rectangular region */ }
void wxTopLevelWindowMac::MacUpdate( long timestamp) { wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ; RgnHandle visRgn = NewRgn() ; GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), visRgn ); BeginUpdate( (WindowRef)m_macWindow ) ; RgnHandle updateRgn = NewRgn(); RgnHandle diffRgn = NewRgn() ; if ( updateRgn && diffRgn ) { #if 1 // macos internal control redraws clean up areas we'd like to redraw ourselves // therefore we pick the boundary rect and make sure we can redraw it // this has to be intersected by the visRgn in order to avoid drawing over its own // boundaries RgnHandle trueUpdateRgn = NewRgn() ; Rect trueUpdateRgnBoundary ; GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), trueUpdateRgn ); GetRegionBounds( trueUpdateRgn , &trueUpdateRgnBoundary ) ; RectRgn( updateRgn , &trueUpdateRgnBoundary ) ; SectRgn( updateRgn , visRgn , updateRgn ) ; if ( trueUpdateRgn ) DisposeRgn( trueUpdateRgn ) ; SetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ; #else GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ); #endif DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ; if ( !EmptyRgn( updateRgn ) ) { MacRedraw( updateRgn , timestamp , m_macNeedsErasing || !EmptyRgn( diffRgn ) ) ; } } if ( updateRgn ) DisposeRgn( updateRgn ); if ( diffRgn ) DisposeRgn( diffRgn ); if ( visRgn ) DisposeRgn( visRgn ) ; EndUpdate( (WindowRef)m_macWindow ) ; SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ; m_macNeedsErasing = false ; }
void doEventLoop() { EventRecord event; WindowPtr window; short clickArea; Rect screenRect; RgnHandle rgnHandle = NewRgn(); for (;;) { if (WaitNextEvent( everyEvent, &event, 0, nil )) { if (event.what == mouseDown) { clickArea = FindWindow( event.where, &window ); if (clickArea == inDrag) { //screenRect = (**GetGrayRgn ()).rgnBBox; GetRegionBounds(GetGrayRgn(), &screenRect); DragWindow( window, event.where, &screenRect ); } else if (clickArea == inContent) { if (window != FrontWindow()) SelectWindow( window ); } else if (clickArea == inGoAway) if (TrackGoAway( window, event.where )) return; } else if (event.what == updateEvt) { window = (WindowPtr)event.message; //SetPort( window ); SetPortWindowPort( window ); BeginUpdate( window ); drawPixelImageData(); EndUpdate( window ); QDFlushPortBuffer(GetWindowPort(window), GetPortVisibleRegion(GetWindowPort(window), rgnHandle)); } else if (event.what == activateEvt) { /*if (event.modifiers & activeFlag) { window = (WindowPtr)event.message; SetPortWindowPort(window); drawPixelImageData(); QDFlushPortBuffer(GetWindowPort(window), GetPortVisibleRegion(GetWindowPort(window), rgnHandle)); }*/ /*if (event.modifiers & activeFlag) PostEvent(updateEvt, (unsigned long)gWindow);*/ } } } DisposeRgn(rgnHandle); }
//__________________________________________________________________ void _HYPlatformGraphicPane::_SlidePane (int dv, int dh) { _HYGraphicPane* theParent = (_HYGraphicPane*)this; Rect r = {0,0,theParent->h,theParent->w}; RgnHandle dummy = NewRgn(); checkPointer (dummy); ScrollRect(&r,dh,dv,dummy); DisposeRgn (dummy); }
void myShowMenuBar(void) { if (!savedgray) return; CopyRgn(savedgray,GetGrayRgn()); LMSetMBarHeight(savedmbh); DisposeRgn(savedgray); savedgray=NULL; }
void LCD_free(Lcd *x) { EnterCallback(); if (x->screen) freebytes(x->screen,(short)sizeof(char)*(x->cols*x->rows)); if (x->lcd_region) DisposeRgn(x->lcd_region); box_free((void *)x); ExitCallback(); }
static void qt_mac_cleanup_rgncache() { rgncache_init = false; for(int i = 0; i < RGN_CACHE_SIZE; ++i) { if(rgncache[i]) { --rgncache_used; DisposeRgn(rgncache[i]); rgncache[i] = 0; } } }
void LCD_dolinesegment(Lcd *x, Symbol *s, short argc, Atom *argv) { PaletteHandle pH; RGBColor fColor; GrafPort *gp; RgnHandle cur; long fromx,fromy,tox,toy,color; short save; EnterCallback(); fromx = argv->a_w.w_long; fromy = (argv+1)->a_w.w_long; tox = (argv+2)->a_w.w_long; toy = (argv+3)->a_w.w_long; color = (argv+4)->a_w.w_long; #ifdef debug post("Segment"); #endif gp = patcher_setport(x->lcd_box.b_patcher); if (gp) { if (!box_nodraw((void *)x)) { // save=lockout_set(1); MoveTo(x->lcd_box.b_rect.left+1+(short)fromx,x->lcd_box.b_rect.top+1+(short)fromy); x->lcd_where.h = (short)fromx; x->lcd_where.v = (short)fromy; if (color) x->lcd_pIndex = (short)color & (numPaletteColors-1); cur = NewRgn(); GetClip(cur); SetClip(x->lcd_region); setUpPalette(x,&fColor,&pH); // LCD_MoveTo(x,(long)(x->lcd_where.h),(long)(x->lcd_where.v)); LineTo(x->lcd_box.b_rect.left+1+(short)tox,x->lcd_box.b_rect.top+1+(short)toy); x->lcd_where.h = (short)tox; x->lcd_where.v = (short)toy; restorePalette(x,&fColor,&pH); SetClip(cur); DisposeRgn(cur); // lockout_set(save); } SetPort(gp); } ExitCallback(); }
bool MCRegionExcludeRect(MCRegionRef self, const MCRectangle& rect) { Rect t_rect; SetRect(&t_rect, rect . x, rect . y, rect . x + rect . width, rect . y + rect . height); RgnHandle t_rect_rgn; t_rect_rgn = NewRgn(); RectRgn(t_rect_rgn, &t_rect); DiffRgn((RgnHandle)self, t_rect_rgn, (RgnHandle)self); DisposeRgn(t_rect_rgn); return true; }
RgnHandle getWindowDragRegion(WindowRef window, RgnHandle dragRegion) { /*------------------------------------------------------ Define the drag region of our window. --------------------------------------------------------*/ RgnHandle structureRegion=NewRgn(); RgnHandle contentRegion=NewRgn(); SetEmptyRgn(dragRegion); getWindowStructureRegion(window,structureRegion); getWindowContentRegion(window,contentRegion); //our drag region is the difference between the structural and content regions DiffRgn(structureRegion,contentRegion,dragRegion); DisposeRgn(structureRegion); DisposeRgn(contentRegion); return dragRegion; }
void MyLUpdateVisRgn(DialogRef theDialog, ListHandle listHdl) { #if TARGET_API_MAC_CARBON RgnHandle visRgn = NewRgn(); if(visRgn) GetPortVisibleRegion(GetDialogPort(theDialog), visRgn); LUpdate(visRgn,listHdl); if(visRgn) DisposeRgn(visRgn); #else LUpdate(theDialog->visRgn,listHdl); #endif }
void DrawMapBoundsPoly (CMap* theMap, PolyObjectHdl MapPolyHdl, DrawSpecRecPtr drawSettings, Boolean erasePolygon) { long numPts = (**MapPolyHdl).pointCount; POINT **pointsH = (POINT**)_NewHandle(numPts *sizeof(POINT)); POINT *pointsPtr = (POINT*)_NewPtr(numPts *sizeof(POINT)); LongPoint** thisPointsHdl=nil; Point pt; LongPoint wPt; long i; Boolean offQuickDrawPlane = false; RGBColor saveColor; // JLM ?? wouldn't compile without this if(!pointsH || !pointsPtr) {SysBeep(5); return;} thisPointsHdl = (LongPoint**) (**MapPolyHdl).objectDataHdl; for(i = 0; i< numPts;i++) { wPt = INDEXH(thisPointsHdl,i); pt = GetQuickDrawPt(wPt.h,wPt.v,&gRect,&offQuickDrawPlane); INDEXH(pointsH,i) = MakePOINT(pt.h,pt.v); (pointsPtr)[i] = MakePOINT(pt.h,pt.v); // code goes here, make sure this point does not equal previous point JLM } GetForeColor (&saveColor); /* save original forecolor */ if (erasePolygon) { RgnHandle newClip=0; HBRUSH whiteBrush; newClip = CreatePolygonRgn((const POINT*)pointsPtr,numPts,ALTERNATE); whiteBrush = (HBRUSH)GetStockObject(WHITE_BRUSH); //err = SelectClipRgn(currentHDC,savedClip); FillRgn(currentHDC, newClip, whiteBrush); //DeleteObject(newClip); DisposeRgn(newClip); //SelectClipRgn(currentHDC,0); } else { POINT p[2]; p[0] = INDEXH(pointsH,numPts-1); p[1] = INDEXH(pointsH,0); RGBForeColor(&colors[BLACK]); if(numPts >= 2) { Polyline(currentHDC,*pointsH,numPts); Polyline(currentHDC,p,2); // close the polygon } } RGBForeColor (&saveColor); DisposeHandle((Handle)pointsH); if(pointsPtr) {_DisposePtr((Ptr)pointsPtr); pointsPtr = 0;} }
/*Assumes that all regions are in the guest coordinates system*/ static void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window) { ContextInfo *c = renderspuGetWindowContext(window); RgnHandle rgn; GLboolean result = true; DEBUG_MSG_POETZSCH (("ApplyVisibleRegion %x\n", window)); if (!c || !c->context) return; rgn = NewRgn(); SetEmptyRgn(rgn); if (render_spu.hRootVisibleRegion) { /* The render_spu.hRootVisibleRegion has coordinates from the root * window. We intersect it with the rect of the OpenGL window we * currently process. */ SetRectRgn(rgn, window->x, window->y, window->x + window->BltInfo.width, window->y + window->BltInfo.height); SectRgn(render_spu.hRootVisibleRegion, rgn, rgn); /* Because the clipping is done in the coordinate space of the OpenGL * window we have to remove the x/y position from the newly created * region. */ OffsetRgn (rgn, -window->x, -window->y); } else { /* If there is not root clipping region is available, create a base * region with the size of the target window. This covers all * needed/possible space. */ SetRectRgn(rgn, 0, 0, window->BltInfo.width, window->BltInfo.height); } /* Now intersect the window clipping region with a additional region e.g. * for the seamless mode. */ if (window->hVisibleRegion) SectRgn(rgn, window->hVisibleRegion, rgn); if (rgn && !EmptyRgn(rgn)) { /* Set the clip region to the context */ result = render_spu.ws.aglSetInteger(c->context, AGL_CLIP_REGION, (const GLint*)rgn); CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): SetInteger Failed"); result = render_spu.ws.aglEnable(c->context, AGL_CLIP_REGION); CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): Enable Failed"); } /* Clear the region structure */ DisposeRgn (rgn); }
//__________________________________________________________________ void _HYPlatformGraphicPane::_SlideRect (_HYRect& rct, int dv, int dh) { _HYGraphicPane* theParent = (_HYGraphicPane*)this; Rect r; r.left = rct.left; r.top = rct.top; r.bottom = rct.bottom; r.right = rct.right; RgnHandle dummy = NewRgn(); checkPointer (dummy); ScrollRect(&r,dh,dv,dummy); DisposeRgn (dummy); }
void GetRect(Rect *zoomFrom, Rect *zoomTo) { static short numRects = 0; Rect theRect,drawRect; Point firstPt,curPt,oldPt; RgnHandle rgnHandle = NewRgn(); GrafPtr oldPort; GetPort(&oldPort); SetPort(GetWindowPort(gWindow)); PenMode(patXor); GetMouse(&firstPt); oldPt = firstPt; SetRect(&theRect,firstPt.h,firstPt.v,firstPt.h,firstPt.v); while (Button()) { GetMouse(&curPt); if (!EqualPt(curPt,oldPt)) { FixRect(&theRect,&drawRect); FrameRect(&drawRect); oldPt = curPt; theRect.right = curPt.h; theRect.bottom = curPt.v; FixRect(&theRect,&drawRect); FrameRect(&drawRect); QDFlushPortBuffer(GetWindowPort(gWindow), GetPortVisibleRegion(GetWindowPort(gWindow), rgnHandle)); } } FixRect(&theRect,&drawRect); if (numRects==0) *zoomFrom = drawRect; else *zoomTo = drawRect; numRects++; QDFlushPortBuffer(GetWindowPort(gWindow), GetPortVisibleRegion(GetWindowPort(gWindow), rgnHandle)); if (numRects >= 2) { ZoomRect(kZoomLarger, zoomFrom, zoomTo); numRects = 0; } PenNormal(); DisposeRgn(rgnHandle); SetPort(oldPort); }
/* call-seq: bounds() -> bounds_hash Returns a hash of boundaries. The hash contains four keys: :left, :top, :right, :bottom. Each holds an integer representing the pixel value. */ static VALUE track_bounds(VALUE obj) { VALUE bounds_hash = rb_hash_new(); RgnHandle region; Rect bounds; region = GetTrackDisplayBoundsRgn(TRACK(obj)); GetRegionBounds(region, &bounds); DisposeRgn(region); rb_hash_aset(bounds_hash, ID2SYM(rb_intern("left")), INT2NUM(bounds.left)); rb_hash_aset(bounds_hash, ID2SYM(rb_intern("top")), INT2NUM(bounds.top)); rb_hash_aset(bounds_hash, ID2SYM(rb_intern("right")), INT2NUM(bounds.right)); rb_hash_aset(bounds_hash, ID2SYM(rb_intern("bottom")), INT2NUM(bounds.bottom)); return bounds_hash; }