Einzelnen Beitrag anzeigen

Amateurprofi

Registriert seit: 17. Nov 2005
Ort: Hamburg
1.050 Beiträge
 
Delphi XE2 Professional
 
#32

AW: weniger Scanline aufrufe ... Graustufenbild

  Alt 1. Apr 2024, 00:32
Zitat:
Delphi-Quellcode:
 BytesPerLine := ((w * 8 * BytesPerPixel + 31) and not 31) div 8;

  DstLine := _DstBmp.ScanLine[0];
  for y := 0 to h - 1 do begin
    DstPixel := DstLine;
    for x := 0 to w - 1 do begin
      _Callback(x, y, PdzRgbTriple(DstPixel)^);
      Inc(DstPixel, BytesPerPixel);
    end;
    Dec(DstLine, BytesPerLine);
  end;
Hallo Thomas,
mir fiel auf, dass Du die BytesPerLine selbst errechnest.
Ich mache das immer so:
Delphi-Quellcode:
DstLine := _DstBmp.ScanLine[0];
if h>1 then BytesPerLine:=NativeInt(_DstBmp.ScanLine[1]) - NativeInt(DstLine)
   else BytesPerLine:=0;
Und Inc(NativeInt(DstLine), BytesPerLine); Das erspart Überraschungen wenn die Zeilen in der Bitmap dann doch mal umgekehrt gespeichert sind.
Gruß, Klaus
Die Titanic wurde von Profis gebaut,
die Arche Noah von einem Amateur.
... Und dieser Beitrag vom Amateurprofi....
  Mit Zitat antworten Zitat