- #136, update the threshold crop to use color distance in the rgb cube

(3d distance) and normalize the threshold level from 0..1.0
master
pajoye 2008-03-14 21:45:12 +00:00
parent 421ff8387b
commit dea4bed17b
2 changed files with 2 additions and 14 deletions

View File

@ -58,19 +58,7 @@ int main()
return 1;
}
im2 = gdImageThresholdCrop(im, 0xFFFFFF, 120);
if (im2) {
save_png(im2, "a3.png");
gdImageDestroy(im2);
}
gdImageDestroy(im);
im = read_png("test_crop_threshold.png");
if (!im) {
return 1;
}
im2 = gdImageThresholdCrop(im, 0xFFFFFF, 70);
im2 = gdImageThresholdCrop(im, 0xFFFFFF, 0.6);
if (im2) {
save_png(im2, "a4.png");
gdImageDestroy(im2);

View File

@ -748,7 +748,7 @@ BGD_DECLARE(void) gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg);
BGD_DECLARE(gdImagePtr) gdImageCrop(gdImagePtr src, const gdRect *crop);
BGD_DECLARE(gdImagePtr) gdImageAutoCrop(gdImagePtr im, const unsigned int mode);
BGD_DECLARE(gdImagePtr) gdImageThresholdCrop(gdImagePtr im, const unsigned int color, const int threshold);
BGD_DECLARE(gdImagePtr) gdImageThresholdCrop(gdImagePtr im, const unsigned int color, const float threshold);
BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im);
BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im);