From: b <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Date: Sat, 28 Dec 2013 20:14:44 +0000 (+0000)
Subject: The world's smallest NewpixbOTTification
X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=4656739d28eb6db73dc1f45af3381c07f084f078;p=ott%2Fenhance

The world's smallest NewpixbOTTification


git-svn-id: svn://botcastle1b/npb@9 0d794883-4e4e-4f65-aa7a-0e7f5947bab5
---

diff --git a/npb b/npb
index c72f199..1d5b27e 100755
Binary files a/npb and b/npb differ
diff --git a/npb.cpp b/npb.cpp
index 3cd9d19..d9a7769 100644
--- a/npb.cpp
+++ b/npb.cpp
@@ -1,6 +1,6 @@
     //  //  It's NewpixbOTTification Time!
    //  //   Take a picture and add a newpixbot to it!
-  //  //    Requires Dev Image Library
+  //  //    Requires Dev Image Library, on Pentium III libdevil must be recompiled with --disable-ssl2 --disable-ssl3
  //  //
 //  //      ~~bicyclesonthemoon
 
@@ -35,6 +35,7 @@ ILboolean inH=false;
 ILboolean outH=false;
 ILboolean npbH=false;
 ILuint inX, inY;
+ILubyte *newdata;
 
 int main (int argc, const char *argv[])
 {
@@ -49,7 +50,7 @@ int main (int argc, const char *argv[])
 	ilInit();
 	if(!ilEnable(IL_ORIGIN_SET))mustard(FAIL);
 	if(!ilEnable(IL_FILE_OVERWRITE))mustard(FAIL);
-	ilClearColour(0,200,0,0);
+	ilClearColour(0,0,0,0);
 	ilGenImages(1, &inPix);
 	inH=true;
 	ilBindImage(inPix);
@@ -80,14 +81,51 @@ void loadnpb(const char *path)
 
 void npbottify0(const char *path)
 {
+	//newdata= new ILubyte[X0*Y0*4];
 	ilGenImages(1, &outPix);
 	outH=true;
-	ilBindImage(outPix);
-	if(!ilTexImage(X0,Y0,1,4,IL_RGBA,IL_UNSIGNED_BYTE,NULL))mustard(OUTPIX_MUSTARD);
-	//ilBindImage(outPix);
-	//if(!ilClearImage())mustard(FAIL);
 	loadnpb(NPBPIX0);
 	ilBindImage(outPix);
+	if(!ilCopyImage(npbPix))mustard(FAIL);
+	//if(!ilTexImage(X0,Y0,1,4,IL_RGBA,IL_UNSIGNED_BYTE,NULL))mustard(OUTPIX_MUSTARD);
+	//if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(OUTPIX_MUSTARD);
+	newdata=ilGetData();
+	for(unsigned long i=0;i<X0;++i)
+	{
+		for(unsigned long j=0;j<Y0;++j)
+		{
+			if((i>=X01+(X02-inX)/2)&&
+			   (i< X01+(X02-inX)/2+inX)&&
+			   (j>=Y01+(Y02-inY)/2)&&
+			   (j< Y01+(Y02-inY)/2+inY))
+			{
+				newdata[4*(i+X0*j)+0]=0xFF;
+				newdata[4*(i+X0*j)+1]=0xFF;
+				newdata[4*(i+X0*j)+2]=0xFF;
+				newdata[4*(i+X0*j)+3]=0xFF;
+			}
+			else if((i>=X01)&&(i<X01+X02)&&
+			        (j>=Y01)&&(j<Y01+Y02))
+			{
+				newdata[4*(i+X0*j)+0]=0x00;
+				newdata[4*(i+X0*j)+1]=0x00;
+				newdata[4*(i+X0*j)+2]=0x00;
+				newdata[4*(i+X0*j)+3]=0xFF;
+			}
+			else
+			{
+				//newdata[4*(i+X0*j)+0]=0xFF;
+				//newdata[4*(i+X0*j)+1]=0xFF;
+				//newdata[4*(i+X0*j)+2]=0xFF;
+				//newdata[4*(i+X0*j)+3]=0x00;
+			}
+		}
+	}
+	//if(!ilSetData(newdata))mustard(OUTPIX_MUSTARD);
+	
+	//printf("%d\n",iCurImage);
+	if(!ilOverlayImage(inPix,X01+(X02-inX)/2,Y0-inY-(Y01+(Y02-inY)/2),0))mustard(FAIL);
+	if(!ilOverlayImage(npbPix,0,0,0))mustard(FAIL);
 	if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
 }
 
@@ -113,7 +151,10 @@ void mustard(int mustard)
 	if(inH)
 		ilDeleteImages(1, &inPix);
 	if(outH)
+	{
 		ilDeleteImages(1, &outPix);
+		//delete[] newdata;
+	}
 	if(npbH)
 		ilDeleteImages(1, &npbPix);
 	exit(mustard);