Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure ReplaceColorIn(var bmp: TSCARBitmap; XS, YS, XE, YE: Integer; color, newColor: Integer);
- var
- b: TSCARBitmap;
- c: TSCARClient;
- begin
- case ((XS <= XE) and (YS <= YE) and InRange(XS, 0, (bmp.Width - 1)) and InRange(XE, 0, (bmp.Width - 1)) and InRange(YS, 0, (bmp.Height -1)) and InRange(YE, 0, (bmp.Height -1))) of
- True:
- try
- c := SetClient(TSCARBitmapClient.Create(bmp));
- try
- b := GetClient.CaptureEx(XS, YS, XE, YE);
- try
- ReplaceColor(b, color, newColor);
- b.DrawTo(bmp, XS, YS);
- except
- finally
- b.Free;
- end;
- except
- finally
- SetClient(c).Free;
- end;
- except
- end;
- False: RaiseException(erException, 'Invalid area!');
- end;
- end;
- procedure ReplaceColorTolIn(var bmp: TSCARBitmap; XS, YS, XE, YE: Integer; color, newColor, tol: Integer);
- var
- b: TSCARBitmap;
- c: TSCARClient;
- begin
- case ((XS <= XE) and (YS <= YE) and InRange(XS, 0, (bmp.Width - 1)) and InRange(XE, 0, (bmp.Width - 1)) and InRange(YS, 0, (bmp.Height -1)) and InRange(YE, 0, (bmp.Height -1))) of
- True:
- try
- c := SetClient(TSCARBitmapClient.Create(bmp));
- try
- b := GetClient.CaptureEx(XS, YS, XE, YE);
- try
- ReplaceColorTol(b, color, newColor, tol);
- b.DrawTo(bmp, XS, YS);
- except
- finally
- b.Free;
- end;
- except
- finally
- SetClient(c).Free;
- end;
- except
- end;
- False: RaiseException(erException, 'Invalid area!');
- end;
- end;
- procedure ReplaceColorsIn(var bmp: TSCARBitmap; XS, YS, XE, YE: Integer; colors: TIntArray; newColor: Integer);
- var
- b: TSCARBitmap;
- c: TSCARClient;
- begin
- case ((XS <= XE) and (YS <= YE) and InRange(XS, 0, (bmp.Width - 1)) and InRange(XE, 0, (bmp.Width - 1)) and InRange(YS, 0, (bmp.Height -1)) and InRange(YE, 0, (bmp.Height -1))) of
- True:
- try
- c := SetClient(TSCARBitmapClient.Create(bmp));
- try
- b := GetClient.CaptureEx(XS, YS, XE, YE);
- try
- ReplaceColors(b, colors, newColor);
- b.DrawTo(bmp, XS, YS);
- except
- finally
- b.Free;
- end;
- except
- finally
- SetClient(c).Free;
- end;
- except
- end;
- False: RaiseException(erException, 'Invalid area!');
- end;
- end;
- procedure ReplaceColorsTolIn(var bmp: TSCARBitmap; XS, YS, XE, YE: Integer; colors: TIntArray; newColor, tol: Integer);
- var
- b: TSCARBitmap;
- c: TSCARClient;
- begin
- case ((XS <= XE) and (YS <= YE) and InRange(XS, 0, (bmp.Width - 1)) and InRange(XE, 0, (bmp.Width - 1)) and InRange(YS, 0, (bmp.Height -1)) and InRange(YE, 0, (bmp.Height -1))) of
- True:
- try
- c := SetClient(TSCARBitmapClient.Create(bmp));
- try
- b := GetClient.CaptureEx(XS, YS, XE, YE);
- try
- ReplaceColorsTol(b, colors, newColor, tol);
- b.DrawTo(bmp, XS, YS);
- except
- finally
- b.Free;
- end;
- except
- finally
- SetClient(c).Free;
- end;
- except
- end;
- False: RaiseException(erException, 'Invalid area!');
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment