Qt 4.8
Public Functions | Protected Functions | Protected Variables | List of all members
QWindowsVistaAnimation Class Reference

#include <qwindowsvistastyle_p.h>

Inheritance diagram for QWindowsVistaAnimation:
QWindowsVistaPulse QWindowsVistaTransition

Public Functions

virtual void paint (QPainter *painter, const QStyleOption *option)
 
 QWindowsVistaAnimation ()
 
bool running () const
 
void setRunning (bool val)
 
void setStartTime (const QTime &startTime)
 
void setWidget (QWidget *widget)
 
const QTimestartTime () const
 
QWidgetwidget () const
 
virtual ~QWindowsVistaAnimation ()
 

Protected Functions

void drawBlendedImage (QPainter *painter, QRect rect, float value)
 

Protected Variables

QImage _primaryImage
 
bool _running
 
QImage _secondaryImage
 
QTime _startTime
 
QImage _tempImage
 
QPointer< QWidget_widget
 

Detailed Description

Definition at line 140 of file qwindowsvistastyle_p.h.

Constructors and Destructors

◆ QWindowsVistaAnimation()

QWindowsVistaAnimation::QWindowsVistaAnimation ( )
inline

Definition at line 143 of file qwindowsvistastyle_p.h.

143 : _running(true) { }

◆ ~QWindowsVistaAnimation()

virtual QWindowsVistaAnimation::~QWindowsVistaAnimation ( )
inlinevirtual

Definition at line 144 of file qwindowsvistastyle_p.h.

144 { }

Functions

◆ drawBlendedImage()

void QWindowsVistaAnimation::drawBlendedImage ( QPainter painter,
QRect  rect,
float  alpha 
)
protected
Warning
This function is not part of the public interface.

Helperfunction to paint the current transition state between two animation frames.

The result is a blended image consisting of ((alpha)*_primaryImage)

  • ((1-alpha)*_secondaryImage)

Definition at line 216 of file qwindowsvistastyle.cpp.

Referenced by setStartTime().

216  {
218  return;
219 
220  if (_tempImage.isNull())
222 
223  const int a = qRound(alpha*256);
224  const int ia = 256 - a;
225  const int sw = _primaryImage.width();
226  const int sh = _primaryImage.height();
227  const int bpl = _primaryImage.bytesPerLine();
228  switch(_primaryImage.depth()) {
229  case 32:
230  {
231  uchar *mixed_data = _tempImage.bits();
232  const uchar *back_data = _primaryImage.bits();
233  const uchar *front_data = _secondaryImage.bits();
234  for (int sy = 0; sy < sh; sy++) {
235  quint32* mixed = (quint32*)mixed_data;
236  const quint32* back = (const quint32*)back_data;
237  const quint32* front = (const quint32*)front_data;
238  for (int sx = 0; sx < sw; sx++) {
239  quint32 bp = back[sx];
240  quint32 fp = front[sx];
241  mixed[sx] = qRgba ((qRed(bp)*ia + qRed(fp)*a)>>8,
242  (qGreen(bp)*ia + qGreen(fp)*a)>>8,
243  (qBlue(bp)*ia + qBlue(fp)*a)>>8,
244  (qAlpha(bp)*ia + qAlpha(fp)*a)>>8);
245  }
246  mixed_data += bpl;
247  back_data += bpl;
248  front_data += bpl;
249  }
250  }
251  default:
252  break;
253  }
254  painter->drawImage(rect, _tempImage);
255 }
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
Definition: qrgb.h:66
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Definition: qimage.cpp:1542
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
long ASN1_INTEGER_get ASN1_INTEGER * a
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
Definition: qrgb.h:57
unsigned char uchar
Definition: qglobal.h:994
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
Definition: qrgb.h:72
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
Definition: qrgb.h:63
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
unsigned int quint32
Definition: qglobal.h:938
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Definition: qpainter.cpp:5936
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
Definition: qrgb.h:60
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ paint()

void QWindowsVistaAnimation::paint ( QPainter painter,
const QStyleOption option 
)
virtual

Reimplemented in QWindowsVistaPulse, and QWindowsVistaTransition.

Definition at line 201 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawControl(), QWindowsVistaStyle::drawPrimitive(), QWindowsVistaPulse::setAlternateImage(), QWindowsVistaTransition::setEndImage(), and setStartTime().

202 {
203  Q_UNUSED(option);
204  Q_UNUSED(painter);
205 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ running()

bool QWindowsVistaAnimation::running ( ) const
inline

Definition at line 146 of file qwindowsvistastyle_p.h.

146 { return _running; }

◆ setRunning()

void QWindowsVistaAnimation::setRunning ( bool  val)
inline

Definition at line 148 of file qwindowsvistastyle_p.h.

◆ setStartTime()

void QWindowsVistaAnimation::setStartTime ( const QTime startTime)
inline

◆ setWidget()

void QWindowsVistaAnimation::setWidget ( QWidget widget)
inline

◆ startTime()

const QTime& QWindowsVistaAnimation::startTime ( ) const
inline

Definition at line 147 of file qwindowsvistastyle_p.h.

Referenced by setStartTime().

147 { return _startTime; }

◆ widget()

QWidget* QWindowsVistaAnimation::widget ( ) const
inline

Properties

◆ _primaryImage

QImage QWindowsVistaAnimation::_primaryImage
protected

◆ _running

bool QWindowsVistaAnimation::_running
protected

Definition at line 160 of file qwindowsvistastyle_p.h.

Referenced by running(), and setRunning().

◆ _secondaryImage

QImage QWindowsVistaAnimation::_secondaryImage
protected

◆ _startTime

QTime QWindowsVistaAnimation::_startTime
protected

Definition at line 155 of file qwindowsvistastyle_p.h.

Referenced by setStartTime(), and startTime().

◆ _tempImage

QImage QWindowsVistaAnimation::_tempImage
protected

Definition at line 159 of file qwindowsvistastyle_p.h.

◆ _widget

QPointer<QWidget> QWindowsVistaAnimation::_widget
protected

Definition at line 156 of file qwindowsvistastyle_p.h.

Referenced by setWidget(), and widget().


The documentation for this class was generated from the following files: