From 08fd914612d8ba416039b53bd9c80fcf088ee719 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 12 Nov 2022 10:19:12 +0000 Subject: [PATCH] spktoolbar: Remove restriction to 24-bit bitmaps. (see https://forum.lazarus.freepascal.org/index.php/topic,61200.0.html) git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8611 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../spktoolbar/SpkGUITools/SpkGUITools.pas | 47 ------------------- .../spktoolbar/SpkToolbar/SpkToolbar.pas | 3 -- 2 files changed, 50 deletions(-) diff --git a/components/spktoolbar/SpkGUITools/SpkGUITools.pas b/components/spktoolbar/SpkGUITools/SpkGUITools.pas index 879953858..08586900f 100644 --- a/components/spktoolbar/SpkGUITools/SpkGUITools.pas +++ b/components/spktoolbar/SpkGUITools/SpkGUITools.pas @@ -425,9 +425,6 @@ var Dist : double; SrcImg, DestImg: TLazIntfImage; begin - if (ABuffer.PixelFormat <> pf24Bit) or (ABitmap.PixelFormat <> pf24Bit) then - raise Exception.Create('TSpkGUITools.CopyRoundCorner: Only 24-bit bitmaps are accepted!'); - // Validation if Radius < 1 then exit; @@ -567,9 +564,6 @@ class procedure TGUITools.CopyRoundRect(ABuffer, ABitmap: TBitmap; SrcPoint, DstPoint: T2DIntVector; Width, Height, Radius: integer; ClipRect: T2DIntRect; LeftTopRound, RightTopRound, LeftBottomRound, RightBottomRound: boolean); begin - if (ABuffer.PixelFormat <> pf24Bit) or (ABitmap.PixelFormat <> pf24Bit) then - raise Exception.Create('TSpkGUITools.CopyBackground: Only 24 bit bitmaps are accepted!'); - if Radius < 0 then exit; @@ -746,9 +740,6 @@ class procedure TGUITools.CopyRoundRect(ABuffer : TBitmap; ABitmap: TBitmap; Src DstPoint: T2DIntVector; Width, Height, Radius: integer; LeftTopRound, RightTopRound, LeftBottomRound, RightBottomRound: boolean); begin - if (ABuffer.PixelFormat <> pf24bit) or (ABitmap.PixelFormat <> pf24bit) then - raise exception.create('TSpkGUITools.CopyBackground: Only 24 bit bitmaps are accepted!'); - if Radius < 0 then exit; @@ -920,9 +911,6 @@ var SrcImg: TLazIntfImage; DestImg: TLazIntfImage; begin - if (ABuffer.PixelFormat <> pf24Bit) or (ABitmap.PixelFormat <> pf24Bit) then - raise exception.create('TSpkGUITools.CopyRoundCorner: Only 24 bit bitmaps are accepted!'); - // Validation if (Width < 1) or (Height < 1) then exit; @@ -1026,9 +1014,6 @@ var DestImg: TLazIntfImage; i: Integer; begin - if (ABuffer.PixelFormat <> pf24Bit) or (ABitmap.PixelFormat <> pf24Bit) then - raise Exception.Create('TSpkGUITools.CopyRoundCorner: Only 24 bit bitmaps are accepted!'); - if (AMask.PixelFormat <> pf8bit) then raise Exception.Create('TSpkGUITools.CopyRoundCorner: Only 8-bit masks are accepted!'); @@ -1133,8 +1118,6 @@ var i: Integer; MaskLine: Pointer; begin - if (ABuffer.PixelFormat <> pf24Bit) or (ABitmap.PixelFormat <> pf24Bit) then - raise Exception.Create('TSpkGUITools.CopyMaskRectangle: Only 24 bit bitmaps are accepted!'); if AMask.PixelFormat<>pf8bit then raise Exception.Create('TSpkGUITools.CopyMaskRectangle: Only 8-bit masks are accepted!'); @@ -1244,9 +1227,6 @@ var BufferRect, BitmapRect : T2DIntRect; DstLine: Pointer; begin -if (ABuffer.PixelFormat<>pf24bit) or (ABitmap.PixelFormat<>pf24bit) then - raise exception.create('TSpkGUITools.CopyRoundCorner: Tylko 24-bitowe bitmapy s¹ akceptowane!'); - // Sprawdzanie poprawnoœci if (Width<1) or (Height<1) then exit; @@ -1338,9 +1318,6 @@ var BufferRect, BitmapRect : T2DIntRect; Dist : double; begin -if (ABuffer.PixelFormat<>pf24bit) or (ABitmap.PixelFormat<>pf24bit) then - raise exception.create('TSpkGUITools.CopyRoundCorner: Tylko 24-bitowe bitmapy s¹ akceptowane!'); - // Sprawdzanie poprawnoœci if Radius<1 then exit; @@ -1479,9 +1456,6 @@ var BitmapRect: T2DIntRect; cr, cg, cb: Byte; begin - if ABitmap.PixelFormat <> pf24bit then - raise Exception.Create('TSpkGUITools.DrawAARoundCorner: Bitmapa musi byæ w trybie 24-bitowym!'); - // Sprawdzamy poprawnoœæ if Radius < 1 then exit; @@ -1581,9 +1555,6 @@ var BitmapRect: T2DIntRect; cr,cb,cg: byte; begin - if ABitmap.PixelFormat<>pf24bit then - raise Exception.Create('TSpkGUITools.DrawAARoundCorner: Bitmap must be in 24-bit mode!'); - if Radius < 1 then exit; if (ABitmap.Width = 0) or (ABitmap.Height = 0) then @@ -1764,9 +1735,6 @@ end; class procedure TGUITools.DrawAARoundFrame(ABitmap: TBitmap; Rect: T2DIntRect; Radius: integer; Color: TColor; ClipRect: T2DIntRect); begin - if ABitmap.PixelFormat <> pf24Bit then - raise Exception.Create('TGUITools.DrawAARoundFrame: Bitmap must be in 24-bit mode!'); - if Radius < 1 then exit; @@ -1799,9 +1767,6 @@ end; class procedure TGUITools.DrawAARoundFrame(ABitmap: TBitmap; Rect: T2DIntRect; Radius: integer; Color: TColor); begin - if ABitmap.PixelFormat <> pf24Bit then - raise Exception.Create('TGUITools.DrawAARoundFrame: Bitmap must be in 24-bit mode!'); - if Radius < 1 then exit; @@ -2155,8 +2120,6 @@ var LineRect: T2DIntRect; BitmapRect: T2DIntRect; begin - if ABitmap.PixelFormat <> pf24Bit then - raise Exception.Create('TGUITools.DrawHLine: Bitmap must be in 24-bit mode'); EnsureOrder(x1, x2); {$IFDEF EnhancedRecordSupport} @@ -2182,8 +2145,6 @@ var LineRect: T2DIntRect; BitmapRect: T2DIntRect; begin - if ABitmap.PixelFormat<>pf24bit then - raise Exception.Create('TGUITools.DrawHLine: Bitmap must be in 24-bit mode!'); EnsureOrder(x1, x2); {$IFDEF EnhancedRecordSupport} @@ -2640,8 +2601,6 @@ class procedure TGUITools.RenderBackground(ABuffer: TBitmap; var TempRect: T2DIntRect; begin - if ABuffer.PixelFormat<>pf24bit then - raise Exception.Create('TGUITools.RenderBackground: Bitmap must be in 24-bit mode'); if (Rect.Left > Rect.Right) or (Rect.Top > Rect.Bottom) then exit; @@ -2716,9 +2675,6 @@ var LineRect: T2DIntRect; BitmapRect: T2DIntRect; begin - if ABitmap.PixelFormat <> pf24bit then - raise Exception.Create('TGUITools.DrawHLine: Bitmap must be in 24-bit mode!'); - EnsureOrder(y1, y2); {$IFDEF EnhancedRecordSupport} @@ -2744,9 +2700,6 @@ var LineRect: T2DIntRect; BitmapRect: T2DIntRect; begin - if ABitmap.PixelFormat <> pf24bit then - raise Exception.Create('TGUITools.DrawHLine: Bitmap must be in 24-bit mode!'); - EnsureOrder(y1, y2); {$IFDEF EnhancedRecordSupport} diff --git a/components/spktoolbar/SpkToolbar/SpkToolbar.pas b/components/spktoolbar/SpkToolbar/SpkToolbar.pas index c2b5b2f2d..08f3c9ef2 100644 --- a/components/spktoolbar/SpkToolbar/SpkToolbar.pas +++ b/components/spktoolbar/SpkToolbar/SpkToolbar.pas @@ -700,10 +700,7 @@ begin FToolbarDispatch := TSpkToolbarDispatch.Create(self); FBuffer := TBitmap.Create; - FBuffer.PixelFormat := pf24bit; - FTemporary := TBitmap.Create; - FTemporary.Pixelformat := pf24bit; SetLength(FTabRects, 0);