From: b Date: Fri, 27 Dec 2013 22:37:40 +0000 (+0000) Subject: New methods of handling mustard. X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=346d9fce4848d65a7598256cc581e62bc70d0535;p=ott%2Fenhance New methods of handling mustard. Size, generate a nothing. git-svn-id: svn://botcastle1b/npb@8 0d794883-4e4e-4f65-aa7a-0e7f5947bab5 --- diff --git a/npb b/npb index ddcb69f..c72f199 100755 Binary files a/npb and b/npb differ diff --git a/npb.cpp b/npb.cpp index 0d4d3a5..3cd9d19 100644 --- a/npb.cpp +++ b/npb.cpp @@ -7,40 +7,115 @@ #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 #include #include +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); +} +