I'd been creating and deleting pens and colours each time round a loop to avoid 
accumulations, and returned to this issue while seeking ways to speed up my 
program.

My current attempt is this (with irrelevance stripped out):

  local DC,P=wx.wxMemoryDC(),wx.wxPen()  P:SetWidth(5)  P:SetStyle(wx.wxSOLID)
  DC:SelectObject(BITMAP)  DC:SetPen(P)  DC:SetBrush(wx.wxTRANSPARENT_BRUSH)
  for N=0,255,5 do
    P:SetColour(N,N,N)  DC:SetPen(P)  DC:DrawLine(N,0,N,100)
  end
  DC:SelectObject(wx.wxNullBitmap)  P:delete()
  DC:delete()

It works, but I'm not sure that it's safe. is P:SetColour() changing an implied 
colour 'object' that would better be made explicit and assigned to a vartiable 
so I can delete it along with the pen after the loop ends? The wx.chm manual 
doesn't make this clear, it seems to imply that this method avoids the need for 
an actual colour 'object' entirely.


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to