CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset );
}
- if ((m_brush.GetStyle() != wxTRANSPARENT) && m_window)
- gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
+ if (m_window)
+ {
+ if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
+ gdk_draw_polygon (m_window, m_textGC, TRUE, gdkpoints, n);
+ else
+ {
+ if ((m_brush.GetStyle() != wxTRANSPARENT))
+ gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
+ }
+ }
// To do: Fillstyle
if (m_window)
{
- if (m_brush.GetStyle() != wxTRANSPARENT)
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
-
- if (m_pen.GetStyle() != wxTRANSPARENT)
- gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
+ if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
+ {
+ gdk_draw_rectangle( m_window, m_textGC, TRUE, xx, yy, ww, hh );
+ gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
+ }
+ else
+ {
+ if (m_brush.GetStyle() != wxTRANSPARENT)
+ gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
+
+ if (m_pen.GetStyle() != wxTRANSPARENT)
+ gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
+ }
}
CalcBoundingBox( x, y );
wxCHECK_RET( bitmap.Ok(), wxT("invalid bitmap") );
+ bool is_mono = (bitmap.GetBitmap() != NULL);
+
/* scale/translate size and position */
int xx = XLOG2DEV(x);
if ((w != ww) || (h != hh))
{
wxImage image( bitmap );
- image = image.Scale( ww, hh );
-
- use_bitmap = image.ConvertToBitmap();
+ image.Rescale( ww, hh );
+ if (is_mono)
+ use_bitmap = image.ConvertToMonoBitmap(255,255,255);
+ else
+ use_bitmap = image.ConvertToBitmap();
}
else
{
if (useMask && mask)
{
- gdk_gc_set_clip_mask( m_penGC, mask );
- gdk_gc_set_clip_origin( m_penGC, xx, yy );
- }
-
- /* draw XPixmap or XBitmap, depending on what the wxBitmap contains */
-
- GdkPixmap *pm = use_bitmap.GetPixmap();
- if (pm)
- {
- gdk_draw_pixmap( m_window, m_penGC, pm, 0, 0, xx, yy, -1, -1 );
- }
- else
- {
- GdkBitmap *bm = use_bitmap.GetBitmap();
- if (bm)
+ if (is_mono)
{
- gdk_draw_bitmap( m_window, m_penGC, bm, 0, 0, xx, yy, -1, -1 );
+ gdk_gc_set_clip_mask( m_textGC, mask );
+ gdk_gc_set_clip_origin( m_textGC, xx, yy );
+ }
+ else
+ {
+ gdk_gc_set_clip_mask( m_penGC, mask );
+ gdk_gc_set_clip_origin( m_penGC, xx, yy );
}
}
+ /* 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_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), 0, 0, xx, yy, -1, -1 );
+ else
+ gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
+
/* remove mask again if any */
if (useMask && mask)
{
- gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
- gdk_gc_set_clip_origin( m_penGC, 0, 0 );
+ if (is_mono)
+ {
+ gdk_gc_set_clip_mask( m_textGC, (GdkBitmap *) NULL );
+ gdk_gc_set_clip_origin( m_textGC, 0, 0 );
+ }
+ else
+ {
+ gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
+ gdk_gc_set_clip_origin( m_penGC, 0, 0 );
+ }
}
}
wxMemoryDC *memDC = (wxMemoryDC*)source;
bool use_bitmap_method = FALSE;
+ bool is_mono = FALSE;
if (srcDC->m_isMemDC)
{
/* we HAVE TO use the direct way for memory dcs
that are bitmaps because XCopyArea doesn't cope
with different bit depths */
+ is_mono = TRUE;
use_bitmap_method = TRUE;
}
else if ((xsrc == 0) && (ysrc == 0) &&
wxImage image( memDC->m_selected );
image = image.Scale( bm_ww, bm_hh );
- use_bitmap = image.ConvertToBitmap();
+ if (is_mono)
+ use_bitmap = image.ConvertToMonoBitmap(255,255,255);
+ else
+ use_bitmap = image.ConvertToBitmap();
}
else
{
if (useMask && mask)
{
- gdk_gc_set_clip_mask( m_penGC, mask );
- gdk_gc_set_clip_origin( m_penGC, xx, yy );
- }
-
- /* draw XPixmap or XBitmap, depending on what the wxBitmap contains */
-
- GdkPixmap *pm = use_bitmap.GetPixmap();
- if (pm)
- {
- gdk_draw_pixmap( m_window, m_penGC, pm, xsrc, ysrc, xx, yy, ww, hh );
- }
- else
- {
- GdkBitmap *bm = use_bitmap.GetBitmap();
- if (bm)
+ if (is_mono)
+ {
+ gdk_gc_set_clip_mask( m_textGC, mask );
+ gdk_gc_set_clip_origin( m_textGC, xx, yy );
+ }
+ else
{
- /* we use the textGC here because blitting a bitmap is done
- using the current text colour */
- gdk_draw_bitmap( m_window, m_textGC, bm, xsrc, ysrc, xx, yy, ww, hh );
+ gdk_gc_set_clip_mask( m_penGC, mask );
+ gdk_gc_set_clip_origin( m_penGC, xx, yy );
}
}
+ /* 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_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), xsrc, ysrc, xx, yy, ww, hh );
+ else
+ gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), xsrc, ysrc, xx, yy, ww, hh );
+
/* remove mask again if any */
if (useMask && mask)
{
- gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
- gdk_gc_set_clip_origin( m_penGC, 0, 0 );
+ if (is_mono)
+ {
+ gdk_gc_set_clip_mask( m_textGC, (GdkBitmap *) NULL );
+ gdk_gc_set_clip_origin( m_textGC, 0, 0 );
+ }
+ else
+ {
+ gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
+ gdk_gc_set_clip_origin( m_penGC, 0, 0 );
+ }
}
}
else /* use_bitmap_method */
}
case wxTRANSPARENT:
+ case wxSTIPPLE_MASK_OPAQUE:
case wxSTIPPLE:
case wxSOLID:
default:
GdkCapStyle capStyle = GDK_CAP_ROUND;
switch (m_pen.GetCap())
{
- case wxCAP_ROUND: { capStyle = (width <= 1) ? GDK_CAP_NOT_LAST : GDK_CAP_ROUND; break; }
case wxCAP_PROJECTING: { capStyle = GDK_CAP_PROJECTING; break; }
case wxCAP_BUTT: { capStyle = GDK_CAP_BUTT; break; }
+ case wxCAP_ROUND:
+ default:
+ {
+ if (width <= 1)
+ {
+ width = 0;
+ capStyle = GDK_CAP_NOT_LAST;
+ }
+ else
+ {
+ capStyle = GDK_CAP_ROUND;
+ }
+ break;
+ }
}
GdkJoinStyle joinStyle = GDK_JOIN_ROUND;
switch (m_pen.GetJoin())
{
case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; }
- case wxJOIN_ROUND: { joinStyle = GDK_JOIN_ROUND; break; }
case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; }
+ case wxJOIN_ROUND:
+ default: { joinStyle = GDK_JOIN_ROUND; break; }
}
gdk_gc_set_line_attributes( m_penGC, width, lineStyle, capStyle, joinStyle );
}
}
+ if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
+ {
+ gdk_gc_set_fill( m_textGC, GDK_OPAQUE_STIPPLED);
+ gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->GetBitmap() );
+ }
+
if (IS_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );