Thema: Delphi Bilder Verschlüsseln

Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.163 Beiträge
 
Delphi 12 Athens
 
#13

Re: Bilder Verschlüsseln

  Alt 28. Apr 2009, 11:23
Zitat von Neutral General:
Ich hoffe das der Code so läuft.
wenn schon, dann verschlüssel besser alle Bytes und nicht nur das erste je Pixel
Code:
procedure XorBitmapData(ABitmap: TBitmap; Key: [b]Cardinal[/b]);

bzw.:
Delphi-Quellcode:
procedure XorBitmapData(ABitmap: TBitmap; Key: Byte);
var p: PByte;
    i,j: Integer;
begin
  ABitmap.Pixelformat := pf24Bit;
  for i := 0 to ABitmap.Height - 1 do
  begin
    p := ABitmap.Scanline[i];
    for j := 0 to (ABitmap.Width * 3) - 1 do
    begin
      p^ := p^ xor Key;
      inc(p);
    end;
  end;
end;
oder gleich
Delphi-Quellcode:
procedure XorBitmapData(ABitmap: TBitmap; Key: Byte);
var p: PByte;
    i: Integer;
begin
  ABitmap.Pixelformat := pf24Bit;
  p := ABitmap.Scanline[ABitmap.Height - 1]; // oder ABitmap.Scanline[0];
  // *grübel* das Bild wird doch von unten nach oben gespeichert ???
  for i := 0 to ABitmap.Height * ABitmap.Width * 3 - 1 do
    p^ := p^ xor Key;
    Inc(p);
  end;
end;
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat