Thema: Delphi Farbwert zu Dezimal

Einzelnen Beitrag anzeigen

Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.755 Beiträge
 
Delphi 10.4 Sydney
 
#44

AW: Farbwert zu Dezimal

  Alt 29. Mär 2019, 11:54
.. mach aus Deinem alpha: Integer mal ein alpha: Byte


Delphi-Quellcode:
     0: begin
           d := fade * 255;
           // nur für Tests
           //d := round((random(10) /10)) *255;
           for y:= 0 to h do
             for x := 0 to w do
               begin

                 alpha := ((imgSpectrum[x,y] and $FF000000) shr 24) and $FF;
                 alpha := alpha - d;
                // Byte kann nicht < 0 sein
                // if alpha < 0 then
                // alpha := 0;
                 c := imgSpectrum[x,y] and $FFFFFF;
                 if alpha > 127 then
                   imgSpectrum[x,y] := c or ((alpha -256) shl 24)
                 else
                   imgSpectrum[x,y] := c or (alpha shl 24);
               end;
rot, grün und blau können auch vom Type Byte sein.

Grüße
Klaus
Klaus

Geändert von Klaus01 (29. Mär 2019 um 12:06 Uhr)
  Mit Zitat antworten Zitat