Ed Leafe wrote:
However, I tested your code right now and I get:
Point 1: (255, 0, 0, 255)
Point 2: (0, 0, 0, 255)
Point 3: (255, 0, 0, 255)This is Windows XP, Python 2.5, wxPython 2.8.3.
Hmm... I tested on OS X, Python 2.4.3, wxPython 2.8.3, and got the results I previously posted. So I copied the code to my XP machine (same version of Python and wxPython as you), and got your results. I also got your results when running on Kubuntu 7.04, Python 2.5.1, wxPython 2.8.3.
So it seems that this is an OS X issue. Fortunately, the project this is for is Windows-only, so I can proceed. But is this behavior by design on OS X, or a bug?
It's a platform limitation. The CoreGraphics API does not provide any way to get read access to the buffer in the graphics context where the pixels are stored. This is the same reason that using wxDC logical functions no longer works on Mac. IIUC the Mac has never had a native API for doing logical function blending, and so in the past when we using the old QuickDraw APIs wxMac would do the combining of pixel values itself. But QuickDraw is now mostly dead and we need to use CoreGraphics, which is much better in many ways, but does not provide the same access that we (ab)used before to do things like GetPixel and logical blends.
One way to do what you are trying that does still work is to draw your polygon to the memory dc and then instead of trying to fetch the pixel via the DC, use the new raw bitmap access functions to get it directly from the bitmap. There is an example of this in the newest FloatCanvas.
···
On May 8, 2007, at 9:27 AM, Andrea Gavana wrote:
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!