X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Ffreenet%2Fcaptcha%2Fsimplecaptcha.cpp;h=c84010fe48628183709db66aeb7810dfd94dae4f;hp=60e1d397a9d656df8d9b8cd18ce7b5078ba024d2;hb=175f098e7e712b839db433b93fe8649a402c6784;hpb=1dee4e3cd008a27789bbce05b0eb47b0eb5d121a diff --git a/src/freenet/captcha/simplecaptcha.cpp b/src/freenet/captcha/simplecaptcha.cpp index 60e1d39..c84010f 100644 --- a/src/freenet/captcha/simplecaptcha.cpp +++ b/src/freenet/captcha/simplecaptcha.cpp @@ -12,6 +12,7 @@ void SimpleCaptcha::Generate() BMP bmp; int bmpwidth=100; int bmpheight=50; + RGBApixel lettercols[5]; std::string puzzlestring; std::string tempfilename=GenerateRandomString(10); tempfilename+=".bmp"; @@ -23,7 +24,7 @@ void SimpleCaptcha::Generate() bmp.SetSize(bmpwidth,bmpheight); // first draw some random lines around the bitmap - int numlines=(rand()%20)+10; + int numlines=(rand()%10)+10; for(int i=0; iskew; xx--) + { + pixel=bmp.GetPixel(xx-skew,yy); + bmp.SetPixel(xx,yy,pixel); + } + } + for(xx=bmpwidth+skew; xx 255 ? tempred=255 : false; + tempgreen < 0 ? tempgreen=0 : false; + tempgreen > 255 ? tempgreen=255 : false; + tempblue < 0 ? tempblue=0 : false; + tempblue > 255 ? tempblue=255 : false; + + pixel.Red=tempred; + pixel.Green=tempgreen; + pixel.Blue=tempblue; + + bmp.SetPixel(xx,yy,pixel); + } } bmp.WriteToFile(tempfilename.c_str());