![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
монохром
Тиммммм © (2007-01-05 16:34:00)народ может кто знает как из цветной картинки сделать черно-белую,спасибо
Тиммммм (2007-01-05 16:47:00) [1]спасибо выручили
antonn (2007-01-05 16:46:00) [2]если нужно сделать порог цвета (что сомневаюсь):
Lr,Lg,Lb:byte - пороговые значения для каналов красного, зеленого, синего
procedure PrepareBitmapLevel(_B_out:Tbitmap; Lr,Lg,Lb:byte);
const Pixels = MaxInt div SizeOf(TRGBTriple);
type PRGBArray = ^TRGBArray;
TRGBArray = array[0..Pixels-1] of TRGBTriple;
var x, y: Integer; RowOut: PRGBArray;
begin
_B_out.PixelFormat:=pf24bit;
for y:=0 to _B_out.Height-1 do begin
RowOut:= _B_out.ScanLine[y];
for x:=0 to _B_out.Width-1 do begin
if (RowOut[x].rgbtRed>Lr)and(RowOut[x].rgbtGreen>Lg)and(RowOut[x].rgbtBlue>Lb) then begin
RowOut[x].rgbtRed:=255;
RowOut[x].rgbtGreen:=255;
RowOut[x].rgbtBlue:=255;
end else begin
RowOut[x].rgbtRed:=0;
RowOut[x].rgbtGreen:=0;
RowOut[x].rgbtBlue:=0;
end;
end;
end
end;
antonn (2007-01-05 16:41:00) [3]
procedure PrepareBitmap(_B_out:Tbitmap);
const MaxPixelCount = MaxInt div SizeOf(TRGBTriple);
type PRGBArray = ^TRGBArray;
TRGBArray = array[0..MaxPixelCount-1] of TRGBTriple;
var x, y: Integer; RowOut: PRGBArray;
begin
_B_out.PixelFormat:=pf24bit;
for y:=0 to _B_out.Height-1 do begin
RowOut:= _B_out.ScanLine[y];
for x:=0 to _B_out.Width-1 do begin
RowOut[x].rgbtRed:=round(RowOut[x].rgbtRed*0.30+RowOut[x].rgbtGreen*0.59+RowOut[x].rgbtBlue*0.11);
RowOut[x].rgbtGreen:=RowOut[x].rgbtRed;
RowOut[x].rgbtBlue:=RowOut[x].rgbtRed;
end;
end
end;
Desdechado (2007-01-05 16:37:00) [4]каждый пиксел с цветом больше энного сделать черным, меньше энного - белым