mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-20 16:42:28 +02:00
Qt: implemented TQtWidgetSet.CreateCompatibleBitmap()
git-svn-id: trunk@22925 -
This commit is contained in:
parent
0d614ca60b
commit
f25b61f322
@ -361,6 +361,7 @@ type
|
||||
function setPen(APen: TQtPen): TQtPen;
|
||||
function SetBkColor(Color: TcolorRef): TColorRef;
|
||||
function SetBkMode(BkMode: Integer): Integer;
|
||||
function getDepth: integer;
|
||||
function getDeviceSize: TPoint;
|
||||
function getRegionType(ARegion: QRegionH): integer;
|
||||
function getClipRegion: TQtRegion;
|
||||
@ -2683,6 +2684,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TQtDeviceContext.getDepth: integer;
|
||||
var
|
||||
device: QPaintDeviceH;
|
||||
begin
|
||||
Result := QPaintDevice_depth(Device);
|
||||
end;
|
||||
|
||||
function TQtDeviceContext.getDeviceSize: TPoint;
|
||||
var
|
||||
device: QPaintDeviceH;
|
||||
|
@ -143,7 +143,7 @@ begin
|
||||
{$ifdef VerboseQtWinAPI_MISSING_IMPLEMENTATION}
|
||||
WriteLn('***** [WinAPI TQtWidgetSet.CallWindowProc] missing implementation ');
|
||||
{$endif}
|
||||
Result := 0;
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -272,16 +272,52 @@ end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TQtWidgetSet.CreateCompatibleBitmap
|
||||
Params:
|
||||
Returns:
|
||||
Params: HDC, Width & Height
|
||||
Returns: HBITMAP
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.CreateCompatibleBitmap(DC: HDC; Width, Height: Integer): HBITMAP;
|
||||
var
|
||||
QtDC: TQtDeviceContext;
|
||||
Format: QImageFormat = QImageFormat_ARGB32;
|
||||
ADevice: QPaintDeviceH = nil;
|
||||
ADesktop: QDesktopWidgetH = nil;
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI_MISSING_IMPLEMENTATION}
|
||||
WriteLn('***** [WinAPI TQtWidgetSet.CreateCompatibleBitmap] missing implementation ');
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('Trace:> [WinAPI CreateCompatibleBitmap]',
|
||||
' DC:', dbghex(DC),
|
||||
' Width:', dbgs(Width),
|
||||
' Height:', dbgs(Height));
|
||||
{$endif}
|
||||
Result := 0;
|
||||
if IsValidDC(DC) then
|
||||
begin
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
case QtDC.getDepth of
|
||||
1: Format := QImageFormat_Mono;
|
||||
15, 16: Format := QImageFormat_RGB16;
|
||||
24: Format := QImageFormat_RGB32;
|
||||
32: Format := QImageFormat_ARGB32;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
ADesktop := QApplication_desktop();
|
||||
if ADesktop <> nil then
|
||||
ADevice := QWidget_to_QPaintDevice(ADesktop);
|
||||
if ADevice <> nil then
|
||||
begin
|
||||
case QPaintDevice_depth(ADevice) of
|
||||
1: Format := QImageFormat_Mono;
|
||||
15, 16: Format := QImageFormat_RGB16;
|
||||
24: Format := QImageFormat_RGB32;
|
||||
32: Format := QImageFormat_ARGB32;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Result := HBitmap(TQtImage.Create(nil, Width, Height, Format));
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('Trace:< [WinAPI CreateCompatibleBitmap] Bitmap:', dbghex(Result));
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user