# HG changeset patch # User Viktor Demidov # Date 1575799317 -7200 # Sun Dec 08 12:01:57 2019 +0200 # Node ID b094178210a4abd45506d7f926f9b8d21cad8e1b # Parent b207fca0186dc8892adfbe4021b0b72dd8f880fb SAS Fix diff -r b207fca0186d -r b094178210a4 Source/GR32.pas --- a/Source/GR32.pas Tue Nov 19 08:50:49 2019 +0100 +++ b/Source/GR32.pas Sun Dec 08 12:01:57 2019 +0200 @@ -1084,8 +1084,12 @@ function GetWidth: TFloat; virtual; procedure Resample( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); virtual; abstract; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); virtual; abstract; procedure AssignTo(Dst: TPersistent); override; property ClipRect: TRect read FClipRect; public @@ -2832,33 +2836,33 @@ procedure TCustomBitmap32.DrawTo(Dst: TCustomBitmap32); begin BlockTransfer(Dst, 0, 0, Dst.ClipRect, Self, BoundsRect, DrawMode, - FOnPixelCombine); + CombineMode, MasterAlpha, OuterColor, FOnPixelCombine); end; procedure TCustomBitmap32.DrawTo(Dst: TCustomBitmap32; DstX, DstY: Integer); begin BlockTransfer(Dst, DstX, DstY, Dst.ClipRect, Self, BoundsRect, DrawMode, - FOnPixelCombine); + CombineMode, MasterAlpha, OuterColor, FOnPixelCombine); end; procedure TCustomBitmap32.DrawTo(Dst: TCustomBitmap32; DstX, DstY: Integer; const SrcRect: TRect); begin BlockTransfer(Dst, DstX, DstY, Dst.ClipRect, Self, SrcRect, - DrawMode, FOnPixelCombine); + DrawMode, CombineMode, MasterAlpha, OuterColor, FOnPixelCombine); end; procedure TCustomBitmap32.DrawTo(Dst: TCustomBitmap32; const DstRect: TRect); begin StretchTransfer(Dst, DstRect, Dst.ClipRect, Self, BoundsRect, Resampler, - DrawMode, FOnPixelCombine); + DrawMode, CombineMode, MasterAlpha, OuterColor, FOnPixelCombine); end; procedure TCustomBitmap32.DrawTo(Dst: TCustomBitmap32; const DstRect, SrcRect: TRect); begin StretchTransfer(Dst, DstRect, Dst.ClipRect, Self, SrcRect, Resampler, - DrawMode, FOnPixelCombine); + DrawMode, CombineMode, MasterAlpha, OuterColor, FOnPixelCombine); end; procedure TCustomBitmap32.ResetAlpha; @@ -5974,7 +5978,7 @@ R := DstRect; OffsetRect(R, -X - DstRect.Left, -Y - DstRect.Top); Buffer.SetSize(ClipRect.Right, ClipRect.Bottom); - StretchTransfer(Buffer, R, ClipRect, Self, SrcRect, Resampler, DrawMode, FOnPixelCombine); + StretchTransfer(Buffer, R, ClipRect, Self, SrcRect, Resampler, DrawMode, CombineMode, MasterAlpha, OuterColor, FOnPixelCombine); (Buffer.Backend as IDeviceContextSupport).DrawTo(hDst, MakeRect(X + DstRect.Left, Y + DstRect.Top, X + ClipRect.Right, diff -r b207fca0186d -r b094178210a4 Source/GR32_Layers.pas --- a/Source/GR32_Layers.pas Tue Nov 19 08:50:49 2019 +0100 +++ b/Source/GR32_Layers.pas Sun Dec 08 12:01:57 2019 +0200 @@ -1249,7 +1249,8 @@ GR32.IntersectRect(ClipRect, ClipRect, ImageRect); end; StretchTransfer(Buffer, DstRect, ClipRect, FBitmap, SrcRect, - FBitmap.Resampler, FBitmap.DrawMode, FBitmap.OnPixelCombine); + FBitmap.Resampler, FBitmap.DrawMode, FBitmap.CombineMode, FBitmap.MasterAlpha, + FBitmap.OuterColor, FBitmap.OnPixelCombine); end; procedure TBitmapLayer.SetBitmap(Value: TBitmap32); diff -r b207fca0186d -r b094178210a4 Source/GR32_Polygons.pas --- a/Source/GR32_Polygons.pas Tue Nov 19 08:50:49 2019 +0100 +++ b/Source/GR32_Polygons.pas Sun Dec 08 12:01:57 2019 +0200 @@ -74,7 +74,7 @@ { TPolygonRenderer32 } TPolygonRenderer32 = class(TCustomPolygonRenderer) private - FBitmap: TBitmap32; + FBitmap: TCustomBitmap32; FFillMode: TPolyFillMode; FColor: TColor32; FFiller: TCustomPolygonFiller; @@ -82,13 +82,13 @@ procedure SetFillMode(const Value: TPolyFillMode); procedure SetFiller(const Value: TCustomPolygonFiller); protected - procedure SetBitmap(const Value: TBitmap32); virtual; + procedure SetBitmap(const Value: TCustomBitmap32); virtual; public - constructor Create(Bitmap: TBitmap32; Fillmode: TPolyFillMode = pfWinding); reintroduce; overload; + constructor Create(Bitmap: TCustomBitmap32; Fillmode: TPolyFillMode = pfWinding); reintroduce; overload; procedure PolygonFS(const Points: TArrayOfFloatPoint); overload; virtual; procedure PolyPolygonFS(const Points: TArrayOfArrayOfFloatPoint); overload; virtual; - property Bitmap: TBitmap32 read FBitmap write SetBitmap; + property Bitmap: TCustomBitmap32 read FBitmap write SetBitmap; property FillMode: TPolyFillMode read FFillMode write SetFillMode; property Color: TColor32 read FColor write SetColor; property Filler: TCustomPolygonFiller read FFiller write SetFiller; @@ -214,150 +214,150 @@ property Sampler: TCustomSampler read FSampler write SetSampler; end; -procedure PolyPolygonFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolygonFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolygonFS_LCD(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonFS_LCD(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolygonFS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonFS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolygonFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolygonFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; ClipRect: TRect; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; ClipRect: TRect; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolygonFS_LCD(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonFS_LCD(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolygonFS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonFS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolylineFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolylineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Color: TColor32; Closed: Boolean = False; StrokeWidth: TFloat = 1.0; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFloat = 4.0; Transformation: TTransformation = nil); overload; -procedure PolyPolylineFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolylineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Filler: TCustomPolygonFiller; Closed: Boolean = False; StrokeWidth: TFloat = 1.0; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFloat = 4.0; Transformation: TTransformation = nil); overload; -procedure PolylineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolylineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Color: TColor32; Closed: Boolean = False; StrokeWidth: TFloat = 1.0; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFloat = 4.0; Transformation: TTransformation = nil); overload; -procedure PolylineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolylineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Filler: TCustomPolygonFiller; Closed: Boolean = False; StrokeWidth: TFloat = 1.0; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFloat = 4.0; Transformation: TTransformation = nil); overload; //Filled only Dashes ... -procedure DashLineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure DashLineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; const Dashes: TArrayOfFloat; Color: TColor32; Closed: Boolean = False; Width: TFloat = 1.0); overload; -procedure DashLineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure DashLineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; const Dashes: TArrayOfFloat; FillColor, StrokeColor: TColor32; Closed: Boolean; Width: TFloat; StrokeWidth: TFloat = 2.0); overload; //Filled and stroked Dashes ... -procedure DashLineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure DashLineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; const Dashes: TArrayOfFloat; Filler: TCustomPolygonFiller; Closed: Boolean = False; Width: TFloat = 1.0); overload; -procedure DashLineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure DashLineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; const Dashes: TArrayOfFloat; Filler: TCustomPolygonFiller; StrokeColor: TColor32; Closed: Boolean; Width: TFloat; StrokeWidth: TFloat = 2.0); overload; -procedure PolyPolygonXS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolygonXS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolygonXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolygonXS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolygonXS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolygonXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolyPolygonXS_LCD(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolygonXS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonXS_LCD(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolygonXS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); -procedure PolyPolygonXS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolygonXS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); overload; -procedure PolygonXS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolygonXS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode = pfAlternate; Transformation: TTransformation = nil); -procedure PolyPolylineXS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolylineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Color: TColor32; Closed: Boolean = False; StrokeWidth: TFixed = $10000; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFixed = $40000; Transformation: TTransformation = nil); overload; -procedure PolyPolylineXS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolylineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Filler: TCustomPolygonFiller; Closed: Boolean = False; StrokeWidth: TFixed = $10000; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFixed = $40000; Transformation: TTransformation = nil); overload; -procedure PolylineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolylineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Color: TColor32; Closed: Boolean = False; StrokeWidth: TFixed = $10000; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFixed = $40000; Transformation: TTransformation = nil); overload; -procedure PolylineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolylineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Filler: TCustomPolygonFiller; Closed: Boolean = False; StrokeWidth: TFixed = $10000; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFixed = $40000; Transformation: TTransformation = nil); overload; //Filled only Dashes ... -procedure DashLineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure DashLineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; const Dashes: TArrayOfFixed; Color: TColor32; Closed: Boolean = False; Width: TFixed = $10000); overload; -procedure DashLineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure DashLineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; const Dashes: TArrayOfFixed; FillColor, StrokeColor: TColor32; Closed: Boolean; Width: TFixed; StrokeWidth: TFixed = $20000); overload; //Filled and stroked Dashes ... -procedure DashLineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure DashLineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; const Dashes: TArrayOfFixed; Filler: TCustomPolygonFiller; Closed: Boolean = False; Width: TFixed = $10000); overload; -procedure DashLineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure DashLineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; const Dashes: TArrayOfFixed; Filler: TCustomPolygonFiller; StrokeColor: TColor32; Closed: Boolean; Width: TFixed; StrokeWidth: TFixed = $20000); overload; // fill entire bitmap with a given polygon filler -procedure FillBitmap(Bitmap: TBitmap32; Filler: TCustomPolygonFiller); +procedure FillBitmap(Bitmap: TCustomBitmap32; Filler: TCustomPolygonFiller); { Registration routines } procedure RegisterPolygonRenderer(PolygonRendererClass: TCustomPolygonRendererClass); @@ -376,7 +376,7 @@ RCStrNoSamplerSpecified = 'No sampler specified!'; type - TBitmap32Access = class(TBitmap32); + TBitmap32Access = class(TCustomBitmap32); procedure RegisterPolygonRenderer(PolygonRendererClass: TCustomPolygonRendererClass); begin @@ -563,7 +563,7 @@ FillLongWord(AlphaValues[0], Count, V); end; -procedure PolyPolygonFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32VPR; @@ -579,7 +579,7 @@ end; end; -procedure PolygonFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32VPR; @@ -595,7 +595,7 @@ end; end; -procedure PolyPolygonFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32VPR; @@ -612,7 +612,7 @@ end; end; -procedure PolygonFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32VPR; @@ -629,7 +629,7 @@ end; end; -procedure PolygonFS_LCD(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32LCD; @@ -645,7 +645,7 @@ end; end; -procedure PolyPolygonFS_LCD(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32LCD; @@ -661,7 +661,7 @@ end; end; -procedure PolygonFS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32LCD2; @@ -677,7 +677,7 @@ end; end; -procedure PolyPolygonFS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32LCD2; @@ -693,7 +693,7 @@ end; end; -procedure PolyPolygonFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var @@ -712,7 +712,7 @@ end; end; -procedure PolygonFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var @@ -731,7 +731,7 @@ end; end; -procedure PolyPolygonFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; ClipRect: TRect; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode; Transformation: TTransformation); var @@ -751,7 +751,7 @@ end; end; -procedure PolygonFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; ClipRect: TRect; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode; Transformation: TTransformation); var @@ -771,7 +771,7 @@ end; end; -procedure PolygonFS_LCD(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var @@ -790,7 +790,7 @@ end; end; -procedure PolyPolygonFS_LCD(Bitmap: TBitmap32; +procedure PolyPolygonFS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var @@ -809,7 +809,7 @@ end; end; -procedure PolygonFS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolygonFS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var @@ -828,7 +828,7 @@ end; end; -procedure PolyPolygonFS_LCD2(Bitmap: TBitmap32; +procedure PolyPolygonFS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; ClipRect: TRect; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var @@ -847,7 +847,7 @@ end; end; -procedure PolyPolylineFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolylineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Color: TColor32; Closed: Boolean; StrokeWidth: TFloat; JoinStyle: TJoinStyle; EndStyle: TEndStyle; MiterLimit: TFloat; Transformation: TTransformation); @@ -858,7 +858,7 @@ PolyPolygonFS(Bitmap, Dst, Color, pfWinding, Transformation); end; -procedure PolyPolylineFS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFloatPoint; +procedure PolyPolylineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFloatPoint; Filler: TCustomPolygonFiller; Closed: Boolean = False; StrokeWidth: TFloat = 1.0; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFloat = 4.0; Transformation: TTransformation = nil); @@ -869,7 +869,7 @@ PolyPolygonFS(Bitmap, Dst, Filler, pfWinding, Transformation); end; -procedure PolylineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolylineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Color: TColor32; Closed: Boolean; StrokeWidth: TFloat; JoinStyle: TJoinStyle; EndStyle: TEndStyle; MiterLimit: TFloat; Transformation: TTransformation); @@ -878,7 +878,7 @@ JoinStyle, EndStyle, MiterLimit, Transformation); end; -procedure PolylineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure PolylineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; Filler: TCustomPolygonFiller; Closed: Boolean = False; StrokeWidth: TFloat = 1.0; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFloat = 4.0; Transformation: TTransformation = nil); @@ -887,7 +887,7 @@ JoinStyle, EndStyle, MiterLimit, Transformation); end; -procedure DashLineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure DashLineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; const Dashes: TArrayOfFloat; Color: TColor32; Closed: Boolean = False; Width: TFloat = 1.0); var @@ -897,7 +897,7 @@ PolyPolylineFS(Bitmap, MultiPoly, Color, False, Width); end; -procedure DashLineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure DashLineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; const Dashes: TArrayOfFloat; FillColor, StrokeColor: TColor32; Closed: Boolean; Width: TFloat; StrokeWidth: TFloat = 2.0); var @@ -909,7 +909,7 @@ PolyPolylineFS(Bitmap, MultiPoly, StrokeColor, True, StrokeWidth); end; -procedure DashLineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure DashLineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; const Dashes: TArrayOfFloat; Filler: TCustomPolygonFiller; Closed: Boolean = False; Width: TFloat = 1.0); var @@ -919,7 +919,7 @@ PolyPolylineFS(Bitmap, MultiPoly, Filler, False, Width); end; -procedure DashLineFS(Bitmap: TBitmap32; const Points: TArrayOfFloatPoint; +procedure DashLineFS(Bitmap: TCustomBitmap32; const Points: TArrayOfFloatPoint; const Dashes: TArrayOfFloat; Filler: TCustomPolygonFiller; StrokeColor: TColor32; Closed: Boolean; Width: TFloat; StrokeWidth: TFloat = 2.0); var @@ -932,7 +932,7 @@ end; -procedure PolyPolygonXS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolygonXS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32VPR; @@ -949,7 +949,7 @@ end; end; -procedure PolygonXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolygonXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32VPR; @@ -966,7 +966,7 @@ end; end; -procedure PolyPolygonXS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolygonXS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32VPR; @@ -983,7 +983,7 @@ end; end; -procedure PolygonXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolygonXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Filler: TCustomPolygonFiller; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32VPR; @@ -1000,7 +1000,7 @@ end; end; -procedure PolygonXS_LCD(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolygonXS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32LCD; @@ -1017,7 +1017,7 @@ end; end; -procedure PolyPolygonXS_LCD(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolygonXS_LCD(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32LCD; @@ -1034,7 +1034,7 @@ end; end; -procedure PolygonXS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolygonXS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32LCD2; @@ -1051,7 +1051,7 @@ end; end; -procedure PolyPolygonXS_LCD2(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolygonXS_LCD2(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Color: TColor32; FillMode: TPolyFillMode; Transformation: TTransformation); var Renderer: TPolygonRenderer32LCD2; @@ -1068,7 +1068,7 @@ end; end; -procedure PolyPolylineXS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolylineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Color: TColor32; Closed: Boolean; StrokeWidth: TFixed; JoinStyle: TJoinStyle; EndStyle: TEndStyle; MiterLimit: TFixed; Transformation: TTransformation); @@ -1080,7 +1080,7 @@ PolyPolygonXS(Bitmap, Dst, Color, pfWinding, Transformation); end; -procedure PolyPolylineXS(Bitmap: TBitmap32; const Points: TArrayOfArrayOfFixedPoint; +procedure PolyPolylineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfArrayOfFixedPoint; Filler: TCustomPolygonFiller; Closed: Boolean = False; StrokeWidth: TFixed = $10000; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFixed = $40000; @@ -1093,7 +1093,7 @@ PolyPolygonXS(Bitmap, Dst, Filler, pfWinding, Transformation); end; -procedure PolylineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolylineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Color: TColor32; Closed: Boolean; StrokeWidth: TFixed; JoinStyle: TJoinStyle; EndStyle: TEndStyle; MiterLimit: TFixed; Transformation: TTransformation); @@ -1103,7 +1103,7 @@ MiterLimit, Transformation); end; -procedure PolylineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure PolylineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; Filler: TCustomPolygonFiller; Closed: Boolean = False; StrokeWidth: TFixed = $10000; JoinStyle: TJoinStyle = jsMiter; EndStyle: TEndStyle = esButt; MiterLimit: TFixed = $40000; @@ -1113,7 +1113,7 @@ JoinStyle, EndStyle, MiterLimit, Transformation); end; -procedure DashLineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure DashLineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; const Dashes: TArrayOfFixed; Color: TColor32; Closed: Boolean = False; Width: TFixed = $10000); var @@ -1123,7 +1123,7 @@ PolyPolylineXS(Bitmap, MultiPoly, Color, False, Width); end; -procedure DashLineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure DashLineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; const Dashes: TArrayOfFixed; FillColor, StrokeColor: TColor32; Closed: Boolean; Width: TFixed; StrokeWidth: TFixed = $20000); var @@ -1135,7 +1135,7 @@ PolyPolylineXS(Bitmap, MultiPoly, StrokeColor, True, strokeWidth); end; -procedure DashLineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure DashLineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; const Dashes: TArrayOfFixed; Filler: TCustomPolygonFiller; Closed: Boolean = False; Width: TFixed = $10000); var @@ -1145,7 +1145,7 @@ PolyPolylineXS(Bitmap, MultiPoly, Filler, False, Width); end; -procedure DashLineXS(Bitmap: TBitmap32; const Points: TArrayOfFixedPoint; +procedure DashLineXS(Bitmap: TCustomBitmap32; const Points: TArrayOfFixedPoint; const Dashes: TArrayOfFixed; Filler: TCustomPolygonFiller; StrokeColor: TColor32; Closed: Boolean; Width: TFixed; StrokeWidth: TFixed = $20000); var @@ -1157,7 +1157,7 @@ PolyPolylineXS(Bitmap, MultiPoly, StrokeColor, True, StrokeWidth); end; -procedure FillBitmap(Bitmap: TBitmap32; Filler: TCustomPolygonFiller); +procedure FillBitmap(Bitmap: TCustomBitmap32; Filler: TCustomPolygonFiller); var AlphaValues: PColor32; Y: Integer; @@ -1692,7 +1692,7 @@ { TPolygonRenderer32 } -constructor TPolygonRenderer32.Create(Bitmap: TBitmap32; +constructor TPolygonRenderer32.Create(Bitmap: TCustomBitmap32; Fillmode: TPolyFillMode); begin inherited Create; @@ -1710,7 +1710,7 @@ PolyPolygonFS(Points, FloatRect(FBitmap.ClipRect)); end; -procedure TPolygonRenderer32.SetBitmap(const Value: TBitmap32); +procedure TPolygonRenderer32.SetBitmap(const Value: TCustomBitmap32); begin if FBitmap <> Value then begin diff -r b207fca0186d -r b094178210a4 Source/GR32_Resamplers.pas --- a/Source/GR32_Resamplers.pas Tue Nov 19 08:50:49 2019 +0100 +++ b/Source/GR32_Resamplers.pas Sun Dec 08 12:01:57 2019 +0200 @@ -54,18 +54,48 @@ procedure BlockTransfer( Dst: TCustomBitmap32; DstX: Integer; DstY: Integer; DstClip: TRect; Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent = nil); + CombineOp: TDrawMode; + CombineMode: TCombineMode = cmMerge; + MasterAlpha: Cardinal = 255; + OuterColor: TColor32 = 0; + CombineCallBack: TPixelCombineEvent = nil); overload; + +procedure BlockTransfer( + Dst: TCustomBitmap32; DstX: Integer; DstY: Integer; DstClip: TRect; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + CombineOp: TDrawMode; + CombineMode: TCombineMode = cmMerge; + MasterAlpha: Cardinal = 255; + OuterColor: TColor32 = 0; + CombineCallBack: TPixelCombineEvent = nil); overload; procedure BlockTransferX( - Dst: TCustomBitmap32; DstX, DstY: TFixed; + Dst: TCustomBitmap32; DstX, DstY: TFixed; Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent = nil); + CombineOp: TDrawMode; + CombineMode: TCombineMode = cmMerge; + MasterAlpha: Cardinal = 255; + CombineCallBack: TPixelCombineEvent = nil); procedure StretchTransfer( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; Src: TCustomBitmap32; SrcRect: TRect; Resampler: TCustomResampler; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent = nil); + CombineOp: TDrawMode; + CombineMode: TCombineMode = cmMerge; + MasterAlpha: Cardinal = 255; + OuterColor: TColor32 = 0; + CombineCallBack: TPixelCombineEvent = nil); overload; + +procedure StretchTransfer( + Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + Resampler: TCustomResampler; + CombineOp: TDrawMode; + CombineMode: TCombineMode = cmMerge; + MasterAlpha: Cardinal = 255; + OuterColor: TColor32 = 0; + CombineCallBack: TPixelCombineEvent = nil); overload; procedure BlendTransfer( Dst: TCustomBitmap32; DstX, DstY: Integer; DstClip: TRect; @@ -287,8 +317,12 @@ function GetWidth: TFloat; override; procedure Resample( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); override; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); override; public function GetSampleInt(X, Y: Integer): TColor32; override; function GetSampleFixed(X, Y: TFixed): TColor32; override; @@ -306,8 +340,12 @@ function GetPixelTransparentEdge(X, Y: TFixed): TColor32; procedure Resample( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); override; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); override; public constructor Create; override; destructor Destroy; override; @@ -321,8 +359,12 @@ protected procedure Resample( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); override; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); override; end; { TKernelResampler } @@ -353,8 +395,12 @@ function GetSampleFloat(X, Y: TFloat): TColor32; override; procedure Resample( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); override; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); override; procedure PrepareSampling; override; procedure FinalizeSampling; override; published @@ -762,8 +808,13 @@ procedure BlendBlock( Dst: TCustomBitmap32; DstRect: TRect; - Src: TCustomBitmap32; SrcX, SrcY: Integer; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; + SrcX, SrcY: Integer; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); var SrcP, DstP: PColor32; SP, DP: PColor32; @@ -774,7 +825,7 @@ begin { Internal routine } W := DstRect.Right - DstRect.Left; - SrcP := Src.PixelPtr[SrcX, SrcY]; + SrcP := @SrcBits[SrcX + SrcY*SrcWidth]; DstP := Dst.PixelPtr[DstRect.Left, DstRect.Top]; case CombineOp of @@ -784,34 +835,34 @@ begin //Move(SrcP^, DstP^, W shl 2); // for FastCode MoveLongWord(SrcP^, DstP^, W); - Inc(SrcP, Src.Width); + Inc(SrcP, SrcWidth); Inc(DstP, Dst.Width); end; end; dmBlend: - if Src.MasterAlpha >= 255 then + if MasterAlpha >= 255 then begin - BlendLine := BLEND_LINE[Src.CombineMode]^; + BlendLine := BLEND_LINE[CombineMode]^; for DstY := DstRect.Top to DstRect.Bottom - 1 do begin BlendLine(SrcP, DstP, W); - Inc(SrcP, Src.Width); + Inc(SrcP, SrcWidth); Inc(DstP, Dst.Width); end end else begin - BlendLineEx := BLEND_LINE_EX[Src.CombineMode]^; + BlendLineEx := BLEND_LINE_EX[CombineMode]^; for DstY := DstRect.Top to DstRect.Bottom - 1 do begin - BlendLineEx(SrcP, DstP, W, Src.MasterAlpha); - Inc(SrcP, Src.Width); + BlendLineEx(SrcP, DstP, W, MasterAlpha); + Inc(SrcP, SrcWidth); Inc(DstP, Dst.Width); end end; dmTransparent: begin - MC := Src.OuterColor; + MC := OuterColor; for DstY := DstRect.Top to DstRect.Bottom - 1 do begin SP := SrcP; @@ -822,7 +873,7 @@ if MC <> SP^ then DP^ := SP^; Inc(SP); Inc(DP); end; - Inc(SrcP, Src.Width); + Inc(SrcP, SrcWidth); Inc(DstP, Dst.Width); end; end; @@ -834,10 +885,10 @@ DP := DstP; for I := 0 to W - 1 do begin - CombineCallBack(SP^, DP^, Src.MasterAlpha); + CombineCallBack(SP^, DP^, MasterAlpha); Inc(SP); Inc(DP); end; - Inc(SrcP, Src.Width); + Inc(SrcP, SrcWidth); Inc(DstP, Dst.Width); end; end; @@ -847,18 +898,37 @@ procedure BlockTransfer( Dst: TCustomBitmap32; DstX: Integer; DstY: Integer; DstClip: TRect; Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + OuterColor: TColor32; + CombineCallBack: TPixelCombineEvent); +begin + CheckBitmaps(Dst, Src); + BlockTransfer(Dst, DstX, DstY, DstClip, Src.Bits, Src.Width, Src.Height, + SrcRect, CombineOp, CombineMode, MasterAlpha, OuterColor, CombineCallBack); +end; + +procedure BlockTransfer( + Dst: TCustomBitmap32; DstX: Integer; DstY: Integer; DstClip: TRect; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + OuterColor: TColor32; + CombineCallBack: TPixelCombineEvent); var SrcX, SrcY: Integer; begin - CheckBitmaps(Dst, Src); - if Dst.Empty or Src.Empty or ((CombineOp = dmBlend) and (Src.MasterAlpha = 0)) then Exit; + if not Assigned(Dst) then raise EBitmapException.Create(SDstNil); + if Dst.Empty or not Assigned(SrcBits) or (SrcWidth <= 0) or (SrcHeight <= 0) or + ((CombineOp = dmBlend) and (MasterAlpha = 0)) then Exit; SrcX := SrcRect.Left; SrcY := SrcRect.Top; GR32.IntersectRect(DstClip, DstClip, Dst.BoundsRect); - GR32.IntersectRect(SrcRect, SrcRect, Src.BoundsRect); + GR32.IntersectRect(SrcRect, SrcRect, Bounds(0, 0, SrcWidth, SrcHeight)); GR32.OffsetRect(SrcRect, DstX - SrcX, DstY - SrcY); GR32.IntersectRect(SrcRect, DstClip, SrcRect); @@ -874,7 +944,9 @@ if (CombineOp = dmCustom) and not Assigned(CombineCallBack) then CombineOp := dmOpaque; - BlendBlock(Dst, DstClip, Src, SrcRect.Left, SrcRect.Top, CombineOp, CombineCallBack); + BlendBlock(Dst, DstClip, SrcBits, SrcWidth, SrcHeight, + SrcRect.Left, SrcRect.Top, OuterColor, CombineOp, + CombineMode, MasterAlpha, CombineCallBack); finally EMMS; end; @@ -887,7 +959,10 @@ procedure BlockTransferX( Dst: TCustomBitmap32; DstX, DstY: TFixed; Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent = nil); + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); type TColor32Array = array [0..1] of TColor32; PColor32Array = ^TColor32Array; @@ -905,7 +980,7 @@ BlendMemEx: TBlendMemEx; begin CheckBitmaps(Dst, Src); - if Dst.Empty or Src.Empty or ((CombineOp = dmBlend) and (Src.MasterAlpha = 0)) then Exit; + if Dst.Empty or Src.Empty or ((CombineOp = dmBlend) and (MasterAlpha = 0)) then Exit; SrcRectW := SrcRect.Right - SrcRect.Left - 1; SrcRectH := SrcRect.Bottom - SrcRect.Top - 1; @@ -919,7 +994,7 @@ DstW := Dst.Width; DstH := Dst.Height; - MA := Src.MasterAlpha; + MA := MasterAlpha; if (DstX >= DstW) or (DstY >= DstH) or (MA = 0) then Exit; @@ -951,8 +1026,8 @@ SetLength(Buffer[0], SrcRectW + 1); SetLength(Buffer[1], SrcRectW + 1); - BlendLineEx := BLEND_LINE_EX[Src.CombineMode]^; - BlendMemEx := BLEND_MEM_EX[Src.CombineMode]^; + BlendLineEx := BLEND_LINE_EX[CombineMode]^; + BlendMemEx := BLEND_MEM_EX[CombineMode]^; try SrcP := PColor32Array(Src.PixelPtr[SrcRect.Left, SrcRect.Top - 1]); @@ -1216,8 +1291,12 @@ procedure StretchNearest( Dst: TCustomBitmap32; DstRect, DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); var R: TRect; SrcW, SrcH, DstW, DstH, DstClipW, DstClipH: Integer; @@ -1236,8 +1315,8 @@ if GR32.IsRectEmpty(DstClip) then Exit; GR32.IntersectRect(R, DstClip, DstRect); if GR32.IsRectEmpty(R) then Exit; - if (SrcRect.Left < 0) or (SrcRect.Top < 0) or (SrcRect.Right > Src.Width) or - (SrcRect.Bottom > Src.Height) then + if (SrcRect.Left < 0) or (SrcRect.Top < 0) or (SrcRect.Right > SrcWidth) or + (SrcRect.Bottom > SrcHeight) then raise Exception.Create(RCStrInvalidSrcRect); SrcW := SrcRect.Right - SrcRect.Left; @@ -1250,8 +1329,10 @@ if (SrcW = DstW) and (SrcH = DstH) then begin { Copy without resampling } - BlendBlock(Dst, DstClip, Src, SrcRect.Left + DstClip.Left - DstRect.Left, - SrcRect.Top + DstClip.Top - DstRect.Top, CombineOp, CombineCallBack); + BlendBlock(Dst, DstClip, SrcBits, SrcWidth, SrcHeight, + SrcRect.Left + DstClip.Left - DstRect.Left, + SrcRect.Top + DstClip.Top - DstRect.Top, OuterColor, CombineOp, CombineMode, + MasterAlpha, CombineCallBack); end else begin @@ -1298,7 +1379,7 @@ if SrcY <> OldSrcY then begin - SrcLine := Src.ScanLine[SrcY]; + SrcLine := @SrcBits[SrcY * SrcWidth]; DstLinePtr := @DstLine[0]; MapPtr := @MapHorz^[0]; for I := 0 to DstClipW - 1 do @@ -1320,14 +1401,14 @@ DstLine := PColor32Array(Dst.PixelPtr[DstClip.Left, DstClip.Top]); OldSrcY := -1; - if Src.MasterAlpha >= 255 then + if MasterAlpha >= 255 then begin - BlendLine := BLEND_LINE[Src.CombineMode]^; + BlendLine := BLEND_LINE[CombineMode]^; BlendLineEx := nil; // stop compiler warnings... end else begin - BlendLineEx := BLEND_LINE_EX[Src.CombineMode]^; + BlendLineEx := BLEND_LINE_EX[CombineMode]^; BlendLine := nil; // stop compiler warnings... end; @@ -1346,7 +1427,7 @@ if SrcY <> OldSrcY then begin - SrcLine := Src.ScanLine[SrcY]; + SrcLine := @SrcBits[SrcY * SrcWidth]; DstLinePtr := @Buffer[0]; MapPtr := @MapHorz^[0]; for I := 0 to DstClipW - 1 do @@ -1360,16 +1441,16 @@ case CombineOp of dmBlend: - if Src.MasterAlpha >= 255 then + if MasterAlpha >= 255 then BlendLine(@Buffer[0], @DstLine[0], DstClipW) else - BlendLineEx(@Buffer[0], @DstLine[0], DstClipW, Src.MasterAlpha); + BlendLineEx(@Buffer[0], @DstLine[0], DstClipW, MasterAlpha); dmTransparent: for I := 0 to DstClipW - 1 do - if Buffer[I] <> Src.OuterColor then DstLine[I] := Buffer[I]; + if Buffer[I] <> OuterColor then DstLine[I] := Buffer[I]; dmCustom: for I := 0 to DstClipW - 1 do - CombineCallBack(Buffer[I], DstLine[I], Src.MasterAlpha); + CombineCallBack(Buffer[I], DstLine[I], MasterAlpha); end; Inc(DstLine, Dst.Width); @@ -1386,8 +1467,12 @@ procedure StretchHorzStretchVertLinear( Dst: TCustomBitmap32; DstRect, DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); //Assure DstRect is >= SrcRect, otherwise quality loss will occur var SrcW, SrcH, DstW, DstH, DstClipW, DstClipH: Integer; @@ -1416,7 +1501,7 @@ if FullEdge then t2 := SrcRect.Left - 0.5 + (I + DstClip.Left - DstRect.Left + 0.5) * Scale else t2 := SrcRect.Left + (I + DstClip.Left - DstRect.Left) * Scale; if t2 < 0 then t2 := 0 - else if t2 > Src.Width - 1 then t2 := Src.Width - 1; + else if t2 > SrcWidth - 1 then t2 := SrcWidth - 1; MapHorz[I].Pos := Floor(t2); MapHorz[I].Weight := 256 - Round(Frac(t2) * 256); //Pre-pack weights to reduce MMX Reg. setups per pixel: @@ -1438,7 +1523,7 @@ if FullEdge then t2 := SrcRect.Top - 0.5 + (I + DstClip.Top - DstRect.Top + 0.5) * Scale else t2 := SrcRect.Top + (I + DstClip.Top - DstRect.Top) * Scale; if t2 < 0 then t2 := 0 - else if t2 > Src.Height - 1 then t2 := Src.Height - 1; + else if t2 > SrcHeight - 1 then t2 := SrcHeight - 1; MapVert[I].Pos := Floor(t2); MapVert[I].Weight := 256 - Round(Frac(t2) * 256); //Pre-pack weights to reduce MMX Reg. setups per pixel: @@ -1453,13 +1538,13 @@ end; DstLine := PColor32Array(Dst.PixelPtr[DstClip.Left, DstClip.Top]); - SrcW := Src.Width; + SrcW := SrcWidth; DstW := Dst.Width; case CombineOp of dmOpaque: for J := 0 to DstClipH - 1 do begin - SrcLine := Src.ScanLine[MapVert[J].Pos]; + SrcLine := @SrcBits[MapVert[J].Pos * SrcWidth]; WY := MapVert[J].Weight; SrcIndex := MapHorz[0].Pos; @@ -1479,10 +1564,10 @@ end; dmBlend: begin - BlendMemEx := BLEND_MEM_EX[Src.CombineMode]^; + BlendMemEx := BLEND_MEM_EX[CombineMode]^; for J := 0 to DstClipH - 1 do begin - SrcLine := Src.ScanLine[MapVert[J].Pos]; + SrcLine := @SrcBits[MapVert[J].Pos * SrcWidth]; WY := MapVert[J].Weight; SrcIndex := MapHorz[0].Pos; SrcPtr1 := @SrcLine[SrcIndex]; @@ -1496,7 +1581,7 @@ SrcPtr2 := @SrcLine[SrcIndex + SrcW]; end; C := Interpolator(MapHorz[I].Weight, WY, SrcPtr1, SrcPtr2); - BlendMemEx(C, DstLine[I], Src.MasterAlpha) + BlendMemEx(C, DstLine[I], MasterAlpha) end; Inc(DstLine, Dst.Width); end @@ -1505,7 +1590,7 @@ begin for J := 0 to DstClipH - 1 do begin - SrcLine := Src.ScanLine[MapVert[J].Pos]; + SrcLine := @SrcBits[MapVert[J].Pos * SrcWidth]; WY := MapVert[J].Weight; SrcIndex := MapHorz[0].Pos; SrcPtr1 := @SrcLine[SrcIndex]; @@ -1519,7 +1604,7 @@ SrcPtr2 := @SrcLine[SrcIndex + SrcW]; end; C := Interpolator(MapHorz[I].Weight, WY, SrcPtr1, SrcPtr2); - if C <> Src.OuterColor then DstLine[I] := C; + if C <> OuterColor then DstLine[I] := C; end; Inc(DstLine, Dst.Width); end @@ -1527,7 +1612,7 @@ else // cmCustom for J := 0 to DstClipH - 1 do begin - SrcLine := Src.ScanLine[MapVert[J].Pos]; + SrcLine := @SrcBits[MapVert[J].Pos * SrcWidth]; WY := MapVert[J].Weight; SrcIndex := MapHorz[0].Pos; SrcPtr1 := @SrcLine[SrcIndex]; @@ -1541,7 +1626,7 @@ SrcPtr2 := @SrcLine[SrcIndex + SrcW]; end; C := Interpolator(MapHorz[I].Weight, WY, SrcPtr1, SrcPtr2); - CombineCallBack(C, DstLine[I], Src.MasterAlpha); + CombineCallBack(C, DstLine[I], MasterAlpha); end; Inc(DstLine, Dst.Width); end; @@ -1670,9 +1755,13 @@ {$WARNINGS OFF} procedure Resample( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; Kernel: TCustomKernel; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); var DstClipW: Integer; MapX, MapY: TMappingTable; @@ -1691,9 +1780,9 @@ CombineOp := dmOpaque; { check source and destination } - if (CombineOp = dmBlend) and (Src.MasterAlpha = 0) then Exit; - - BlendMemEx := BLEND_MEM_EX[Src.CombineMode]^; // store in local variable + if (CombineOp = dmBlend) and (MasterAlpha = 0) then Exit; + + BlendMemEx := BLEND_MEM_EX[CombineMode]^; // store in local variable DstClipW := DstClip.Right - DstClip.Left; @@ -1719,7 +1808,7 @@ Ca := 0; Cr := 0; Cg := 0; Cb := 0; for Y := 0 to Length(ClusterY) - 1 do begin - C := Src.Bits[X + ClusterY[Y].Pos * Src.Width]; + C := SrcBits[X + ClusterY[Y].Pos * SrcWidth]; ClustYW := ClusterY[Y].Weight; Inc(Ca, Integer(C shr 24) * ClustYW); Inc(Cr, Integer(C and $00FF0000) shr 16 * ClustYW); @@ -1778,9 +1867,9 @@ // combine it with the background case CombineOp of dmOpaque: DstLine[I] := C; - dmBlend: BlendMemEx(C, DstLine[I], Src.MasterAlpha); - dmTransparent: if C <> Src.OuterColor then DstLine[I] := C; - dmCustom: CombineCallBack(C, DstLine[I], Src.MasterAlpha); + dmBlend: BlendMemEx(C, DstLine[I], MasterAlpha); + dmTransparent: if C <> OuterColor then DstLine[I] := C; + dmCustom: CombineCallBack(C, DstLine[I], MasterAlpha); end; end; end; @@ -2183,8 +2272,13 @@ procedure DraftResample(Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; Kernel: TCustomKernel; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + Kernel: TCustomKernel; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); var SrcW, SrcH, DstW, DstH, @@ -2212,19 +2306,20 @@ DstClipW := DstClip.Right - DstClip.Left; DstClipH := DstClip.Bottom - DstClip.Top; - BlendMemEx := BLEND_MEM_EX[Src.CombineMode]^; + BlendMemEx := BLEND_MEM_EX[CombineMode]^; if (DstW > SrcW)or(DstH > SrcH) then begin if (SrcW < 2) or (SrcH < 2) then - Resample(Dst, DstRect, DstClip, Src, SrcRect, Kernel, CombineOp, - CombineCallBack) + Resample(Dst, DstRect, DstClip, SrcBits, SrcWidth, SrcHeight, SrcRect, + Kernel, OuterColor, CombineOp, CombineMode, + MasterAlpha, CombineCallBack) else - StretchHorzStretchVertLinear(Dst, DstRect, DstClip, Src, SrcRect, CombineOp, - CombineCallBack); + StretchHorzStretchVertLinear(Dst, DstRect, DstClip, SrcBits, SrcWidth, SrcHeight, SrcRect, OuterColor, CombineOp, + CombineMode, MasterAlpha, CombineCallBack); end else begin //Full Scaledown, ignores Fulledge - cannot be integrated into this resampling method - OffSrc := Src.Width * 4; + OffSrc := SrcWidth * 4; ScaleFactor:= SrcW / DstW; cx := Trunc( (DstClip.Left - DstRect.Left) * ScaleFactor); @@ -2237,7 +2332,7 @@ sc := Trunc( $10000 * ScaleFactor ); DstLine := PColor32Array(Dst.PixelPtr[0, DstClip.Top]); - RowSrc := Src.PixelPtr[SrcRect.Left + cx, SrcRect.Top + cy ]; + RowSrc := @SrcBits[SrcRect.Left + cx + (SrcRect.Top + cy) * SrcWidth]; xs := r2; c1 := 0; @@ -2269,7 +2364,7 @@ dx := r2 - r1; r1 := r2; r2 := FixedMul(I, sr); BlendMemEx(BlockAverage(dx, dy, xsrc, OffSrc), - DstLine[DstClip.Left + I], Src.MasterAlpha); + DstLine[DstClip.Left + I], MasterAlpha); Inc(xsrc, dx); end; dmTransparent: @@ -2278,7 +2373,7 @@ dx := r2 - r1; r1 := r2; r2 := FixedMul(I, sr); C := BlockAverage(dx, dy, xsrc, OffSrc); - if C <> Src.OuterColor then DstLine[DstClip.Left + I] := C; + if C <> OuterColor then DstLine[DstClip.Left + I] := C; Inc(xsrc, dx); end; dmCustom: @@ -2287,7 +2382,7 @@ dx := r2 - r1; r1 := r2; r2 := FixedMul(I, sr); CombineCallBack(BlockAverage(dx, dy, xsrc, OffSrc), - DstLine[DstClip.Left + I], Src.MasterAlpha); + DstLine[DstClip.Left + I], MasterAlpha); Inc(xsrc, dx); end; end; @@ -2414,18 +2509,38 @@ Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; Src: TCustomBitmap32; SrcRect: TRect; Resampler: TCustomResampler; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + OuterColor: TColor32; + CombineCallBack: TPixelCombineEvent); +begin + CheckBitmaps(Dst, Src); + StretchTransfer(Dst, DstRect, DstClip, Src.Bits, Src.Width, Src.Height, + SrcRect, Resampler, CombineOp, CombineMode, MasterAlpha, OuterColor, + CombineCallBack); +end; + +procedure StretchTransfer( + Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + Resampler: TCustomResampler; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + OuterColor: TColor32; + CombineCallBack: TPixelCombineEvent); var SrcW, SrcH: Integer; DstW, DstH: Integer; R: TRect; RatioX, RatioY: Single; begin - CheckBitmaps(Dst, Src); + if not Assigned(Dst) then raise EBitmapException.Create(SDstNil); // transform dest rect when the src rect is out of the src bitmap's bounds - if (SrcRect.Left < 0) or (SrcRect.Right > Src.Width) or - (SrcRect.Top < 0) or (SrcRect.Bottom > Src.Height) then + if (SrcRect.Left < 0) or (SrcRect.Right > SrcWidth) or + (SrcRect.Top < 0) or (SrcRect.Bottom > SrcHeight) then begin RatioX := (DstRect.Right - DstRect.Left) / (SrcRect.Right - SrcRect.Left); RatioY := (DstRect.Bottom - DstRect.Top) / (SrcRect.Bottom - SrcRect.Top); @@ -2442,21 +2557,21 @@ SrcRect.Top := 0; end; - if SrcRect.Right > Src.Width then + if SrcRect.Right > SrcWidth then begin - DstRect.Right := DstRect.Right - Floor((SrcRect.Right - Src.Width) * RatioX); - SrcRect.Right := Src.Width; + DstRect.Right := DstRect.Right - Floor((SrcRect.Right - SrcWidth) * RatioX); + SrcRect.Right := SrcWidth; end; - if SrcRect.Bottom > Src.Height then + if SrcRect.Bottom > SrcHeight then begin - DstRect.Bottom := DstRect.Bottom - Floor((SrcRect.Bottom - Src.Height) * RatioY); - SrcRect.Bottom := Src.Height; + DstRect.Bottom := DstRect.Bottom - Floor((SrcRect.Bottom - SrcHeight) * RatioY); + SrcRect.Bottom := SrcHeight; end; end; - if Src.Empty or Dst.Empty or - ((CombineOp = dmBlend) and (Src.MasterAlpha = 0)) or + if not Assigned(SrcBits) or (SrcWidth <= 0) or (SrcHeight <= 0) or Dst.Empty or + ((CombineOp = dmBlend) and (MasterAlpha = 0)) or GR32.IsRectEmpty(SrcRect) then Exit; @@ -2478,11 +2593,16 @@ try if (SrcW = DstW) and (SrcH = DstH) then - BlendBlock(Dst, DstClip, Src, SrcRect.Left + DstClip.Left - DstRect.Left, - SrcRect.Top + DstClip.Top - DstRect.Top, CombineOp, CombineCallBack) + BlendBlock(Dst, DstClip, SrcBits, SrcWidth, SrcHeight, + SrcRect.Left + DstClip.Left - DstRect.Left, + SrcRect.Top + DstClip.Top - DstRect.Top, + OuterColor, CombineOp, CombineMode, + MasterAlpha, CombineCallBack) else TCustomResamplerAccess(Resampler).Resample( - Dst, DstRect, DstClip, Src, SrcRect, CombineOp, CombineCallBack); + Dst, DstRect, DstClip, SrcBits, SrcWidth, SrcHeight, SrcRect, + OuterColor, CombineOp, CombineMode, + MasterAlpha, CombineCallBack); finally EMMS; end; @@ -3031,10 +3151,17 @@ end; procedure TKernelResampler.Resample(Dst: TCustomBitmap32; DstRect, - DstClip: TRect; Src: TCustomBitmap32; SrcRect: TRect; CombineOp: TDrawMode; + DstClip: TRect; + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; CombineCallBack: TPixelCombineEvent); begin - GR32_Resamplers.Resample(Dst, DstRect, DstClip, Src, SrcRect, FKernel, CombineOp, CombineCallBack); + GR32_Resamplers.Resample(Dst, DstRect, DstClip, SrcBits, SrcWidth, SrcHeight, + SrcRect, FKernel, OuterColor, + CombineOp, CombineMode, MasterAlpha, CombineCallBack); end; {$WARNINGS OFF} @@ -3500,10 +3627,16 @@ procedure TNearestResampler.Resample( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); begin - StretchNearest(Dst, DstRect, DstClip, Src, SrcRect, CombineOp, CombineCallBack) + StretchNearest(Dst, DstRect, DstClip, SrcBits, SrcWidth, SrcHeight, SrcRect, + OuterColor, CombineOp, CombineMode, + MasterAlpha, CombineCallBack) end; @@ -3616,8 +3749,12 @@ procedure TLinearResampler.Resample( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); var SrcW, SrcH: TFloat; DstW, DstH: Integer; @@ -3627,20 +3764,28 @@ DstW := DstRect.Right - DstRect.Left; DstH := DstRect.Bottom - DstRect.Top; if (DstW > SrcW) and (DstH > SrcH) and (SrcW > 1) and (SrcH > 1) then - StretchHorzStretchVertLinear(Dst, DstRect, DstClip, Src, SrcRect, CombineOp, - CombineCallBack) + StretchHorzStretchVertLinear(Dst, DstRect, DstClip, SrcBits, SrcWidth, SrcHeight, + SrcRect, OuterColor, CombineOp, + CombineMode, MasterAlpha, CombineCallBack) else - GR32_Resamplers.Resample(Dst, DstRect, DstClip, Src, SrcRect, FLinearKernel, - CombineOp, CombineCallBack); + GR32_Resamplers.Resample(Dst, DstRect, DstClip, SrcBits, SrcWidth, SrcHeight, + SrcRect, FLinearKernel, OuterColor, + CombineOp, CombineMode, MasterAlpha, CombineCallBack); end; procedure TDraftResampler.Resample( Dst: TCustomBitmap32; DstRect: TRect; DstClip: TRect; - Src: TCustomBitmap32; SrcRect: TRect; - CombineOp: TDrawMode; CombineCallBack: TPixelCombineEvent); + SrcBits: PColor32Array; SrcWidth, SrcHeight: Integer; SrcRect: TRect; + OuterColor: TColor32; + CombineOp: TDrawMode; + CombineMode: TCombineMode; + MasterAlpha: Cardinal; + CombineCallBack: TPixelCombineEvent); begin - DraftResample(Dst, DstRect, DstClip, Src, SrcRect, FLinearKernel, CombineOp, - CombineCallBack) + DraftResample( + Dst, DstRect, DstClip, SrcBits, SrcWidth, SrcHeight, SrcRect, + FLinearKernel, OuterColor, CombineOp, + CombineMode, MasterAlpha, CombineCallBack) end; { TTransformer }