m_textGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxTEXT_SCREEN );
m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBG_SCREEN );
}
-#if 0
else
if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1))
{
m_textGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxTEXT_MONO );
m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBG_MONO );
}
-#endif
else
{
m_penGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxPEN_COLOUR );
XSetFillStyle( (Display*) m_display, (GC) m_textGC, FillSolid );
+#if wxUSE_NANOX
+ // By default, draw transparently
+ GrSetGCUseBackground((GC) m_textGC, FALSE);
+#endif
+
/* m_penGC */
m_pen.GetColour().CalcPixel( m_cmap );
XSetForeground( (Display*) m_display, (GC) m_penGC, m_pen.GetColour().GetPixel() );
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
-
- wxLogDebug("Drawing line at %d, %d -> %d, %d", XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
}
}
if (m_pen.GetStyle () != wxTRANSPARENT)
{
XDrawRectangle( (Display*) m_display, (Window) m_window,
- (GC) m_penGC, xx, yy, ww, hh );
+ (GC) m_penGC, xx, yy, ww-1, hh-1 );
}
}
CalcBoundingBox( x, y );
CalcBoundingBox( x + width, y + height );
- wxLogDebug("Drawing rectangle at %d, %d (%dx%d)", x, y, width, height);
}
void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
wxCHECK_RET( bitmap.Ok(), wxT("invalid bitmap") );
-#if 0
bool is_mono = (bitmap.GetBitmap() != NULL);
/* scale/translate size and position */
{
wxImage image( bitmap );
image.Rescale( ww, hh );
+#if 0
if (is_mono)
use_bitmap = image.ConvertToMonoBitmap(255,255,255);
else
+#endif
use_bitmap = image.ConvertToBitmap();
}
else
}
/* apply mask if any */
- GdkBitmap *mask = (GdkBitmap *) NULL;
+ WXPixmap mask = NULL;
if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap();
-
+ {
if (useMask && mask)
{
- GdkBitmap *new_mask = (GdkBitmap*) NULL;
+ WXPixmap new_mask = NULL;
+#if 0
if (!m_currentClippingRegion.IsNull())
{
GdkColor col;
gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh );
gdk_gc_unref( gc );
}
-
+#endif
if (is_mono)
{
if (new_mask)
- gdk_gc_set_clip_mask( m_textGC, new_mask );
+ XSetClipMask( (Display*) m_display, (GC) m_textGC, (Pixmap) new_mask );
else
- gdk_gc_set_clip_mask( m_textGC, mask );
- gdk_gc_set_clip_origin( m_textGC, xx, yy );
+ XSetClipMask( (Display*) m_display, (GC) m_textGC, (Pixmap) mask );
+ XSetClipOrigin( (Display*) m_display, (GC) m_textGC, xx, yy );
}
else
{
if (new_mask)
- gdk_gc_set_clip_mask( m_penGC, new_mask );
+ XSetClipMask( (Display*) m_display, (GC) m_penGC, (Pixmap) new_mask );
else
- gdk_gc_set_clip_mask( m_penGC, mask );
- gdk_gc_set_clip_origin( m_penGC, xx, yy );
+ XSetClipMask( (Display*) m_display, (GC) m_penGC, (Pixmap) mask );
+ XSetClipOrigin( (Display*) m_display, (GC) m_penGC, xx, yy );
}
+
if (new_mask)
- gdk_bitmap_unref( new_mask );
+ XFreePixmap( (Display*) m_display, (Pixmap) new_mask );
}
+ }
/* Draw XPixmap or XBitmap, depending on what the wxBitmap contains. For
drawing a mono-bitmap (XBitmap) we use the current text GC */
if (is_mono)
- gdk_wx_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 );
+ XCopyPlane( (Display*) m_display, (Pixmap) use_bitmap.GetBitmap(), (Window) m_window,
+ (GC) m_textGC, 0, 0, w, h, xx, yy, 1 );
else
- gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
+ XCopyArea( (Display*) m_display, (Pixmap) use_bitmap.GetPixmap(), (Window) m_window,
+ (GC) m_penGC, 0, 0, w, h, xx, yy );
/* remove mask again if any */
if (useMask && mask)
{
if (is_mono)
{
- gdk_gc_set_clip_mask( m_textGC, (GdkBitmap *) NULL );
- gdk_gc_set_clip_origin( m_textGC, 0, 0 );
+ XSetClipMask( (Display*) m_display, (GC) m_textGC, None );
+ XSetClipOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
if (!m_currentClippingRegion.IsNull())
- gdk_gc_set_clip_region( m_textGC, m_currentClippingRegion.GetRegion() );
+ XSetRegion( (Display*) m_display, (GC) m_textGC, (Region) m_currentClippingRegion.GetX11Region() );
}
else
{
- gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
- gdk_gc_set_clip_origin( m_penGC, 0, 0 );
+ XSetClipMask( (Display*) m_display, (GC) m_penGC, None );
+ XSetClipOrigin( (Display*) m_display, (GC) m_penGC, 0, 0 );
if (!m_currentClippingRegion.IsNull())
- gdk_gc_set_clip_region( m_penGC, m_currentClippingRegion.GetRegion() );
+ XSetRegion( (Display*) m_display, (GC) m_penGC, (Region) m_currentClippingRegion.GetX11Region() );
}
}
-#endif
}
bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
{
xsrcMask = xsrc; ysrcMask = ysrc;
}
-
+
#if 0
if (srcDC->m_isMemDC)
{
x = XLOG2DEV(x);
y = YLOG2DEV(y);
- XCharStruct overall_return;
- int direction, slen, ascent, descent;
- (void)XTextExtents((XFontStruct*) xfont, (char*) (const char*) text, slen, &direction,
- &ascent, &descent, &overall_return);
#if 0
wxCoord width = gdk_string_width( font, text.mbc_str() );
wxCoord height = font->ascent + font->descent;
#endif
XSetFont( (Display*) m_display, (GC) m_textGC, xfont->fid );
+#if !wxUSE_NANOX
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
- {
+#endif
+ {
XDrawString( (Display*) m_display, (Window) m_window,
- (GC) m_textGC, x, y + ascent, text.c_str(), text.Len() );
- wxLogDebug("Drawing text %s at %d, %d", text.c_str(), x, y);
- }
+ (GC) m_textGC, x, y + XFontStructGetAscent(xfont), text.c_str(), text.Len() );
+ }
#if 0
if (m_font.GetUnderlined())
{
- wxCoord ul_y = y + font->ascent;
+ wxCoord ul_y = y + XFontStructGetAscent(font);
if (font->descent > 0) ul_y++;
gdk_draw_line( m_window, m_textGC, x, ul_y, x + width, ul_y);
}
int direction, ascent, descent2;
XCharStruct overall;
- XTextExtents( xfont, string.c_str(), string.Len(), &direction,
+ XTextExtents( xfont, (char*) string.c_str(), string.Len(), &direction,
&ascent, &descent2, &overall);
if (width)
else
{
XSetFillStyle( (Display*) m_display, (GC) m_brushGC, FillStippled );
-// XSetStipple( (Display*) m_display, (GC) m_brushGC, (Pixmap) m_brush.GetStipple()->GetBitmap() );
+ XSetStipple( (Display*) m_display, (GC) m_brushGC, (Pixmap) m_brush.GetStipple()->GetBitmap() );
}
}
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{
XSetFillStyle( (Display*) m_display, (GC) m_textGC, FillOpaqueStippled );
-// XSetStipple( (Display*) m_display, (GC) m_textGC, (Pixmap) m_brush.GetStipple()->GetMask()->GetBitmap() );
+ XSetStipple( (Display*) m_display, (GC) m_textGC, (Pixmap) m_brush.GetStipple()->GetMask()->GetBitmap() );
}
if (IS_HATCH(m_brush.GetStyle()))
else
{
XSetFillStyle( (Display*) m_display, (GC) m_bgGC, FillStippled );
-// XSetStipple( (Display*) m_display, (GC) m_bgGC, (Pixmap) m_backgroundBrush.GetStipple()->GetBitmap() );
+ XSetStipple( (Display*) m_display, (GC) m_bgGC, (Pixmap) m_backgroundBrush.GetStipple()->GetBitmap() );
}
}
m_backgroundMode = mode;
+#if wxUSE_NANOX
+ GrSetGCUseBackground((GC) m_textGC, mode == wxTRANSPARENT ? FALSE : TRUE);
+#endif
+
if (!m_window) return;
// CMB 21/7/98: fill style of cross-hatch brushes is affected by
: wxWindowDC( win )
{
wxCHECK_RET( win, _T("NULL window in wxClientDC::wxClientDC") );
+
+#ifdef __WXUNIVERSAL__
+ wxPoint ptOrigin = win->GetClientAreaOrigin();
+ SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
+ wxSize size = win->GetClientSize();
+ SetClippingRegion(wxPoint(0, 0), size);
+#endif // __WXUNIVERSAL__
}
void wxClientDC::DoGetSize(int *width, int *height) const