From 346d9fce4848d65a7598256cc581e62bc70d0535 Mon Sep 17 00:00:00 2001 From: b Date: Fri, 27 Dec 2013 22:37:40 +0000 Subject: [PATCH] New methods of handling mustard. Size, generate a nothing. git-svn-id: svn://botcastle1b/npb@8 0d794883-4e4e-4f65-aa7a-0e7f5947bab5 --- npb | Bin 7845 -> 10224 bytes npb.cpp | 113 ++++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 94 insertions(+), 19 deletions(-) diff --git a/npb b/npb index ddcb69fa0b54e9590ca34f0d0088965e1d5aa7e7..c72f199937a383abb315a5e6a07f31abeb0deb5d 100755 GIT binary patch literal 10224 zcmeHNdvH|Oc|Uh|C0&pZ;$ebg;w+B9GK3XijIqJCKoUr{c*_KA!)2wt(yp`GU3Tw+ zz{m$?EzVm+E^Ln(oZKYutLOY-E3!>B$0do=fx#>!?NCbr`>clK@ zgD8iHx<$KT1Cjv{s0^|I$WI;cqQ{^IO#voR$GAz-F)ZkXY9UArFKS#pxEO>Umn&;x$V>G#cps}b+#+khPpo(WuqzRZ3$ z2^Jem^!1Rp>{H<Z&`jmda2n+95CCt7>L-3S$nuZSfg z62RY<3>W;3$;3`O?P%31+i6WWcDK#&?RKx0Zw&8b{7rV;c5F9NWIW?UI_J)1<`)aA zwSBb}vD0pb+gCTnlL@|PW( zm32@R7LDB6>IugZ!m=Y_Ck#bLCZpsKB_d)~TkDEOYhh?U>b~eWdP*H-KFlR!|2~B_ z)pJ2jEQTTK6A{ShW}q*WV?cf$yaKZMlzZ9GTcojtMA2jsbD+feRb^F9mYU%l(gyyoq^h;48n$=kt5t zamsRwA>DlcnGqrKx6~p;epVfRX`7$L97pLLJqPprEap5)-RN0~S%N5wJvuBgOA_VO zGWvqVEKxK_d_-cFELulAC^1VIWtETamY5}tE+I}y%o0Z%h__43l1E#J*GbG8h^`}U zkeD?Q-Ap`RV%A7>J8@8A)=ZQI8m*C-H55$|3*ZGm-*(_%`p;ip*S;aT8{;oJh@bVF zq7Up3n7Miwd@w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N}+xs);Rj)<`$KQ^xc z1rRIQbtQT;pf^?LT~#e^j5igsvTP}D2|rsK}BpVu{R5Y zqO`rt#yv6nPEiDUVH$8rv5Y;_OAJgvzhJIULpnEH{2rWh80Mqwy$Of?drwAX4{8?? z{W%le8*J&f9qbsOe|E4_WBOqSJEMXA*1@P4hTKe3Js{_)BcCYcoR1FX2@P)tMa&bL zGrt)7M&0ZZdp#iW)l@5zPkf`ulko{`x;^9*0S}`5ni70%ao$m2;BFSvP5LcjO-vB1 z@f^3mb@X=-c(VsL0;_W?<-A*_zuDxW7;ZtGQf#8&{T@2BDW@$OuGp8!tK zGdvaG`IhfDybt3{7>D+@5WDRmUg^;fK&0*{!3yFe4yjDbt|od-_3za7Az02{X(~`m9iQ^PVKrjHJw- zc&aNDHzRf`lQl!Ryuj8y%{PEZaN&*f=fLtMl;jJ8b0on1x}E72&aonrOC)-c#e?LN z#3)sD=rqlxYa3U!nysr__?#hI;PT7b*EBV@n`@RXUDw)ab~ZM(w^D-#o1&@6=mhyJ zBFvUMRyVF{YZg3Yc~?G$h|k_`EWz xE$Ut6;-{R32G664IqLZa7Tk9ie7Z%87X^DP+f0W|JDN*w33la$^JXKf`5$HOq6h#0 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); +} + -- 2.30.2