星期二, 11月 04, 2008

判斷圖片是否全白


function BMPisWhite(Bmp: TBitmap): Boolean;
type
PRGBTripleArray = ^TRGBTripleArray;
TRGBTripleArray = array[0..32767] of TRGBTriple;
var
x, y: integer;
p0 : PRGBTripleArray;
begin
Result:=True;
Bmp.PixelFormat := pf24bit;
for y:=0 to Bmp.Height-1 do
begin
p0 := Bmp.ScanLine[y];
for x:=0 to Bmp.Width-1 do
begin
if (p0[x].rgbtBlue <> 255) or (p0[x].rgbtGreen <> 255) or (p0[x].rgbtRed <> 255) then
begin
Result := False;
Exit;
end;
end;
end;
end;

沒有留言: