Fix TX spectrum filter alpha accumulation

This commit is contained in:
2026-05-24 16:03:48 +03:00
parent 3bfd9adf0d
commit 0dc04ffcad
+25 -2
View File
@@ -19,7 +19,7 @@ interface
uses uses
Classes, SysUtils, Graphics, ExtCtrls, Controls, Math, Classes, SysUtils, Graphics, ExtCtrls, Controls, Math,
LCLIntf, LCLType, AppTheme, AppTheme,
AlertOverlay, SampleRateOverlay, VfoOverlay, AlertOverlay, SampleRateOverlay, VfoOverlay,
WaterfallView, SMeterView, RulerView; WaterfallView, SMeterView, RulerView;
@@ -98,6 +98,7 @@ type
procedure DrawSpectrumGradient(const SpPts: array of TPoint; W, H: Integer); procedure DrawSpectrumGradient(const SpPts: array of TPoint; W, H: Integer);
procedure DrawMarkerLine(C: TCanvas; W, H: Integer); procedure DrawMarkerLine(C: TCanvas; W, H: Integer);
procedure BlendBand(X1, X2, H: Integer; R, G, B, Alpha: Byte); procedure BlendBand(X1, X2, H: Integer; R, G, B, Alpha: Byte);
procedure CopyGridToSpectrum(W, H: Integer);
procedure DrawADCOverloadOverlay(C: TCanvas; W, H: Integer); procedure DrawADCOverloadOverlay(C: TCanvas; W, H: Integer);
procedure CalcFilterBandX(VfoFreq: Double; W: Integer; procedure CalcFilterBandX(VfoFreq: Double; W: Integer;
out X1, X2, VfoX: Integer); out X1, X2, VfoX: Integer);
@@ -282,6 +283,7 @@ begin
FSpectrumBitmap := TBitmap.Create; FSpectrumBitmap := TBitmap.Create;
FSpectrumBitmap.PixelFormat := pf32bit; FSpectrumBitmap.PixelFormat := pf32bit;
FGridBitmap := TBitmap.Create; FGridBitmap := TBitmap.Create;
FGridBitmap.PixelFormat := pf32bit;
FGridBitmapW := 0; FGridBitmapH := 0; FGridBitmapW := 0; FGridBitmapH := 0;
FFMGridLastCenter := -1.0; FFMGridLastStepHz := -1.0; FFMGridLastSpan := -1.0; FFMGridLastCenter := -1.0; FFMGridLastStepHz := -1.0; FFMGridLastSpan := -1.0;
FFMGridStepHz := 0.0; FFMGridStepHz := 0.0;
@@ -503,6 +505,27 @@ begin
end; end;
end; end;
procedure TSpectrumView.CopyGridToSpectrum(W, H: Integer);
var
Y: Integer;
Src, Dst: PByte;
begin
if (FSpectrumBitmap = nil) or (FGridBitmap = nil) then Exit;
if (W <= 0) or (H <= 0) then Exit;
FSpectrumBitmap.BeginUpdate(False);
try
for Y := 0 to H - 1 do
begin
Src := PByte(FGridBitmap.ScanLine[Y]);
Dst := PByte(FSpectrumBitmap.ScanLine[Y]);
if (Src <> nil) and (Dst <> nil) then
Move(Src^, Dst^, W * 4);
end;
finally
FSpectrumBitmap.EndUpdate(False);
end;
end;
procedure TSpectrumView.DrawADCOverloadOverlay(C: TCanvas; W, H: Integer); procedure TSpectrumView.DrawADCOverloadOverlay(C: TCanvas; W, H: Integer);
begin begin
if not FADCOverloadVisible then Exit; if not FADCOverloadVisible then Exit;
@@ -761,7 +784,7 @@ begin
end; end;
end; end;
end; end;
LCLIntf.BitBlt(C.Handle, 0, 0, W, H, FGridBitmap.Canvas.Handle, 0, 0, $CC0020); CopyGridToSpectrum(W, H);
// ── 2. Полоса фильтра ───────────────────────────────────────────────────── // ── 2. Полоса фильтра ─────────────────────────────────────────────────────
if FActiveVfo = 0 then CalcFilterBandX(FVfoA, W, X1, X2, VfoX) if FActiveVfo = 0 then CalcFilterBandX(FVfoA, W, X1, X2, VfoX)