Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpixmap_win.cpp File Reference

(b37b8eb7ea0a809c6e96189e8f9e834d6763e170)

#include "qbitmap.h"
#include "qpixmap.h"
#include <private/qpixmap_win_p.h>
#include <qpa/qplatformpixmap.h>
#include "qpixmap_raster_p.h"
#include <qdebug.h>
#include <QScopedArrayPointer>
#include <qt_windows.h>
#include <algorithm>
#include <iterator>
+ Include dependency graph for qpixmap_win.cpp:

Go to the source code of this file.

Classes

struct  BITMAPINFO_COLORTABLE256
 
class  DisplayHdc
 

Enumerations

enum  { Indexed8ColorTableSize = 256 }
 
enum  HBitmapFormat { HBitmapNoAlpha , HBitmapPremultipliedAlpha , HBitmapAlpha }
 

Functions

template<typename Int >
static QT_BEGIN_NAMESPACE Int pad4 (Int v)
 
QDebug operator<< (QDebug d, const BITMAPINFOHEADER &bih)
 
static void initBitMapInfoHeader (int width, int height, bool topToBottom, DWORD compression, DWORD bitCount, BITMAPINFOHEADER *bih)
 
template<class BITMAPINFO_T >
static void initBitMapInfo (int width, int height, bool topToBottom, DWORD compression, DWORD bitCount, BITMAPINFO_T *bmi)
 
static uchargetDiBits (HDC hdc, HBITMAP bitmap, int width, int height, bool topToBottom=true)
 
static void copyImageDataCreateAlpha (const uchar *data, QImage *target)
 
static void flipRgb3 (uchar *p, int width, int height)
 
static RGBQUAD qRgbToRgbQuad (QRgb qrgb)
 
static QRgb rgbQuadToQRgb (RGBQUAD quad)
 
static QImage copyImageData (const BITMAPINFOHEADER &header, const RGBQUAD *colorTableIn, const void *data, QImage::Format format)
 
static HBITMAP qt_createIconMask (QImage bm)
 
HBITMAP qt_createIconMask (const QBitmap &bitmap)
 
static QImage::Format format32 (int hbitmapFormat)
 
HBITMAP qt_imageToWinHBITMAP (const QImage &imageIn, int hbitmapFormat)
 
HBITMAP qt_pixmapToWinHBITMAP (const QPixmap &p, int hbitmapFormat)
 
static QImage::Format imageFromWinHBITMAP_Format (const BITMAPINFOHEADER &header, int hbitmapFormat)
 
static QImage imageFromWinHBITMAP_DibSection (HBITMAP bitmap, int hbitmapFormat)
 
static QImage imageFromWinHBITMAP_GetDiBits (HBITMAP bitmap, bool forceQuads, int hbitmapFormat)
 
QImage qt_imageFromWinHBITMAP (HBITMAP bitmap, int hbitmapFormat)
 
QPixmap qt_pixmapFromWinHBITMAP (HBITMAP bitmap, int hbitmapFormat)
 
HICON qt_pixmapToWinHICON (const QPixmap &p)
 
QImage qt_imageFromWinHBITMAP (HDC hdc, HBITMAP bitmap, int w, int h)
 
static QImage qt_imageFromWinIconHBITMAP (HDC hdc, HBITMAP bitmap, int w, int h)
 
static bool hasAlpha (const QImage &image)
 
QPixmap qt_pixmapFromWinHICON (HICON icon)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Indexed8ColorTableSize 

Definition at line 55 of file qpixmap_win.cpp.

◆ HBitmapFormat

Enumerator
HBitmapNoAlpha 
HBitmapPremultipliedAlpha 
HBitmapAlpha 

Definition at line 189 of file qpixmap_win.cpp.

Function Documentation

◆ copyImageData()

static QImage copyImageData ( const BITMAPINFOHEADER & header,
const RGBQUAD * colorTableIn,
const void * data,
QImage::Format format )
static

Definition at line 130 of file qpixmap_win.cpp.

References copyImageDataCreateAlpha(), QImage::Format_Indexed8, QImage::Format_Mono, QImage::Format_RGB888, header(), Indexed8ColorTableSize, Q_ASSERT, qAbs(), and rgbQuadToQRgb().

Referenced by imageFromWinHBITMAP_DibSection(), and imageFromWinHBITMAP_GetDiBits().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyImageDataCreateAlpha()

static void copyImageDataCreateAlpha ( const uchar * data,
QImage * target )
inlinestatic

Definition at line 84 of file qpixmap_win.cpp.

References QImage::Format_RGB32, and QRgb.

Referenced by copyImageData(), and qt_imageFromWinHBITMAP().

+ Here is the caller graph for this function:

◆ flipRgb3()

