From 4d92724f4ed1ec77db2078867ed9059c8a333335 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 3 Nov 2024 16:32:09 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Support=20QT6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Imaging/ImagingComponents.pas | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Imaging/ImagingComponents.pas b/Imaging/ImagingComponents.pas index f4d3109..69cc0ae 100644 --- a/Imaging/ImagingComponents.pas +++ b/Imaging/ImagingComponents.pas @@ -352,6 +352,8 @@ uses GLib2, GDK2, GTK2, GTK2Def, GTK2Proc, {$ELSEIF Defined(LCLqt5)} Qt5, qtobjects, + {$ELSEIF Defined(LCLqt6)} + Qt6, qtobjects, {$ELSEIF Defined(LCLcocoa)} CocoaGDIObjects, CocoaUtils, {$IFEND} @@ -916,6 +918,28 @@ begin end; end; end; +{$ELSEIF Defined(LCLqt6)} +var + QImage: TQtImage; + Context: TQtDeviceContext; +begin + if TestImage(ImageData) then + begin + if not (ImageData.Format in [ifA8R8G8B8, ifX8R8G8B8]) then + raise EImagingError.Create(SBadFormatDisplay); + + Context := TQtDeviceContext(DstCanvas.Handle); + + // QImage directly uses the image memory, there is no copy done + QImage := TQtImage.Create(ImageData.Bits, ImageData.Width, ImageData.Height, + ImageData.Width * 4, QImageFormat_ARGB32, False); + try + QPainter_drawImage(Context.Widget, PRect(@DstRect), QImage.Handle, @SrcRect, QtAutoColor); + finally + QImage.Free; + end; + end; +end; {$ELSEIF Defined(LCLcocoa)} var CocoaBmp: TCocoaBitmap;