You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'The "pixmap = surface.peekPixels()" line is wrong. Can you fix that?'
Certainly! The correct way to get the pixel buffer from a skia.Surface in skia-python for use with wx.Bitmap.FromBufferRGBA is as follows:
Use surface.readPixels() to obtain a numpy array.
The numpy array will have shape (height, width, 4), dtype uint8, and pixel order RGBA.
Use .tobytes() on the numpy array to obtain the buffer for wx.Bitmap.FromBufferRGBA(width, height, ...).
Here is a corrected version of the OnPaint method:
...
Summary of fix:
Use arr = surface.readPixels()
Then wx.Bitmap.FromBufferRGBA(w, h, arr.tobytes())
Do not use .peekPixels() for this purpose in skia-python.
0 commit comments