def SetBrush( me, rgb, style, fill_rule =0): #me.context.state.fill_rule = me.fill_rules[ fill_rule] color = wx_color( *rgb) fill_style = me.fill_styles[ style] brush = wx.TheBrushList.FindOrCreateBrush( color, fill_style) me.context.SetBrush( brush) me.context.SetTextForeground( color)
def SetPen( me, rgb, width, line_dash =None, line_cap =0, line_join =0, style =1): pen = me.context.state.pen_data pen.colour = wx_color( *rgb) pen.cap = me.cap_mode_translator[ line_cap] pen.join = me.join_mode_translator[ line_join] pen.width = width pen.dashes = line_dash pen.style = me.fill_styles[ style] me.context._update_context()
def DrawPath( me, path, stroke=1, fill=0, fill_rule=0): # FIXME problems with FindOrCreatePen, as it seems we must work with # a single pen and modify it as needed instead of creating new one each time me.PushState() #me.context.state.fill_rule = me.fill_rules[ fill_rule] if not fill: me.SetBrush( (255,255,255), 0) if not stroke: pen = wx.ThePenList.FindOrCreatePen( wx_color('WHITE'), 1, wx.TRANSPARENT) me.context.SetPen( pen) path.recorder.DEBUG = me.DEBUG path.recorder.play_on( me) me.PopState()
def SetTextBackground( me, r, g, b): me.context.SetTextBackground( wx_color( r, g, b))
def SetTextForeground( me, r, g, b): me.context.SetTextForeground( wx_color( r, g, b))