
26.07.2010, 23:16
|
 |
Always hardcore!
|
|
Регистрация: 04.03.2009
Адрес: СПб
Сообщения: 3,239
Версия Delphi: GCC/FPC/FASM
Репутация: 62149
|
|
Код:
procedure ParseBg(var bmp: TBitmap);
var
x, y, i, sx, sy, w, h: integer;
r, g, b: Byte;
screenb:TBitmap;
begin
w:=bmp.Width;
h:=bmp.Height;
screenb := TBitmap.Create;
screenb.Width := w;
screenb.Height := h;
sx:=(screen.Width-w)div 2;
sy:=(screen.Height-h)div 2;
BitBlt(screenb.Canvas.Handle, 0, 0, w, h, GetDC(0), sx, sy, SRCCOPY);
for y:=0 to h-1 do
for x:=0 to w-1 do begin
i:=bmp.Canvas.Pixels[x,y];
r:=i and $FF;
g:=i shr 8 and $FF;
b:=i shr 16 and $FF;
if (r=g)and(g=b) then begin
i:=screenb.Canvas.Pixels[x,y];
r:=(i and $FF)*r shr 8;
g:=(i shr 8 and $FF)*g shr 8;
b:=(i shr 16 and $FF)*b shr 8;
bmp.Canvas.Pixels[x,y]:=(r or (g shl 8) or (b shl 16));
end;
end;
screenb.Free;
end;
Странно, но этот метод работает даже быстрее сканлайна...
__________________
Оставайтесь хорошими людьми...
VK id2634397, ds [at] phoenix [dot] dj
|