]> bicyclesonthemoon.info Git - ott/enhance/commitdiff
ALL OF THEM!
authorb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Sat, 28 Dec 2013 23:16:23 +0000 (23:16 +0000)
committerb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Sat, 28 Dec 2013 23:16:23 +0000 (23:16 +0000)
git-svn-id: svn://botcastle1b/npb@13 0d794883-4e4e-4f65-aa7a-0e7f5947bab5

npb
npb.cpp

diff --git a/npb b/npb
index 1ffc8da8755959d97ddecb40ff446ad504fff741..ac27a5b06420aacb259cd826770baea84513825b 100755 (executable)
Binary files a/npb and b/npb differ
diff --git a/npb.cpp b/npb.cpp
index eff256644c1a10a3eb00a362249a520a63d49918..9896f6073037332e827bc4c9ca029b0ff1c53f8c 100644 (file)
--- a/npb.cpp
+++ b/npb.cpp
@@ -13,7 +13,7 @@
 #define FAIL 900
 #define OK 0
 
-//npb0.png
+#define NPBPIX0 "npb0.png"
 #define X0  411
 #define X01  21
 #define X02  96
@@ -21,7 +21,7 @@
 #define Y01 214
 #define Y02  68
 
-//npb1.png
+#define NPBPIX1 "npb1.png"
 #define X1  411
 #define X11  22
 #define X12 133
 #define Y11 241
 #define Y12  94
 
-#define NPBPIX0 "npb0.png"
-#define NPBPIX1 "npb1.png"
+#define NPBPIX2 "npb2.png"
+#define X2  411
+#define X21 213
+#define Y2  404
+#define Y21 234
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <IL/il.h>
+
 void mustard(int mustard);
 void loadnpb(const char *path);
 void npbottify0(const char *path);
 void npbottify1(const char *path);
+void npbottify2(const char *path);
 int main (int argc, const char *argv[]);
 
 ILuint inPix, outPix, npbPix;
@@ -46,7 +51,7 @@ ILboolean q=true;
 ILboolean inH=false;
 ILboolean outH=false;
 ILboolean npbH=false;
-ILuint inX, inY;
+ILuint inX, inY, outX, outY;
 ILubyte *newdata;
 
 int main (int argc, const char *argv[])
@@ -62,7 +67,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,0,0,0);
+       ilClearColour(255,255,0,0);
        ilGenImages(1, &inPix);
        inH=true;
        ilBindImage(inPix);
@@ -80,8 +85,7 @@ int main (int argc, const char *argv[])
        else if(inX<=X12&&inY<=Y12)
                npbottify1(argv[2]);
        else
-               mustard(SEAISH_MUSTARD);
-       
+               npbottify2(argv[2]);    
        //ok
        mustard(0);
 }
@@ -192,6 +196,96 @@ void npbottify1(const char *path)
        if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
 }
 
+void npbottify2(const char *path)
+{
+       unsigned long i,j;
+       outX=(X21+inX+2>X2)?(X21+inX+2):X2;
+       outY=(Y21+inY+2>Y2)?(Y21+inY+2):Y2;
+       ilGenImages(1, &outPix);
+       outH=true;
+       loadnpb(NPBPIX2);
+       newdata=ilGetData();
+       ilBindImage(outPix);
+       if(!ilTexImage(outX,outY,1,4,IL_RGBA,IL_UNSIGNED_BYTE,NULL))mustard(OUTPIX_MUSTARD);
+       if(!ilClearImage())mustard(FAIL);
+       ilSetPixels(outX-X2,0,0,X2,Y2,1,IL_RGBA,IL_UNSIGNED_BYTE,newdata);
+       newdata=ilGetData();
+       for(i=outX-X21-inX-2;i<outX-X21+2;++i)
+       {
+               //printf("i=%lu\n",i);
+               for(j=Y21-2;j<Y21+inY+2;++j)
+               {
+                       //printf("i=%lu j=%lu\n",i,j);
+                       if((i==outX-X21-inX-2)||(i==outX-X21-inX-1)||
+                          (i==outX-X21    +1)||(i==outX-X21      )||
+                          (j==     Y21    -2)||(j==     Y21    -1)||
+                          (j==     Y21+inY+1)||(j==     Y21+inY  ))
+                       {
+                               newdata[4*(i+outX*j)+0]=0x00;
+                               newdata[4*(i+outX*j)+1]=0x00;
+                               newdata[4*(i+outX*j)+2]=0x00;
+                               newdata[4*(i+outX*j)+3]=0xFF;   
+                       }
+                       else
+                       {
+                               newdata[4*(i+outX*j)+0]=0xFF;
+                               newdata[4*(i+outX*j)+1]=0xFF;
+                               newdata[4*(i+outX*j)+2]=0xFF;
+                               newdata[4*(i+outX*j)+3]=0xFF;
+                       }
+               }
+       }
+       
+       if(!ilOverlayImage(inPix,outX-X21-inX,outY-Y21-inY,0))mustard(FAIL);
+       
+       i=outX-X21-inX-2;
+       j=Y21-2;
+       newdata[4*(i+outX*j)+0]=0x00;
+       newdata[4*(i+outX*j)+1]=0x00;
+       newdata[4*(i+outX*j)+2]=0x00;
+       newdata[4*(i+outX*j)+3]=0x00;   
+       j=Y21+inY+1;
+       newdata[4*(i+outX*j)+0]=0x00;
+       newdata[4*(i+outX*j)+1]=0x00;
+       newdata[4*(i+outX*j)+2]=0x00;
+       newdata[4*(i+outX*j)+3]=0x00;   
+       i=outX-X21+1;
+       newdata[4*(i+outX*j)+0]=0x00;
+       newdata[4*(i+outX*j)+1]=0x00;
+       newdata[4*(i+outX*j)+2]=0x00;
+       newdata[4*(i+outX*j)+3]=0x00;   
+       j=Y21-2;
+       newdata[4*(i+outX*j)+0]=0x00;
+       newdata[4*(i+outX*j)+1]=0x00;
+       newdata[4*(i+outX*j)+2]=0x00;
+       newdata[4*(i+outX*j)+3]=0x00;   
+       
+       i=outX-X21-inX;
+       j=Y21;
+       newdata[4*(i+outX*j)+0]=0x00;
+       newdata[4*(i+outX*j)+1]=0x00;
+       newdata[4*(i+outX*j)+2]=0x00;
+       newdata[4*(i+outX*j)+3]=0xFF;   
+       j=Y21+inY-1;
+       newdata[4*(i+outX*j)+0]=0x00;
+       newdata[4*(i+outX*j)+1]=0x00;
+       newdata[4*(i+outX*j)+2]=0x00;
+       newdata[4*(i+outX*j)+3]=0xFF;   
+       i=outX-X21-1;
+       newdata[4*(i+outX*j)+0]=0x00;
+       newdata[4*(i+outX*j)+1]=0x00;
+       newdata[4*(i+outX*j)+2]=0x00;
+       newdata[4*(i+outX*j)+3]=0xFF;   
+       j=Y21;
+       newdata[4*(i+outX*j)+0]=0x00;
+       newdata[4*(i+outX*j)+1]=0x00;
+       newdata[4*(i+outX*j)+2]=0x00;
+       newdata[4*(i+outX*j)+3]=0xFF;
+       
+       if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
+
+       
+}
 
 void mustard(int mustard)
 {