[wxPython] wxImage colours...

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[wxPython] wxImage colours...

Sam Pumphrey
(sorry for last post as html and plaintext. wasn't thinking)

Anyway, another problem I just discovered:

given:

memdc = wxMemoryDC()
bmp = wxEmptyBitmap(10,10)
memdc.SelectObject(bmp)

if you do the following, you get different results in unix and windows:

memdc.SetPen(wxPen(wxColour(1,2,3),1,wxSOLID))
memdc.SetBrush(wxBrush(wxColour(1,2,3),wxSOLID))
memdc.DrawRectangle(0,0,10,10)

img = wxImageFromBitmap(bmp)

### Unix

>>> img.GetRed(0,0)
3
>>> img.GetGreen(0,0)
2
>>> img.GetBlue(0,0)
1

### windows

>>> img.GetRed(0,0)
1
>>> img.GetGreen(0,0)
2
>>> img.GetBlue(0,0)
3

This is killing my program which tries to decode the colour value into
an index into an array... any ideas as to what's causing it..?

Cheers,

Sam

------------------------------------------------------
   Sam Pumphrey - Project SPIRIT, AT&T Research UK
 Email: [hidden email] - Tel: (01223) 343215
------------------------------------------------------



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [wxPython] wxImage colours...

Robin Dunn
> Anyway, another problem I just discovered:
>
> given:
>
> memdc = wxMemoryDC()
> bmp = wxEmptyBitmap(10,10)
> memdc.SelectObject(bmp)
>
> if you do the following, you get different results in unix and windows:
>
> memdc.SetPen(wxPen(wxColour(1,2,3),1,wxSOLID))
> memdc.SetBrush(wxBrush(wxColour(1,2,3),wxSOLID))
> memdc.DrawRectangle(0,0,10,10)
>
> img = wxImageFromBitmap(bmp)
>
> ### Unix
>
> >>> img.GetRed(0,0)
> 3
> >>> img.GetGreen(0,0)
> 2
> >>> img.GetBlue(0,0)
> 1
>
> ### windows
>
> >>> img.GetRed(0,0)
> 1
> >>> img.GetGreen(0,0)
> 2
> >>> img.GetBlue(0,0)
> 3
>


I can't duplicate this.  I added the following to your blit sample and it
prints the same values for both MSW and GTK.

        img = wxImageFromBitmap(self.maskbitmap)
        print (img.GetRed(0,0), img.GetGreen(0,0), img.GetBlue(0,0))

Are you on the latest versions of wxGTK and GTK?

Robin




_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [wxPython] wxImage colours...

Sam Pumphrey
> I can't duplicate this.  I added the following to your blit sample and it
> prints the same values for both MSW and GTK.
>
>         img = wxImageFromBitmap(self.maskbitmap)
>         print (img.GetRed(0,0), img.GetGreen(0,0), img.GetBlue(0,0))
>
> Are you on the latest versions of wxGTK and GTK?

Possibly not.. I couldn't get the CVS version to compile properly. :(
Where can I get the latest full release?

Cheers,
Sam

------------------------------------------------------
   Sam Pumphrey - Project SPIRIT, AT&T Research UK
 Email: [hidden email] - Tel: (01223) 343215
------------------------------------------------------

_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [wxPython] wxImage colours...

Robin Dunn


> > I can't duplicate this.  I added the following to your blit sample and
it

> > prints the same values for both MSW and GTK.
> >
> >         img = wxImageFromBitmap(self.maskbitmap)
> >         print (img.GetRed(0,0), img.GetGreen(0,0), img.GetBlue(0,0))
> >
> > Are you on the latest versions of wxGTK and GTK?
>
> Possibly not.. I couldn't get the CVS version to compile properly. :(
> Where can I get the latest full release?
>

You can get snapshot #8 of 2.1 here: http://www.freiburg.linux.de/~wxxt/

Robin



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [wxPython] wxImage colours...

Robin Dunn
In reply to this post by Sam Pumphrey


> > I can't duplicate this.  I added the following to your blit sample and
it
> > prints the same values for both MSW and GTK.
> >
> >         img = wxImageFromBitmap(self.maskbitmap)
> >         print (img.GetRed(0,0), img.GetGreen(0,0), img.GetBlue(0,0))
> >
> > Are you on the latest versions of wxGTK and GTK?
>

Looks like an endian fix was just put into wxWindows CVS.  The cvs log
message was "Big-endian fix for image.cpp (Untested, I have no sparc)"  If
you are building wxGTK from cvs you may want to try it out.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!




_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Loading...