Qt 4.8
Public Functions | Properties | List of all members
QBrushPatternImageCache Class Reference

Public Functions

void cleanup ()
 
QImage getImage (int brushStyle, bool invert) const
 
void init ()
 
 QBrushPatternImageCache ()
 

Properties

QImage m_images [Qt::DiagCrossPattern - Qt::Dense1Pattern+1][2]
 
bool m_initialized
 

Detailed Description

Definition at line 115 of file qbrush.cpp.

Constructors and Destructors

◆ QBrushPatternImageCache()

QBrushPatternImageCache::QBrushPatternImageCache ( )
inline

Definition at line 118 of file qbrush.cpp.

119  : m_initialized(false)
120  {
121  init();
122  }

Functions

◆ cleanup()

void QBrushPatternImageCache::cleanup ( )
inline

Definition at line 142 of file qbrush.cpp.

142  {
143  for (int style = Qt::Dense1Pattern; style <= Qt::DiagCrossPattern; ++style) {
144  int i = style - Qt::Dense1Pattern;
145  m_images[i][0] = QImage();
146  m_images[i][1] = QImage();
147  }
148  m_initialized = false;
149  }
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QImage m_images[Qt::DiagCrossPattern - Qt::Dense1Pattern+1][2]
Definition: qbrush.cpp:152

◆ getImage()

QImage QBrushPatternImageCache::getImage ( int  brushStyle,
bool  invert 
) const
inline

Definition at line 134 of file qbrush.cpp.

135  {
136  Q_ASSERT(brushStyle >= Qt::Dense1Pattern && brushStyle <= Qt::DiagCrossPattern);
137  if (!m_initialized)
138  const_cast<QBrushPatternImageCache*>(this)->init();
139  return m_images[brushStyle - Qt::Dense1Pattern][invert];
140  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QImage m_images[Qt::DiagCrossPattern - Qt::Dense1Pattern+1][2]
Definition: qbrush.cpp:152

◆ init()

void QBrushPatternImageCache::init ( )
inline

Definition at line 124 of file qbrush.cpp.

Referenced by getImage(), and QBrushPatternImageCache().

125  {
126  for (int style = Qt::Dense1Pattern; style <= Qt::DiagCrossPattern; ++style) {
127  int i = style - Qt::Dense1Pattern;
128  m_images[i][0] = QImage(qt_patternForBrush(style, 0), 8, 8, 1, QImage::Format_MonoLSB);
129  m_images[i][1] = QImage(qt_patternForBrush(style, 1), 8, 8, 1, QImage::Format_MonoLSB);
130  }
131  m_initialized = true;
132  }
const uchar * qt_patternForBrush(int brushStyle, bool invert)
Definition: qbrush.cpp:56
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QImage m_images[Qt::DiagCrossPattern - Qt::Dense1Pattern+1][2]
Definition: qbrush.cpp:152

Properties

◆ m_images

QImage QBrushPatternImageCache::m_images[Qt::DiagCrossPattern - Qt::Dense1Pattern+1][2]
private

Definition at line 152 of file qbrush.cpp.

Referenced by cleanup(), getImage(), and init().

◆ m_initialized

bool QBrushPatternImageCache::m_initialized
private

Definition at line 153 of file qbrush.cpp.

Referenced by cleanup(), getImage(), and init().


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