Hi Waheed
CastColor performs a flood fill. You want to use CastColorRange which processes all pixels in the image.
procedure TForm1.ImageEnView1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
const
Tolerance = 10;
var
clickColor, fromRGB, toRGB: TRGB;
begin
// When the user clicks the image turn all image pixels of a similar color to white
if fColorCasting then
begin
clickColor := ImageEnView1.IEBitmap.Pixels[ ImageEnView1.XScr2Bmp(x), ImageEnView1.Yscr2Bmp(y) ];
fromRGB := CreateRGB( imax( 0, clickColor.r - Tolerance ),
imax( 0, clickColor.g - Tolerance ),
imax( 0, clickColor.B - Tolerance ));
toRGB := CreateRGB( imin( 255, clickColor.r + Tolerance ),
imin( 255, clickColor.g + Tolerance ),
imin( 255, clickColor.B + Tolerance ));
ImageEnView1.Proc.CastColorRange( fromRGB, toRGB, CreateRGB(255, 255, 255));
end;
end;
Nigel
Xequte Software
www.imageen.com