Small Link Icon Resizing / 12-13-2012
Here is the Qt4 C++ code to transform the (20x15) icon to (16x12). This preserves the transparent pixels in the original to partially transparent pixels in the reduced-size icon (i.e. using a full "alpha channel") ...
Declarations: QPixmap _slotLinked15; // (20x15) built from XPM source QPixmap _slotLinked12; // (16x12) dynamically drawn, see below. Initializers: _slotLinked15 (_slotLinked15Data), // XPM source _slotLinked12 (16,12), Code: _slotLinked12.fill (Qt::transparent); QPainter ptr1 (&_slotLinked12); ptr1.setRenderHint (QPainter::SmoothPixmapTransform); ptr1.drawPixmap (QRect (0,0,16,12), _slotLinked15); |
Examples of these two icons, in context: