Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#17

AW: Prüfung eines Bitmaps auf Transparenz (gehts noch schneller)?

  Alt 22. Feb 2016, 10:11
Hallo,

Ich habe mal ne (Teil-)Assemblerversion gebaut:

Delphi-Quellcode:
function HasTransparentRGBAValues(const bmp: TBitmap): Boolean;
label schleife, ende, hasTrans;
var z: Integer; RGBA: PRGBQuad;
begin
  Result := false;
  RGBA := bmp.Scanline[bmp.Height-1];
  z := bmp.Width * bmp.Height;
  asm
    mov esi, rgba
    mov ecx, z
schleife:
    lodsd
    shr eax, 24
    inc al
    jnz hasTrans
    loop schleife
    jmp ende
hasTrans:
    mov result, true
ende:
  end;
end;
Ich habs nicht mit anderen Lösungen verglichen. Müsste man mal ausprobieren.
Ist in der Form nicht für 64-Bit geeignet, das wäre ein Stück mehr Arbeit.
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."

Geändert von Neutral General (22. Feb 2016 um 10:14 Uhr)
  Mit Zitat antworten Zitat