]> bicyclesonthemoon.info Git - ott/enhance/commitdiff
New methods of handling mustard.
authorb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Fri, 27 Dec 2013 22:37:40 +0000 (22:37 +0000)
committerb <b@0d794883-4e4e-4f65-aa7a-0e7f5947bab5>
Fri, 27 Dec 2013 22:37:40 +0000 (22:37 +0000)
Size, generate a nothing.

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

npb
npb.cpp

diff --git a/npb b/npb
index ddcb69fa0b54e9590ca34f0d0088965e1d5aa7e7..c72f199937a383abb315a5e6a07f31abeb0deb5d 100755 (executable)
Binary files a/npb and b/npb differ
diff --git a/npb.cpp b/npb.cpp
index 0d4d3a5904c4f1572d07b0ea41ee78cdb8a0df36..3cd9d19a5eda1fc3732ce798748f190c42dfdd93 100644 (file)
--- a/npb.cpp
+++ b/npb.cpp
 #define INPIX_MUSTARD 1
 #define OUTPIX_MUSTARD 2
 #define NPBPIX_MUSTARD 3
+#define ARGUMENT_MUSTARD 4
+#define SEAISH_MUSTARD 5
+#define FAIL 900
 #define OK 0
 
+#define X0  411
+#define X01  21
+#define X02  96
+#define Y0  404
+#define Y01 214
+#define Y02  68
+
+#define NPBPIX0 "npb0.png"
+
+#include <stdlib.h>
 #include <stdio.h>
 #include <IL/il.h>
+void mustard(int mustard);
+void loadnpb(const char *path);
+void npbottify0(const char *path);
+int main (int argc, const char *argv[]);
+
+ILuint inPix, outPix, npbPix;
+ILboolean q=true;
+ILboolean inH=false;
+ILboolean outH=false;
+ILboolean npbH=false;
+ILuint inX, inY;
+
 int main (int argc, const char *argv[])
 {
-       ILuint inPix, outPix, npbPix;
-       ILubyte q=1;
-       
        if(argc<3)
-       {
-               printf("npb inPix outPix [q]\n");
-               return 0;
-       }
+               mustard(ARGUMENT_MUSTARD);
        if (argc>=4)
        {
                if (argv[3][0]=='q' || argv[3][0]=='Q')
-                       q=0;
+                       q=false;
        }
        
        ilInit();
-       ilEnable(IL_ORIGIN_SET);
+       if(!ilEnable(IL_ORIGIN_SET))mustard(FAIL);
+       if(!ilEnable(IL_FILE_OVERWRITE))mustard(FAIL);
+       ilClearColour(0,200,0,0);
        ilGenImages(1, &inPix);
+       inH=true;
        ilBindImage(inPix);
-       if(!ilLoadImage(argv[1]))
-       {
-               ilDeleteImages(1, &inPix);
-               if(q) printf("Input file mustard\n");
-               return INPIX_MUSTARD;
-       }
+       if(!ilLoadImage(argv[1]))mustard(INPIX_MUSTARD);
+       if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(INPIX_MUSTARD);
+       //if(!ilConvertPal(IL_PAL_RGBA32))mustard(FAIL);
+       
+       inX=ilGetInteger(IL_IMAGE_WIDTH);
+       inY=ilGetInteger(IL_IMAGE_HEIGHT);
+       
+       if(inX<=X02&&inY<=Y02)
+               npbottify0(argv[2]);
+       else
+               mustard(SEAISH_MUSTARD);
        
        //ok
-       if(q) printf("OK\n");
-       ilDeleteImages(1, &inPix);
-       printf("TEST\n");
-       return OK;
+       mustard(0);
 }
+
+void loadnpb(const char *path)
+{
+       ilGenImages(1, &npbPix);
+       npbH=true;
+       ilBindImage(npbPix);
+       if(!ilLoadImage(path))mustard(NPBPIX_MUSTARD);
+       if(!ilConvertImage(IL_RGBA,IL_UNSIGNED_BYTE))mustard(NPBPIX_MUSTARD);
+}
+
+void npbottify0(const char *path)
+{
+       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(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
+}
+
+void mustard(int mustard)
+{
+       switch(mustard)
+       {
+       case 0:
+               if(q) printf("NewpixbOTTified!\n");break;
+       case ARGUMENT_MUSTARD:
+               if(q) printf("npb inPix outPix [q]\n");break;
+       case INPIX_MUSTARD:
+               if(q) printf("inPIX mustard.\n");break;
+       case OUTPIX_MUSTARD:
+               if(q) printf("outPIX mustard.\n");break;
+       case NPBPIX_MUSTARD:
+               if(q) printf("npbPIX mustard.\n");break;
+       case SEAISH_MUSTARD:
+               if(q) printf("Seaishness is mustard.\n");break;
+       default:
+               if (q) printf("Ch*rpin* mustard mustaard!\n");
+       }
+       if(inH)
+               ilDeleteImages(1, &inPix);
+       if(outH)
+               ilDeleteImages(1, &outPix);
+       if(npbH)
+               ilDeleteImages(1, &npbPix);
+       exit(mustard);
+}
+