[wxPython-users] Does wx support DIB bitmap?
Chris Mellon
arkanes at gmail.com
Mon Jun 4 09:48:41 PDT 2007
On 6/3/07, 甜瓜 <littlesweetmelon at gmail.com> wrote:
> I encounter a big problem in drawing bitmap to a wx.Window. The bitmap
> data is not in the form of RGB-8byte. The pixel is 64K color which
> Rmax, Gmax, Bmax == (31, 63, 31). For this pixel format, I can easily
> create a DIB by using pure Win32 API and then Bitblt to a window area.
> However, it seems that wx does not support DIB and it does not give
> user a opportunity to setup pixel format (eg: Red bitshift, etc.).
> Maybe DIB is only used by MS Window, while other platforms use
> different methods to deal with bitmap rendering. So, what is the best
> way to draw a bitmap from buffer platform-independently?
> The required rendering speed is about 15-20 fps for the area
> (1024x768). The additional buffer-copying is the most I concerned. Is
> this problem the bottle-neck of my rendering program in python? How to
> suppress this operation? Eg: the bitmap data is not at the beginning
> of the buffer, but in the middle:
>
> wx.BitmapForBuffer(w, h, buf[start:end] ) # @_@ may be a big copy...
>
> Thank you.
>
wxWidgets (the C++ library) actually does have DIB support on Windows,
but it doesn't seem to be wrapped for use from Python. You can use
ctypes to interact with the win32 api directly for your drawing, or
you could look at writing wrappers for the wxDIB implementation.
More information about the wxpython-users
mailing list