]> bicyclesonthemoon.info Git - ott/enhance/commitdiff
The world's smallest NewpixbOTTification
authorb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Sat, 28 Dec 2013 20:14:44 +0000 (20:14 +0000)
committerb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Sat, 28 Dec 2013 20:14:44 +0000 (20:14 +0000)
git-svn-id: svn://botcastle1b/npb@9 0d794883-4e4e-4f65-aa7a-0e7f5947bab5

npb
npb.cpp

diff --git a/npb b/npb
index c72f199937a383abb315a5e6a07f31abeb0deb5d..1d5b27ec20c223cc788a429eef587b4d9c9b9537 100755 (executable)
Binary files a/npb and b/npb differ
diff --git a/npb.cpp b/npb.cpp
index 3cd9d19a5eda1fc3732ce798748f190c42dfdd93..d9a77696ed586a48dd560c99f5cbfca8d23a7220 100644 (file)
--- 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);