X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ffreenet%2Fcaptcha%2Fsimplecaptcha.cpp;h=512774e301562ebc1df32b77a2f7eebde3869891;hb=dec33c63afafabf83c3039e916725cac6faef9b3;hp=c84010fe48628183709db66aeb7810dfd94dae4f;hpb=175f098e7e712b839db433b93fe8649a402c6784;p=fms.git diff --git a/src/freenet/captcha/simplecaptcha.cpp b/src/freenet/captcha/simplecaptcha.cpp index c84010f..512774e 100644 --- a/src/freenet/captcha/simplecaptcha.cpp +++ b/src/freenet/captcha/simplecaptcha.cpp @@ -3,6 +3,10 @@ #include "../../../include/freenet/captcha/easybmp/EasyBMP_Font.h" #include "../../../include/freenet/captcha/easybmp/EasyBMP_Geometry.h" +#include + +#include + #ifdef XMEM #include #endif @@ -10,12 +14,13 @@ void SimpleCaptcha::Generate() { BMP bmp; - int bmpwidth=100; + int bmpwidth=110; int bmpheight=50; RGBApixel lettercols[5]; std::string puzzlestring; - std::string tempfilename=GenerateRandomString(10); - tempfilename+=".bmp"; + std::string tempfilename=""; + + tempfilename=Poco::TemporaryFile::tempName(); puzzlestring=GenerateRandomString(5); m_solution.clear(); @@ -51,16 +56,17 @@ void SimpleCaptcha::Generate() double endangle=(double)(rand()%360)*(3.14159/180); pixel.Red=100+(rand()%150); pixel.Green=100+(rand()%150); + pixel.Blue=100+(rand()%150); DrawArc(bmp,x1,y1,radius,startangle,endangle,pixel); } for(int i=0; i<5; i++) { // keep the colors dark - lettercols[i].Red=(rand()%200); - lettercols[i].Green=(rand()%200); - lettercols[i].Blue=(rand()%200); - // draw a line with the letter col + lettercols[i].Red=(rand()%150); + lettercols[i].Green=(rand()%150); + lettercols[i].Blue=(rand()%150); + // draw a line with the letter color DrawAALine(bmp,rand()%bmpwidth,rand()%bmpheight,rand()%bmpwidth,rand()%bmpheight,lettercols[i]); }