hi all,
i was wandering if my approach of displaying a DIB is correct.
I have a DIB in memory, generated from a commerical graphic library.
Using wxWidget 2.8 im using the following procedure to display it, and mantain the application win/mac portable.
1) i mirror the Y axis (my own function) of the bitmap in memory (DIB are stored with lines reversed).
2) sometime the DIB is 8bpp, so when necessary, i convert 8bpp to 24bpp (my own function).
3) i give the 24bpp buffer to the wxImage constructor.
4) i create a wxBitmap(wxImage)
5) i use dc.DrawBitmap
This procedure works fine, but i'm not sure if i can avoid some steps, if i'm missing something to make it easier.
Many thanks, Angelo
wxImage & DIB suggestions Topic is solved
wxImage & DIB suggestions
spectrum
Re: wxImage & DIB suggestions
Do you call these steps many times?spectrum wrote:hi all,
i was wandering if my approach of displaying a DIB is correct.
I have a DIB in memory, generated from a commerical graphic library.
Using wxWidget 2.8 im using the following procedure to display it, and mantain the application win/mac portable.
1) i mirror the Y axis (my own function) of the bitmap in memory (DIB are stored with lines reversed).
2) sometime the DIB is 8bpp, so when necessary, i convert 8bpp to 24bpp (my own function).
3) i give the 24bpp buffer to the wxImage constructor.
4) i create a wxBitmap(wxImage)
5) i use dc.DrawBitmap
This procedure works fine, but i'm not sure if i can avoid some steps, if i'm missing something to make it easier.
Many thanks, Angelo
Are dib dimensions fixed?
Maybe you can speedup a bit using a single wxImage everytime, and updating its buffer copying memory from dib to wxImage buffer (using memory functions like memcpy).spectrum wrote:the application display a particular XY graph. For now i've fixed it to 640x480, and i recall the procedure everytime i zoom or i move the diagram.
I know there're some undocumented classes that you can use to access to raw bitmap data maybe. In this case you can use wxBitmap only (without wxImage)
There's a file called rawbmp.h that contains just that. It contains some example code as well. Can be pretty handy.Trikko wrote:I know there're some undocumented classes that you can use to access to raw bitmap data maybe. In this case you can use wxBitmap only (without wxImage)
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda