[Help!]wxImage:Incomplete construction from unsigned char*

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
SamHu
Earned a small fee
Earned a small fee
Posts: 20
Joined: Tue Sep 20, 2011 7:52 am

[Help!]wxImage:Incomplete construction from unsigned char*

Post by SamHu » Mon Feb 20, 2012 6:44 am

Evironment:ubuntu 12.04
wxWidgets:2.8.12(gtk)
I want to creat a image 150*90 from array(unsigned char*)
half of pix are fine but the rest pix are random data.
screenshot.png
incompelete construction
screenshot.png (5.29 KiB) Viewed 1127 times
Any help !
Please Help!
Coding is not funny.
It is nothing but a pain.
While people like me still get obessed to it.

User avatar
doublemax
Moderator
Moderator
Posts: 15068
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: [Help!]wxImage:Incomplete construction from unsigned cha

Post by doublemax » Mon Feb 20, 2012 9:10 am

wxImage is always RGB, so the buffer must be width*height*3 bytes long. The pic almost looks like you passed 8bit gray data only.
Use the source, Luke!

Youka
Experienced Solver
Experienced Solver
Posts: 51
Joined: Thu Feb 16, 2012 2:24 pm

Re: [Help!]wxImage:Incomplete construction from unsigned cha

Post by Youka » Mon Feb 20, 2012 4:47 pm

doublemax wrote:wxImage is always RGB, so the buffer must be width*height*3 bytes long. The pic almost looks like you passed 8bit gray data only.
Because it's a PNG image, i would bet he inserted the alpha channel in the RGB palette ("rgbargbargba..."; like it's common in most image de-/encoders), but wxImage storing alpha data separatly.

Jessy V
Earned a small fee
Earned a small fee
Posts: 17
Joined: Sat Feb 18, 2012 9:12 pm

Re: [Help!]wxImage:Incomplete construction from unsigned cha

Post by Jessy V » Tue Feb 21, 2012 5:56 pm

In the worse case, prefer using something like png2c.py

Post Reply