]> bicyclesonthemoon.info Git - ott/enhance/commitdiff
The slightly bigger than the world's smallest NewpixbOTTification. Animations are...
authorb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Sat, 28 Dec 2013 21:16:46 +0000 (21:16 +0000)
committerb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Sat, 28 Dec 2013 21:16:46 +0000 (21:16 +0000)
git-svn-id: svn://botcastle1b/npb@11 0d794883-4e4e-4f65-aa7a-0e7f5947bab5

npb
npb.cpp

diff --git a/npb b/npb
index 1d5b27ec20c223cc788a429eef587b4d9c9b9537..1ffc8da8755959d97ddecb40ff446ad504fff741 100755 (executable)
Binary files a/npb and b/npb differ
diff --git a/npb.cpp b/npb.cpp
index d9a77696ed586a48dd560c99f5cbfca8d23a7220..eff256644c1a10a3eb00a362249a520a63d49918 100644 (file)
--- a/npb.cpp
+++ b/npb.cpp
@@ -9,9 +9,11 @@
 #define NPBPIX_MUSTARD 3
 #define ARGUMENT_MUSTARD 4
 #define SEAISH_MUSTARD 5
+#define ANIMATED_MUSTARD 6
 #define FAIL 900
 #define OK 0
 
+//npb0.png
 #define X0  411
 #define X01  21
 #define X02  96
 #define Y01 214
 #define Y02  68
 
+//npb1.png
+#define X1  411
+#define X11  22
+#define X12 133
+#define Y1  404
+#define Y11 241
+#define Y12  94
+
 #define NPBPIX0 "npb0.png"
+#define NPBPIX1 "npb1.png"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -27,6 +38,7 @@
 void mustard(int mustard);
 void loadnpb(const char *path);
 void npbottify0(const char *path);
+void npbottify1(const char *path);
 int main (int argc, const char *argv[]);
 
 ILuint inPix, outPix, npbPix;
@@ -60,9 +72,13 @@ int main (int argc, const char *argv[])
        
        inX=ilGetInteger(IL_IMAGE_WIDTH);
        inY=ilGetInteger(IL_IMAGE_HEIGHT);
+       if(ilGetInteger(IL_NUM_IMAGES)>1)
+               mustard(ANIMATED_MUSTARD);
        
        if(inX<=X02&&inY<=Y02)
                npbottify0(argv[2]);
+       else if(inX<=X12&&inY<=Y12)
+               npbottify1(argv[2]);
        else
                mustard(SEAISH_MUSTARD);
        
@@ -129,6 +145,54 @@ void npbottify0(const char *path)
        if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
 }
 
+void npbottify1(const char *path)
+{
+       //newdata= new ILubyte[X0*Y0*4];
+       ilGenImages(1, &outPix);
+       outH=true;
+       loadnpb(NPBPIX1);
+       ilBindImage(outPix);
+       if(!ilCopyImage(npbPix))mustard(FAIL);
+       //if(!ilTexImage(X1,Y1,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<X1;++i)
+       {
+               for(unsigned long j=0;j<Y1;++j)
+               {
+                       if((i>=X11+(X12-inX)/2)&&
+                          (i< X11+(X12-inX)/2+inX)&&
+                          (j>=Y11+(Y12-inY)/2)&&
+                          (j< Y11+(Y12-inY)/2+inY))
+                       {
+                               newdata[4*(i+X1*j)+0]=0xFF;
+                               newdata[4*(i+X1*j)+1]=0xFF;
+                               newdata[4*(i+X1*j)+2]=0xFF;
+                               newdata[4*(i+X1*j)+3]=0xFF;
+                       }
+                       else if((i>=X11)&&(i<X11+X12)&&
+                               (j>=Y11)&&(j<Y11+Y12))
+                       {
+                               newdata[4*(i+X1*j)+0]=0x00;
+                               newdata[4*(i+X1*j)+1]=0x00;
+                               newdata[4*(i+X1*j)+2]=0x00;
+                               newdata[4*(i+X1*j)+3]=0xFF;
+                       }
+                       else
+                       {
+                               //
+                       }
+               }
+       }
+       //if(!ilSetData(newdata))mustard(OUTPIX_MUSTARD);
+       
+       //printf("%d\n",iCurImage);
+       if(!ilOverlayImage(inPix,X11+(X12-inX)/2,Y1-inY-(Y11+(Y12-inY)/2),0))mustard(FAIL);
+       //(!ilOverlayImage(npbPix,0,0,0))mustard(FAIL);
+       if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
+}
+
+
 void mustard(int mustard)
 {
        switch(mustard)
@@ -145,6 +209,8 @@ void mustard(int mustard)
                if(q) printf("npbPIX mustard.\n");break;
        case SEAISH_MUSTARD:
                if(q) printf("Seaishness is mustard.\n");break;
+       case ANIMATED_MUSTARD:
+               if(q) printf("Animation is mustard.\n");break;
        default:
                if (q) printf("Ch*rpin* mustard mustaard!\n");
        }