79 WriteToBuffer(pImage);
81 #if QT_VERSION >= 0x040000
82 QImage image(m_pBuffer, m_nImageWidth, m_nImageHeight, QImage::Format_RGB32);
84 QImage image(m_pBuffer, m_nImageWidth, m_nImageHeight, 32, 0, 0, QImage::BigEndian);
87 drawImage(x, y, image);
90 void CQTPainter::WriteToBuffer(
const CByteImage *pImage)
92 if (m_nImageWidth != pImage->
width || m_nImageHeight != pImage->
height)
94 m_nImageWidth = pImage->
width;
95 m_nImageHeight = pImage->
height;
100 m_pBuffer =
new unsigned char[m_nImageWidth * m_nImageHeight *
sizeof(int)];
105 const int nPixels = m_nImageWidth * m_nImageHeight;
106 unsigned char *pixels = pImage->
pixels;
107 int *output = (
int *) m_pBuffer;
109 for (
int i = 0; i < nPixels; i++)
110 output[i] = 255 << 24 | pixels[i] << 16 | pixels[i] << 8 | pixels[i];
114 const int nPixels = m_nImageWidth * m_nImageHeight;
115 unsigned char *pixels = pImage->
pixels;
116 int *output = (
int *) m_pBuffer;
118 for (
int offset = 0, i = 0; i < nPixels; i++)
120 output[i] = 255 << 24 | pixels[offset] << 16 | pixels[offset + 1] << 8 | pixels[offset + 2];
CQTPainter(QPaintDevice *pd)
ImageType type
The type of the image.
int width
The width of the image in pixels.
int height
The height of the image in pixels.
unsigned char * pixels
The pointer to the the pixels.
void DrawImage(const CByteImage *pImage, int x=0, int y=0)
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...