# HG changeset patch # User zed # Date 1576003622 -10800 # Tue Dec 10 21:47:02 2019 +0300 # Node ID d012bdc98d62002e9fb2e5be5316b03c7dbe9d65 # Parent f323278af2ff28139822bf06fb055536e841bfe0 3597: Устранение обнаруженных проблем после перехода на новую версию Graphics32 diff -r f323278af2ff -r d012bdc98d62 Src/MainForm/frm_Main.pas --- a/Src/MainForm/frm_Main.pas Sun Dec 08 19:07:06 2019 +0200 +++ b/Src/MainForm/frm_Main.pas Tue Dec 10 21:47:02 2019 +0300 @@ -1098,6 +1098,7 @@ CompatibilityIniFiles, {$ENDIF} gnugettext, + GR32_Gamma, t_CommonTypes, t_FillingMapModes, c_ZeroGUID, @@ -1226,6 +1227,8 @@ begin inherited; + GR32_Gamma.SetGamma(1); + // Disable popup menu item "Make Polygon by RosReestr (F8+MLeft)" due it // stop working: http://www.sasgis.org/mantis/view.php?id=2641 TBXMakeRosreestrPolygon.Enabled := False; diff -r f323278af2ff -r d012bdc98d62 Src/MapLayers/WindowLayers/ScaleLine/u_WindowLayerScaleLineBase.pas --- a/Src/MapLayers/WindowLayers/ScaleLine/u_WindowLayerScaleLineBase.pas Sun Dec 08 19:07:06 2019 +0200 +++ b/Src/MapLayers/WindowLayers/ScaleLine/u_WindowLayerScaleLineBase.pas Tue Dec 10 21:47:02 2019 +0300 @@ -1,6 +1,6 @@ {******************************************************************************} {* SAS.Planet (SAS.Планета) *} -{* Copyright (C) 2007-2014, SAS.Planet development team. *} +{* Copyright (C) 2007-2019, SAS.Planet development team. *} {* This program is free software: you can redistribute it and/or modify *} {* it under the terms of the GNU General Public License as published by *} {* the Free Software Foundation, either version 3 of the License, or *} @@ -57,11 +57,11 @@ ); protected procedure DrawOutLinedText( - X, Y: Integer; - const Text: string; - TextColor: TColor32; - OutLineColor: TColor32; - TargetBitmap: TBitmap32 + const X, Y: Integer; + const AText: string; + const ATextColor: TColor32; + const AOutLineColor: TColor32; + const ATargetBitmap: TBitmap32 ); function GetNiceLen(ALen: Double): Double; function GetNewVisibility: boolean; virtual; abstract; @@ -285,39 +285,62 @@ Layer.MouseEvents := Visible; end; +const + cBackGroundColor: TColor32 = 0; + +function IsPixelForOutLine( + const ABitmap: TBitmap32; + const X, Y: Integer; + const AOutLineColor: TColor32 +): Boolean; inline; +var + I, J: Integer; + VPixel: TColor32; +begin + Result := False; + if ABitmap.Pixel[X, Y] <> cBackGroundColor then begin + Exit; + end; + for I := -1 to 1 do begin + for J := -1 to 1 do begin + VPixel := ABitmap.Pixel[X + I, Y + J]; + if (VPixel <> cBackGroundColor) and (VPixel <> AOutLineColor) then begin + Result := True; + Exit; + end; + end; + end; +end; + procedure TWindowLayerScaleLineBase.DrawOutLinedText( - X, Y: Integer; - const Text: string; - TextColor: TColor32; - OutLineColor: TColor32; - TargetBitmap: TBitmap32 + const X, Y: Integer; + const AText: string; + const ATextColor: TColor32; + const AOutLineColor: TColor32; + const ATargetBitmap: TBitmap32 ); var I, J: Integer; + VSize: TSize; begin - FTmpBitmap.SetSize(FTmpBitmap.TextWidth(Text) + 4, FTmpBitmap.TextHeight(Text) + 4); - FTmpBitmap.Clear(0); - FTmpBitmap.RenderText(2, 2, Text, 0, TextColor); + VSize := FTmpBitmap.TextExtent(AText); + FTmpBitmap.SetSize(VSize.cx + 4, VSize.cy + 4); + + FTmpBitmap.Clear(cBackGroundColor); + FTmpBitmap.RenderText(2, 2, AText, 0, ATextColor); + for I := 1 to FTmpBitmap.Width - 2 do begin for J := 1 to FTmpBitmap.Height - 2 do begin - if (FTmpBitmap.Pixel[I, J] <> TextColor) and (FTmpBitmap.Pixel[I, J] <> OutLineColor) then begin - if (FTmpBitmap.Pixel[I + 1, J] = TextColor) or - (FTmpBitmap.Pixel[I - 1, J] = TextColor) or - (FTmpBitmap.Pixel[I, J + 1] = TextColor) or - (FTmpBitmap.Pixel[I, J - 1] = TextColor) or - (FTmpBitmap.Pixel[I + 1, J + 1] = TextColor) or - (FTmpBitmap.Pixel[I - 1, J + 1] = TextColor) or - (FTmpBitmap.Pixel[I + 1, J - 1] = TextColor) or - (FTmpBitmap.Pixel[I - 1, J - 1] = TextColor) then begin - FTmpBitmap.Pixel[I, J] := OutLineColor; - end; + if IsPixelForOutLine(FTmpBitmap, I, J, AOutLineColor) then begin + FTmpBitmap.Pixel[I, J] := AOutLineColor; end; end; end; + BlockTransfer( - TargetBitmap, + ATargetBitmap, X, Y, - TargetBitmap.ClipRect, + ATargetBitmap.ClipRect, FTmpBitmap.Bits, FTmpBitmap.Width, FTmpBitmap.Height, diff -r f323278af2ff -r d012bdc98d62 Src/MapLayers/WindowLayers/SunCalc/u_SunCalcDrawTools.pas --- a/Src/MapLayers/WindowLayers/SunCalc/u_SunCalcDrawTools.pas Sun Dec 08 19:07:06 2019 +0200 +++ b/Src/MapLayers/WindowLayers/SunCalc/u_SunCalcDrawTools.pas Tue Dec 10 21:47:02 2019 +0300 @@ -1,6 +1,6 @@ {******************************************************************************} {* SAS.Planet (SAS.Планета) *} -{* Copyright (C) 2007-2017, SAS.Planet development team. *} +{* Copyright (C) 2007-2019, SAS.Planet development team. *} {* This program is free software: you can redistribute it and/or modify *} {* it under the terms of the GNU General Public License as published by *} {* the Free Software Foundation, either version 3 of the License, or *} @@ -36,7 +36,7 @@ ABitmap: TBitmap32; const APoints: TArrayOfFloatPoint; const AColor: TColor32 -); +); inline; implementation @@ -45,9 +45,6 @@ GR32_Math, GR32_Polygons; -var - GUsePolygonAntiAliasing: Boolean = True; - procedure ThickLine( ABitmap: TBitmap32; const AStart, AEnd: TFloatPoint; diff -r f323278af2ff -r d012bdc98d62 Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcDayInfo.pas --- a/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcDayInfo.pas Sun Dec 08 19:07:06 2019 +0200 +++ b/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcDayInfo.pas Tue Dec 10 21:47:02 2019 +0300 @@ -24,6 +24,8 @@ uses GR32, + GR32_Polygons, + GR32_Transforms, u_WindowLayerSunCalcInfoBase; type diff -r f323278af2ff -r d012bdc98d62 Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcDetailsPanel.pas --- a/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcDetailsPanel.pas Sun Dec 08 19:07:06 2019 +0200 +++ b/Src/MapLayers/WindowLayers/SunCalc/u_WindowLayerSunCalcDetailsPanel.pas Tue Dec 10 21:47:02 2019 +0300 @@ -308,7 +308,7 @@ VTextRec.Bitmap.Clear(FColors.BgColor); VTextRec.Bitmap.RenderText(0, 0, VTextRec.Text, 0, FFont.TextColor); - VTextRec.Bitmap.DrawMode := dmBlend; + VTextRec.Bitmap.DrawMode := dmOpaque; end; X := FBorder.Left;