void ClearDownloadSettings(void) { GrafPtr oldPort; GetPort(&oldPort); if (gWPtr) { SetPort(gWPtr); if (gControls->tw->dlSettingsGB) DisposeControl(gControls->tw->dlSettingsGB); if (gControls->tw->startMsg) EraseRect(&gControls->tw->startMsgBox); if (gControls->tw->siteSelector) DisposeControl(gControls->tw->siteSelector); if (gControls->tw->siteSelMsg) DisposeControl(gControls->tw->siteSelMsg); if (gControls->tw->saveBitsMsg) EraseRect(&gControls->tw->saveBitsMsgBox); if (gControls->tw->saveBitsCheckbox) DisposeControl(gControls->tw->saveBitsCheckbox); if (gControls->tw->proxySettingsBtn) DisposeControl(gControls->tw->proxySettingsBtn); } SetPort(oldPort); }
static void draw_window_contents( WindowPtr wp) { GrafPtr old_port; GetPort(&old_port); SetPortWindowPort(wp); /* Any specific updating stuff.... */ #ifdef OP_PLATFORM_MAC_CARBON_FLAG { Rect windowBounds; GetWindowPortBounds(wp, &windowBounds); EraseRect(&windowBounds); } #else EraseRect(&wp->portRect); #endif update_log(wp); SetPort(old_port); return; }
bool MCRegionCalculateMask(MCRegionRef self, int32_t w, int32_t h, MCBitmap*& r_mask) { // Create a pixmap Pixmap t_image; t_image = MCscreen -> createpixmap(w, h, 1, False); // Draw into the pixmap's port CGrafPtr t_old_port; GDHandle t_old_device; GetGWorld(&t_old_port, &t_old_device); SetGWorld((CGrafPtr)t_image -> handle . pixmap, NULL); BackColor(whiteColor); ForeColor(blackColor); Rect t_rect; SetRect(&t_rect, 0, 0, w, h); EraseRect(&t_rect); PaintRgn((RgnHandle)self); SetGWorld(t_old_port, t_old_device); // Fetch the pixmap as a bitmap MCBitmap *t_bitmap; t_bitmap = MCscreen -> getimage(t_image, 0, 0, w, h, False); // Discard the pixmap MCscreen -> freepixmap(t_image); r_mask = t_bitmap; return true; }
void _GuiMacScale_destroy (GuiObject widget) { _GuiMac_clipOnParent (widget); EraseRect (& widget -> rect); GuiMac_clipOff (); iam_scale; forget (me); // NOTE: my widget is not destroyed here }
//__________________________________________________________________ void _HYGraphicPane::DrawInfoBox (_HYRect theBox, _String boxName) { long stringWidth, avWidth = theBox.right-theBox.left-20; theBox.width = 1; DrawRect (theBox); if (boxName.sLength) { stringWidth = GetVisibleStringWidth (boxName, font); while (stringWidth>avWidth && boxName.sLength) { boxName.Trim (0, boxName.sLength-2); stringWidth = GetVisibleStringWidth (boxName, font); } // measure string length _HYRect textRect = theBox; textRect.left += 8; textRect.right = textRect.left+stringWidth+4; textRect.top-=6; textRect.bottom = textRect.top+9; EraseRect (textRect); DisplayText (boxName, textRect.bottom, textRect.left+2, true); } }
void MyDrawString(/*short dir,*/ short h, short v, char *s,Boolean framed,short selectMode) { Rect r; if(sharedPrinting)selectMode = POINTDRAWFLAG; if(strlen(s) >0) { GetTextOffsets(/*dir,*/s,&h,&v); GetStringRect(s,h,v,&r); if(selectMode == BADPOINTDRAWFLAG)selectMode = POINTDRAWFLAG; if(selectMode == POINTDRAWFLAG) { EraseRect(&r); MyMoveTo(h,v); drawstring(s); } if(framed) { if(selectMode != POINTDRAWFLAG) { PenMode(patXor);PaintRect(&r); } PenMode(patCopy); MyFrameRect(&r); } } }
IPTR ImageClass__IM_ERASE(Class *cl, struct Image *im, struct impErase *msg) { /* * Both erase methods are documented as handled the same * at this level, so we will fall thru... */ WORD left, top, width, height; D(kprintf("ImageClass IM_ERASE(FRAME)\n") ); left = im->LeftEdge + msg->imp_Offset.X; top = im->TopEdge + msg->imp_Offset.Y; width = im->Width - 1; height = im->Height - 1; if (msg->imp_RPort) { EraseRect(msg->imp_RPort, left, top, left + width, top + height ); } return (IPTR)0; }
void QTApp_Draw (WindowReference theWindow) { GrafPtr mySavedPort = NULL; GrafPtr myWindowPort = NULL; WindowPtr myWindow = NULL; Rect myRect; GetPort(&mySavedPort); myWindowPort = QTFrame_GetPortFromWindowReference(theWindow); myWindow = QTFrame_GetWindowFromWindowReference(theWindow); if (myWindowPort == NULL) return; MacSetPort(myWindowPort); #if TARGET_API_MAC_CARBON GetPortBounds(myWindowPort, &myRect); #else myRect = myWindowPort->portRect; #endif BeginUpdate(myWindow); // erase any part of a movie window that hasn't already been updated // by the movie controller if (QTFrame_IsMovieWindow(theWindow)) EraseRect(&myRect); // ***insert application-specific drawing here*** EndUpdate(myWindow); MacSetPort(mySavedPort); }
void ShowTxt(void) { switch (gCurrWin) { case kLicenseID: if(gControls->lw->licTxt) { RGBColor backColorOld; Rect textRect; // get back color GetBackColor(&backColorOld); // set to white BackColor(whiteColor); // erase rect and update textRect = (**(gControls->lw->licTxt)).viewRect; EraseRect(&textRect); TEUpdate(&textRect, gControls->lw->licTxt); // restore back color RGBBackColor(&backColorOld); } break; default: break; } }
// Erase a window interior void erase_window(struct Window *window) { EraseRect(window->RPort, window->BorderLeft, window->BorderTop, window->Width-window->BorderRight-1, window->Height-window->BorderBottom-1); }
void Icon::Paint( const Rect &cUpdateRect ) { EraseRect( cUpdateRect ); if( m_bSelected ) { Rect cUpdateFrame = GetBounds(); cUpdateFrame.top += 2; cUpdateFrame.left += 2; /* XXXKV: This is a hack; why is the height from GetBounds() so large? */ cUpdateFrame.right = m_cSize.x - 2; cUpdateFrame.bottom = m_cSize.y - 2; FillRect( cUpdateFrame, m_sHighlightColor ); /* Round edges */ SetDrawingMode( DM_COPY ); SetFgColor( m_sHighlightColor ); DrawLine( os::Point( cUpdateFrame.left + 2, cUpdateFrame.top - 2 ), os::Point( cUpdateFrame.right - 2, cUpdateFrame.top - 2 ) ); DrawLine( os::Point( cUpdateFrame.left, cUpdateFrame.top - 1 ), os::Point( cUpdateFrame.right, cUpdateFrame.top - 1 ) ); DrawLine( os::Point( cUpdateFrame.left - 2, cUpdateFrame.top + 2 ), os::Point( cUpdateFrame.left - 2, cUpdateFrame.bottom - 2 ) ); DrawLine( os::Point( cUpdateFrame.left - 1, cUpdateFrame.top ), os::Point( cUpdateFrame.left - 1, cUpdateFrame.bottom ) ); DrawLine( os::Point( cUpdateFrame.left + 2, cUpdateFrame.bottom + 2 ), os::Point( cUpdateFrame.right - 2, cUpdateFrame.bottom + 2 ) ); DrawLine( os::Point( cUpdateFrame.left, cUpdateFrame.bottom + 1 ), os::Point( cUpdateFrame.right, cUpdateFrame.bottom + 1 ) ); DrawLine( os::Point( cUpdateFrame.right + 2, cUpdateFrame.top + 2 ), os::Point( cUpdateFrame.right + 2, cUpdateFrame.bottom - 2 ) ); DrawLine( os::Point( cUpdateFrame.right + 1, cUpdateFrame.top ), os::Point( cUpdateFrame.right + 1, cUpdateFrame.bottom ) ); SetFgColor( m_sFgColor ); } SetDrawingMode( DM_BLEND ); /* XXXKV: Will only work with BitmapImage; should use RTTI to find type and handle accordingly */ BitmapImage *pcImage = static_cast<BitmapImage*>( m_pcImage ); Bitmap *pcBitmap = pcImage->LockBitmap(); DrawBitmap( pcBitmap, pcImage->GetBounds(), m_cImageFrame ); pcImage->UnlockBitmap(); /* Draw the icon name */ SetDrawingMode( DM_OVER ); MovePenTo( m_cNamePos ); DrawString( m_cName ); }
void UpdateAdditionsWin(void) { Rect r; Cell c; int i; GrafPtr oldPort; GetPort(&oldPort); SetPort(gWPtr); MoveTo( gControls->aw->compListBox.left, gControls->aw->compListBox.top - kInterWidgetPad + 1); HLock(gControls->cfg->selAddMsg); DrawString( CToPascal(*gControls->cfg->selAddMsg)); HUnlock(gControls->cfg->selAddMsg); #if 0 RGBColor backColorOld; Rect adjustedRect, *clRect = &gControls->aw->compListBox; SetRect(&adjustedRect, clRect->left, clRect->top+1, clRect->right, clRect->bottom-1); GetBackColor(&backColorOld); BackColor(whiteColor); EraseRect(&adjustedRect); RGBBackColor(&backColorOld); #endif LUpdate( (*gControls->aw->compList)->port->visRgn, gControls->aw->compList); SetRect(&r, gControls->aw->compListBox.left, gControls->aw->compListBox.top, gControls->aw->compListBox.right + 1, gControls->aw->compListBox.bottom); FrameRect(&r); SetPt(&c, 0, 0); if (LGetSelect(true, &c, gControls->aw->compList)) { HLock((Handle)gControls->aw->compDescTxt); SetRect(&r, (*gControls->aw->compDescTxt)->viewRect.left, (*gControls->aw->compDescTxt)->viewRect.top, (*gControls->aw->compDescTxt)->viewRect.right, (*gControls->aw->compDescTxt)->viewRect.bottom); HUnlock((Handle)gControls->aw->compDescTxt); TEUpdate(&r, gControls->aw->compDescTxt); } DrawDiskSpaceMsgs( gControls->opt->vRefNum ); for (i = 0; i < numRows; i++) { if (gControls->cfg->comp[rowToComp[i]].highlighted) { AddInitRowHighlight(i); break; } } SetPort(oldPort); }
static void draw_device_area( GDSpecPtr device_spec, GDHandle selected_device, Rect *frame) { Point offset; GDHandle device; get_device_area_offset(frame, &offset); EraseRect(frame); FrameRect(frame); for (device= GetDeviceList(); device; device= GetNextDevice(device)) { if (TestDeviceAttribute(device, screenDevice) && TestDeviceAttribute(device, screenActive)) { GDSpec spec; Rect bounds; BuildExplicitGDSpec(&spec, device, device_spec->flags, device_spec->bit_depth, 0, 0); get_device_area_frame(device, &bounds, offset); RGBForeColor(HasDepthGDSpec(&spec) ? &rgb_dark_gray : &rgb_white); PaintRect(&bounds); RGBForeColor(&rgb_black); if (device==selected_device) PenSize(2, 2); FrameRect(&bounds); PenSize(1, 1); if (device==GetMainDevice()) { bounds.bottom= bounds.top + DEVICE_AREA_MENU_BAR_HEIGHT; EraseRect(&bounds); FrameRect(&bounds); } } } return; }
void LCD_clear_area(Lcd *x) /* erase the area occupied by the LCD */ { Rect r; r = x->lcd_oldRect; InsetRect(&r,1,1); EraseRect(&r); x->lcd_row = 0; x->lcd_col = 0; }
static void draw_scope(double *values) { static int32 call_cnt; int offset, expose,i; RGBColor pixels[SCOPE_HEIGHT]; double work[SCOPE_HEIGHT]; int nze; Rect righthalf={0,SCOPE_WIDTH - SCROLL_THRESHOLD, SCOPE_HEIGHT, SCOPE_WIDTH }, lefthalf={0,0, SCOPE_HEIGHT, SCOPE_WIDTH - SCROLL_THRESHOLD-1 }; nze = 0; make_logspectrogram(values, work); if( win.show ){ set_draw_pixel(work, pixels); expose = 0; SetPortWindowPort(win.ref); offset = call_cnt % SCROLL_THRESHOLD; if(offset == 0) { //scroll the window EraseRect(&lefthalf); ScrollRect(&win.ref->portRect, -(SCOPE_WIDTH - SCROLL_THRESHOLD), 0, 0); EraseRect(&righthalf); } //draw for( i=0; i<SCOPE_HEIGHT; i++ ){ RGBForeColor(&pixels[i]); MoveTo(SCOPE_WIDTH - SCROLL_THRESHOLD + offset,i); Line(0,0); } } if( skin_need_speana ){ skin_draw_spectrum(work); //ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "." ); } if(nze) initialize_exp_hz_table(soundspec_zoom - 4 * nze); call_cnt++; }
static void MacClearViewPort (void) { Rect PlotRgnRect; PlotRgnRect.left = currgw->Local_LL[0]; PlotRgnRect.bottom = currgw->Local_LL[1]; PlotRgnRect.right = currgw->Local_UR[0]; PlotRgnRect.top = currgw->Local_UR[1]; EraseRect(&PlotRgnRect); }
void SimplePluginInstance::DoDraw(void) { Rect drawRect; drawRect.top = 0; drawRect.left = 0; drawRect.bottom = drawRect.top + fWindow->height; drawRect.right = drawRect.left + fWindow->width; EraseRect( &drawRect ); MoveTo( 2, 12 ); DrawString("\pHello, World!"); }
void ShowLogo(Boolean bEraseRect) { short reserr; Rect derefd, logoRect; PicHandle logoPicH; Handle logoRectH; /* draw the image well */ ControlHandle imgWellH = GetNewControl(rLogoImgWell, gWPtr); if (!imgWellH) { ErrorHandler(eMem, nil); return; } /* initialize Netscape logo */ logoPicH = GetPicture(rNSLogo); reserr = ResError(); if (reserr == noErr) { /* draw Netscape logo */ if (logoPicH != nil) { logoRectH = GetResource('RECT', rNSLogoBox); reserr = ResError(); if (reserr == noErr && logoRectH) { HLock(logoRectH); derefd = (Rect) **((Rect**)logoRectH); SetRect(&logoRect, derefd.left, derefd.top, derefd.right, derefd.bottom); HUnlock(logoRectH); reserr = ResError(); if (reserr == noErr) { if (bEraseRect) { EraseRect(&logoRect); InvalRect(&logoRect); } DrawPicture(logoPicH, &logoRect); ReleaseResource((Handle)logoPicH); } ReleaseResource((Handle)logoRectH); } } } if (reserr != noErr) ErrorHandler(reserr, nil); }
void RemoteIconView::DrawMessage( const String& zMsg ) { DEBUG( "RemoteIconView::DrawMessage( %s )\n", zMsg.c_str() ); EraseRect( GetBounds() ); SetFgColor( Color32_s( 255,0,0 ) ); Point cSize = GetTextExtent( zMsg ); Point cPos; cPos.x = Width()/2 - cSize.x/2; cPos.y = Height()/2 - cSize.y/2; DrawString( cPos, zMsg ); Flush(); }
void mac_trc_update_all_info() { Rect r; SetPortWindowPort(win.ref); SetRect(&r, 0,0, win.ref->portRect.right,UPPER_MERGIN); EraseRect(&r); mac_trc_update_voices(); update_filename(); update_title(); mac_trc_update_time(-1,-1); }
/*---------------------------------------------------------------------- * +++ ToolbarBackground element -- toolbar style for frames. * * This is very similar to the normal background element, but uses a * different ThemeBrush in order to get the lighter pinstripe effect * used in toolbars. We use SetThemeBackground() rather than * ApplyThemeBackground() in order to get the right style. * * <URL: http://developer.apple.com/documentation/Carbon/Reference/ * Appearance_Manager/appearance_manager/constant_7.html#/ * /apple_ref/doc/uid/TP30000243/C005321> * */ static void ToolbarBackgroundElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeBrush brush = kThemeBrushToolbarBackground; Rect bounds = BoxToRect(d, Ttk_WinBox(tkwin)); BEGIN_DRAWING(d) ChkErr(SetThemeBackground, brush, 32, true); QDSetPatternOrigin(PatternOrigin(tkwin, d)); EraseRect(&bounds); END_DRAWING }
void Form_ADChannel_Timer(void *ptmr, void *parg) { LPWindow lpWindow = (LPWindow)parg; #if SYS_CRITICAL_METHOD == 3 SYS_CPU_SR cpu_sr = 0; #endif Get_Scaler_WetPar(&wet_chanle); if(lpWindow != NULL) { if(g_pCurWindow == &gWD_ADChannel) { SYS_ENTER_CRITICAL(); sADChannel1_Value = wet_chanle.ScalerAD; sADChannel2_Value = wet_chanle.BackAxleAD; // sADChannel3_Value = wet_chanle.PreAxle1AD; sADChannel4_Value = wet_chanle.PreAxle2AD; // SYS_EXIT_CRITICAL(); PostWindowMsg(lpWindow, WM_UPDATECTRL, 0, 0); #if 0 EraseRect(70,44, 170,18); EraseRect(70,66, 170,18); EraseRect(70,88, 170,18); EraseRect(70,109,170,18); PostWindowMsg(lpWindow, WM_UPDATECTRL, (u32)&mADChannel1, 0); RDelay(5); PostWindowMsg(lpWindow, WM_UPDATECTRL, (u32)&mADChannel2, 0); RDelay(5); PostWindowMsg(lpWindow, WM_UPDATECTRL, (u32)&mADChannel3, 0); RDelay(5); PostWindowMsg(lpWindow, WM_UPDATECTRL, (u32)&mADChannel4, 0); #endif } } }
void DrawWindow(WindowRef window) { Rect tempRect; GrafPtr curPort; GetPort(&curPort); SetPort(GetWindowPort(window)); BeginUpdate(window); EraseRect(GetWindowPortBounds(window, &tempRect)); DrawControls(window); DrawGrowIcon(window); EndUpdate(window); SetPort(curPort); }
void PF_EraseRect ( PF_InData *in_data, PF_ContextH contextH, PF_Rect *rect) { #ifdef AE_OS_WIN HDC hdc; HBRUSH Brush = GetStockObject(WHITE_BRUSH); PF_GET_CGRAF_DATA((*contextH)->cgrafptr, PF_CGrafData_HDC, &hdc); FillRect(hdc, (RECT*)rect, Brush); #else EraseRect((Rect*)rect); #endif }
void HandleMouseDown(EventRecord *event) { short part; WindowRef window; MacWindow *macwin; Rect growRect={100,100,32000,32000}; long size; part=FindWindow(event->where, &window); macwin = (MacWindow*)GetWRefCon(window); switch(part) { case inMenuBar: mac_AdjustMenus(event->modifiers); mac_HandleMenuSelect(MenuSelect(event->where), event->modifiers); HiliteMenu(0); break; case inContent: SetPortWindowPort(window); SelectWindow(window); GlobalToLocal(&event->where); if(macwin) macwin->click(event->where, event->modifiers); break; case inDrag: DragWindow(window, event->where, &qd.screenBits.bounds); break; case inGrow: SetPortWindowPort(window); size=GrowWindow(window, event->where, &growRect); if( size ) { SizeWindow(window, size&0x0000FFFF, size>>16, 0); EraseRect(&GetWindowPort(window)->portRect); InvalRect(&GetWindowPort(window)->portRect); if( macwin ) macwin->message(MW_GROW, size); } break; case inGoAway: if( TrackGoAway(window, event->where) ){ if( macwin ){ macwin->goaway(macwin); } } break; //case inZoomIn: //case inZoomOut: // break; } }
void UserPaneDraw( ControlRef control, ControlPartCode cpc) { MacButton *mbPtr = (MacButton *)(intptr_t)GetControlReference(control); Rect contrlRect; CGrafPtr port; GetPort(&port); GetControlBounds(control,&contrlRect); TkMacOSXSetColorInPort(mbPtr->userPaneBackground, 0, NULL, port); EraseRect(&contrlRect); }
static void FillElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Rect bounds = BoxToRect(d, b); ThemeBrush brush = (state & TTK_STATE_BACKGROUND) ? kThemeBrushModelessDialogBackgroundInactive : kThemeBrushModelessDialogBackgroundActive; BEGIN_DRAWING(d) ChkErr(SetThemeBackground, brush, 32, true); QDSetPatternOrigin(PatternOrigin(tkwin, d)); EraseRect(&bounds); END_DRAWING }
/**************************************************************** PopErase() erases the given popup and its shadow. ****************************************************************/ void PopErase(DialogPtr theDialog, short itemNum) { GrafPtr savePort; short itemType; Handle itemHandle; Rect itemBox; GetPortGrafPtr(&savePort); SetPortDialogPort(theDialog); GetDialogItem(theDialog, itemNum, &itemType, &itemHandle, &itemBox); itemBox.right++; itemBox.bottom++; EraseRect(&itemBox); SetPortGrafPort(savePort); }
void mark_for_update( GrafPtr port, Rect *rectangle) { GrafPtr old_port; GetPort(&old_port); SetPort(port); if (!rectangle) rectangle= &port->portRect; EraseRect(rectangle); InvalRect(rectangle); SetPort(old_port); return; }
PRIVATE GWorldPtr gworld_from_pict (PicHandle ph) { GWorldPtr retval; retval = NULL; if (ph) { CGrafPtr save_port; GDHandle save_device; Rect r; OSErr err; GetGWorld (&save_port, &save_device); save_port = MR (save_port); save_device = MR (save_device); r = HxX (ph, picFrame); err = NewGWorld (&retval, 32, &r, NULL, NULL, keepLocal); if (retval) { PixMapHandle pm; retval = MR (retval); SetGWorld (retval, NULL); pm = GetGWorldPixMap (retval); LockPixels (pm); DrawPicture (ph, &r); #if 0 #warning THIS INTERFERES WITH PICT PASTING { char *p; EraseRect (&r); p = GetPixBaseAddr (pm); memset (p, 0x00, 4 * RECT_HEIGHT(&r) * RECT_WIDTH (&r)); memset (p, 0xFF, 4 * RECT_HEIGHT(&r) * RECT_WIDTH (&r) / 2); } #endif UnlockPixels (pm); } SetGWorld (save_port, save_device); } return retval; }