diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index 626091762d..4db5d78a0d 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1026,9 +1026,34 @@ wxCairoBrushData::wxCairoBrushData( wxGraphicsRenderer* renderer, InitStipple(brush.GetStipple()); break; + case wxBRUSHSTYLE_SOLID: + // Non-RGB colours, which may e.g. appear under wxOSX for wxColours + // with NSColor backend, are not supported by Cairo and have to be + // handled in a special way. + if ( !brush.GetColour().IsSolid() ) + { +#if wxOSX_USE_COCOA + // Under wxOSX, non-solid NSColors are actually represented + // by pattern images and therefore a wxBrush with non-solid + // colour and wxBRUSHSTYLE_SOLID style can be converted + // to a stiple (a surface pattern). + + // Create a stiple bitmap from NSColor's pattern image + wxBitmap bmp(brush.GetColour().OSXGetNSPatternImage()); + InitStipple(&bmp); +#else + wxFAIL_MSG( "Brush with non-solid colour is not supported." ); +#endif + } + break; + default: if ( brush.IsHatch() ) + { + wxASSERT_MSG( brush.GetColour().IsSolid(), + "Brush with non-solid colour is not supported." ); InitHatch(static_cast(brush.GetStyle())); + } break; } }