On Windows XP I do not the alpha blended in cursor_bitmap.
On Mac OS X and Linux this same code works problem free.
Why dosen't it work on Windows?
Barry
def OnPaint( self, event ):
self._debugSpeed( 'OnPaint() begin' )
self.SetFocusIgnoringChildren()
if self.first_paint:
self._debugPanel( 'EmacsPanel.OnPaint() first paint' )
self.first_paint = False
dc = wx.PaintDC( self )
dc.SetBackgroundMode( wx.SOLID )
dc.SetBackground( wx.Brush( bg_colours[ SYNTAX_DULL ] ) )
dc.Clear()
self.__initFont( dc )
dc = None
self.__calculateWindowSize()
# queue up this action until after the rest of GUI init has happend
self.app.onGuiThread( self.app.onEmacsPanelReady, () )
elif self.editor_bitmap is not None:
self._debugPanel( 'EmacsPanel.OnPaint() editor_bitmap' )
pdc = wx.PaintDC( self )
pdc.SetBackgroundMode( wx.SOLID )
self._debugSpeed( 'DrawBitmap() start' )
pdc.DrawBitmap( self.editor_bitmap, 0, 0, False )
self._debugSpeed( 'DrawBitmap() end %d x %d' % (self.pixel_width, self.pixel_length) )
c_x, c_y = self.__pixelPoint( self.cursor_x, self.cursor_y )
# Create a dc to alpha blend just the cursor as wx.GCDC is very slow on large bitmaps
cursor_bitmap = self.editor_bitmap.GetSubBitmap( (c_x, c_y, self.char_width, self.char_length) )
cur_dc_mem = wx.MemoryDC()
cur_dc_mem.SelectObject( cursor_bitmap )
cur_dc = wx.GCDC( cur_dc_mem )
# alpha blend the cursor
cur_dc.SetBackgroundMode( wx.TRANSPARENT )
cursor_colour = wx.Colour( 255, 0, 0, 64 )
cur_dc.SetPen( wx.Pen( cursor_colour ) )
cur_dc.SetBrush( wx.Brush( cursor_colour ) )
cur_dc.DrawRectangle( 0, 0, self.char_width, self.char_length )
pdc.DrawBitmap( cursor_bitmap, c_x, c_y, False )
pdc = None
self._debugSpeed( 'at end' )
else:
self._debugPanel( 'EmacsPanel.OnPaint() Nothing to do' )
event.Skip()
self._debugSpeed( 'OnPaint() end' )
···
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en