1. windwiny
  2. wxPython


wxPython / contrib / gizmos / wxCode / src / gizmos / statpict.txt

wxStaticPicture class
by Wade Brainerd (wadeb@wadeb.com)


This class is an improved version of wxStaticBitmap.  

Rather than using a native bitmap control, it uses DC operations to draw the
control.  This makes its appearance more consistent across platforms, and
allows for additional features.

Features include:

  wxStaticBitmap compatible API - drop-in replacement.  Image alignment - top,
  left, bottom, right, center vertical and/or horizontal.
  Image scaling - scale horizontally and/or vertically, justified scaling
  (maintains image aspect ratio).

Platforms tested:  

Implementation notes:

Under MSW wxWindows uses the operating system to do an optimized (potentially
hardware accelerated) blit in wxDC::DrawBitmap.  This is usually fast enough to
do image scaling without affecting the program's interactivity.  

On wxMac and wxGTK however, wxDC::DrawBitmap implicitly calls wxImage::Scale 
which is a much slower operation.  Therefore, on these platforms wxStaticPicture 
caches the scaled image to make updates that don't change the image (overlapping 
windows, etc.) faster.