Anonymous | Login | Signup for a new account | 21-11-24 12:58 UTC |
All Projects | SAS.Планета | Домен, сайт, форум, багтрекер | Доработка карты (ZMP) | Переводы и локализации | Прочее |
My View | View Issues | Change Log | Roadmap | Search |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0003597 | SAS.Планета | Рефакторинг | public | 06-12-2019 08:15 | 12-12-2019 16:14 | ||||
Reporter | zed | ||||||||
Assigned To | vdemidov | ||||||||
Priority | normal | Severity | minor | Reproducibility | N/A | ||||
Status | resolved | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | 190707 | ||||||||
Target Version | 191221 | Fixed in Version | 191221 | ||||||
Summary | 0003597: Переход на актуальную версию Graphics32 | ||||||||
Description | Как-то так получилось, что у нас сорцы этого компонента застряли на отметке 2012-го года, а он, в общем-то, продолжает разрабатываться. Официальный репозиторий тут: https://github.com/graphics32/graphics32 | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | gr32.patch [^] (64,904 bytes) 08-12-2019 17:06 [Show Content] [Hide Content]# HG changeset patch # User Viktor Demidov <[email protected]> # 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 } Sas.patch [^] (82,446 bytes) 08-12-2019 17:09 [Show Content] [Hide Content] # HG changeset patch # User Viktor Demidov <[email protected]> # Date 1575824826 -7200 # Sun Dec 08 19:07:06 2019 +0200 # Node ID f323278af2ff28139822bf06fb055536e841bfe0 # Parent bf461203504ca14bc417397a75f5c7cfed6419d8 Graphics32 upgrade diff -r bf461203504c -r f323278af2ff Src/Bitmap32/u_Bitmap32ByStaticBitmap.pas --- a/Src/Bitmap32/u_Bitmap32ByStaticBitmap.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/Bitmap32/u_Bitmap32ByStaticBitmap.pas Sun Dec 08 19:07:06 2019 +0200 @@ -30,7 +30,6 @@ type TStaticBitmapBackend = class(TCustomBackend) private - FBufferFactory: IBitmap32BufferFactory; FBitmapStatic: IBitmap32Buffer; protected procedure InitializeSurface( @@ -40,9 +39,8 @@ procedure FinalizeSurface; override; public constructor Create( - Owner: TCustomBitmap32; - const ABufferFactory: IBitmap32BufferFactory - ); + Owner: TCustomBitmap32 + ); override; end; TBitmap32ByStaticBitmap = class(TCustomBitmap32) @@ -50,7 +48,6 @@ FBitmap32StaticFactory: IBitmap32StaticFactory; FBackEndByStatic: TStaticBitmapBackend; protected - procedure InitializeBackend; override; procedure SetBackend(const Backend: TCustomBackend); override; public function MakeAndClear: IBitmap32Static; @@ -68,13 +65,11 @@ { TStaticBitmapBackend } constructor TStaticBitmapBackend.Create( - Owner: TCustomBitmap32; - const ABufferFactory: IBitmap32BufferFactory + Owner: TCustomBitmap32 ); begin - Assert(ABufferFactory <> nil); + Assert(Owner is TBitmap32ByStaticBitmap); inherited Create(Owner); - FBufferFactory := ABufferFactory; end; procedure TStaticBitmapBackend.FinalizeSurface; @@ -88,11 +83,14 @@ NewWidth, NewHeight: Integer; ClearBuffer: Boolean ); +var + VBufferFactory: IBitmap32BufferFactory; begin + VBufferFactory := TBitmap32ByStaticBitmap(FOwner).FBitmap32StaticFactory.BufferFactory; if ClearBuffer then begin - FBitmapStatic := FBufferFactory.BuildEmptyClear(Types.Point(NewWidth, NewHeight), 0); + FBitmapStatic := VBufferFactory.BuildEmptyClear(Types.Point(NewWidth, NewHeight), 0); end else begin - FBitmapStatic := FBufferFactory.BuildEmpty(Types.Point(NewWidth, NewHeight)); + FBitmapStatic := VBufferFactory.BuildEmpty(Types.Point(NewWidth, NewHeight)); end; if FBitmapStatic <> nil then begin FBits := FBitmapStatic.Data; @@ -109,12 +107,7 @@ begin Assert(Assigned(ABitmap32StaticFactory)); FBitmap32StaticFactory := ABitmap32StaticFactory; - inherited Create; -end; - -procedure TBitmap32ByStaticBitmap.InitializeBackend; -begin - TStaticBitmapBackend.Create(Self, FBitmap32StaticFactory.BufferFactory); + inherited Create(TStaticBitmapBackend); end; function TBitmap32ByStaticBitmap.MakeAndClear: IBitmap32Static; @@ -129,6 +122,8 @@ if Backend is TStaticBitmapBackend then begin FBackEndByStatic := TStaticBitmapBackend(Backend); inherited; + end else begin + Assert(False, 'Bad backend for this bitmap class'); end; end; diff -r bf461203504c -r f323278af2ff Src/Bitmap32/u_Bitmap32StaticBuilderByGR32.pas --- a/Src/Bitmap32/u_Bitmap32StaticBuilderByGR32.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/Bitmap32/u_Bitmap32StaticBuilderByGR32.pas Sun Dec 08 19:07:06 2019 +0200 @@ -104,16 +104,14 @@ procedure FinalizeSurface; override; public constructor Create( - Owner: TCustomBitmap32; - const ABitmapBuffer: IBitmap32Buffer - ); + Owner: TCustomBitmap32 + ); override; end; TBitmap32FixedBitmapBuffer = class(TCustomBitmap32) private FBitmapBuffer: IBitmap32Buffer; protected - procedure InitializeBackend; override; procedure SetBackend(const Backend: TCustomBackend); override; public constructor Create(const ABitmapBuffer: IBitmap32Buffer); reintroduce; @@ -122,13 +120,12 @@ { TFixedBufferBitmapBackend } constructor TFixedBufferBitmapBackend.Create( - Owner: TCustomBitmap32; - const ABitmapBuffer: IBitmap32Buffer + Owner: TCustomBitmap32 ); begin - Assert(Assigned(ABitmapBuffer)); + Assert(Owner is TBitmap32FixedBitmapBuffer); inherited Create(Owner); - FBitmapBuffer := ABitmapBuffer; + FBitmapBuffer := TBitmap32FixedBitmapBuffer(FOwner).FBitmapBuffer; end; procedure TFixedBufferBitmapBackend.FinalizeSurface; @@ -159,16 +156,10 @@ ); begin Assert(Assigned(ABitmapBuffer)); - inherited Create; + inherited Create(TFixedBufferBitmapBackend); FBitmapBuffer := ABitmapBuffer; end; -procedure TBitmap32FixedBitmapBuffer.InitializeBackend; -begin - inherited; - TFixedBufferBitmapBackend.Create(Self, FBitmapBuffer); -end; - procedure TBitmap32FixedBitmapBuffer.SetBackend(const Backend: TCustomBackend); begin Assert(Backend is TFixedBufferBitmapBackend); diff -r bf461203504c -r f323278af2ff Src/BitmapLayerProvider/u_BitmapLayerProviderByTrackPath.pas --- a/Src/BitmapLayerProvider/u_BitmapLayerProviderByTrackPath.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/BitmapLayerProvider/u_BitmapLayerProviderByTrackPath.pas Sun Dec 08 19:07:06 2019 +0200 @@ -103,6 +103,7 @@ Types, Math, GR32_Polygons, + GR32_VectorUtils, i_ProjectionType, u_Bitmap32ByStaticBitmap, u_GeometryFunc, @@ -233,19 +234,19 @@ ); var VSegmentColor: TColor32; - VLine: TArrayOfFixedPoint; - VLines: TArrayOfArrayOfFixedPoint; + VLine: TArrayOfFloatPoint; + VLines: TArrayOfArrayOfFloatPoint; begin if (APointPrev.x < 32767) and (APointPrev.x > -32767) and (APointPrev.y < 32767) and (APointPrev.y > -32767) then begin VSegmentColor := ATrackColorer.GetColorForSpeed(ASpeed); SetLength(VLine, 2); - VLine[0] := FixedPoint(APointPrev.X, APointPrev.Y); - VLine[1] := FixedPoint(APointCurr.X, APointCurr.Y); + VLine[0] := FloatPoint(APointPrev.X, APointPrev.Y); + VLine[1] := FloatPoint(APointCurr.X, APointCurr.Y); SetLength(VLines, 1); VLines[0] := VLine; VLines := BuildPolyPolyLine(VLines, False, ALineWidth); - PolyPolygonXS( + PolyPolygonFS( ATargetBmp, VLines, VSegmentColor diff -r bf461203504c -r f323278af2ff Src/Geometry/u_GeometryFunc.pas --- a/Src/Geometry/u_GeometryFunc.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/Geometry/u_GeometryFunc.pas Sun Dec 08 19:07:06 2019 +0200 @@ -25,65 +25,27 @@ const AGeometry: IGeometryProjectedPolygon ): IGeometryProjectedSinglePolygon; -function BuildPolyPolyLine( - const APoints: TArrayOfArrayOfFixedPoint; - AClosed: Boolean; - AStrokeWidth: double -): TArrayOfArrayOfFixedPoint; - -procedure AppendArrayOfArrayOfFixedPoint( - var APoints1: TArrayOfArrayOfFixedPoint; - const APoints2: TArrayOfArrayOfFixedPoint +procedure AppendArrayOfArrayOfFloatPoint( + var APoints1: TArrayOfArrayOfFloatPoint; + const APoints2: TArrayOfArrayOfFloatPoint ); overload; -procedure AppendArrayOfArrayOfFixedPoint( - var APoints1: TArrayOfArrayOfFixedPoint; - const APoints2: TArrayOfFixedPoint +procedure AppendArrayOfArrayOfFloatPoint( + var APoints1: TArrayOfArrayOfFloatPoint; + const APoints2: TArrayOfFloatPoint ); overload; function ProjectedLine2ArrayOfArray( const ALine: IGeometryProjectedLine; const AMapRect: TRect; - var APointArray: TArrayOfFixedPoint -): TArrayOfArrayOfFixedPoint; - -procedure ProjectedLine2GR32Polygon( - const ALine: IGeometryProjectedLine; - const ALocalConverter: ILocalCoordConverter; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; - -procedure ProjectedLine2GR32Polygon( - const ALine: IGeometryProjectedLine; - const AMapRect: TRect; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; + var APointArray: TArrayOfFloatPoint +): TArrayOfArrayOfFloatPoint; function ProjectedPolygon2ArrayOfArray( const ALine: IGeometryProjectedSinglePolygon; const AMapRect: TRect; - var APointArray: TArrayOfFixedPoint -): TArrayOfArrayOfFixedPoint; - -procedure ProjectedPolygon2GR32Polygon( - const ALine: IGeometryProjectedSinglePolygon; - const ALocalConverter: ILocalCoordConverter; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; - -procedure ProjectedPolygon2GR32Polygon( - const ALine: IGeometryProjectedSinglePolygon; - const AMapRect: TRect; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; + var APointArray: TArrayOfFloatPoint +): TArrayOfArrayOfFloatPoint; function IsValidLonLatLine( const AGeometry: IGeometryLonLatLine @@ -463,51 +425,21 @@ end; end; -function BuildPolyPolyLine( - const APoints: TArrayOfArrayOfFixedPoint; - AClosed: Boolean; - AStrokeWidth: double -): TArrayOfArrayOfFixedPoint; -var - VPolygon: TPolygon32; -begin - VPolygon := TPolygon32.Create; - try - VPolygon.Closed := AClosed; - VPolygon.Points := APoints; - with VPolygon.Outline do begin - try - with Grow(GR32.Fixed(AStrokeWidth / 2), 0.5) do begin - try - Result := Points; - finally - Free; - end; - end; - finally - Free; - end; - end; - finally - VPolygon.Free; - end; -end; - -procedure AppendArrayOfArrayOfFixedPoint( - var APoints1: TArrayOfArrayOfFixedPoint; - const APoints2: TArrayOfArrayOfFixedPoint +procedure AppendArrayOfArrayOfFloatPoint( + var APoints1: TArrayOfArrayOfFloatPoint; + const APoints2: TArrayOfArrayOfFloatPoint ); overload; var i: Integer; begin for i := 0 to Length(APoints2) - 1 do begin - AppendArrayOfArrayOfFixedPoint(APoints1, APoints2[i]); + AppendArrayOfArrayOfFloatPoint(APoints1, APoints2[i]); end; end; -procedure AppendArrayOfArrayOfFixedPoint( - var APoints1: TArrayOfArrayOfFixedPoint; - const APoints2: TArrayOfFixedPoint +procedure AppendArrayOfArrayOfFloatPoint( + var APoints1: TArrayOfArrayOfFloatPoint; + const APoints2: TArrayOfFloatPoint ); overload; var VLen: Integer; @@ -521,8 +453,8 @@ const ALine: IGeometryProjectedSingleLine; const ARectWithDelta: TDoubleRect; const AMapRect: TDoubleRect; - var APointArray: TArrayOfFixedPoint -): TArrayOfArrayOfFixedPoint; + var APointArray: TArrayOfFloatPoint +): TArrayOfArrayOfFloatPoint; var VEnum: IEnumLocalPoint; VPoint: TDoublePoint; @@ -556,7 +488,7 @@ if VPointsProcessedCount + 1 >= Length(APointArray) then begin SetLength(APointArray, (VPointsProcessedCount + 1) * 2); end; - APointArray[VPointsProcessedCount] := FixedPoint(VPoint.X, VPoint.Y); + APointArray[VPointsProcessedCount] := FloatPoint(VPoint.X, VPoint.Y); Inc(VPointsProcessedCount); end; end; @@ -569,134 +501,11 @@ end; end; -procedure SingleLine2GR32Polygon( - const ALine: IGeometryProjectedSingleLine; - const ALocalConverter: ILocalCoordConverter; - const ARectWithDelta: TDoubleRect; - const AMapRect: TDoubleRect; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; -var - VEnum: IEnumLocalPoint; - VPoint: TDoublePoint; - VPointsProcessedCount: Integer; -begin - if IsIntersecProjectedRect(AMapRect, ALine.Bounds) then begin - VEnum := - TEnumDoublePointMapPixelToLocalPixel.Create( - ALocalConverter, - ALine.GetEnum - ); - VEnum := - TEnumLocalPointClipByRect.Create( - False, - ARectWithDelta, - VEnum - ); - VEnum := TEnumLocalPointFilterEqual.Create(VEnum); - VPointsProcessedCount := 0; - while VEnum.Next(VPoint) do begin - if PointIsEmpty(VPoint) then begin - if VPointsProcessedCount > 0 then begin - if APolygon = nil then begin - APolygon := TPolygon32.Create; - APolygon.Antialiased := AAntialiasMode <> amNone; - APolygon.AntialiasMode := AAntialiasMode; - APolygon.Closed := False; - end else begin - APolygon.NewLine; - end; - end; - end else begin - if VPointsProcessedCount + 1 >= Length(AFixedPointArray) then begin - SetLength(AFixedPointArray, (VPointsProcessedCount + 1) * 2); - end; - AFixedPointArray[VPointsProcessedCount] := FixedPoint(VPoint.X, VPoint.Y); - Inc(VPointsProcessedCount); - end; - end; - if VPointsProcessedCount > 0 then begin - if APolygon = nil then begin - APolygon := TPolygon32.Create; - APolygon.Antialiased := AAntialiasMode <> amNone; - APolygon.AntialiasMode := AAntialiasMode; - APolygon.Closed := False; - end else begin - APolygon.NewLine; - end; - APolygon.AddPoints(AFixedPointArray[0], VPointsProcessedCount); - end; - end; -end; - -procedure SingleLine2GR32Polygon( - const ALine: IGeometryProjectedSingleLine; - const ARectWithDelta: TDoubleRect; - const AMapRect: TDoubleRect; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; -var - VEnum: IEnumLocalPoint; - VPoint: TDoublePoint; - VPointsProcessedCount: Integer; -begin - if IsIntersecProjectedRect(AMapRect, ALine.Bounds) then begin - VEnum := - TEnumDoublePointMapPixelToLocalPixelSimple.Create( - AMapRect.TopLeft, - ALine.GetEnum - ); - VEnum := - TEnumLocalPointClipByRect.Create( - False, - ARectWithDelta, - VEnum - ); - VEnum := TEnumLocalPointFilterEqual.Create(VEnum); - VPointsProcessedCount := 0; - while VEnum.Next(VPoint) do begin - if PointIsEmpty(VPoint) then begin - if VPointsProcessedCount > 0 then begin - if APolygon = nil then begin - APolygon := TPolygon32.Create; - APolygon.Antialiased := AAntialiasMode <> amNone; - APolygon.AntialiasMode := AAntialiasMode; - APolygon.Closed := False; - end else begin - APolygon.NewLine; - end; - end; - end else begin - if VPointsProcessedCount + 1 >= Length(AFixedPointArray) then begin - SetLength(AFixedPointArray, (VPointsProcessedCount + 1) * 2); - end; - AFixedPointArray[VPointsProcessedCount] := FixedPoint(VPoint.X, VPoint.Y); - Inc(VPointsProcessedCount); - end; - end; - if VPointsProcessedCount > 0 then begin - if APolygon = nil then begin - APolygon := TPolygon32.Create; - APolygon.Antialiased := AAntialiasMode <> amNone; - APolygon.AntialiasMode := AAntialiasMode; - APolygon.Closed := False; - end else begin - APolygon.NewLine; - end; - APolygon.AddPoints(AFixedPointArray[0], VPointsProcessedCount); - end; - end; -end; - function ProjectedLine2ArrayOfArray( const ALine: IGeometryProjectedLine; const AMapRect: TRect; - var APointArray: TArrayOfFixedPoint -): TArrayOfArrayOfFixedPoint; + var APointArray: TArrayOfFloatPoint +): TArrayOfArrayOfFloatPoint; var VMapRect: TDoubleRect; VLocalRect: TDoubleRect; @@ -704,7 +513,7 @@ VLineIndex: Integer; VSingleLine: IGeometryProjectedSingleLine; VMultiLine: IGeometryProjectedMultiLine; - VLines: TArrayOfArrayOfFixedPoint; + VLines: TArrayOfArrayOfFloatPoint; begin if Assigned(ALine) then begin VMapRect := DoubleRect(AMapRect); @@ -732,115 +541,7 @@ VMapRect, APointArray ); - AppendArrayOfArrayOfFixedPoint(Result, VLines); - end; - end; - end; - end; -end; - -procedure ProjectedLine2GR32Polygon( - const ALine: IGeometryProjectedLine; - const ALocalConverter: ILocalCoordConverter; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); -var - VMapRect: TDoubleRect; - VLocalRect: TDoubleRect; - VRectWithDelta: TDoubleRect; - VLineIndex: Integer; - VSingleLine: IGeometryProjectedSingleLine; - VMultiLine: IGeometryProjectedMultiLine; -begin - if Assigned(APolygon) then begin - APolygon.Clear; - end; - - if Assigned(ALine) then begin - VMapRect := ALocalConverter.GetRectInMapPixelFloat; - if IsIntersecProjectedRect(VMapRect, ALine.Bounds) then begin - VLocalRect := DoubleRect(ALocalConverter.GetLocalRect); - VRectWithDelta.Left := VLocalRect.Left - 10; - VRectWithDelta.Top := VLocalRect.Top - 10; - VRectWithDelta.Right := VLocalRect.Right + 10; - VRectWithDelta.Bottom := VLocalRect.Bottom + 10; - if Supports(ALine, IGeometryProjectedSingleLine, VSingleLine) then begin - SingleLine2GR32Polygon( - VSingleLine, - ALocalConverter, - VRectWithDelta, - VMapRect, - AAntialiasMode, - AFixedPointArray, - APolygon - ); - end else if Supports(ALine, IGeometryProjectedMultiLine, VMultiLine) then begin - for VLineIndex := 0 to VMultiLine.Count - 1 do begin - VSingleLine := VMultiLine.Item[VLineIndex]; - SingleLine2GR32Polygon( - VSingleLine, - ALocalConverter, - VRectWithDelta, - VMapRect, - AAntialiasMode, - AFixedPointArray, - APolygon - ); - end; - end; - end; - end; -end; - -procedure ProjectedLine2GR32Polygon( - const ALine: IGeometryProjectedLine; - const AMapRect: TRect; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; -var - VMapRect: TDoubleRect; - VLocalRect: TDoubleRect; - VRectWithDelta: TDoubleRect; - VLineIndex: Integer; - VSingleLine: IGeometryProjectedSingleLine; - VMultiLine: IGeometryProjectedMultiLine; -begin - if Assigned(APolygon) then begin - APolygon.Clear; - end; - - if Assigned(ALine) then begin - VMapRect := DoubleRect(AMapRect); - if IsIntersecProjectedRect(VMapRect, ALine.Bounds) then begin - VLocalRect := DoubleRect(0, 0, VMapRect.Right - VMapRect.Left, VMapRect.Bottom - VMapRect.Top); - VRectWithDelta.Left := VLocalRect.Left - 10; - VRectWithDelta.Top := VLocalRect.Top - 10; - VRectWithDelta.Right := VLocalRect.Right + 10; - VRectWithDelta.Bottom := VLocalRect.Bottom + 10; - if Supports(ALine, IGeometryProjectedSingleLine, VSingleLine) then begin - SingleLine2GR32Polygon( - VSingleLine, - VRectWithDelta, - VMapRect, - AAntialiasMode, - AFixedPointArray, - APolygon - ); - end else if Supports(ALine, IGeometryProjectedMultiLine, VMultiLine) then begin - for VLineIndex := 0 to VMultiLine.Count - 1 do begin - VSingleLine := VMultiLine.Item[VLineIndex]; - SingleLine2GR32Polygon( - VSingleLine, - VRectWithDelta, - VMapRect, - AAntialiasMode, - AFixedPointArray, - APolygon - ); + AppendArrayOfArrayOfFloatPoint(Result, VLines); end; end; end; @@ -851,8 +552,8 @@ const ALine: IGeometryProjectedContour; const ARectWithDelta: TDoubleRect; const AMapRect: TDoubleRect; - var APointArray: TArrayOfFixedPoint -): TArrayOfArrayOfFixedPoint; overload; + var APointArray: TArrayOfFloatPoint +): TArrayOfArrayOfFloatPoint; overload; var VEnum: IEnumLocalPoint; VPoint: TDoublePoint; @@ -887,7 +588,7 @@ if VPointsProcessedCount + 1 >= Length(APointArray) then begin SetLength(APointArray, (VPointsProcessedCount + 1) * 2); end; - APointArray[VPointsProcessedCount] := FixedPoint(VPoint.X, VPoint.Y); + APointArray[VPointsProcessedCount] := FloatPoint(VPoint.X, VPoint.Y); Inc(VPointsProcessedCount); end; end; @@ -901,146 +602,17 @@ end; end; -procedure SingleContour2GR32Polygon( - const ALine: IGeometryProjectedContour; - const ALocalConverter: ILocalCoordConverter; - const ARectWithDelta: TDoubleRect; - const AMapRect: TDoubleRect; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; -var - VEnum: IEnumLocalPoint; - VPoint: TDoublePoint; - VPointsProcessedCount: Integer; -begin - if IsIntersecProjectedRect(AMapRect, ALine.Bounds) then begin - VEnum := - TEnumDoublePointMapPixelToLocalPixel.Create( - ALocalConverter, - ALine.GetEnum - ); - VEnum := - TEnumLocalPointClipByRect.Create( - True, - ARectWithDelta, - VEnum - ); - VEnum := TEnumLocalPointFilterEqual.Create(VEnum); - VEnum := TEnumLocalPointClosePoly.Create(VEnum); - VPointsProcessedCount := 0; - while VEnum.Next(VPoint) do begin - if PointIsEmpty(VPoint) then begin - if VPointsProcessedCount > 0 then begin - if APolygon = nil then begin - APolygon := TPolygon32.Create; - APolygon.Antialiased := AAntialiasMode <> amNone; - APolygon.AntialiasMode := AAntialiasMode; - APolygon.Closed := True; - end else begin - APolygon.NewLine; - end; - APolygon.AddPoints(AFixedPointArray[0], VPointsProcessedCount); - end; - end else begin - if VPointsProcessedCount + 1 >= Length(AFixedPointArray) then begin - SetLength(AFixedPointArray, (VPointsProcessedCount + 1) * 2); - end; - AFixedPointArray[VPointsProcessedCount] := FixedPoint(VPoint.X, VPoint.Y); - Inc(VPointsProcessedCount); - end; - end; - - if VPointsProcessedCount > 0 then begin - if APolygon = nil then begin - APolygon := TPolygon32.Create; - APolygon.Antialiased := AAntialiasMode <> amNone; - APolygon.AntialiasMode := AAntialiasMode; - APolygon.Closed := True; - end else begin - APolygon.NewLine; - end; - APolygon.AddPoints(AFixedPointArray[0], VPointsProcessedCount); - end; - end; -end; - -procedure SingleContour2GR32Polygon( - const ALine: IGeometryProjectedContour; - const ARectWithDelta: TDoubleRect; - const AMapRect: TDoubleRect; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; -var - VEnum: IEnumLocalPoint; - VPoint: TDoublePoint; - VPointsProcessedCount: Integer; -begin - if IsIntersecProjectedRect(AMapRect, ALine.Bounds) then begin - VEnum := - TEnumDoublePointMapPixelToLocalPixelSimple.Create( - AMapRect.TopLeft, - ALine.GetEnum - ); - VEnum := - TEnumLocalPointClipByRect.Create( - True, - ARectWithDelta, - VEnum - ); - VEnum := TEnumLocalPointFilterEqual.Create(VEnum); - VEnum := TEnumLocalPointClosePoly.Create(VEnum); - VPointsProcessedCount := 0; - while VEnum.Next(VPoint) do begin - if PointIsEmpty(VPoint) then begin - if VPointsProcessedCount > 0 then begin - if APolygon = nil then begin - APolygon := TPolygon32.Create; - APolygon.Antialiased := AAntialiasMode <> amNone; - APolygon.AntialiasMode := AAntialiasMode; - APolygon.Closed := True; - end else begin - APolygon.NewLine; - end; - APolygon.AddPoints(AFixedPointArray[0], VPointsProcessedCount); - end; - end else begin - if VPointsProcessedCount + 1 >= Length(AFixedPointArray) then begin - SetLength(AFixedPointArray, (VPointsProcessedCount + 1) * 2); - end; - AFixedPointArray[VPointsProcessedCount] := FixedPoint(VPoint.X, VPoint.Y); - Inc(VPointsProcessedCount); - end; - end; - - if VPointsProcessedCount > 0 then begin - if APolygon = nil then begin - APolygon := TPolygon32.Create; - APolygon.Antialiased := AAntialiasMode <> amNone; - APolygon.AntialiasMode := AAntialiasMode; - APolygon.Closed := True; - end else begin - APolygon.NewLine; - end; - APolygon.AddPoints(AFixedPointArray[0], VPointsProcessedCount); - end; - end; -end; - function ProjectedPolygon2ArrayOfArray( const ALine: IGeometryProjectedSinglePolygon; const AMapRect: TRect; - var APointArray: TArrayOfFixedPoint -): TArrayOfArrayOfFixedPoint; + var APointArray: TArrayOfFloatPoint +): TArrayOfArrayOfFloatPoint; var VMapRect: TDoubleRect; VLocalRect: TDoubleRect; VRectWithDelta: TDoubleRect; VLineIndex: Integer; - VLines: TArrayOfArrayOfFixedPoint; + VLines: TArrayOfArrayOfFloatPoint; begin if Assigned(ALine) then begin VMapRect := DoubleRect(AMapRect); @@ -1065,103 +637,7 @@ VMapRect, APointArray ); - AppendArrayOfArrayOfFixedPoint(Result, VLines); - end; - end; - end; -end; - -procedure ProjectedPolygon2GR32Polygon( - const ALine: IGeometryProjectedSinglePolygon; - const ALocalConverter: ILocalCoordConverter; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); -var - VMapRect: TDoubleRect; - VLocalRect: TDoubleRect; - VRectWithDelta: TDoubleRect; - VLineIndex: Integer; -begin - if Assigned(APolygon) then begin - APolygon.Clear; - end; - - if Assigned(ALine) then begin - VMapRect := ALocalConverter.GetRectInMapPixelFloat; - if IsIntersecProjectedRect(VMapRect, ALine.Bounds) then begin - VLocalRect := DoubleRect(ALocalConverter.GetLocalRect); - VRectWithDelta.Left := VLocalRect.Left - 10; - VRectWithDelta.Top := VLocalRect.Top - 10; - VRectWithDelta.Right := VLocalRect.Right + 10; - VRectWithDelta.Bottom := VLocalRect.Bottom + 10; - SingleContour2GR32Polygon( - ALine.OuterBorder, - ALocalConverter, - VRectWithDelta, - VMapRect, - AAntialiasMode, - AFixedPointArray, - APolygon - ); - for VLineIndex := 0 to ALine.HoleCount - 1 do begin - SingleContour2GR32Polygon( - ALine.HoleBorder[VLineIndex], - ALocalConverter, - VRectWithDelta, - VMapRect, - AAntialiasMode, - AFixedPointArray, - APolygon - ); - end; - end; - end; -end; - -procedure ProjectedPolygon2GR32Polygon( - const ALine: IGeometryProjectedSinglePolygon; - const AMapRect: TRect; - const AAntialiasMode: TAntialiasMode; - var AFixedPointArray: TArrayOfFixedPoint; - var APolygon: TPolygon32 -); overload; -var - VMapRect: TDoubleRect; - VLocalRect: TDoubleRect; - VRectWithDelta: TDoubleRect; - VLineIndex: Integer; -begin - if Assigned(APolygon) then begin - APolygon.Clear; - end; - - if Assigned(ALine) then begin - VMapRect := DoubleRect(AMapRect); - if IsIntersecProjectedRect(VMapRect, ALine.Bounds) then begin - VLocalRect := DoubleRect(0, 0, VMapRect.Right - VMapRect.Left, VMapRect.Bottom - VMapRect.Top); - VRectWithDelta.Left := VLocalRect.Left - 10; - VRectWithDelta.Top := VLocalRect.Top - 10; - VRectWithDelta.Right := VLocalRect.Right + 10; - VRectWithDelta.Bottom := VLocalRect.Bottom + 10; - SingleContour2GR32Polygon( - ALine.OuterBorder, - VRectWithDelta, - VMapRect, - AAntialiasMode, - AFixedPointArray, - APolygon - ); - for VLineIndex := 0 to ALine.HoleCount - 1 do begin - SingleContour2GR32Polygon( - ALine.HoleBorder[VLineIndex], - VRectWithDelta, - VMapRect, - AAntialiasMode, - AFixedPointArray, - APolygon - ); + AppendArrayOfArrayOfFloatPoint(Result, VLines); end; end; end; diff -r bf461203504c -r f323278af2ff Src/MapLayers/WindowLayers/GPSMarker/u_MapLayerGPSMarkerRings.pas --- a/Src/MapLayers/WindowLayers/GPSMarker/u_MapLayerGPSMarkerRings.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/MapLayers/WindowLayers/GPSMarker/u_MapLayerGPSMarkerRings.pas Sun Dec 08 19:07:06 2019 +0200 @@ -289,7 +289,6 @@ TProjectedDrawableElementByPolygonSimpleEdge.Create( ALocalConverter.Projection, VCirclesProjected, - amNone, clRed32 ); end; diff -r bf461203504c -r f323278af2ff Src/MapLayers/WindowLayers/GPSMarker/u_ProjectedDrawableElementByPolygon.pas --- a/Src/MapLayers/WindowLayers/GPSMarker/u_ProjectedDrawableElementByPolygon.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/MapLayers/WindowLayers/GPSMarker/u_ProjectedDrawableElementByPolygon.pas Sun Dec 08 19:07:06 2019 +0200 @@ -39,7 +39,6 @@ FProjection: IProjection; FSource: IGeometryProjectedPolygon; FColor: TColor32; - FAntialiasMode: TAntialiasMode; private function GetProjection: IProjection; procedure Draw( @@ -50,27 +49,26 @@ constructor Create( const AProjection: IProjection; const ASource: IGeometryProjectedPolygon; - const AAntialiasMode: TAntialiasMode; const AColor: TColor32 ); end; TDrawableBaseByPoints = class(TBaseInterfacedObject) private - FPoints: TArrayOfArrayOfFixedPoint; + FPoints: TArrayOfArrayOfFloatPoint; FProjection: IProjection; FBaseRelativeRect: TDoubleRect; FCachedForLocalCoordConverter: ILocalCoordConverter; - FCachedPoints: TArrayOfArrayOfFixedPoint; + FCachedPoints: TArrayOfArrayOfFloatPoint; protected function GetProjection: IProjection; - function PreparePoints(const ALocalCoordConverter: ILocalCoordConverter): TArrayOfArrayOfFixedPoint; + function PreparePoints(const ALocalCoordConverter: ILocalCoordConverter): TArrayOfArrayOfFloatPoint; public constructor Create( const AProjection: IProjection; const AMapPixelAtLocalZero: TPoint; - APoints: TArrayOfArrayOfFixedPoint + APoints: TArrayOfArrayOfFloatPoint ); end; @@ -87,7 +85,7 @@ constructor Create( const AProjection: IProjection; const AMapPixelAtLocalZero: TPoint; - APoints: TArrayOfArrayOfFixedPoint; + APoints: TArrayOfArrayOfFloatPoint; const AClosed: Boolean; const AColor: TColor32 ); @@ -105,7 +103,7 @@ constructor Create( const AProjection: IProjection; const AMapPixelAtLocalZero: TPoint; - APoints: TArrayOfArrayOfFixedPoint; + APoints: TArrayOfArrayOfFloatPoint; const AColor: TColor32 ); end; @@ -132,6 +130,7 @@ uses SysUtils, GR32_Math, + GR32_VectorUtils, u_GeometryFunc, u_GeoFunc; @@ -140,7 +139,6 @@ constructor TProjectedDrawableElementByPolygonSimpleEdge.Create( const AProjection: IProjection; const ASource: IGeometryProjectedPolygon; - const AAntialiasMode: TAntialiasMode; const AColor: TColor32 ); begin @@ -148,7 +146,6 @@ inherited Create; FProjection := AProjection; FSource := ASource; - FAntialiasMode := AAntialiasMode; FColor := AColor; end; @@ -158,8 +155,8 @@ ); var VDrawRect: TDoubleRect; - VPolygon: TPolygon32; - VPathFixedPoints: TArrayOfFixedPoint; + VPolygon: TArrayOfArrayOfFloatPoint; + VPathPoints: TArrayOfFloatPoint; VIntersectRect: TDoubleRect; i: integer; VProjectedMultiLine: IGeometryProjectedMultiPolygon; @@ -168,39 +165,19 @@ VDrawRect := ALocalConverter.LocalRect2MapRectFloat(ABitmap.ClipRect); if IntersecProjectedRect(VIntersectRect, VDrawRect, FSource.Bounds) then begin if DoubleRectsEqual(VIntersectRect, FSource.Bounds) or FSource.IsRectIntersectBorder(VDrawRect) then begin - VPolygon := TPolygon32.Create; - try - VPolygon.Closed := True; - if Supports(FSource, IGeometryProjectedSinglePolygon, VProjectedSingleLine) then begin - ProjectedPolygon2GR32Polygon( - VProjectedSingleLine, - ALocalConverter, - am4times, - VPathFixedPoints, - VPolygon - ); + if Supports(FSource, IGeometryProjectedSinglePolygon, VProjectedSingleLine) then begin + VPolygon := ProjectedPolygon2ArrayOfArray(VProjectedSingleLine, ALocalConverter.GetRectInMapPixel, VPathPoints); + if Assigned(VPolygon) then begin + PolyPolylineFS(ABitmap, VPolygon, FColor, True); + end; + end else if Supports(FSource, IGeometryProjectedMultiPolygon, VProjectedMultiLine) then begin + for i := 0 to VProjectedMultiLine.Count - 1 do begin + VProjectedSingleLine := VProjectedMultiLine.Item[i]; + VPolygon := ProjectedPolygon2ArrayOfArray(VProjectedSingleLine, ALocalConverter.GetRectInMapPixel, VPathPoints); if Assigned(VPolygon) then begin - VPolygon.DrawEdge(ABitmap, FColor); - end; - end else if Supports(FSource, IGeometryProjectedMultiPolygon, VProjectedMultiLine) then begin - for i := 0 to VProjectedMultiLine.Count - 1 do begin - VProjectedSingleLine := VProjectedMultiLine.Item[i]; - ProjectedPolygon2GR32Polygon( - VProjectedSingleLine, - ALocalConverter, - am4times, - VPathFixedPoints, - VPolygon - ); - if Assigned(VPolygon) then begin - VPolygon.DrawEdge(ABitmap, FColor); - end; + PolyPolylineFS(ABitmap, VPolygon, FColor, True); end; end; - - VPathFixedPoints := nil; - finally - VPolygon.Free; end; end; end; @@ -211,63 +188,12 @@ Result := FProjection; end; -// Scales to a polygon (TArrayOfFixedPoint) -function ScalePolygon(const Points: TArrayOfFixedPoint; ScaleX, ScaleY: TFixed): TArrayOfFixedPoint; -var - I, L: Integer; -begin - L := Length(Points); - SetLength(Result, L); - for I := 0 to L - 1 do - begin - Result[I].X := FixedMul(Points[I].X, ScaleX); - Result[I].Y := FixedMul(Points[I].Y, ScaleY); - end; -end; - -// Scales all sub polygons in a complex polygon (TArrayOfArrayOfFixedPoint) -function ScalePolyPolygon(const Points: TArrayOfArrayOfFixedPoint; - ScaleX, ScaleY: TFixed): TArrayOfArrayOfFixedPoint; -var - I, L: Integer; -begin - L := Length(Points); - SetLength(Result, L); - for I := 0 to L - 1 do - Result[I] := ScalePolygon(Points[I], ScaleX, ScaleY); -end; -// Translates a polygon (TArrayOfFixedPoint) -function TranslatePolygon(const Points: TArrayOfFixedPoint; - OffsetX, OffsetY: TFixed): TArrayOfFixedPoint; -var - I, Len: Integer; -begin - Len := Length(Points); - SetLength(Result, Len); - for I := 0 to Len - 1 do - begin - Result[I].X := Points[I].X + OffsetX; - Result[I].Y := Points[I].Y + OffsetY; - end; -end; -// Translates all sub polygons in a complex polygon (TArrayOfArrayOfFixedPoint) -function TranslatePolyPolygon(const Points: TArrayOfArrayOfFixedPoint; - OffsetX, OffsetY: TFixed): TArrayOfArrayOfFixedPoint; -var - I, L: Integer; -begin - L := Length(Points); - SetLength(Result, L); - for I := 0 to L - 1 do - Result[I] := TranslatePolygon(Points[I], OffsetX, OffsetY); -end; - { TDrawableBaseByPoints } constructor TDrawableBaseByPoints.Create( const AProjection: IProjection; const AMapPixelAtLocalZero: TPoint; - APoints: TArrayOfArrayOfFixedPoint + APoints: TArrayOfArrayOfFloatPoint ); begin Assert(Assigned(AProjection)); @@ -285,7 +211,7 @@ function TDrawableBaseByPoints.PreparePoints( const ALocalCoordConverter: ILocalCoordConverter -): TArrayOfArrayOfFixedPoint; +): TArrayOfArrayOfFloatPoint; var VTranslateDelta: TDoublePoint; VTargetRect: TDoubleRect; @@ -302,12 +228,12 @@ VTargetRect := ALocalCoordConverter.MapRectFloat2LocalRectFloat(ALocalCoordConverter.Projection.RelativeRect2PixelRectFloat(FBaseRelativeRect)); VScale := RectSize(VTargetRect); if (VScale.X <> 1.0) or (VScale.Y <> 1.0) then begin - FCachedPoints := ScalePolyPolygon(FCachedPoints, Fixed(VScale.X), Fixed(VScale.Y)); + FCachedPoints := ScalePolyPolygon(FCachedPoints, VScale.X, VScale.Y); end; VTranslateDelta := VTargetRect.TopLeft; if (Abs(VTranslateDelta.X) > 0.0001) or (Abs(VTranslateDelta.Y) > 0.0001) then begin - FCachedPoints := TranslatePolyPolygon(FCachedPoints, Fixed(VTranslateDelta.X), Fixed(VTranslateDelta.Y)); + FCachedPoints := TranslatePolyPolygon(FCachedPoints, VTranslateDelta.X, VTranslateDelta.Y); end; FCachedForLocalCoordConverter := ALocalCoordConverter; Result := FCachedPoints; @@ -318,7 +244,7 @@ constructor TDrawableSimpleLine.Create( const AProjection: IProjection; const AMapPixelAtLocalZero: TPoint; - APoints: TArrayOfArrayOfFixedPoint; + APoints: TArrayOfArrayOfFloatPoint; const AClosed: Boolean; const AColor: TColor32 ); @@ -333,10 +259,10 @@ const ALocalCoordConverter: ILocalCoordConverter ); var - VPoints: TArrayOfArrayOfFixedPoint; + VPoints: TArrayOfArrayOfFloatPoint; begin VPoints := PreparePoints(ALocalCoordConverter); - PolyPolylineXS(ABitmap, VPoints, FColor, FClosed); + PolyPolylineFS(ABitmap, VPoints, FColor, FClosed); end; { TDrawablePolygonFill } @@ -344,7 +270,7 @@ constructor TDrawablePolygonFill.Create( const AProjection: IProjection; const AMapPixelAtLocalZero: TPoint; - APoints: TArrayOfArrayOfFixedPoint; + APoints: TArrayOfArrayOfFloatPoint; const AColor: TColor32 ); begin @@ -357,10 +283,10 @@ const ALocalCoordConverter: ILocalCoordConverter ); var - VPoints: TArrayOfArrayOfFixedPoint; + VPoints: TArrayOfArrayOfFloatPoint; begin VPoints := PreparePoints(ALocalCoordConverter); - PolyPolygonXS(ABitmap, VPoints, FColor, pfWinding, am4times); + PolyPolygonFS(ABitmap, VPoints, FColor, pfWinding); end; { TDrawableByList } diff -r bf461203504c -r f323278af2ff Src/MapLayers/WindowLayers/Polygon/u_MapLayerSingleGeometry.pas --- a/Src/MapLayers/WindowLayers/Polygon/u_MapLayerSingleGeometry.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/MapLayers/WindowLayers/Polygon/u_MapLayerSingleGeometry.pas Sun Dec 08 19:07:06 2019 +0200 @@ -153,6 +153,7 @@ uses Types, SysUtils, + GR32_VectorUtils, i_InterfaceListSimple, u_SimpleFlagWithInterlock, u_InterfaceListSimple, @@ -350,8 +351,8 @@ var VLonLatLine: IGeometryLonLatLine; VProjectedLine: IGeometryProjectedLine; - VPathPoints: TArrayOfFixedPoint; - VPolygon: TArrayOfArrayOfFixedPoint; + VPathPoints: TArrayOfFloatPoint; + VPolygon: TArrayOfArrayOfFloatPoint; begin Result := nil; if (AlphaComponent(FLineColor) = 0) or (FLineWidth < 1) then begin @@ -430,8 +431,8 @@ var ADrawableList: IInterfaceListSimple ); var - VPathPoints: TArrayOfFixedPoint; - VPolygon: TArrayOfArrayOfFixedPoint; + VPathPoints: TArrayOfFloatPoint; + VPolygon: TArrayOfArrayOfFloatPoint; VFill: IProjectedDrawableElement; VBorder: IProjectedDrawableElement; begin diff -r bf461203504c -r f323278af2ff Src/MapLayers/WindowLayers/SunCalc/i_SunCalcShapesGenerator.pas --- a/Src/MapLayers/WindowLayers/SunCalc/i_SunCalcShapesGenerator.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/MapLayers/WindowLayers/SunCalc/i_SunCalcShapesGenerator.pas Sun Dec 08 19:07:06 2019 +0200 @@ -48,25 +48,25 @@ ); procedure GetCirclePoints( - out ACirclePoints: TArrayOfFixedPoint + out ACirclePoints: TArrayOfFloatPoint ); procedure GetMinMaxAltitudePoints( - out AMinAltitudePoints: TArrayOfFixedPoint; - out AMaxAltitudePoints: TArrayOfFixedPoint; - out AMinMaxAltitudePolygon: TArrayOfFixedPoint + out AMinAltitudePoints: TArrayOfFloatPoint; + out AMaxAltitudePoints: TArrayOfFloatPoint; + out AMinMaxAltitudePolygon: TArrayOfFloatPoint ); procedure GetDayInfoPoints( - out ADayPoints: TArrayOfArrayOfFixedPoint; - out ARise: TFixedPoint; - out ASet: TFixedPoint; - out ACenter: TFixedPoint + out ADayPoints: TArrayOfArrayOfFloatPoint; + out ARise: TFloatPoint; + out ASet: TFloatPoint; + out ACenter: TFloatPoint ); procedure GetTimeInfoPoints( - out APos: TFixedPoint; - out ACenter: TFixedPoint + out APos: TFloatPoint; + out ACenter: TFloatPoint ); end; diff -r bf461203504c -r f323278af2ff Src/MapLayers/WindowLayers/SunCalc/u_SunCalcDrawTools.pas --- a/Src/MapLayers/WindowLayers/SunCalc/u_SunCalcDrawTools.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/MapLayers/WindowLayers/SunCalc/u_SunCalcDrawTools.pas Sun Dec 08 19:07:06 2019 +0200 @@ -27,14 +27,14 @@ procedure ThickLine( ABitmap: TBitmap32; - const AStart, AEnd: TFixedPoint; + const AStart, AEnd: TFloatPoint; const AColor: TColor32; const AWidth: Integer ); procedure ThickPolyLine( ABitmap: TBitmap32; - const APoints: TArrayOfFixedPoint; + const APoints: TArrayOfFloatPoint; const AColor: TColor32 ); @@ -50,86 +50,44 @@ procedure ThickLine( ABitmap: TBitmap32; - const AStart, AEnd: TFixedPoint; + const AStart, AEnd: TFloatPoint; const AColor: TColor32; const AWidth: Integer ); var I: Integer; P1, P2: TPoint; - VPolygon: TPolygon32; + VPolygon: TArrayOfFloatPoint; begin I := AWidth div 2; P1 := GR32.Point(AStart); P2 := GR32.Point(AEnd); - VPolygon := TPolygon32.Create; - try - VPolygon.Add(FixedPoint(P1.X - I, P1.Y)); - VPolygon.Add(FixedPoint(P1.X + I, P1.Y)); - VPolygon.Add(FixedPoint(P2.X + I, P2.Y)); - VPolygon.Add(FixedPoint(P2.X - I, P2.Y)); + SetLength(VPolygon, 4); - if GUsePolygonAntiAliasing then begin - try - PolyPolygonXS(ABitmap, VPolygon.Points, AColor); - except - GUsePolygonAntiAliasing := False; - end; - end else begin - PolyPolygonTS(ABitmap, VPolygon.Points, AColor); - end; + VPolygon[0] := FloatPoint(P1.X - I, P1.Y); + VPolygon[1] := FloatPoint(P1.X + I, P1.Y); + VPolygon[2] := FloatPoint(P2.X + I, P2.Y); + VPolygon[3] := FloatPoint(P2.X - I, P2.Y); - VPolygon.Clear; - - VPolygon.Add(FixedPoint(P1.X, P1.Y + I)); - VPolygon.Add(FixedPoint(P1.X, P1.Y - I)); - VPolygon.Add(FixedPoint(P2.X, P2.Y - I)); - VPolygon.Add(FixedPoint(P2.X, P2.Y + I)); + PolygonFS(ABitmap, VPolygon, AColor); - if GUsePolygonAntiAliasing then begin - try - PolyPolygonXS(ABitmap, VPolygon.Points, AColor); - except - GUsePolygonAntiAliasing := False; - end; - end else begin - PolyPolygonTS(ABitmap, VPolygon.Points, AColor); - end; - finally - VPolygon.Free; - end; + VPolygon[0] := FloatPoint(P1.X, P1.Y + I); + VPolygon[1] := FloatPoint(P1.X, P1.Y - I); + VPolygon[2] := FloatPoint(P2.X, P2.Y - I); + VPolygon[3] := FloatPoint(P2.X, P2.Y + I); + + PolygonFS(ABitmap, VPolygon, AColor); end; procedure ThickPolyLine( ABitmap: TBitmap32; - const APoints: TArrayOfFixedPoint; + const APoints: TArrayOfFloatPoint; const AColor: TColor32 ); -var - I: Integer; - VPolygon, VTmp: TPolygon32; begin - VPolygon := TPolygon32.Create; - try - VPolygon.Closed := False; - VPolygon.AddPoints(APoints[0], Length(APoints)); - for I := -2 to 1 do begin - if I = 0 then begin - PolylineXS(ABitmap, APoints, AColor, False); - end else begin - VTmp := VPolygon.Grow(Fixed(I)); - try - PolyPolyLineXS(ABitmap, VTmp.Points, AColor, False); - finally - VTmp.Free; - end; - end; - end; - finally - VPolygon.Free; - end; + PolylineFS(ABitmap, APoints, AColor, False, 4); end; end. diff -r bf461203504c -r f323278af2ff Src/MapLayers/WindowLayers/SunCalc/u_SunCalcShapesGenerator.pas --- a/Src/MapLayers/WindowLayers/SunCalc/u_SunCalcShapesGenerator.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/MapLayers/WindowLayers/SunCalc/u_SunCalcShapesGenerator.pas Sun Dec 08 19:07:06 2019 +0200 @@ -47,22 +47,22 @@ FEndOfTheDay: TDateTime; FDataProvider: ISunCalcDataProvider; - FCirclePoints: TArrayOfFixedPoint; + FCirclePoints: TArrayOfFloatPoint; FIsCirclePointsValid: Boolean; FMinAltitude: Double; - FMaxAltitudeDayPoints: TArrayOfFixedPoint; - FMinAltitudeDayPoints: TArrayOfFixedPoint; - FMinMaxAltitudePoly: TArrayOfFixedPoint; + FMaxAltitudeDayPoints: TArrayOfFloatPoint; + FMinAltitudeDayPoints: TArrayOfFloatPoint; + FMinMaxAltitudePoly: TArrayOfFloatPoint; FIsAltitudePointsValid: Boolean; - FDayPoints: TArrayOfArrayOfFixedPoint; - FRisePoint: TFixedPoint; - FSetPoint: TFixedPoint; + FDayPoints: TArrayOfArrayOfFloatPoint; + FRisePoint: TFloatPoint; + FSetPoint: TFloatPoint; FIsDayInfoPointsValid: Boolean; - FCurrentPos: TFixedPoint; + FCurrentPos: TFloatPoint; FIsCurrentPosValid: Boolean; FLocalCoordConverter: ILocalCoordConverterChangeable; @@ -73,12 +73,12 @@ function GetPointPosition( const ADate: TDateTime; out AAltitude: Double - ): TFixedPoint; inline; + ): TFloatPoint; inline; function GenerateCurvePoints( const AStartOfTheDay: TDateTime; const AEndOfTheDay: TDateTime - ): TArrayOfArrayOfFixedPoint; + ): TArrayOfArrayOfFloatPoint; procedure UpdateMinAltitude( const AStartOfTheDay: TDateTime; @@ -103,25 +103,25 @@ ); procedure GetCirclePoints( - out ACirclePoints: TArrayOfFixedPoint + out ACirclePoints: TArrayOfFloatPoint ); procedure GetMinMaxAltitudePoints( - out AMinAltitudePoints: TArrayOfFixedPoint; - out AMaxAltitudePoints: TArrayOfFixedPoint; - out AMinMaxAltitudePolygon: TArrayOfFixedPoint + out AMinAltitudePoints: TArrayOfFloatPoint; + out AMaxAltitudePoints: TArrayOfFloatPoint; + out AMinMaxAltitudePolygon: TArrayOfFloatPoint ); procedure GetDayInfoPoints( - out ADayPoints: TArrayOfArrayOfFixedPoint; - out ARise: TFixedPoint; - out ASet: TFixedPoint; - out ACenter: TFixedPoint + out ADayPoints: TArrayOfArrayOfFloatPoint; + out ARise: TFloatPoint; + out ASet: TFloatPoint; + out ACenter: TFloatPoint ); procedure GetTimeInfoPoints( - out APos: TFixedPoint; - out ACenter: TFixedPoint + out APos: TFloatPoint; + out ACenter: TFloatPoint ); public constructor Create( @@ -178,7 +178,7 @@ function GenerateCircle( const ACenter: TFloatPoint; const ARadius: TFloat -): TArrayOfFixedPoint; +): TArrayOfFloatPoint; const cSteps: Integer = 72; var @@ -190,8 +190,8 @@ M := 2 * System.Pi / cSteps; // first item - Result[0].X := Fixed(ARadius + ACenter.X); - Result[0].Y := Fixed(ACenter.Y); + Result[0].X := ARadius + ACenter.X; + Result[0].Y := ACenter.Y; // calculate complex offset GR32_Math.SinCos(M, C.Y, C.X); @@ -199,20 +199,20 @@ D.Y := ARadius * C.Y; // second item - Result[1].X := Fixed(D.X + ACenter.X); - Result[1].Y := Fixed(D.Y + ACenter.Y); + Result[1].X := D.X + ACenter.X; + Result[1].Y := D.Y + ACenter.Y; // other items for I := 2 to cSteps - 1 do begin D := FloatPoint(D.X * C.X - D.Y * C.Y, D.Y * C.X + D.X * C.Y); - Result[I].X := Fixed(D.X + ACenter.X); - Result[I].Y := Fixed(D.Y + ACenter.Y); + Result[I].X := D.X + ACenter.X; + Result[I].Y := D.Y + ACenter.Y; end; end; procedure TSunCalcShapesGenerator.GetCirclePoints( - out ACirclePoints: TArrayOfFixedPoint + out ACirclePoints: TArrayOfFloatPoint ); begin if not IsValidSate then begin @@ -232,7 +232,7 @@ function TSunCalcShapesGenerator.GetPointPosition( const ADate: TDateTime; out AAltitude: Double -): TFixedPoint; +): TFloatPoint; var VPos: TSunCalcProviderPosition; VAngle: Double; @@ -240,23 +240,23 @@ begin if ADate = 0 then begin AAltitude := 0; - Result := FixedPoint(0, 0); + Result := FloatPoint(0, 0); Exit; end; VPos := FDataProvider.GetPosition(ADate, FLocation); VAngle := Pi / 2 + VPos.Azimuth; R := FRadius * Cos(VPos.Altitude); AAltitude := VPos.Altitude; - Result.X := Fixed(FCenter.X + R * Cos(VAngle)); - Result.Y := Fixed(FCenter.Y + R * Sin(VAngle)); + Result.X := FCenter.X + R * Cos(VAngle); + Result.Y := FCenter.Y + R * Sin(VAngle); end; function TSunCalcShapesGenerator.GenerateCurvePoints( const AStartOfTheDay: TDateTime; const AEndOfTheDay: TDateTime -): TArrayOfArrayOfFixedPoint; +): TArrayOfArrayOfFloatPoint; - function GetInterval(const AStart, AEnd: TDateTime): TArrayOfFixedPoint; + function GetInterval(const AStart, AEnd: TDateTime): TArrayOfFloatPoint; const cStep = 20; // minutes var @@ -347,9 +347,9 @@ function GenerateCircleSegment( const ACenter: TFloatPoint; const ARadius: Integer; - const AStart: TFixedPoint; - const AEnd: TFixedPoint -): TArrayOfFixedPoint; + const AStart: TFloatPoint; + const AEnd: TFloatPoint +): TArrayOfFloatPoint; const cStep: Double = 0.0873; // 5 degree var @@ -361,8 +361,8 @@ begin P := ACenter; - P1 := FloatPoint(AStart); - P2 := FloatPoint(AEnd); + P1 := AStart; + P2 := AEnd; A1 := ArcTan2(-(P1.Y - P.Y), P1.X - P.X); A2 := ArcTan2(-(P2.Y - P.Y), P2.X - P.X); @@ -379,28 +379,28 @@ D.X := P1.X - P.X; D.Y := P1.Y - P.Y; - Result[0].X := Fixed(D.X + P.X); - Result[0].Y := Fixed(D.Y + P.Y); + Result[0].X := D.X + P.X; + Result[0].Y := D.Y + P.Y; for I := 1 to VSteps - 1 do begin D := FloatPoint(D.X * C.X - D.Y * C.Y, D.Y * C.X + D.X * C.Y); - Result[I].X := Fixed(D.X + P.X); - Result[I].Y := Fixed(D.Y + P.Y); + Result[I].X := D.X + P.X; + Result[I].Y := D.Y + P.Y; end; end; procedure TSunCalcShapesGenerator.GetMinMaxAltitudePoints( - out AMinAltitudePoints: TArrayOfFixedPoint; - out AMaxAltitudePoints: TArrayOfFixedPoint; - out AMinMaxAltitudePolygon: TArrayOfFixedPoint + out AMinAltitudePoints: TArrayOfFloatPoint; + out AMaxAltitudePoints: TArrayOfFloatPoint; + out AMinMaxAltitudePolygon: TArrayOfFloatPoint ); var I, J: Integer; VDay: TDateTime; - VPoints: TArrayOfArrayOfFixedPoint; + VPoints: TArrayOfArrayOfFloatPoint; VLen1, VLen2, VLen3, VLen4: Integer; - VSeg1, VSeg2: TArrayOfFixedPoint; + VSeg1, VSeg2: TArrayOfFloatPoint; begin if not IsValidSate then begin SetLength(AMinAltitudePoints, 0); @@ -454,7 +454,7 @@ SetLength(FMinMaxAltitudePoly, VLen1 + VLen2 + VLen3 + VLen4); - Move(FMaxAltitudeDayPoints[0], FMinMaxAltitudePoly[0], VLen1 * SizeOf(TFixedPoint)); + Move(FMaxAltitudeDayPoints[0], FMinMaxAltitudePoly[0], VLen1 * SizeOf(TFloatPoint)); J := VLen1; @@ -485,19 +485,19 @@ end; procedure TSunCalcShapesGenerator.GetDayInfoPoints( - out ADayPoints: TArrayOfArrayOfFixedPoint; - out ARise, ASet, ACenter: TFixedPoint + out ADayPoints: TArrayOfArrayOfFloatPoint; + out ARise, ASet, ACenter: TFloatPoint ); var VTimes: TSunCalcProviderTimes; VAltitude: Double; begin - ACenter := FixedPoint(FCenter); + ACenter := FCenter; if not IsValidSate then begin SetLength(ADayPoints, 0); - ARise := FixedPoint(0, 0); - ASet := FixedPoint(0, 0); + ARise := FloatPoint(0, 0); + ASet := FloatPoint(0, 0); Exit; end; @@ -517,14 +517,14 @@ end; procedure TSunCalcShapesGenerator.GetTimeInfoPoints( - out APos, ACenter: TFixedPoint + out APos, ACenter: TFloatPoint ); var VAltitude: Double; begin if not IsValidSate then begin - APos := FixedPoint(0, 0); - ACenter := FixedPoint(0, 0); + APos := FloatPoint(0, 0); + ACenter := FloatPoint(0, 0); Exit; end; @@ -536,7 +536,7 @@ if VAltitude < FMinAltitude then begin UpdateMinAltitude(FStartOfTheDay, FEndOfTheDay); if VAltitude < FMinAltitude then begin - FCurrentPos := FixedPoint(0, 0); + FCurrentPos := FloatPoint(0, 0); end; end; @@ -544,7 +544,7 @@ end; APos := FCurrentPos; - ACenter := FixedPoint(FCenter); + ACenter := FCenter; end; procedure TSunCalcShapesGenerator.UpdateMinAltitude( @@ -553,7 +553,7 @@ ); var VAlt: Double; - VPoint: TFixedPoint; + VPoint: TFloatPoint; VTimes: TSunCalcProviderTimes; begin FMinAltitude := 0; diff -r bf461203504c -r f323278af2ff Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcDayInfo.pas --- a/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcDayInfo.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcDayInfo.pas Sun Dec 08 19:07:06 2019 +0200 @@ -52,10 +52,10 @@ procedure TWindowLayerSunCalcDayInfo.PaintLayer(ABuffer: TBitmap32); var I: Integer; - VDayPoints: TArrayOfArrayOfFixedPoint; - VRisePoint: TFixedPoint; - VSetPoint: TFixedPoint; - VCenter: TFixedPoint; + VDayPoints: TArrayOfArrayOfFloatPoint; + VRisePoint: TFloatPoint; + VSetPoint: TFloatPoint; + VCenter: TFloatPoint; begin if not FShapesGenerator.IsIntersectScreenRect then begin Exit; diff -r bf461203504c -r f323278af2ff Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcTimeInfo.pas --- a/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcTimeInfo.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcTimeInfo.pas Sun Dec 08 19:07:06 2019 +0200 @@ -128,8 +128,8 @@ procedure TWindowLayerSunCalcTimeInfo.PaintLayer(ABuffer: TBitmap32); var - VCenter: TFixedPoint; - VCurrentPos: TFixedPoint; + VCenter: TFloatPoint; + VCurrentPos: TFloatPoint; begin if not FShapesGenerator.IsIntersectScreenRect then begin Exit; diff -r bf461203504c -r f323278af2ff Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcYearInfo.pas --- a/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcYearInfo.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcYearInfo.pas Sun Dec 08 19:07:06 2019 +0200 @@ -52,7 +52,7 @@ procedure TWindowLayerSunCalcYearInfo.PaintLayer(ABuffer: TBitmap32); var - VCircle, VMaxAlt, VMinAlt, VPoly: TArrayOfFixedPoint; + VCircle, VMaxAlt, VMinAlt, VPoly: TArrayOfFloatPoint; begin if not FShapesGenerator.IsIntersectScreenRect then begin Exit; @@ -65,23 +65,23 @@ // Background circle FShapesGenerator.GetCirclePoints(VCircle); if Length(VCircle) > 0 then begin - PolylineXS(ABuffer, VCircle, FShapesColors.YearCircleColor, True); + PolylineFS(ABuffer, VCircle, FShapesColors.YearCircleColor, True); end; // Min/Max altitude FShapesGenerator.GetMinMaxAltitudePoints(VMinAlt, VMaxAlt, VPoly); if Length(VMinAlt) > 0 then begin - PolylineXS(ABuffer, VMinAlt, FShapesColors.YearPolyLinesColor, False); + PolylineFS(ABuffer, VMinAlt, FShapesColors.YearPolyLinesColor, False); end; if Length(VMaxAlt) > 0 then begin - PolylineXS(ABuffer, VMaxAlt, FShapesColors.YearPolyLinesColor, False); + PolylineFS(ABuffer, VMaxAlt, FShapesColors.YearPolyLinesColor, False); end; // Draw transparent polygon betwen min and max altitude curves if Length(VPoly) > 0 then begin - PolygonTS(ABuffer, VPoly, FShapesColors.YearPolygonFillColor); + PolygonFS(ABuffer, VPoly, FShapesColors.YearPolygonFillColor); end; finally diff -r bf461203504c -r f323278af2ff Src/Marker/u_MarkerDrawableSimpleArrow.pas --- a/Src/Marker/u_MarkerDrawableSimpleArrow.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/Marker/u_MarkerDrawableSimpleArrow.pas Sun Dec 08 19:07:06 2019 +0200 @@ -54,7 +54,7 @@ const AAngle: Double ): Boolean; var - VPolygon: TPolygon32; + VPolygon: TArrayOfFloatPoint; VTransform: TAffineTransformation; VHalfSize: Double; VWidth: Double; @@ -82,20 +82,12 @@ VTransform := TAffineTransformation.Create; try VTransform.Rotate(APosition.X, APosition.Y, -AAngle); - VPolygon := TPolygon32.Create; - try - VPolygon.Closed := True; - VPolygon.Antialiased := true; - VPolygon.AntialiasMode := am2times; - VPolygon.Add(VTransform.Transform(FixedPoint(APosition.X, APosition.Y - VHalfSize))); - VPolygon.Add(VTransform.Transform(FixedPoint(APosition.X - VWidth, APosition.Y + VHalfSize))); - VPolygon.Add(VTransform.Transform(FixedPoint(APosition.X + VWidth, APosition.Y + VHalfSize))); - - VPolygon.DrawFill(ABitmap, Config.MarkerColor); - VPolygon.DrawEdge(ABitmap, Config.BorderColor); - finally - VPolygon.Free; - end; + SetLength(VPolygon, 3); + VPolygon[0] := VTransform.Transform(FloatPoint(APosition.X, APosition.Y - VHalfSize)); + VPolygon[1] := VTransform.Transform(FloatPoint(APosition.X - VWidth, APosition.Y + VHalfSize)); + VPolygon[2] := VTransform.Transform(FloatPoint(APosition.X + VWidth, APosition.Y + VHalfSize)); + PolygonFS(ABitmap, VPolygon, Config.MarkerColor); + PolylineFS(ABitmap, VPolygon, Config.BorderColor, True); finally VTransform.Free; end; diff -r bf461203504c -r f323278af2ff Src/Marker/u_MarkerDrawableSimpleCircle.pas --- a/Src/Marker/u_MarkerDrawableSimpleCircle.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/Marker/u_MarkerDrawableSimpleCircle.pas Sun Dec 08 19:07:06 2019 +0200 @@ -57,7 +57,7 @@ function GenerateCirclePoints( const ACenter: TFloatPoint; const ARadius: TFloat -): TArrayOfFixedPoint; +): TArrayOfFloatPoint; var I: Integer; M: TFloat; @@ -70,8 +70,8 @@ M := 2 * System.Pi / VSteps; // first item - Result[0].X := Fixed(ARadius + ACenter.X); - Result[0].Y := Fixed(ACenter.Y); + Result[0].X := ARadius + ACenter.X; + Result[0].Y := ACenter.Y; // calculate complex offset GR32_Math.SinCos(M, C.Y, C.X); @@ -79,15 +79,15 @@ D.Y := ARadius * C.Y; // second item - Result[1].X := Fixed(D.X + ACenter.X); - Result[1].Y := Fixed(D.Y + ACenter.Y); + Result[1].X := D.X + ACenter.X; + Result[1].Y := D.Y + ACenter.Y; // other items for I := 2 to VSteps - 1 do begin D := FloatPoint(D.X * C.X - D.Y * C.Y, D.Y * C.X + D.X * C.Y); - Result[I].X := Fixed(D.X + ACenter.X); - Result[I].Y := Fixed(D.Y + ACenter.Y); + Result[I].X := D.X + ACenter.X; + Result[I].Y := D.Y + ACenter.Y; end; end; @@ -102,7 +102,7 @@ VDoubleRect: TDoubleRect; VRect: TRect; VTargetRect: TRect; - VCirclePoints: TArrayOfFixedPoint; + VCirclePoints: TArrayOfFloatPoint; begin VHalfSize := Config.MarkerSize / 2; VDoubleRect.Left := APosition.X - VHalfSize; @@ -124,9 +124,9 @@ VHalfSize ); if Length(VCirclePoints) > 0 then begin - PolygonTS(ABitmap, VCirclePoints, Config.MarkerColor); + PolygonFS(ABitmap, VCirclePoints, Config.MarkerColor); if Config.MarkerColor <> Config.BorderColor then begin - PolylineXS(ABitmap, VCirclePoints, Config.BorderColor, True); + PolylineFS(ABitmap, VCirclePoints, Config.BorderColor, True); end; end; end else begin diff -r bf461203504c -r f323278af2ff Src/Marker/u_MarkerDrawableSimpleCross.pas --- a/Src/Marker/u_MarkerDrawableSimpleCross.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/Marker/u_MarkerDrawableSimpleCross.pas Sun Dec 08 19:07:06 2019 +0200 @@ -54,7 +54,7 @@ var VCrossHalfWidth: Double; VHalfSize: Double; - VPolygon: TPolygon32; + VPolygon: TArrayOfFloatPoint; VTargetRect: TRect; VTargetDoubleRect: TDoubleRect; begin @@ -74,29 +74,21 @@ if not ABitmap.MeasuringMode then begin ABitmap.BeginUpdate; try - VPolygon := TPolygon32.Create; - try - VPolygon.Closed := True; - VPolygon.Antialiased := true; - VPolygon.AntialiasMode := am2times; - VPolygon.Add(FixedPoint(APosition.X - VCrossHalfWidth, APosition.Y - VHalfSize)); - VPolygon.Add(FixedPoint(APosition.X + VCrossHalfWidth, APosition.Y - VHalfSize)); - VPolygon.Add(FixedPoint(APosition.X + VCrossHalfWidth, APosition.Y - VCrossHalfWidth)); - VPolygon.Add(FixedPoint(APosition.X + VHalfSize, APosition.Y - VCrossHalfWidth)); - VPolygon.Add(FixedPoint(APosition.X + VHalfSize, APosition.Y + VCrossHalfWidth)); - VPolygon.Add(FixedPoint(APosition.X + VCrossHalfWidth, APosition.Y + VCrossHalfWidth)); - VPolygon.Add(FixedPoint(APosition.X + VCrossHalfWidth, APosition.Y + VHalfSize)); - VPolygon.Add(FixedPoint(APosition.X - VCrossHalfWidth, APosition.Y + VHalfSize)); - VPolygon.Add(FixedPoint(APosition.X - VCrossHalfWidth, APosition.Y + VCrossHalfWidth)); - VPolygon.Add(FixedPoint(APosition.X - VHalfSize, APosition.Y + VCrossHalfWidth)); - VPolygon.Add(FixedPoint(APosition.X - VHalfSize, APosition.Y - VCrossHalfWidth)); - VPolygon.Add(FixedPoint(APosition.X - VCrossHalfWidth, APosition.Y - VCrossHalfWidth)); - - VPolygon.DrawFill(ABitmap, Config.MarkerColor); - VPolygon.DrawEdge(ABitmap, Config.BorderColor); - finally - VPolygon.Free; - end; + SetLength(VPolygon, 12); + VPolygon[0] := FloatPoint(APosition.X - VCrossHalfWidth, APosition.Y - VHalfSize); + VPolygon[1] := FloatPoint(APosition.X + VCrossHalfWidth, APosition.Y - VHalfSize); + VPolygon[2] := FloatPoint(APosition.X + VCrossHalfWidth, APosition.Y - VCrossHalfWidth); + VPolygon[3] := FloatPoint(APosition.X + VHalfSize, APosition.Y - VCrossHalfWidth); + VPolygon[4] := FloatPoint(APosition.X + VHalfSize, APosition.Y + VCrossHalfWidth); + VPolygon[5] := FloatPoint(APosition.X + VCrossHalfWidth, APosition.Y + VCrossHalfWidth); + VPolygon[6] := FloatPoint(APosition.X + VCrossHalfWidth, APosition.Y + VHalfSize); + VPolygon[7] := FloatPoint(APosition.X - VCrossHalfWidth, APosition.Y + VHalfSize); + VPolygon[8] := FloatPoint(APosition.X - VCrossHalfWidth, APosition.Y + VCrossHalfWidth); + VPolygon[9] := FloatPoint(APosition.X - VHalfSize, APosition.Y + VCrossHalfWidth); + VPolygon[10] := FloatPoint(APosition.X - VHalfSize, APosition.Y - VCrossHalfWidth); + VPolygon[11] := FloatPoint(APosition.X - VCrossHalfWidth, APosition.Y - VCrossHalfWidth); + PolygonFS(ABitmap, VPolygon, Config.MarkerColor); + PolylineFS(ABitmap, VPolygon, Config.BorderColor, True); finally ABitmap.EndUpdate; end; diff -r bf461203504c -r f323278af2ff Src/TileProvider/u_VectorTileRenderer.pas --- a/Src/TileProvider/u_VectorTileRenderer.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/TileProvider/u_VectorTileRenderer.pas Sun Dec 08 19:07:06 2019 +0200 @@ -58,7 +58,7 @@ ATargetBmp: TCustomBitmap32; const AProjection: IProjection; const AMapRect: TRect; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; function DrawPoint( var ABitmapInited: Boolean; @@ -75,7 +75,7 @@ const AMapRect: TRect; const AAppearance: IAppearance; const ALine: IGeometryLonLatLine; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; function DrawPoly( var ABitmapInited: Boolean; @@ -84,7 +84,7 @@ const AMapRect: TRect; const AAppearance: IAppearance; const APoly: IGeometryLonLatPolygon; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; function DrawSinglePolygon( var ABitmapInited: Boolean; @@ -92,7 +92,7 @@ const AMapRect: TRect; const AAppearance: IAppearance; const APoly: IGeometryProjectedSinglePolygon; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; procedure InitBitmap( ATargetBmp: TCustomBitmap32; @@ -210,67 +210,30 @@ const AMapRect: TRect; const AAppearance: IAppearance; const ALine: IGeometryLonLatLine; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; var - VPolygon: TPolygon32; + VPolygon: TArrayOfArrayOfFloatPoint; VProjected: IGeometryProjectedLine; VAppearanceLine: IAppearanceLine; begin Result := False; - VPolygon := nil; VProjected := FProjectedCache.GetProjectedPath(AProjection, ALine); - ProjectedLine2GR32Polygon( - VProjected, - AMapRect, - am4times, - AFixedPointArray, - VPolygon - ); - try - if Assigned(VPolygon) then begin - if not ABitmapInited then begin - InitBitmap(ATargetBmp, Types.Point(AMapRect.Right - AMapRect.Left, AMapRect.Bottom - AMapRect.Top)); - ABitmapInited := True; - end; + VPolygon := ProjectedLine2ArrayOfArray(VProjected, AMapRect, APointArray); + if Assigned(VPolygon) then begin + if not ABitmapInited then begin + InitBitmap(ATargetBmp, Types.Point(AMapRect.Right - AMapRect.Left, AMapRect.Bottom - AMapRect.Top)); + ABitmapInited := True; + end; - if Supports(AAppearance, IAppearanceLine, VAppearanceLine) then begin - with VPolygon.Outline do begin - try - with Grow(GR32.Fixed(VAppearanceLine.LineWidth / 2), 0.5) do begin - try - FillMode := pfWinding; - DrawFill(ATargetBmp, VAppearanceLine.LineColor); - finally - free; - end; - end; - finally - free; - end; - end; - end else begin - with VPolygon.Outline do begin - try - with Grow(GR32.Fixed(0.5), 0.5) do begin - try - FillMode := pfWinding; - DrawFill(ATargetBmp, FColorBG); - finally - free; - end; - end; - finally - free; - end; - end; - VPolygon.DrawEdge(ATargetBmp, FColorMain); - end; + if Supports(AAppearance, IAppearanceLine, VAppearanceLine) then begin + PolyPolylineFS(ATargetBmp, VPolygon, VAppearanceLine.LineColor, False, VAppearanceLine.LineWidth); + end else begin + PolyPolylineFS(ATargetBmp, VPolygon, FColorBG, False, 2); + PolyPolylineFS(ATargetBmp, VPolygon, FColorMain, False, 1); + end; - Result := True; - end; - finally - VPolygon.Free; + Result := True; end; end; @@ -280,69 +243,32 @@ const AMapRect: TRect; const AAppearance: IAppearance; const APoly: IGeometryProjectedSinglePolygon; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; var - VPolygon: TPolygon32; + VPolygon: TArrayOfArrayOfFloatPoint; VAppearanceBorder: IAppearancePolygonBorder; VAppearanceFill: IAppearancePolygonFill; begin Result := False; - VPolygon := nil; - try - ProjectedPolygon2GR32Polygon( - APoly, - AMapRect, - am4times, - AFixedPointArray, - VPolygon - ); - if VPolygon <> nil then begin - if not ABitmapInited then begin - InitBitmap(ATargetBmp, Types.Point(AMapRect.Right - AMapRect.Left, AMapRect.Bottom - AMapRect.Top)); - ABitmapInited := True; + VPolygon := ProjectedPolygon2ArrayOfArray(APoly, AMapRect, APointArray); + if VPolygon <> nil then begin + if not ABitmapInited then begin + InitBitmap(ATargetBmp, Types.Point(AMapRect.Right - AMapRect.Left, AMapRect.Bottom - AMapRect.Top)); + ABitmapInited := True; + end; + if Assigned(AAppearance) then begin + if Supports(AAppearance, IAppearancePolygonFill, VAppearanceFill) then begin + PolyPolygonFS(ATargetBmp, VPolygon, VAppearanceFill.FillColor, pfWinding); end; - if Assigned(AAppearance) then begin - if Supports(AAppearance, IAppearancePolygonFill, VAppearanceFill) then begin - VPolygon.DrawFill(ATargetBmp, VAppearanceFill.FillColor); - end; - if Supports(AAppearance, IAppearancePolygonBorder, VAppearanceBorder) then begin - with VPolygon.Outline do begin - try - with Grow(GR32.Fixed(VAppearanceBorder.LineWidth / 2), 0.5) do begin - try - FillMode := pfWinding; - DrawFill(ATargetBmp, VAppearanceBorder.LineColor); - finally - free; - end; - end; - finally - free; - end; - end; - end; - end else begin - with VPolygon.Outline do begin - try - with Grow(GR32.Fixed(0.5), 0.5) do begin - try - FillMode := pfWinding; - DrawFill(ATargetBmp, FColorBG); - finally - free; - end; - end; - finally - free; - end; - end; - VPolygon.DrawEdge(ATargetBmp, FColorMain); + if Supports(AAppearance, IAppearancePolygonBorder, VAppearanceBorder) then begin + PolyPolylineFS(ATargetBmp, VPolygon, VAppearanceBorder.LineColor, True, VAppearanceBorder.LineWidth); end; - Result := True; + end else begin + PolyPolylineFS(ATargetBmp, VPolygon, FColorBG, True, 2); + PolyPolylineFS(ATargetBmp, VPolygon, FColorMain, True, 1); end; - finally - VPolygon.Free; + Result := True; end; end; @@ -353,7 +279,7 @@ const AMapRect: TRect; const AAppearance: IAppearance; const APoly: IGeometryLonLatPolygon; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; var VProjected: IGeometryProjectedPolygon; @@ -365,11 +291,11 @@ VProjected := FProjectedCache.GetProjectedPolygon(AProjection, APoly); if Assigned(VProjected) then begin if Supports(VProjected, IGeometryProjectedSinglePolygon, VProjectedSingle) then begin - Result := DrawSinglePolygon(ABitmapInited, ATargetBmp, AMapRect, AAppearance, VProjectedSingle, AFixedPointArray); + Result := DrawSinglePolygon(ABitmapInited, ATargetBmp, AMapRect, AAppearance, VProjectedSingle, APointArray); end else if Supports(VProjected, IGeometryProjectedMultiPolygon, VProjectedMulti) then begin for i := 0 to VProjectedMulti.Count - 1 do begin VProjectedSingle := VProjectedMulti.Item[i]; - if DrawSinglePolygon(ABitmapInited, ATargetBmp, AMapRect, AAppearance, VProjectedSingle, AFixedPointArray) then begin + if DrawSinglePolygon(ABitmapInited, ATargetBmp, AMapRect, AAppearance, VProjectedSingle, APointArray) then begin Result := True; end; end; @@ -386,7 +312,7 @@ ATargetBmp: TCustomBitmap32; const AProjection: IProjection; const AMapRect: TRect; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; var VEnumMarks: IEnumUnknown; @@ -405,7 +331,7 @@ Break; end; if Supports(VMark.Geometry, IGeometryLonLatPolygon, VPoly) then begin - if DrawPoly(VBitmapInited, ATargetBmp, AProjection, AMapRect, VMark.Appearance, VPoly, AFixedPointArray) then begin + if DrawPoly(VBitmapInited, ATargetBmp, AProjection, AMapRect, VMark.Appearance, VPoly, APointArray) then begin Result := True; end; end; @@ -416,7 +342,7 @@ Break; end; if Supports(VMark.Geometry, IGeometryLonLatLine, VLine) then begin - if DrawPath(VBitmapInited, ATargetBmp, AProjection, AMapRect, VMark.Appearance, VLine, AFixedPointArray) then begin + if DrawPath(VBitmapInited, ATargetBmp, AProjection, AMapRect, VMark.Appearance, VLine, APointArray) then begin Result := True; end; end; @@ -444,14 +370,14 @@ var VMapRect: TRect; VBitmap: TBitmap32ByStaticBitmap; - VFixedPointArray: TArrayOfFixedPoint; + VPointArray: TArrayOfFloatPoint; begin Result := nil; if Assigned(ASource) and not ASource.IsEmpty then begin VBitmap := TBitmap32ByStaticBitmap.Create(FBitmap32StaticFactory); try VMapRect := AProjection.TilePos2PixelRect(ATile); - if DrawSubset(AOperationID, ACancelNotifier, ASource, VBitmap, AProjection, VMapRect, VFixedPointArray) then begin + if DrawSubset(AOperationID, ACancelNotifier, ASource, VBitmap, AProjection, VMapRect, VPointArray) then begin Result := VBitmap.MakeAndClear; end; finally diff -r bf461203504c -r f323278af2ff Src/TileProvider/u_VectorTileRendererForMarks.pas --- a/Src/TileProvider/u_VectorTileRendererForMarks.pas Sat Dec 07 16:54:46 2019 +0300 +++ b/Src/TileProvider/u_VectorTileRendererForMarks.pas Sun Dec 08 19:07:06 2019 +0200 @@ -56,7 +56,7 @@ ATargetBmp: TCustomBitmap32; const AProjection: IProjection; const AMapRect: TRect; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; function DrawPoint( var ABitmapInited: Boolean; @@ -73,7 +73,7 @@ const AMapRect: TRect; const AAppearance: IAppearance; const ALine: IGeometryLonLatLine; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; function DrawPoly( var ABitmapInited: Boolean; @@ -82,7 +82,7 @@ const AMapRect: TRect; const AAppearance: IAppearance; const APoly: IGeometryLonLatPolygon; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; function DrawSinglePolygon( var ABitmapInited: Boolean; @@ -90,7 +90,7 @@ const AMapRect: TRect; const AAppearance: IAppearance; const APoly: IGeometryProjectedSinglePolygon; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; procedure InitBitmap( @@ -183,49 +183,25 @@ const AMapRect: TRect; const AAppearance: IAppearance; const ALine: IGeometryLonLatLine; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; var - VPolygon: TPolygon32; + VPolygon: TArrayOfArrayOfFloatPoint; VProjected: IGeometryProjectedLine; VAppearanceLine: IAppearanceLine; begin Result := False; - VPolygon := nil; VProjected := FProjectedCache.GetProjectedPath(AProjection, ALine); - ProjectedLine2GR32Polygon( - VProjected, - AMapRect, - am4times, - AFixedPointArray, - VPolygon - ); - try - if Assigned(VPolygon) then begin - if not ABitmapInited then begin - InitBitmap(ATargetBmp, Types.Point(AMapRect.Right - AMapRect.Left, AMapRect.Bottom - AMapRect.Top)); - ABitmapInited := True; - end; - if Supports(AAppearance, IAppearanceLine, VAppearanceLine) then begin - with VPolygon.Outline do begin - try - with Grow(GR32.Fixed(VAppearanceLine.LineWidth / 2), 0.5) do begin - try - FillMode := pfWinding; - DrawFill(ATargetBmp, VAppearanceLine.LineColor); - finally - free; - end; - end; - finally - free; - end; - end; - end; - Result := True; + VPolygon := ProjectedLine2ArrayOfArray(VProjected, AMapRect, APointArray); + if Assigned(VPolygon) then begin + if not ABitmapInited then begin + InitBitmap(ATargetBmp, Types.Point(AMapRect.Right - AMapRect.Left, AMapRect.Bottom - AMapRect.Top)); + ABitmapInited := True; end; - finally - VPolygon.Free; + if Supports(AAppearance, IAppearanceLine, VAppearanceLine) then begin + PolyPolylineFS(ATargetBmp, VPolygon, VAppearanceLine.LineColor, False, VAppearanceLine.LineWidth); + end; + Result := True; end; end; @@ -235,51 +211,27 @@ const AMapRect: TRect; const AAppearance: IAppearance; const APoly: IGeometryProjectedSinglePolygon; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; var - VPolygon: TPolygon32; + VPolygon: TArrayOfArrayOfFloatPoint; VAppearanceBorder: IAppearancePolygonBorder; VAppearanceFill: IAppearancePolygonFill; begin Result := False; - VPolygon := nil; - try - ProjectedPolygon2GR32Polygon( - APoly, - AMapRect, - am4times, - AFixedPointArray, - VPolygon - ); - if VPolygon <> nil then begin - if not ABitmapInited then begin - InitBitmap(ATargetBmp, Types.Point(AMapRect.Right - AMapRect.Left, AMapRect.Bottom - AMapRect.Top)); - ABitmapInited := True; - end; - if Supports(AAppearance, IAppearancePolygonFill, VAppearanceFill) then begin - VPolygon.DrawFill(ATargetBmp, VAppearanceFill.FillColor); - end; - if Supports(AAppearance, IAppearancePolygonBorder, VAppearanceBorder) then begin - with VPolygon.Outline do begin - try - with Grow(GR32.Fixed(VAppearanceBorder.LineWidth / 2), 0.5) do begin - try - FillMode := pfWinding; - DrawFill(ATargetBmp, VAppearanceBorder.LineColor); - finally - free; - end; - end; - finally - free; - end; - end; - end; - Result := True; + VPolygon := ProjectedPolygon2ArrayOfArray(APoly, AMapRect, APointArray); + if VPolygon <> nil then begin + if not ABitmapInited then begin + InitBitmap(ATargetBmp, Types.Point(AMapRect.Right - AMapRect.Left, AMapRect.Bottom - AMapRect.Top)); + ABitmapInited := True; end; - finally - VPolygon.Free; + if Supports(AAppearance, IAppearancePolygonFill, VAppearanceFill) then begin + PolyPolygonFS(ATargetBmp, VPolygon, VAppearanceFill.FillColor); + end; + if Supports(AAppearance, IAppearancePolygonBorder, VAppearanceBorder) then begin + PolyPolylineFS(ATargetBmp, VPolygon, VAppearanceBorder.LineColor, True, VAppearanceBorder.LineWidth); + end; + Result := True; end; end; @@ -290,7 +242,7 @@ const AMapRect: TRect; const AAppearance: IAppearance; const APoly: IGeometryLonLatPolygon; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; var VProjected: IGeometryProjectedPolygon; @@ -302,11 +254,11 @@ VProjected := FProjectedCache.GetProjectedPolygon(AProjection, APoly); if Assigned(VProjected) then begin if Supports(VProjected, IGeometryProjectedSinglePolygon, VProjectedSingle) then begin - Result := DrawSinglePolygon(ABitmapInited, ATargetBmp, AMapRect, AAppearance, VProjectedSingle, AFixedPointArray); + Result := DrawSinglePolygon(ABitmapInited, ATargetBmp, AMapRect, AAppearance, VProjectedSingle, APointArray); end else if Supports(VProjected, IGeometryProjectedMultiPolygon, VProjectedMulti) then begin for i := 0 to VProjectedMulti.Count - 1 do begin VProjectedSingle := VProjectedMulti.Item[i]; - if DrawSinglePolygon(ABitmapInited, ATargetBmp, AMapRect, AAppearance, VProjectedSingle, AFixedPointArray) then begin + if DrawSinglePolygon(ABitmapInited, ATargetBmp, AMapRect, AAppearance, VProjectedSingle, APointArray) then begin Result := True; end; end; @@ -323,7 +275,7 @@ ATargetBmp: TCustomBitmap32; const AProjection: IProjection; const AMapRect: TRect; - var AFixedPointArray: TArrayOfFixedPoint + var APointArray: TArrayOfFloatPoint ): Boolean; var VEnumMarks: IEnumUnknown; @@ -342,7 +294,7 @@ Break; end; if Supports(VMark.Geometry, IGeometryLonLatPolygon, VPoly) then begin - if DrawPoly(VBitmapInited, ATargetBmp, AProjection, AMapRect, VMark.Appearance, VPoly, AFixedPointArray) then begin + if DrawPoly(VBitmapInited, ATargetBmp, AProjection, AMapRect, VMark.Appearance, VPoly, APointArray) then begin Result := True; end; end; @@ -353,7 +305,7 @@ Break; end; if Supports(VMark.Geometry, IGeometryLonLatLine, VLine) then begin - if DrawPath(VBitmapInited, ATargetBmp, AProjection, AMapRect, VMark.Appearance, VLine, AFixedPointArray) then begin + if DrawPath(VBitmapInited, ATargetBmp, AProjection, AMapRect, VMark.Appearance, VLine, APointArray) then begin Result := True; end; end; @@ -381,7 +333,7 @@ var VMapRect: TRect; VBitmap: TBitmap32ByStaticBitmap; - VFixedPointArray: TArrayOfFixedPoint; + VFixedPointArray: TArrayOfFloatPoint; begin Result := nil; if Assigned(ASource) and not ASource.IsEmpty then begin Screenshot_1.jpg [^] (369,635 bytes) 09-12-2019 09:32 Screenshot_2.png [^] (57,127 bytes) 09-12-2019 09:53 10089.patch [^] (7,122 bytes) 10-12-2019 18:47 [Show Content] [Hide Content] | ||||||||
Relationships | ||||||
|
Notes | |
(0019529) zed (manager) 06-12-2019 08:20 |
vdemidov Не хочешь заняться? Я так понимаю, что ты уже экспериментировал с миграцией и хорошо представляешь что надо делать. |
(0019530) vdemidov (manager) 06-12-2019 10:46 |
Хорошо. Там уже много чего сделано в нужном направлении. Может в субботу или воскресенья попытаюсь сделать. |
(0019531) vdemidov (manager) 06-12-2019 16:15 |
Освежил чуть воспоминания о коде. Там действительно почти все сделано. Осталось только заменить все использования TFixedPoint на TFloatPoint (в том числе и всякие массивы). И вместо TPolygon32 использовать TArrayOfArrayOfFloatPoint. Там уже почти все для этого готово. |
(0019533) vdemidov (manager) 08-12-2019 17:10 |
Залил патчи для свежей гитовой версии gr32 и для сас для перехода. Но нужно проверять. А у меня возможности нет. |
(0019534) zed (manager) 08-12-2019 18:03 |
Я немного не понял про патч GR32. Ты взял версию с git и внёс туда какие-то фиксы? |
(0019535) zed (manager) 08-12-2019 18:24 |
Мда, так и есть. Не ожидал такого поворота. Есть шанс что эти изменения могут быть приняты в основную ветку GR32? |
(0019536) zed (manager) 08-12-2019 18:48 edited on: 08-12-2019 18:49 |
Немного погонял, вроде работает без проблем. Вот тестовая сборка: https://yadi.sk/d/yt2ePQl_f9MrCg (утечки памяти детектит FastMM, стектрейсы сохраняет SynLog. Если что-то случится, то файлы с отчётами автоматически появятся в папке с программой). |
(0019537) vdemidov (manager) 08-12-2019 19:55 |
> Мда, так и есть. Не ожидал такого поворота. Есть шанс что эти изменения могут быть приняты в основную ветку GR32? Очень вряд ли. Но можешь попробовать протолкнуть. Проще их в своей копии подтягивать и мержить. >Немного погонял, вроде работает без проблем. Проверь свой SunCalc. Я там не очень уверен в ThickPolyLine. |
(0019538) zed (manager) 09-12-2019 09:32 |
> Проверь свой SunCalc С ним всё нормально, на сколько я могу судить. И в актуальной версии GR32, если не ошибаюсь, даже есть аналог ThickPolyLine. Помню, я этот код откуда-то копи-пастил. Пока что заметил 2 отличия: - цвет заливки полигонов стал менее прозрачным - пропала обводка тенью у надписей шкалы масштаба Приложил скриншот, где видны оба отличия. Слева - старый вариант, справа - новый. По первому отличию, на гитхабе есть тикет https://github.com/graphics32/graphics32/issues/102 но написано, что исправлено. |
(0019539) zed (manager) 09-12-2019 09:45 |
Если при запуске задать гамму равную единице, как советуют в комментариях то первое отличие пропадает: SetGamma(1). |
(0019540) zed (manager) 09-12-2019 09:53 |
Оу, с надписями у SunCalc баг вылез - второй скриншот в аттаче. |
(0019541) zed (manager) 09-12-2019 10:31 |
Добавил патч для фикса SunCalc. А вот что делать с обводкой непонятно. |
(0019542) vdemidov (manager) 09-12-2019 11:44 |
С обводкой, нужно посмотреть в новой версии GR32. Если я ничего не путаю, там сейчас есть рендеринг текста в полигоны, которые потом можно сделать Grow и нарисовать предварительно. |
(0019547) zed (manager) 10-12-2019 18:49 edited on: 10-12-2019 18:50 |
Решил проблему с обводкой, доработав старый алгоритм. Приложил обновлённый патч с исправлением всех обнаруженных проблем. Думаю, патчи можно вливать в репозитории. |
(0019556) vdemidov (manager) 11-12-2019 07:33 |
Ну, так давай. Заменяй репозиторий Gr32 (если я правильно помню, у нас не общий корень, так что придется). Вливай патчи. Отдельно можно таки попоробвать пропихнуть наши патчи в апстрим. Они там вполне логичные. |
(0019564) zed (manager) 12-12-2019 12:34 |
Отправил PR: https://github.com/graphics32/graphics32/pull/118 |
(0019565) vdemidov (manager) 12-12-2019 12:55 |
Надо было изменения в GR32_Polygons.pas отдельным пул реквестом кидать. Они никак не связаны и почти на что не влияют. |
(0019567) zed (manager) 12-12-2019 15:20 |
Ответь в PR, какую проблему и как решают изменения. Что касается GR32_Polygons то эти изменения могу откатить или возьми сам откати. |
(0019568) vdemidov (manager) 12-12-2019 15:52 |
Проблема - использование StretchTransfer для копирования данных в случае, если исходное изображение живет не в TCustomBitmap32, а в каком-то другом объекте, но сами данные, при этом, в формате PColor32Array. Все остальные изменения - это последствия этого изменения. Как это обосновать ХЗ. У нас это тайлы, которые нужно отрисовывать на чем-то. Хранить для каждого тайла TCustomBitmap32 это явный перебор - там кучу всего криэйтить и дестроить нужно. И копировать в TCustomBitmap32 перед каждой операцией - тоже дикий оверхед. >возьми сам откати. Как я это откачу, если это твой пул реквест. Я там никто. Так упомянут в качестве автора, но прав никаких не имею |
(0019569) zed (manager) 12-12-2019 16:02 |
> Как это обосновать ХЗ Ну вот так и обоснуй. И я тут немного подумал над кодом и мне кажется можно сделать менее калечащие изменения: оставить оригинальную версию StretchTransfer и добавить нашу, с доп параметрами. Из оригинальной (её даже можно попробовать сделать inline) вызывать нашу, а ресамплеры не трогать, пусть они вызывают оригинальную. > но прав никаких не имею Точно? У тебя же в исходном репо из которого сделан пулл такие же права, как и у меня. Так что делаешь коммит в соответствующую ветку и PR обновляется. |
(0019570) vdemidov (manager) 12-12-2019 16:05 |
> добавить нашу, с доп параметрами. Ты не поверишь :) Именно так и сделано. |
(0019571) vdemidov (manager) 12-12-2019 16:08 |
> Так что делаешь коммит в соответствующую ветку и PR обновляется. Ну, может на следующей недельке получится. |
(0019572) zed (manager) 12-12-2019 16:09 |
Не совсем так, ты в оригинальную добавил 3 доп. параметра и это за собой потянуло кучу изменений. А я предлагаю не добавлять их, а для передачи параметров в нашу брать соответствующие значения из параметра Src. |
(0019573) vdemidov (manager) 12-12-2019 16:14 |
> Не совсем так, ты в оригинальную добавил 3 доп. параметра и это за собой потянуло кучу изменений. Возможно. Давно это было. Много лет назад. Плюс делалось постепенно. А на новую версию просто было перетащено почти без изменений. Причеши это хозяйство, если есть время и желание. |
Users who viewed this issue | |
User List | Anonymous (1956x), nnngrach (1x), ygorigor (1x), gma (1x), vdemidov (58x), zed (39x), goodzon (1x), kalakotkas (1x) |
Total Views | 2058 |
Last View | 21-11-2024 12:58 |
Issue History | |||
Date Modified | Username | Field | Change |
06-12-2019 08:15 | zed | New Issue | |
06-12-2019 08:15 | zed | Relationship added | related to 0003581 |
06-12-2019 08:20 | zed | Note Added: 0019529 | |
06-12-2019 10:46 | vdemidov | Note Added: 0019530 | |
06-12-2019 16:15 | vdemidov | Note Added: 0019531 | |
08-12-2019 17:06 | vdemidov | File Added: gr32.patch | |
08-12-2019 17:09 | vdemidov | File Added: Sas.patch | |
08-12-2019 17:10 | vdemidov | Note Added: 0019533 | |
08-12-2019 18:03 | zed | Note Added: 0019534 | |
08-12-2019 18:24 | zed | Note Added: 0019535 | |
08-12-2019 18:48 | zed | Note Added: 0019536 | |
08-12-2019 18:49 | zed | Note Edited: 0019536 | View Revisions |
08-12-2019 19:55 | vdemidov | Note Added: 0019537 | |
09-12-2019 09:32 | zed | Note Added: 0019538 | |
09-12-2019 09:32 | zed | File Added: Screenshot_1.jpg | |
09-12-2019 09:45 | zed | Note Added: 0019539 | |
09-12-2019 09:53 | zed | Note Added: 0019540 | |
09-12-2019 09:53 | zed | File Added: Screenshot_2.png | |
09-12-2019 10:30 | zed | File Added: 10089.patch | |
09-12-2019 10:31 | zed | Note Added: 0019541 | |
09-12-2019 11:44 | vdemidov | Note Added: 0019542 | |
10-12-2019 18:47 | zed | File Deleted: 10089.patch | |
10-12-2019 18:47 | zed | File Added: 10089.patch | |
10-12-2019 18:49 | zed | Note Added: 0019547 | |
10-12-2019 18:50 | zed | Note Edited: 0019547 | View Revisions |
11-12-2019 07:33 | vdemidov | Note Added: 0019556 | |
12-12-2019 08:14 | zed | Status | new => resolved |
12-12-2019 08:14 | zed | Fixed in Version | => 191221 |
12-12-2019 08:14 | zed | Resolution | open => fixed |
12-12-2019 08:14 | zed | Assigned To | => vdemidov |
12-12-2019 08:14 | zed | Target Version | => 191221 |
12-12-2019 12:34 | zed | Note Added: 0019564 | |
12-12-2019 12:55 | vdemidov | Note Added: 0019565 | |
12-12-2019 15:20 | zed | Note Added: 0019567 | |
12-12-2019 15:52 | vdemidov | Note Added: 0019568 | |
12-12-2019 16:02 | zed | Note Added: 0019569 | |
12-12-2019 16:05 | vdemidov | Note Added: 0019570 | |
12-12-2019 16:08 | vdemidov | Note Added: 0019571 | |
12-12-2019 16:09 | zed | Note Added: 0019572 | |
12-12-2019 16:14 | vdemidov | Note Added: 0019573 |
My View | View Issues | Change Log | Roadmap | Search |
Copyright © 2007 - 2024 SAS.Planet Team |