static void flipRgb3 ( uchar * p,
int width,
int height )
inlinestatic

Definition at line 105 of file qpixmap_win.cpp.

References pad4().

Referenced by qt_imageToWinHBITMAP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format32()

static QImage::Format format32 ( int hbitmapFormat)
inlinestatic

Definition at line 215 of file qpixmap_win.cpp.

References QImage::Format_ARGB32, QImage::Format_ARGB32_Premultiplied, QImage::Format_RGB32, HBitmapAlpha, and HBitmapNoAlpha.

Referenced by qt_imageToWinHBITMAP().

+ Here is the caller graph for this function:

◆ getDiBits()

static uchar * getDiBits ( HDC hdc,
HBITMAP bitmap,
int width,
int height,
bool topToBottom = true )
inlinestatic

Definition at line 71 of file qpixmap_win.cpp.

References initBitMapInfo(), and qErrnoWarning().

Referenced by qt_imageFromWinHBITMAP(), and qt_imageFromWinIconHBITMAP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasAlpha()

static bool hasAlpha ( const QImage & image)
inlinestatic

Definition at line 570 of file qpixmap_win.cpp.

References qAlpha(), and QRgb.

Referenced by QPdfEnginePrivate::addImage(), QCALayerBackingStore::beginPaint(), QWindowsVistaStylePrivate::drawBackgroundThruNativeBuffer(), QQC2::QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QWindowsBackingStore::flush(), QRasterBackingStore::format(), QOpenGLWindow::grabFramebuffer(), QOpenGLWidgetPrivate::grabFramebuffer(), parseColorValue(), qt_color_from_string(), QWindowsWindow::setOpacity(), QWindowsWindow::setWindowLayered(), setWindowOpacity(), and updateGLWindowSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imageFromWinHBITMAP_DibSection()

static QImage imageFromWinHBITMAP_DibSection ( HBITMAP bitmap,
int hbitmapFormat )
static

Definition at line 397 of file qpixmap_win.cpp.

References copyImageData(), QImage::Format_Invalid, and imageFromWinHBITMAP_Format().

Referenced by qt_imageFromWinHBITMAP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imageFromWinHBITMAP_Format()

static QImage::Format imageFromWinHBITMAP_Format ( const BITMAPINFOHEADER & header,
int hbitmapFormat )
static

Definition at line 371 of file qpixmap_win.cpp.

References QImage::Format_ARGB32_Premultiplied, QImage::Format_BGR888, QImage::Format_Indexed8, QImage::Format_Invalid, QImage::Format_Mono, QImage::Format_RGB32, QImage::Format_RGB555, HBitmapNoAlpha, and header().

Referenced by imageFromWinHBITMAP_DibSection(), and imageFromWinHBITMAP_GetDiBits().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imageFromWinHBITMAP_GetDiBits()

static QImage imageFromWinHBITMAP_GetDiBits ( HBITMAP bitmap,
bool forceQuads,
int hbitmapFormat )
static

Definition at line 418 of file qpixmap_win.cpp.

References copyImageData(), QImage::Format_Invalid, imageFromWinHBITMAP_Format(), info, qAbs(), qErrnoWarning(), and qWarning.

Referenced by qt_imageFromWinHBITMAP(), and qt_pixmapFromWinHBITMAP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initBitMapInfo()

template<class BITMAPINFO_T >
static void initBitMapInfo ( int width,
int height,
bool topToBottom,
DWORD compression,
DWORD bitCount,
BITMAPINFO_T * bmi )
inlinestatic

Definition at line 63 of file qpixmap_win.cpp.

References initBitMapInfoHeader().

Referenced by getDiBits(), and qt_imageToWinHBITMAP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initBitMapInfoHeader()

static void initBitMapInfoHeader ( int width,
int height,
bool topToBottom,
DWORD compression,
DWORD bitCount,
BITMAPINFOHEADER * bih )
inlinestatic

Definition at line 39 of file qpixmap_win.cpp.

References pad4().

Referenced by initBitMapInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<()

QDebug operator<< ( QDebug d,
const BITMAPINFOHEADER & bih )

Definition at line 26 of file qpixmap_win.cpp.

References d, and qAbs().

+ Here is the call graph for this function:

◆ pad4()

template<typename Int >
static QT_BEGIN_NAMESPACE Int pad4 ( Int v)
inlinestatic

Definition at line 20 of file qpixmap_win.cpp.

Referenced by flipRgb3(), and initBitMapInfoHeader().

+ Here is the caller graph for this function:

◆ qRgbToRgbQuad()

static RGBQUAD qRgbToRgbQuad ( QRgb qrgb)
inlinestatic

Definition at line 117 of file qpixmap_win.cpp.

References qBlue(), qGreen(), and qRed().

