Инвертировать Bitmap

Советы » Bitmap » Инвертировать Bitmap

{ 
Dieses ist eine ziemlich schnelle Methode, eine Farbumkehrung auf einem 
Bitmap anzuwenden. 
}


 { 
This is a very fast method to invert the colors of a bitmap. 
}


 function

InvertBitmap(MyBitmap: TBitmap): TBitmap; var

x, y: Integer; ByteArray: PByteArray; begin

MyBitmap.PixelFormat := pf24Bit; for

y := 0 to

MyBitmap.Height - 1 do

begin

ByteArray := MyBitmap.ScanLine[y]; for

x := 0 to

MyBitmap.Width * 3 - 1 do

begin

ByteArray[x] := 255 - ByteArray[x]; end

; end

; Result := MyBitmap; end

; procedure

TForm1.Button1Click(Sender: TObject); begin

Image1.Picture.Bitmap := InvertBitmap(Image1.Picture.Bitmap); Image1.Refresh; end

;

Другое по теме:

Категории

Статьи

Советы

Copyright © 2023 - All Rights Reserved - www.delphirus.com