void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush ) { wxGraphicsBrush formerBrush = m_brush; wxGraphicsPen formerPen = m_pen; wxDouble width; wxDouble height; wxDouble descent; wxDouble externalLeading; GetTextExtent( str , &width, &height, &descent, &externalLeading ); SetBrush( backgroundBrush ); // to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape SetPen( wxNullGraphicsPen ); wxGraphicsPath path = CreatePath(); path.MoveToPoint( x , y ); path.AddLineToPoint( (int) (x + sin(angle) * height) , (int) (y + cos(angle) * height) ); path.AddLineToPoint( (int) (x + sin(angle) * height + cos(angle) * width) , (int) (y + cos(angle) * height - sin(angle) * width)); path.AddLineToPoint((int) (x + cos(angle) * width) , (int) (y - sin(angle) * width) ); FillPath( path ); DrawText( str, x ,y, angle); SetBrush( formerBrush ); SetPen( formerPen ); }
void wxGraphicsContext::DoDrawFilledText(const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush) { wxGraphicsBrush formerBrush = m_brush; wxGraphicsPen formerPen = m_pen; wxDouble width; wxDouble height; wxDouble descent; wxDouble externalLeading; GetTextExtent( str , &width, &height, &descent, &externalLeading ); SetBrush( backgroundBrush ); // to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape SetPen( wxNullGraphicsPen ); wxGraphicsPath path = CreatePath(); path.AddRectangle( x , y, width, height ); FillPath( path ); DrawText( str, x ,y); SetBrush( formerBrush ); SetPen( formerPen ); }
void wxGraphicsContext::SetBrush( const wxBrush& brush ) { if ( !brush.Ok() || brush.GetStyle() == wxTRANSPARENT ) SetBrush( wxNullGraphicsBrush ); else SetBrush( CreateBrush( brush ) ); }
void ocpnDC::Clear() { if( dc ) dc->Clear(); else { wxBrush tmpBrush = m_brush; int w, h; SetBrush( wxBrush( glcanvas->GetBackgroundColour() ) ); glcanvas->GetSize( &w, &h ); DrawRectangle( 0, 0, w, h ); SetBrush( tmpBrush ); } }
void ODDC::Clear() { if( dc ) dc->Clear(); else { #ifdef ocpnUSE_GL wxBrush tmpBrush = m_brush; int w, h; SetBrush( wxBrush( glcanvas->GetBackgroundColour() ) ); glcanvas->GetSize( &w, &h ); DrawRectangle( 0, 0, w, h ); SetBrush( tmpBrush ); #endif } }
void Painter::Init () { if (solid == nil) { solid = new Pattern(0xffff); clear = new Pattern(0); lightgray = new Pattern(0x8020); gray = new Pattern(0xa5a5); darkgray = new Pattern(0xfafa); single = new Brush(0xffff, 0); } foreground = nil; background = nil; pattern = nil; br = nil; font = nil; style = 0; matrix = nil; SetColors(black, white); SetPattern(solid); FillBg(true); SetBrush(single); SetFont(stdfont); SetStyle(Plain); SetOrigin(0, 0); MoveTo(0, 0); }
void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) { m_bitmap = bitmap; if (m_gc) XFreeGC((Display*) m_display, (GC) m_gc); m_gc = (WXGC) NULL; if (m_bitmap.Ok() && (bitmap.GetDisplay() == m_display)) { m_pixmap = m_bitmap.GetDrawable(); Display* display = (Display*) m_display; XGCValues gcvalues; gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.background = WhitePixel (display, DefaultScreen (display)); gcvalues.graphics_exposures = False; gcvalues.subwindow_mode = IncludeInferiors; gcvalues.line_width = 1; m_gc = (WXGC) XCreateGC (display, (Drawable)m_pixmap/* RootWindow (display, DefaultScreen (display)) */, GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); m_backgroundPixel = gcvalues.background; m_ok = true; SetBrush (* wxWHITE_BRUSH); SetPen (* wxBLACK_PEN); } else { m_ok = false; m_pixmap = (WXPixmap) 0; }; }
wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC *owner, wxDC* dc) : wxWindowDCImpl(owner) { m_ok = true; if (dc && dc->IsKindOf(CLASSINFO(wxWindowDC))) m_display = ((wxWindowDCImpl *)dc->GetImpl())->GetDisplay(); else m_display = wxGetDisplay(); Display* display = (Display*) m_display; XGCValues gcvalues; gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.background = WhitePixel (display, DefaultScreen (display)); gcvalues.graphics_exposures = False; gcvalues.subwindow_mode = IncludeInferiors; gcvalues.line_width = 1; m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)), GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); m_backgroundPixel = gcvalues.background; SetBrush (* wxWHITE_BRUSH); SetPen (* wxBLACK_PEN); }
void UIFont::CopyFrom(UIFont *Other) { if (!Other) return; SetFace(Other->GetFace()); SetColor(Other->GetColor()); SetBrush(Other->GetBrush()); QPoint offset; QColor color; int blur; quint16 size; Other->GetShadow(offset, color, blur); SetShadow(Other->HasShadow(), offset, color, blur); Other->GetOutline(color, size); SetOutline(Other->HasOutline(), color, size); SetOffset(Other->GetOffset()); SetRelativeSize(Other->GetRelativeSize()); SetSize(Other->GetFace().pixelSize()); SetStretch(Other->GetStretch()); SetImageFileName(Other->GetImageFileName()); SetImageReady(Other->GetImageReady()); UIImage* image = Other->GetImage(); if (image) { SetImage(image); m_image->UpRef(); } }
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush ) { wxGraphicsBrush formerBrush = m_brush; wxDouble width; wxDouble height; wxDouble descent; wxDouble externalLeading; GetTextExtent( str , &width, &height, &descent, &externalLeading ); SetBrush( backgroundBrush ); wxGraphicsPath path = CreatePath(); path.AddRectangle( x , y, width, height ); FillPath( path ); DrawText( str, x ,y); SetBrush( formerBrush ); }
void OCPiano::DrawWhiteKey(const int Pos, const bool Down) { QLinearGradient lg(0,0,0,WhiteKeyHeight); if (Down) { lg.setColorAt(0,"#999"); lg.setColorAt(0.6,"#ddd"); } else { lg.setColorAt(0,"#ccc"); lg.setColorAt(0.8,"#fff"); } SetPen(QPen(Qt::NoPen)); SetBrush(lg); Rectangle(Pos+1,0,WhiteKeyWidth-1,WhiteKeyHeight-1); //Scene.addRect(Pos+1,0,WhiteKeyWidth-1,WhiteKeyHeight-1,QPen(Qt::NoPen),QBrush(lg)); SetPen("#666"); Line(Pos,0,Pos+WhiteKeyWidth,0); //Scene.addLine(Pos,0,Pos+WhiteKeyWidth,0,QPen("#666")); if (Down) { SetPen("#888"); Line(Pos,1,Pos+WhiteKeyWidth,1); //Scene.addLine(Pos,1,Pos+WhiteKeyWidth,1,QPen("#888")); } SetPen("#555"); Line(Pos,0,Pos,WhiteKeyHeight-1); //Scene.addLine(Pos,0,Pos,WhiteKeyHeight-1,QPen("#555")); SetPen(Qt::black); Line(Pos+WhiteKeyWidth,0,Pos+WhiteKeyWidth,WhiteKeyHeight-1); //Scene.addLine(Pos+WhiteKeyWidth,0,Pos+WhiteKeyWidth,WhiteKeyHeight-1,QPen(Qt::black)); SetPenBrush(Qt::gray); Rectangle(Pos+WhiteKeyWidth-1,1,1,WhiteKeyHeight-2); //Scene.addRect(Pos+WhiteKeyWidth-1,1,1,WhiteKeyHeight-2,QPen(Qt::gray),QBrush(Qt::gray)); if (Down) { SetBrush("#666"); Rectangle(Pos+1,1,1,WhiteKeyHeight-2); //Scene.addRect(Pos+1,1,1,WhiteKeyHeight-2,QPen(Qt::gray),QBrush("#666")); } SetPen("#555"); Line(Pos+1,WhiteKeyHeight,Pos+WhiteKeyWidth-1,WhiteKeyHeight); //Scene.addLine(Pos+1,WhiteKeyHeight,Pos+WhiteKeyWidth-1,WhiteKeyHeight,QPen("#555")); }
wxMemoryDC::wxMemoryDC(void) : m_selected() { m_ok = TRUE; SetBackground(*wxWHITE_BRUSH); SetBrush(*wxWHITE_BRUSH); SetPen(*wxBLACK_PEN); m_ok = FALSE; };
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) : m_selected() { m_ok = TRUE; SetBackground(*wxWHITE_BRUSH); SetBrush(*wxWHITE_BRUSH); SetPen(*wxBLACK_PEN); m_ok = FALSE; };
void wxMemoryDCImpl::Init() { m_ok = true; SetBackground(*wxWHITE_BRUSH); SetBrush(*wxWHITE_BRUSH); SetPen(*wxBLACK_PEN); SetFont(*wxNORMAL_FONT); m_ok = false; }
void wxPrinterDCImpl::Init() { if (m_hDC) { SetMapMode(wxMM_TEXT); SetBrush(*wxBLACK_BRUSH); SetPen(*wxBLACK_PEN); } } // end of wxPrinterDC::Init
CBufView::~CBufView() { SetPen(NULL); SetBrush(NULL); SetFont(NULL); SelectObject(m_buffer.hDC, m_buffer.hOldBmp); DeleteObject(m_buffer.hBmp); DeleteDC(m_buffer.hDC); ReleaseDC(GetDesktopWindow(), m_buffer.hDCDesktop); }
void wxMemoryDCImpl::Init() { if ( m_ok ) { SetBrush(*wxWHITE_BRUSH); SetPen(*wxBLACK_PEN); // the background mode is only used for text background and is set in // DrawText() to OPAQUE as required, otherwise always TRANSPARENT ::SetBkMode( GetHdc(), TRANSPARENT ); } }
wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& rPrintData ) : wxPMDCImpl( owner ) { m_printData = rPrintData; m_isInteractive = false; m_hDC = wxGetPrinterDC(rPrintData); m_ok = (m_hDC != 0); if (m_hDC) SetMapMode(wxMM_TEXT); SetBrush(*wxBLACK_BRUSH); SetPen(*wxBLACK_PEN); } // end of wxPrinterDC::wxPrinterDC
void wxPrinterDCImpl::Init() { if ( m_hDC ) { // int width = GetDeviceCaps(m_hDC, VERTRES); // int height = GetDeviceCaps(m_hDC, HORZRES); SetMapMode(wxMM_TEXT); SetBrush(*wxBLACK_BRUSH); SetPen(*wxBLACK_PEN); } }
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush ) { wxGraphicsBrush formerBrush = m_brush; wxDouble width; wxDouble height; wxDouble descent; wxDouble externalLeading; GetTextExtent( str , &width, &height, &descent, &externalLeading ); SetBrush( backgroundBrush ); wxGraphicsPath path = CreatePath(); path.MoveToPoint( x , y ); path.AddLineToPoint( (int) (x + sin(angle) * height) , (int) (y + cos(angle) * height) ); path.AddLineToPoint( (int) (x + sin(angle) * height + cos(angle) * width) , (int) (y + cos(angle) * height - sin(angle) * width)); path.AddLineToPoint((int) (x + cos(angle) * width) , (int) (y - sin(angle) * width) ); FillPath( path ); DrawText( str, x ,y, angle); SetBrush( formerBrush ); }
wxControlPoint::wxControlPoint(wxShapeCanvas *theCanvas, wxShape *object, double size, double the_xoffset, double the_yoffset, int the_type): wxRectangleShape(size, size) { m_canvas = theCanvas; m_shape = object; m_xoffset = the_xoffset; m_yoffset = the_yoffset; m_type = the_type; SetPen(g_oglBlackForegroundPen); SetBrush((wxBrush *) wxBLACK_BRUSH); m_oldCursor = NULL; m_visible = TRUE; m_eraseObject = TRUE; }
wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, WXHDC hTheDC ) : wxPMDCImpl( owner ) { m_isInteractive = false; m_hDC = hTheDC; m_ok = true; if (m_hDC) { SetMapMode(wxMM_TEXT); } SetBrush(*wxBLACK_BRUSH); SetPen(*wxBLACK_PEN); } // end of wxPrinterDC::wxPrinterDC
wxPrinterDC::wxPrinterDC( const wxPrintData& rPrintData ) { m_printData = rPrintData; m_isInteractive = FALSE; m_hDC = wxGetPrinterDC(rPrintData); m_ok = (m_hDC != 0); if (m_hDC) SetMapMode(wxMM_TEXT); SetBrush(*wxBLACK_BRUSH); SetPen(*wxBLACK_PEN); } // end of wxPrinterDC::wxPrinterDC
void wxMemoryDCImpl::Init() { if (m_ok) { SetBrush(*wxWHITE_BRUSH); SetPen(*wxBLACK_PEN); // the background mode is only used for text background and is set in // DrawText() to OPAQUE as required, otherwise always TRANSPARENT ::GpiSetBackMix( GetHPS(), BM_LEAVEALONE ); } memset(&m_vRclPaint, 0, sizeof(m_vRclPaint)); } // end of wxMemoryDC::Init
void CPaintHelper::SetElement(UIELEMENT eElement) { UIELEMENTINFO *info = m_uig.GetElementInfo(eElement); if (!info) return; if (info->eFont != UIF_LAST) SetFont(info->eFont); if (info->eBrush != UIB_LAST) SetBrush(info->eBrush); if (info->ePen != UIP_LAST) SetPen(info->ePen); SetText(info->eText, info->eBk); }
wxPrinterDC::wxPrinterDC( WXHDC hTheDC ) { m_isInteractive = FALSE; m_hDC = hTheDC; m_ok = TRUE; if (m_hDC) { SetMapMode(wxMM_TEXT); } SetBrush(*wxBLACK_BRUSH); SetPen(*wxBLACK_PEN); } // end of wxPrinterDC::wxPrinterDC
BBoxDeviceContext::BBoxDeviceContext ( View *view, int width, int height): DeviceContext() { m_view = view; m_width = width; m_height = height; m_userScaleX = 1.0; m_userScaleY = 1.0; m_drawingText = false; SetBrush( AxBLACK, AxSOLID ); SetPen( AxBLACK, 1, AxSOLID ); }
void wxDFBDCImpl::DFBInit(const wxIDirectFBSurfacePtr& surface) { m_surface = surface; wxCHECK_RET( surface != NULL, "invalid surface" ); m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() / (double)wxGetDisplaySizeMM().GetWidth(); m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() / (double)wxGetDisplaySizeMM().GetHeight(); SetFont(DEFAULT_FONT); SetPen(DEFAULT_PEN); SetBrush(DEFAULT_BRUSH); }
BBoxDeviceContext::BBoxDeviceContext(View *view, int width, int height, unsigned char update) : DeviceContext() { m_view = view; m_width = width; m_height = height; m_userScaleX = 1.0; m_userScaleY = 1.0; m_drawingText = false; m_textAlignment = LEFT; SetBrush(AxBLACK, AxSOLID); SetPen(AxBLACK, 1, AxSOLID); m_update = update; }
void Painter::Copy(Painter* copy) { foreground = nil; background = nil; pattern = nil; br = nil; font = nil; style = 0; matrix = nil; SetColors(copy->foreground, copy->background); SetPattern(copy->pattern); SetBrush(copy->br); SetFont(copy->font); SetStyle(copy->style); SetTransformer(copy->matrix); SetOrigin(copy->xoff, copy->yoff); MoveTo(copy->curx, copy->cury); }