Referenced by qt_imageToWinHBITMAP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_createIconMask() [1/2]

HBITMAP qt_createIconMask ( const QBitmap & bitmap)

Definition at line 210 of file qpixmap_win.cpp.

References QImage::Format_Mono, and qt_createIconMask().

+ Here is the call graph for this function:

◆ qt_createIconMask() [2/2]

static HBITMAP qt_createIconMask ( QImage bm)
static

Definition at line 196 of file qpixmap_win.cpp.

References QImage::constScanLine(), QImage::format(), QImage::Format_Mono, QImage::height(), QImage::invertPixels(), Q_ASSERT, and QImage::width().

Referenced by QWindowsCursor::createPixmapCursor(), and qt_createIconMask().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_imageFromWinHBITMAP() [1/2]

QImage qt_imageFromWinHBITMAP ( HBITMAP bitmap,
int hbitmapFormat )

Definition at line 454 of file qpixmap_win.cpp.

References imageFromWinHBITMAP_DibSection(), and imageFromWinHBITMAP_GetDiBits().

+ Here is the call graph for this function:

◆ qt_imageFromWinHBITMAP() [2/2]

QImage qt_imageFromWinHBITMAP ( HDC hdc,
HBITMAP bitmap,
int w,
int h )

Definition at line 546 of file qpixmap_win.cpp.

References copyImageDataCreateAlpha(), QImage::Format_ARGB32_Premultiplied, and getDiBits().

+ Here is the call graph for this function:

◆ qt_imageFromWinIconHBITMAP()

static QImage qt_imageFromWinIconHBITMAP ( HDC hdc,
HBITMAP bitmap,
int w,
int h )
static

Definition at line 558 of file qpixmap_win.cpp.

References QImage::Format_ARGB32_Premultiplied, and getDiBits().

+ Here is the call graph for this function:

◆ qt_imageToWinHBITMAP()

HBITMAP qt_imageToWinHBITMAP ( const QImage & imageIn,
int hbitmapFormat )

Definition at line 228 of file qpixmap_win.cpp.

References flipRgb3(), format32(), QImage::Format_ARGB32, QImage::Format_ARGB32_Premultiplied, QImage::Format_BGR888, QImage::Format_Grayscale8, QImage::Format_Indexed8, QImage::Format_Mono, QImage::Format_MonoLSB, QImage::Format_RGB16, QImage::Format_RGB32, QImage::Format_RGB555, QImage::Format_RGB888, initBitMapInfo(), qErrnoWarning(), qRgbToRgbQuad(), and qt_imageToWinHBITMAP().

Referenced by qt_imageToWinHBITMAP(), and qt_pixmapToWinHBITMAP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_pixmapFromWinHBITMAP()

QPixmap qt_pixmapFromWinHBITMAP ( HBITMAP bitmap,
int hbitmapFormat )

Definition at line 486 of file qpixmap_win.cpp.

References QPixmap::fromImage(), and imageFromWinHBITMAP_GetDiBits().

Referenced by QWindowsScreen::grabWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_pixmapFromWinHICON()

QPixmap qt_pixmapFromWinHICON ( HICON icon)

Definition at line 646 of file qpixmap_win.cpp.

References QPixmap::fromImage(), and icon.

Referenced by QWindowsFileIconEngine::filePixmap(), loadIconFromShell32(), pixmapFromShellImageList(), and QWindowsTheme::standardPixmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_pixmapToWinHBITMAP()

HBITMAP qt_pixmapToWinHBITMAP ( const QPixmap & p,
int hbitmapFormat )

Definition at line 355 of file qpixmap_win.cpp.

References Qt::AutoColor, QPlatformPixmap::BitmapType, QRasterPlatformPixmap::fromImage(), QPlatformPixmap::PixmapType, platformPixmap(), qt_imageToWinHBITMAP(), qt_pixmapToWinHBITMAP(), and QPlatformPixmap::RasterClass.

Referenced by QWindowsCursor::createPixmapCursor(), QWin32PrintEngine::drawPixmap(), QWin32PrintEngine::drawTiledPixmap(), and qt_pixmapToWinHBITMAP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_pixmapToWinHICON()

HICON qt_pixmapToWinHICON ( const QPixmap & p)

Definition at line 537 of file qpixmap_win.cpp.

References QImage::convertToFormat(), QImage::Format_Mono, QPixmap::mask(), and QPixmap::toImage().

Referenced by createHIcon(), and QWindowsSystemTrayIcon::showMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rgbQuadToQRgb()

static QRgb rgbQuadToQRgb ( RGBQUAD quad)
inlinestatic

Definition at line 123 of file qpixmap_win.cpp.

References QRgb, and quad.

Referenced by copyImageData().

+ Here is the caller graph for this function: