| 1 | wxStaticPicture class |
| 2 | by Wade Brainerd (wadeb@wadeb.com) |
| 3 | |
| 4 | Description: |
| 5 | |
| 6 | This class is an improved version of wxStaticBitmap. |
| 7 | |
| 8 | Rather than using a native bitmap control, it uses DC operations to draw the |
| 9 | control. This makes its appearance more consistent across platforms, and |
| 10 | allows for additional features. |
| 11 | |
| 12 | Features include: |
| 13 | |
| 14 | wxStaticBitmap compatible API - drop-in replacement. Image alignment - top, |
| 15 | left, bottom, right, center vertical and/or horizontal. |
| 16 | Image scaling - scale horizontally and/or vertically, justified scaling |
| 17 | (maintains image aspect ratio). |
| 18 | |
| 19 | Platforms tested: |
| 20 | |
| 21 | wxMSW |
| 22 | wxGTK |
| 23 | wxMac |
| 24 | |
| 25 | Implementation notes: |
| 26 | |
| 27 | Under MSW wxWindows uses the operating system to do an optimized (potentially |
| 28 | hardware accelerated) blit in wxDC::DrawBitmap. This is usually fast enough to |
| 29 | do image scaling without affecting the program's interactivity. |
| 30 | |
| 31 | On wxMac and wxGTK however, wxDC::DrawBitmap implicitly calls wxImage::Scale |
| 32 | which is a much slower operation. Therefore, on these platforms wxStaticPicture |
| 33 | caches the scaled image to make updates that don't change the image (overlapping |
| 34 | windows, etc.) faster. |