Fulvio Senore
2014-05-27 15:16:54 UTC
I have a program that works correctly under Windows but not under OS
X/Cocoa and Linux.
The program is a panoramic viewer (something like Google Street View).
It draws many frames, as quickly as possible, to the screen when the
user "looks around".
The program creates each frame in a wxBitmap, then it draws it to the
screen with the following code:
wxClientDC dc( this );
dc.DrawBitmap( m_ViewerBitmap, 0, 0 );
This works well with all the operating systems.
Sometimes I need to draw a small image in certain locations of each
frame. Those are hotspots: clicking them the user can load another
image. The image is contained in a wxBitmap with an alpha channel.
In this situation I create each frame as usual, then I draw the hotspost
in the wxBitmap that contains the frame, then I draw the frame to the
screen. The only difference is that I draw the hotspots immediately
before drawing the bitmap to the screen.
To draw the hotspots I use code similar to the following:
wxMemoryDC mdc;
mdc.SelectObject( bmp );
mdc.DrawBitmap( m_HotspotBitmap, x, y, true );
mdc.SelectObject( wxNullBitmap );
This code works only under Windows. Under OS X the screen becomes gray
and I only see the hotspots. If I "move around" the hotspots draw lines
on the screen and I can see the image through those lines. It looks like
calling wxMemoryDC::SelectObject() creates a gray layer that hides the
underlying image, and that layer is erased by calling DrawBitmap() to
draw hotspots.
I have commented out some code to see what happens and I discovered that
it is enough to call
mdc.SelectObject( bmp );
to make the screen gray.
Under Linux things are similar, but instead of a gray screen I see the
last image created without drawing hotspost.
I feel like I am missing something obvious, but I cannot understand
where is the error.
May anybody tell me the correct way to do what I want?
Thanks in advance.
Fulvio Senore
X/Cocoa and Linux.
The program is a panoramic viewer (something like Google Street View).
It draws many frames, as quickly as possible, to the screen when the
user "looks around".
The program creates each frame in a wxBitmap, then it draws it to the
screen with the following code:
wxClientDC dc( this );
dc.DrawBitmap( m_ViewerBitmap, 0, 0 );
This works well with all the operating systems.
Sometimes I need to draw a small image in certain locations of each
frame. Those are hotspots: clicking them the user can load another
image. The image is contained in a wxBitmap with an alpha channel.
In this situation I create each frame as usual, then I draw the hotspost
in the wxBitmap that contains the frame, then I draw the frame to the
screen. The only difference is that I draw the hotspots immediately
before drawing the bitmap to the screen.
To draw the hotspots I use code similar to the following:
wxMemoryDC mdc;
mdc.SelectObject( bmp );
mdc.DrawBitmap( m_HotspotBitmap, x, y, true );
mdc.SelectObject( wxNullBitmap );
This code works only under Windows. Under OS X the screen becomes gray
and I only see the hotspots. If I "move around" the hotspots draw lines
on the screen and I can see the image through those lines. It looks like
calling wxMemoryDC::SelectObject() creates a gray layer that hides the
underlying image, and that layer is erased by calling DrawBitmap() to
draw hotspots.
I have commented out some code to see what happens and I discovered that
it is enough to call
mdc.SelectObject( bmp );
to make the screen gray.
Under Linux things are similar, but instead of a gray screen I see the
last image created without drawing hotspost.
I feel like I am missing something obvious, but I cannot understand
where is the error.
May anybody tell me the correct way to do what I want?
Thanks in advance.
Fulvio Senore
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users