// // It's NewpixbOTTification Time!
// // Take a picture and add a newpixbot to it!
- // // Requires Dev Image Library
+ // // Requires Dev Image Library, on Pentium III libdevil must be recompiled with --disable-ssl2 --disable-ssl3
// //
// // ~~bicyclesonthemoon
ILboolean outH=false;
ILboolean npbH=false;
ILuint inX, inY;
+ILubyte *newdata;
int main (int argc, const char *argv[])
{
ilInit();
if(!ilEnable(IL_ORIGIN_SET))mustard(FAIL);
if(!ilEnable(IL_FILE_OVERWRITE))mustard(FAIL);
- ilClearColour(0,200,0,0);
+ ilClearColour(0,0,0,0);
ilGenImages(1, &inPix);
inH=true;
ilBindImage(inPix);
void npbottify0(const char *path)
{
+ //newdata= new ILubyte[X0*Y0*4];
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(!ilCopyImage(npbPix))mustard(FAIL);
+ //if(!ilTexImage(X0,Y0,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<X0;++i)
+ {
+ for(unsigned long j=0;j<Y0;++j)
+ {
+ if((i>=X01+(X02-inX)/2)&&
+ (i< X01+(X02-inX)/2+inX)&&
+ (j>=Y01+(Y02-inY)/2)&&
+ (j< Y01+(Y02-inY)/2+inY))
+ {
+ newdata[4*(i+X0*j)+0]=0xFF;
+ newdata[4*(i+X0*j)+1]=0xFF;
+ newdata[4*(i+X0*j)+2]=0xFF;
+ newdata[4*(i+X0*j)+3]=0xFF;
+ }
+ else if((i>=X01)&&(i<X01+X02)&&
+ (j>=Y01)&&(j<Y01+Y02))
+ {
+ newdata[4*(i+X0*j)+0]=0x00;
+ newdata[4*(i+X0*j)+1]=0x00;
+ newdata[4*(i+X0*j)+2]=0x00;
+ newdata[4*(i+X0*j)+3]=0xFF;
+ }
+ else
+ {
+ //newdata[4*(i+X0*j)+0]=0xFF;
+ //newdata[4*(i+X0*j)+1]=0xFF;
+ //newdata[4*(i+X0*j)+2]=0xFF;
+ //newdata[4*(i+X0*j)+3]=0x00;
+ }
+ }
+ }
+ //if(!ilSetData(newdata))mustard(OUTPIX_MUSTARD);
+
+ //printf("%d\n",iCurImage);
+ if(!ilOverlayImage(inPix,X01+(X02-inX)/2,Y0-inY-(Y01+(Y02-inY)/2),0))mustard(FAIL);
+ if(!ilOverlayImage(npbPix,0,0,0))mustard(FAIL);
if(!ilSave(IL_PNG,path))mustard(OUTPIX_MUSTARD);
}
if(inH)
ilDeleteImages(1, &inPix);
if(outH)
+ {
ilDeleteImages(1, &outPix);
+ //delete[] newdata;
+ }
if(npbH)
ilDeleteImages(1, &npbPix);
exit(mustard);