aebf321998-04-16Mirar (Pontus Hagland) #module Image.image { dnl-----------------------------------------------------------------------
8e781a1998-04-29Mirar (Pontus Hagland) #chapter testsuite
aebf321998-04-16Mirar (Pontus Hagland)  #test Image.PNM.decode, == object img1=Image.PNM.decode("P1\n5 5\n0 1 1 1 1\n1 0 1 1 1\n1 1 0 1 1\n1 1 1 0 1\n1 1 1 1 0"); object img2=Image.PNM.decode("P4\n5 5\nx¸Øèð"); if (img1!=img2) fail("differ\n"); ok(); #test MIME.decode_base64 if ("hejsan, hoppsan" != MIME.decode_base64("aGVqc2FuLCBob3Bwc2Fu\n")) fail("differ"); ok(); #test Image.GIF.decode, MIME.decode_base64, == object img1=Image.GIF.decode(MIME.decode_base64("R0lGODlhBQAFAIAAAAAAAP///ywAAAAABQAFAAACCAxwEWrY8BwoADs=")); object img2=Image.PNM.decode("P4\n5 5\nx\00èØèð"); if (img1!=img2) fail("differ\n"); ok(); dnl----------------------------------------------------------------------- #chapter create #test Image.image() no image object img=Image.image(); if (!img || img->xsize() || img->ysize()) fail("have size"); ok(); #test Image.image() image object img=Image.image(100,100); if (!img || img->xsize()!=100 || img->ysize()!=100) fail("wrong size"); if (img!=0) fail("wrong color"); ok(); #test Image.image() too big int x=1; while ((x<<1)>0) x=(x<<1)+1;
fa6e741998-04-17Mirar (Pontus Hagland)  if (!catch { Image.image(x,2); }) fail(x+"x2 permitted"); if (!catch { Image.image(x/32768,65537); }) fail((x/32768)+"x65537 permitted"); if (!catch { Image.image(x/(32768*3),65537); }) fail((x/(32768*3))+"x65537 permitted");
aebf321998-04-16Mirar (Pontus Hagland)  ok(); #test Image.image() color object img=Image.image(1000,1000,17,42,96); if (!img || img->xsize()!=1000 || img->ysize()!=1000) fail("wrong size"); if (img!=({17,42,96})) fail("wrong color"); ok(); dnl----------------------------------------------------------------------- #chapter testsuite II #test Image.image->test(), == object img=Image.image(10,10);
824cf91999-01-26Mirar (Pontus Hagland)  img=img->test(42);
aebf321998-04-16Mirar (Pontus Hagland)  if (equal(img->max(),({0,0,0}))) fail("failed"); img->setpixel(2,2,0,255,0); if (img==img->invert()) fail("failed"); ok(); dnl----------------------------------------------------------------------- #chapter copy #test Image.image->copy
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(100,100)->test(42);
aebf321998-04-16Mirar (Pontus Hagland)  if (img!=img->copy()) fail("differ"); if (img->copy(25,25,75,75)!=img->copy(25,25,75,75)) fail("subregion differ"); if (img->copy(25,25,75,75)==img) fail("subregion doesn't differ"); img->setpixel(2,2,0,255,0); if (img->copy()==img->invert()->copy()) fail("copy of other doesn't differ"); ok(); #test Image.image->clear
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(100,100)->test(42);
aebf321998-04-16Mirar (Pontus Hagland)  if (img->clear()==img) fail("doesn't differ"); if (img->clear(0,0,0)!=0) fail("wrong color (black)"); if (img->clear(1,255,0)!=({1,255,0})) fail("wrong color (color)"); ok(); #test Image.image->clone
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(100,100)->test(42);
aebf321998-04-16Mirar (Pontus Hagland)  if (img!=img->clone()) fail("differ"); img->setpixel(2,2,0,255,0); if (img->clone()==img->invert()->clone()) fail("clone of other doesn't differ"); ok(); dnl-----------------------------------------------------------------------
8e781a1998-04-29Mirar (Pontus Hagland) #chapter testsuite III
aebf321998-04-16Mirar (Pontus Hagland)  #test equal, copy_value array a=({0,0,0}); array b=copy_value(a); b[0]=17; b[1]=42; b[2]=128; if (!equal( ({0,0,0}), a)) fail("differ (1)"); if (!equal( ({17,42,128}), b)) fail("differ (2)"); ok(); #test Image.image->max() if (!equal( ({0,0,0}), Image.image(10,10,0,0,0)->max() )) fail("erranous (1)"); if (!equal( ({17,42,36}), Image.image(10,10,17,42,36)->max() )) fail("erranous (2)"); if (!equal( ({17,42,36}), Image.image(10,10,0,0,0) ->setpixel(5,5,17,42,36)->max() )) fail("erranous (3)"); if (!equal( ({17,42,36}), Image.image(10,10,0,0,0) ->setpixel(2,2,1,2,3) ->setpixel(3,3,17,42,36) ->setpixel(4,4,3,2,1) ->max())) fail("erranous (4)");
acdcbc1998-04-19Mirar (Pontus Hagland)  if (!equal( ({17,42,36}), Image.image(10,10,0,0,0) ->setpixel(2,2,17,2,3) ->setpixel(3,3,2,42,5) ->setpixel(4,4,3,2,36) ->max())) fail("erranous (5)");
aebf321998-04-16Mirar (Pontus Hagland)  ok(); dnl----------------------------------------------------------------------- #chapter plain #test setpixel, getpixel object img=Image.image(10,10,255,0,0); if (!equal(img->getpixel(5,5),({255,0,0}))) fail("getpixel erranous"); img->setpixel(5,5,1,2,3); if (!equal(img->getpixel(5,5),({1,2,3}))) fail("failed"); ok(); #test setpixel alpha object img=Image.image(10,10,255,0,0); img->setpixel(5,5,0,255,0,127); if (!equal(img->getpixel(5,5),({127,128,0}))) fail("failed"); ok(); #test Image.image->line structure object img=Image.image(100,100,0,0,0); foreach (({40,50,60}),int z) { img->line(50-z,0,50,50,255,255,255); img->line(50-z,100,50,50,255,255,255);
5d0a351998-04-19Mirar (Pontus Hagland)  img->line(100,50+z,50,50,255,255,255);
aebf321998-04-16Mirar (Pontus Hagland)  img->line(100,50-z,50,50,255,255,255); } object img1=Image.GIF.decode(MIME.decode_base64(
5d0a351998-04-19Mirar (Pontus Hagland)  "R0lGODlhZABkAIAAAAAAAP///ywAAAAAZABkAAAC/wxwiGC7/l6UktZ6Mdatdr9toSiSZQmCjPihqPu+MdLST23Lsr7vGF7DrXw+YhEF3AiFx2NTFiwtnU5qMYpUVqvbrAT7/XG5Y3HYfD6TyWsw+vZms68qaTw3n/tazE/AvcCkpwcH95OkFkhIaGdYdwfIyDikePeIVzk5yacFdUmpOcfpIUiaiBnK5Wfp6YiaerT6SecKCrtX++o0mnnb+vrHyKvr+xgpKttbbDxLmGy77Hi86VoK28FnrfesTY3a7VwdjTc8HowJToZ9Ok6unLoemA6fOR+L3u5Fab/T8JzfaR89UPyKnYsnjFzBaP6IVWnoEGAjiKLcSXyYY6EihP8Xd2VkY8Cfxo7BKN4z2RHkCn4hI6Y8CS0LypcVW/ZbOZImCJsvSuq85hMJz5/wzrEYSrRonz85kwoFYtSpwagMqEr1xfRG06u4aGzliusrWFpjASIta1Ae2qnYrK51RjXr201u5c5FttTt3X561YqVmtVa0L2ezooxTDgM4sNVE2tZ/Njl25Ysh/zNF7SgzcsMP6qzzPkWxJEUQ4caHU4gWtQJVXM9+E7lPtOq6g38RxNhaJO0u7oeSFCn7mUc+07t1ft3zLTI23Fcfk0cZmXJg8cmTp02N5K5OEctN/3d33LVWXT3Rv0nbuM3a5XvmQv6r2+A47ME/35+zHmR8rdPj82eeM2ox45k/a1WoHwHrgWeLlYhwmCC31ni32cJWkYhYdM4yAqCEmboGDTdTBGiiPB1eNeGy1UIXHwrljjLNCxi9UYfMAZkiI034hhIAQA7"));
aebf321998-04-16Mirar (Pontus Hagland)  if (img!=img1) fail("differ"); ok();
acdcbc1998-04-19Mirar (Pontus Hagland) #test Image.image->line color
aebf321998-04-16Mirar (Pontus Hagland)  object img=Image.image(100,100,0,0,0); img->line(40,0,0,40); if (!equal( ({0,0,0}), img->max() )) fail("differ (reset)"); img->line(10,10,20,20,128,13,42); if (!equal( ({128,13,42}), img->max() )) fail("differ (direct)"); img->setcolor(200,19,99); img->line(30,20,20,30); if (!equal( ({200,19,99}), img->max() )) fail("differ (setcolor)"); ok();
5d0a351998-04-19Mirar (Pontus Hagland) #test Image.image->box structure object img=Image.image(100,100,0,0,0); foreach (({40,60,50}),int z) { img->box(z,0,50,50,255,z,255); img->box(z,100,50,50,255,z,0); img->box(100,z,50,50,0,z,255); img->box(0,z,50,50,0,z,0); } object img1=Image.GIF.decode(MIME.decode_base64( "R0lGODlhZABkALMAAAAAAAAyAAA8AAAoAP8oAP8yAAAo/wAy/wA8//88AP8o//8y//88/wAAAAAAAAAAACwAAAAAZABkAAME/xAAOWe1Fue8OVAKGIbhwjAniqKe17ouHMcznZEkbq7rats/IFA4nORypV6PVSw2nU4bErlb+qJRbDY7zVWtjO1WPKZ1SV9rubxmf86K9NLtpkfhcfC1XudL4XI9fX2DZoB6TISEijeHiIuLkBZ4gXuRkYSUiGGYmJmOep6efZqPo6NspaGoqGOqYK2tW69qsrJOtHO3t0O5gry8f2eVicHBHr6Wx8eToLDMzI3Dm9HRzdOm1tHJxdrB3Jzex+DizOTl38616Lfn7LLu76jx8p709ZH3+J/Yq/uY+v65CSiwDMGCs9TpYjZgQEOHDiFGjDiRIkWLFy9mJMbAgAGPH/8/hhQpkmTJkidRatS4kiVLly8HcESJkmbNmjdLxoy5kydPhzNx4hQ6dOjPn0eRUgxatGjTokqVRuXJ1KlTqyqlStWqserVq18NbN06dukmsGDRfiRLlq3Ms2nTgm3blqxXuXJr1q0r9W7evCIDBBA8eHBhw4YRJ068mDFjxwEOHJA8eXJly5YxZ868mTNnzgIEhBYtmnTp0qdRo1a9enXrAggQxJYtm3bt2rdx49a9e/du166BBw8+nLgA2L59J1eunLly48ahR48uGnnz5texY8dNnXp376itb98+njx38ODRGxdv3nz75unTxw/O3r17++fly9df/f59/77tt5/lgMf995+BtQ044H71HXggeQsumF6DDz7YnDYEEJChhhpqWEACCYAYYoghIrRIhx2i+CGJJJJoIiEppuhhiy2W+GIdMsq4Yo0u3uhGjinuyGMCPv4I5IxD2ljkGEcimeSSZTRJgJA8Qslkk1TWaOUWUmbZ4pZZdJmkkmAOIeaYZTpx5pNpmonlmES2CcSaQ8o555to2kkDnVXqGQOfWvrpAqBfCuoBoT0amgGiZCoKAKNxOjoBpJJaQGmlj+LJZqWXcqppnZh2KqmojpKqqKmGoiqoqn6yqqerdsIqp6xt0pqmrYtEAAA7")); if (img!=img1) fail("differ"); ok(); #test Image.image->box color object img=Image.image(100,100,0,0,0); img->box(40,0,0,40); if (!equal( ({0,0,0}), img->max() )) fail("differ (reset)"); img->box(10,10,20,20,128,13,42); if (!equal( ({128,13,42}), img->max() )) fail("differ (direct)"); img->setcolor(200,19,99); img->box(30,20,20,30); if (!equal( ({200,19,99}), img->max() )) fail("differ (setcolor)"); ok(); dnl----------------------------------------------------- #chapter advanced drawing
acdcbc1998-04-19Mirar (Pontus Hagland) #test Image.image->polyfill 1 (right triangle 0.0, 0.2) object img=Image.image(100,100,0,0,0); float x=0,y=0.2; img->setcolor(255,254,253); img->polygone(({10+x,15+y,15+x,10+y,15+x,15+y}), ({20+x,15+y,25+x,15+y,20+x,10+y}), ({10+x,20+y,15+x,20+y,15+x,25+y}), ({20+x,25+y,25+x,20+y,20+x,20+y}), ({30+2*10+x,15+y,30+2*15+x,10+y,30+2*15+x,15+y}), ({30+2*20+x,15+y,30+2*25+x,15+y,30+2*20+x,10+y}), ({30+2*10+x,20+y,30+2*15+x,20+y,30+2*15+x,25+y}), ({30+2*20+x,25+y,30+2*25+x,20+y,30+2*20+x,20+y}), ({10+x,30+2*15+y,15+x,30+2*10+y,15+x,30+2*15+y}), ({20+x,30+2*15+y,25+x,30+2*15+y,20+x,30+2*10+y}), ({10+x,30+2*20+y,15+x,30+2*20+y,15+x,30+2*25+y}), ({20+x,30+2*25+y,25+x,30+2*20+y,20+x,30+2*20+y})); object img1=Image.GIF.decode(MIME.decode_base64( "R0lGODlhZABkAMQAAAAAAAICAgUFBQoKChYWFigoKC0tLTAwMDIyMjMyMj8/P1lYWFFRUHJycXp5eYyLi6OioaWlpK2srLW0s8vLyszLytbV1Ojn5vTz8vn49/z7+v/+/QAAAAAAAAAAAAAAACwAAAAAZABkAAQF/yAAiONYmiaapivLuu8byzJd1zeO6/ve+z5gMDgkEo3HY1KpZDabTyhUOp1WrVZsNrvlcr3fb1gsJpfLZzRafWSw3Osd4bF7EOLtDCsDx6fmGBs7Gxh2fjgMGYIpG3yHAIAbG4s1k4SGjyaJkyyTjnGRlpQyopd3j5ucjJ59X6Glg6WmhwYICLYst7cGaAW6uro7wMAIBZmZx8jIysvLzc7O0GUOFBTVLNbWDmgKE9nZ1jvg4BMKhwISlp2TEgJrAw0XsrGiFw0DmeiqJuzuePDy1OGod8+Zvk7tMgHcR2qDPXzRAKBjkXAZwB0PI6bwZ4KjM4g1QGrUOJIkSZMnT+6mVKmSZcuWL2HClDlzZk2bNnHmzLmTJ0+fP38GFSqUaNGiR5EiVbp0aVOnTqFGjTqV6hdjKbBadRaBRdetywpoYKFBK9hDEUYB2PD1rB+xajeUdesnbVy2dOPAvTs3bxm7d/H6vapBIL9JfQdbARxYsOIpBxIkkMxi8uQDjx9n1qyZc+fOn0GDFj169CMI4LBlg2D6yAJR6yYtaE0kgAXDIyxZCECbyGuGa2X3rn377u7hvoELRx7EdtzjzIO87jQ7enMLLKBb91HdRPftO3inEA8efHnz5tGnT7+ePXv379/Hly+ffv369/HjPxQCADs="));
3139761998-04-30Mirar (Pontus Hagland)  if (!(img-img1<16)) fail("differ too much");
acdcbc1998-04-19Mirar (Pontus Hagland)  if (!equal(img->max(),({255,254,253}))) fail("wrong maxcolor"); ok(); #test Image.image->polyfill 2 (right triangle -0.2, -0.2) object img=Image.image(100,100,0,0,0); float x=-0.2,y=-0.2; img->setcolor(255,254,253); img->polygone(({10+x,15+y,15+x,10+y,15+x,15+y}), ({20+x,15+y,25+x,15+y,20+x,10+y}), ({10+x,20+y,15+x,20+y,15+x,25+y}), ({20+x,25+y,25+x,20+y,20+x,20+y}), ({30+2*10+x,15+y,30+2*15+x,10+y,30+2*15+x,15+y}), ({30+2*20+x,15+y,30+2*25+x,15+y,30+2*20+x,10+y}), ({30+2*10+x,20+y,30+2*15+x,20+y,30+2*15+x,25+y}), ({30+2*20+x,25+y,30+2*25+x,20+y,30+2*20+x,20+y}), ({10+x,30+2*15+y,15+x,30+2*10+y,15+x,30+2*15+y}), ({20+x,30+2*15+y,25+x,30+2*15+y,20+x,30+2*10+y}), ({10+x,30+2*20+y,15+x,30+2*20+y,15+x,30+2*25+y}), ({20+x,30+2*25+y,25+x,30+2*20+y,20+x,30+2*20+y})); object img1=Image.GIF.decode(MIME.decode_base64( "R0lGODlhZABkANUAAAAAAAICAgUFBQcHBwoKChQUFBYWFh4eHiMjIyYmJS0tLTAwMDMyMigoKFFRUFlYWHp5eX9+fnJycYyLi56dnDIyMqOioaWlpMHBwMvLyszLytHQz9bV1Orp6Ojn5vTz8vz7+v/+/QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAZABkAAUG/0AAQDgcFo1GZDK5ZDKdz2dUKqVWq1csVrvddr1ecDg8JpPN53NarWa32284XD6f1+12fD6/5/P9f3+BgoKEhYVqAkmKiGQEWAMBjW0FFEkMEZNYBhMYWBUcD5KaWwUbGZchmaRGnB8hqFUVISGho6xJprCpqqyutLuywLWiuEO6wUMMwKuIv8OxUrPDxLeTAhQZGRkWSQ3b2w6FAQ8Y4ODcWN/o4BYNxsbw8fHz9PT29/f5ggIMDP7vjBD49w/BuAUECf4LKGWgQoUHWEUAFg3AMlodFCBqcAEEtWRPplHzIOGRRFoVL2bUxNEjxU8jS9KbmDLESlYtUcKkRdLkvf8IKW8aa1mRyaye+pKIM4JAo74GELAkkJk0aVWrVrFmzbqVK1evX7+GFSuWbNmyZ9GiVbt2bVu3buHGjTuXLl27d+/m1auXb9++fwEDFjx4cGHDhvlYs5b43oMkCxg2jmfAkxEGFybfm5AShGTNmgx8qJkZNKsJIJd5Nh36Vc0QpVkjQp2a1mrZgkTrvAwsNu48tGvb/vxbDQFz27oZWbctavHiz6FDlz59enXr1rFnz152QIUK3yUTAA8+AfczATi85A1MwvkzD9YrA+bB5/st6XfPp+X+Ppn4wtXnHxn5vdbfgGHEV5OACIaRXk0HNujFAykxKKEXASinTIQXbiEk2QH2ddihiCOOWKKJJqKYYoorssiiiy++GKOMMtJYY4034hYEADs="));
3139761998-04-30Mirar (Pontus Hagland)  if (!(img-img1<16)) fail("differ too much");
acdcbc1998-04-19Mirar (Pontus Hagland)  if (!equal(img->max(),({255,254,253}))) fail("wrong maxcolor"); ok();
0e756f1999-05-24Mirar (Pontus Hagland) dnl----------------------------------------------------- #chapter Image.Font #test instansiating default font if (!objectp(Image.Font())) fail("not object"); ok(); #test writing simple text with default font object f=Image.Font(); object i=f->write("hej"); if (i!=Image.PNM.decode(MIME.decode_base64("UDQKMTkgMTEK///gv/7gv//grzjglt7gth7gtv7gtv7gtx7g//7g//Hg"))) fail("incorrect"); ok(); #test writing multiple lines with default font object f=Image.Font(); object i=f->write("h","o"); if (i!=Image.PNM.decode(MIME.decode_base64("UDQKNyAyMwr+vr6ulra2trb+/v7+/s62tra2zv7+/g=="))) fail("incorrect"); ok();
acdcbc1998-04-19Mirar (Pontus Hagland) 
3139761998-04-30Mirar (Pontus Hagland)  dnl-----------------------------------------------------
0e756f1999-05-24Mirar (Pontus Hagland) #chapter Image.Colortable
3139761998-04-30Mirar (Pontus Hagland) 
ccedb81999-05-24Mirar (Pontus Hagland) #test colortable - black/white init & cast object c=Image.Colortable(({Image.Color.white,Image.Color.black})); array z=(array)c; if (sizeof(z)!=2) fail("didn't get two colors (black and white): "+((array(string))c)*", "); if ((z[0]!=Image.Color.black || z[1]!=Image.Color.white) && (z[1]!=Image.Color.black || z[0]!=Image.Color.white))
b277341999-06-14Mirar (Pontus Hagland)  fail("didn't get black and white: "+((array(string))z)*", ");
ccedb81999-05-24Mirar (Pontus Hagland)  ok(); #test colortable - black/white normal object img=Image.image(100,100)->test(43); object c=Image.Colortable(({Image.Color.white,Image.Color.black})); img=c*img; array z=(array)Image.Colortable(img); if (sizeof(z)!=2)
b277341999-06-14Mirar (Pontus Hagland)  fail("didn't get two colors (black and white): "+((array(string))z)*", "); if ((z[0]!=Image.Color.black || z1]!=Image.Color.white) &&
ccedb81999-05-24Mirar (Pontus Hagland)  (z[1]!=Image.Color.black || z[0]!=Image.Color.white))
b277341999-06-14Mirar (Pontus Hagland)  fail("didn't get black and white: "+((array(string))z)*", ");
ccedb81999-05-24Mirar (Pontus Hagland)  ok(); #test colortable - black/white floyd-steinberg object img=Image.image(100,100)->test(43); object c=Image.Colortable(({Image.Color.white,Image.Color.black})); c->floyd_steinberg(); img=c*img; array z=(array)Image.Colortable(img); if (sizeof(z)!=2)
b277341999-06-14Mirar (Pontus Hagland)  fail("didn't get two colors (black and white): "+((array(string))z)*", ");
ccedb81999-05-24Mirar (Pontus Hagland)  if ((z[0]!=Image.Color.black || z[1]!=Image.Color.white) && (z[1]!=Image.Color.black || z[0]!=Image.Color.white))
b277341999-06-14Mirar (Pontus Hagland)  fail("didn't get black and white: "+((array(string))z)*", ");
ccedb81999-05-24Mirar (Pontus Hagland)  ok(); #test colortable - black/white ordered object img=Image.image(100,100)->test(43); object c=Image.Colortable(({Image.Color.white,Image.Color.black})); c->ordered(); img=c*img; array z=(array)Image.Colortable(img); if (sizeof(z)!=2)
b277341999-06-14Mirar (Pontus Hagland)  fail("didn't get two colors (black and white): "+((array(string))z)*", ");
ccedb81999-05-24Mirar (Pontus Hagland)  if ((z[0]!=Image.Color.black || z[1]!=Image.Color.white) && (z[1]!=Image.Color.black || z[0]!=Image.Color.white))
b277341999-06-14Mirar (Pontus Hagland)  fail("didn't get black and white: "+((array(string))z)*", ");
ccedb81999-05-24Mirar (Pontus Hagland)  ok();
3139761998-04-30Mirar (Pontus Hagland) #test colortable - standard
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(200,200)->test(42);
3139761998-04-30Mirar (Pontus Hagland)  img->tuned_box(50,50,150,150,({({0,0,0}),({255,0,0}),({0,255,0}),({0,0,255})}));
521e5c1999-04-17Henrik Grubbström (Grubba)  object c=Image.Colortable(img,1000)->cubicles(16,16,16,4);
3139761998-04-30Mirar (Pontus Hagland)  if (sizeof(c)<200) fail("too few colors"); object img1=(c*img);
c742a51998-04-30Mirar (Pontus Hagland)  if (!(img-img1<50)) fail("differ too much ("+(img-img1)->max()[0]+","+(img-img1)->max()[1]+","+(img-img1)->max()[2]+","+")");
3139761998-04-30Mirar (Pontus Hagland)  ok(); #test colortable - floyd-steinberg
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(200,200)->test(42);
3139761998-04-30Mirar (Pontus Hagland)  img->tuned_box(50,50,150,150,({({0,0,0}),({255,0,0}),({0,255,0}),({0,0,255})}));
521e5c1999-04-17Henrik Grubbström (Grubba)  object c=Image.Colortable(32,32,32)->floyd_steinberg();
3139761998-04-30Mirar (Pontus Hagland)  object img1=(c*img);
c742a51998-04-30Mirar (Pontus Hagland)  if (!(img-img1<50)) fail("differ too much ("+(img-img1)->max()[0]+","+(img-img1)->max()[1]+","+(img-img1)->max()[2]+","+")");
3139761998-04-30Mirar (Pontus Hagland)  ok(); #test colortable - ordered
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(200,200)->test(42);
3139761998-04-30Mirar (Pontus Hagland)  img->tuned_box(50,50,150,150,({({0,0,0}),({255,0,0}),({0,255,0}),({0,0,255})}));
521e5c1999-04-17Henrik Grubbström (Grubba)  object c=Image.Colortable(32,32,32)->ordered();
3139761998-04-30Mirar (Pontus Hagland)  object img1=(c*img); if (!(img-img1<32)) fail("differ too much ("+(img-img1)->max()[0]+","+(img-img1)->max()[1]+","+(img-img1)->max()[2]+","+")"); ok(); dnl----------------------------------------------------- #chapter encoding/decoding #test Image.PNM.encode/decode
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(100,100)->test(40);
3139761998-04-30Mirar (Pontus Hagland)  object img1=Image.PNM.decode(Image.PNM.encode(img)); if (img!=img1) fail("differ"); ok(); #test Image.GIF.encode/decode
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(100,100)->test(41);
521e5c1999-04-17Henrik Grubbström (Grubba)  object c=Image.Colortable(img,250)->cubicles(10,10,10,1)->floyd_steinberg();
c742a51998-04-30Mirar (Pontus Hagland)  img=c*img;
3139761998-04-30Mirar (Pontus Hagland)  object img1=Image.GIF.decode(Image.GIF.encode(img));
c742a51998-04-30Mirar (Pontus Hagland)  if (img!=img1) fail("differ ("+(img-img1)->max()[0]+","+(img-img1)->max()[1]+","+(img-img1)->max()[2]+","+")"); ok(); #test Image.GIF.encode/decode colortable
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(100,100)->test(42);
521e5c1999-04-17Henrik Grubbström (Grubba)  object c=Image.Colortable(img,256)->cubicles(16,16,16,1);
c742a51998-04-30Mirar (Pontus Hagland)  img=c*img; object img1=Image.GIF.decode(Image.GIF.encode(img,c)); if (img!=img1) fail("differ ("+(img-img1)->max()[0]+","+(img-img1)->max()[1]+","+(img-img1)->max()[2]+","+")");
3139761998-04-30Mirar (Pontus Hagland)  ok(); #test Image.GIF.encode/decode colortable w/ floyd-steinberg
824cf91999-01-26Mirar (Pontus Hagland)  object img=Image.image(100,100)->test(43);
521e5c1999-04-17Henrik Grubbström (Grubba)  object c=Image.Colortable(img,256)->floyd_steinberg()->cubicles(16,16,16);
c742a51998-04-30Mirar (Pontus Hagland)  img=c*img;
3139761998-04-30Mirar (Pontus Hagland)  object img1=Image.GIF.decode(Image.GIF.encode(img,c)); if (!(img-img1<50)) fail("differ too much ("+(img-img1)->max()[0]+","+(img-img1)->max()[1]+","+(img-img1)->max()[2]+","+")"); ok();
ccedb81999-05-24Mirar (Pontus Hagland) #test Image.AVS.encode/decode object img=Image.image(100,100)->test(43); if (Image.AVS.decode(Image.AVS.encode(img))!=img) fail("differ"); ok(); #test Image.BMP.encode/decode (truecolor) object img=Image.image(100,100)->test(43); if (Image.BMP.decode(Image.BMP.encode(img))!=img) fail("differ"); ok();
1442e01999-06-01Mirar (Pontus Hagland) 
ccedb81999-05-24Mirar (Pontus Hagland) #test Image.BMP.encode/decode (8bpp) object img=Image.image(100,100)->test(43); object c=Image.Colortable(img,256); img=c*img;
1442e01999-06-01Mirar (Pontus Hagland)  if (Image.BMP.decode(Image.BMP.encode(img,(["bpp":8])))!=img) fail("differ");
ccedb81999-05-24Mirar (Pontus Hagland)  ok(); #test Image.BMP.encode/decode (4bpp) object img=Image.image(100,100)->test(43); object c=Image.Colortable(img,16); img=c*img;
1442e01999-06-01Mirar (Pontus Hagland)  if (Image.BMP.decode(Image.BMP.encode(img,(["bpp":4])))!=img) fail("differ");
ccedb81999-05-24Mirar (Pontus Hagland)  ok(); #test Image.BMP.encode/decode (1bpp) object img=Image.image(100,100)->test(43);
1442e01999-06-01Mirar (Pontus Hagland)  object c=Image.Colortable(img,2)->floyd_steinberg();
ccedb81999-05-24Mirar (Pontus Hagland)  img=c*img;
1442e01999-06-01Mirar (Pontus Hagland)  if (Image.BMP.decode(Image.BMP.encode(img,(["bpp":1])))!=img) fail("differ"); ok(); #test Image.BMP.encode/decode (8bpp rle first) object img=Image.image(400,100,Image.Color.red); img->line(0,0,0,99,Image.Color.green); img->line(399,0,399,99,Image.Color.blue); object c=Image.Colortable(img,256); img=c*img; if (Image.BMP.decode(Image.BMP.encode(img,(["bpp":8,"rle":1])))!=img) fail("differ"); ok(); #test Image.BMP.encode/decode (4bpp rle first) object img=Image.image(400,100,Image.Color.red); img->line(0,0,0,99,Image.Color.green); img->line(399,0,399,99,Image.Color.blue); object c=Image.Colortable(img,16); img=c*img; if (Image.BMP.decode(Image.BMP.encode(img,(["bpp":4,"rle":1])))!=img) fail("differ"); ok(); #test Image.BMP.encode/decode (8bpp rle second) object img=Image.image(100,100)->test(99)->scale(400,100); object c=Image.Colortable(img,256); img=c*img; if (Image.BMP.decode(Image.BMP.encode(img,(["bpp":8,"rle":1])))!=img) fail("differ"); ok(); #test Image.BMP.encode/decode (4bpp rle second) object img=Image.image(100,100)->test(99)->scale(400,100); object c=Image.Colortable(img,16); img=c*img; if (Image.BMP.decode(Image.BMP.encode(img,(["bpp":4,"rle":1])))!=img) fail("differ");
ccedb81999-05-24Mirar (Pontus Hagland)  ok(); #test Image.HRZ.encode/decode object img=Image.image(256,240)->test(43); img=Image.Colortable( ({"white","black","red","green"}) )*img; if (Image.HRZ.decode(Image.HRZ.encode(img))!=img) fail("differ"); ok(); #test Image.ILBM.encode/decode (4bpp) object img=Image.image(100,100)->test(43); object c=Image.Colortable(img,16); img=c*img; if (Image.ILBM.decode(Image.ILBM.encode(img))!=img) fail("differ"); ok(); #test Image.PCX.encode/decode object img=Image.image(100,100)->test(43); if (Image.PCX.decode(Image.PCX.encode(img))!=img) fail("differ"); ok(); #test Image.PNM.encode/decode object img=Image.image(100,100)->test(43); if (Image.PNM.decode(Image.PNM.encode(img))!=img) fail("differ"); ok(); #test Image.TGA.encode/decode object img=Image.image(100,100)->test(43); if (Image.TGA.decode(Image.TGA.encode(img))!=img) fail("differ"); ok(); #test Image.XBM.encode/decode object img=Image.image(100,100)->test(43); object c=Image.Colortable(({Image.Color.white,Image.Color.black})); img=c*img; if (Image.XBM.decode(Image.XBM.encode(img))!=img) fail("differ"); ok();
d8e7361999-05-24Mirar (Pontus Hagland) dnl #test Image.XCF.decode (no crash) dnl #if constant(Image.XCF.decode) dnl object img=Image.image(100,100)->test(43); dnl Image.XCF.decode(); dnl #else dnl werror(" (Image.XCF not available) "); dnl #endif dnl ok(); #test Image.XPM.encode/decode (16 colors) #if constant(Image.XPM.encode) object img=Image.image(100,100)->test(43); object c=Image.Colortable(img,16); img=c*img; if (Image.XPM.decode(Image.XPM.encode(img,(["colortable":c])))!=img) fail("differ"); #else werror(" (Image.XPM not available) "); #endif ok(); #test Image.XPM.encode/decode (4096 colors) #if constant(Image.XPM.encode) object img=Image.image(100,100)->test(43); object c=Image.Colortable(16,16,16); img=c*img; if (Image.XPM.decode(Image.XPM.encode(img,(["colortable":c])))!=img) fail("differ"); #endif ok(); #test Image.TIFF.encode/decode #if constant(Image.TIFF.encode) object img=Image.image(100,100)->test(43); if (Image.TIFF.decode(Image.TIFF.encode(img))!=img) fail("differ"); #else werror(" (Image.TIFF not available) "); #endif ok(); #test Image.XFace.encode/decode #if constant(Image.XFace.encode) object img=Image.image(48,48)->test(43); object c=Image.Colortable(({Image.Color.white,Image.Color.black})); c->floyd_steinberg(); img=c*img; if (Image.XFace.decode(Image.XFace.encode(img))!=img) fail("differ"); #else werror(" (Image.XFace not available) "); #endif ok(); #test Image.JPEG.encode/decode #if constant(Image.JPEG.encode) object img=Image.image(100,100)->test(43); object img1=Image.JPEG.decode(Image.JPEG.encode(img,(["quality":100]))); if (!(img-img1<10)) fail("differ too much ("+(img-img1)->max()[0]+","+(img-img1)->max()[1]+","+(img-img1)->max()[2]+","+")"); #else werror(" (Image.JPEG not available) "); #endif ok();
ccedb81999-05-24Mirar (Pontus Hagland) 
fd77911999-01-23Mirar (Pontus Hagland) dnl-----------------------------------------------------
521e5c1999-04-17Henrik Grubbström (Grubba) #chapter Image.Color
fd77911999-01-23Mirar (Pontus Hagland) 
521e5c1999-04-17Henrik Grubbström (Grubba) #test Image.Color
fd77911999-01-23Mirar (Pontus Hagland)  foreach ( ({ ({ "black", ({ 0, 0, 0 }), ({ 0, 0, 0 }), 0 }), ({ "blue", ({ 0, 0, 255 }), ({ 170, 255, 255 }), 41 }),
824cf91999-01-26Mirar (Pontus Hagland)  ({ "cyan", ({ 0, 255, 255 }), ({ 127, 255, 255 }), 168 }),
fd77911999-01-23Mirar (Pontus Hagland)  ({ "green", ({ 0, 255, 0 }), ({ 85, 255, 255 }), 127 }),
824cf91999-01-26Mirar (Pontus Hagland)  ({ "magenta", ({ 255, 0, 255 }), ({ 212, 255, 255 }), 128 }),
fd77911999-01-23Mirar (Pontus Hagland)  ({ "red", ({ 255, 0, 0 }), ({ 0, 255, 255 }), 87 }), ({ "white", ({ 255, 255, 255 }), ({ 0, 0, 255 }), 255 }),
824cf91999-01-26Mirar (Pontus Hagland)  ({ "yellow", ({ 255, 255, 0 }), ({ 42, 255, 255 }), 214 }) }),
fd77911999-01-23Mirar (Pontus Hagland)  array i) {
521e5c1999-04-17Henrik Grubbström (Grubba)  object c1=Image.Color(i[0]); object c2=Image.Color(@i[1]); object c3=Image.Color.rgb(@i[1]);
fd77911999-01-23Mirar (Pontus Hagland)  if (c1!=c2) fail("color "+i[0]+" (rgb="+i[1][0]+","+i[1][1]+","+i[1][2]+ ", hsv="+i[2][0]+","+i[2][1]+","+i[2][2]+") failed; " "by values != by name"); if (c1!=c3) fail("color "+i[0]+" (rgb="+i[1][0]+","+i[1][1]+","+i[1][2]+ ", hsv="+i[2][0]+","+i[2][1]+","+i[2][2]+") failed; " "by rgb() != by name|values"); if (c1->r!=i[1][0] || c1->g!=i[1][1] || c1->b!=i[1][2]) fail("color "+i[0]+" (rgb="+i[1][0]+","+i[1][1]+","+i[1][2]+ ", hsv="+i[2][0]+","+i[2][1]+","+i[2][2]+") failed; " "wrong ->r("+c1->r+"), ->g, ->b reported"); if (c1->rgb()[0]!=i[1][0] || c1->rgb()[1]!=i[1][1] || c1->rgb()[2]!=i[1][2]) fail("color "+i[0]+" (rgb="+i[1][0]+","+i[1][1]+","+i[1][2]+ ", hsv="+i[2][0]+","+i[2][1]+","+i[2][2]+") failed; " "wrong ->rgb() (" +c1->rgb()[0]+","+c1->rgb()[1]+","+c1->rgb()[2]+") reported"); if (c1->hsv()[0]!=i[2][0] || c1->hsv()[1]!=i[2][1] || c1->hsv()[2]!=i[2][2]) fail("color "+i[0]+" (rgb="+i[1][0]+","+i[1][1]+","+i[1][2]+ ", hsv="+i[2][0]+","+i[2][1]+","+i[2][2]+") failed; " "wrong ->hsv() (" +c1->hsv()[0]+","+c1->hsv()[1]+","+c1->hsv()[2]+") reported"); if (c1->greylevel()!=i[3]) fail("color "+i[0]+" (rgb="+i[1][0]+","+i[1][1]+","+i[1][2]+ ", hsv="+i[2][0]+","+i[2][1]+","+i[2][2]+") failed; " "wrong ->greylevel() ("+c1->greylevel()+", should be " +i[3]+") reported"); if (c1->grey()->r!=i[3]) fail("color "+i[0]+" (rgb="+i[1][0]+","+i[1][1]+","+i[1][2]+ ", hsv="+i[2][0]+","+i[2][1]+","+i[2][2]+") failed; " "wrong ->grey()->r ("+c1->grey()->r+", should be " +i[3]+") reported"); }; ok();
521e5c1999-04-17Henrik Grubbström (Grubba) #test indices(Image.Color) if (!arrayp(indices(Image.Color)))
fd77911999-01-23Mirar (Pontus Hagland)  fail("wrong type\n");
521e5c1999-04-17Henrik Grubbström (Grubba)  if (!stringp(indices(Image.Color)[0]))
fd77911999-01-23Mirar (Pontus Hagland)  fail("wrong type of elements\n");
521e5c1999-04-17Henrik Grubbström (Grubba)  if (sizeof(indices(Image.Color))<8)
fd77911999-01-23Mirar (Pontus Hagland)  fail("too few colors\n"); ok();
521e5c1999-04-17Henrik Grubbström (Grubba) #test values(Image.Color) if (!arrayp(values(Image.Color)))
fd77911999-01-23Mirar (Pontus Hagland)  fail("wrong type\n");
521e5c1999-04-17Henrik Grubbström (Grubba)  if (!objectp(values(Image.Color)[0]))
fd77911999-01-23Mirar (Pontus Hagland)  fail("wrong type of elements\n");
521e5c1999-04-17Henrik Grubbström (Grubba)  if (sizeof(indices(Image.Color))!=sizeof(values(Image.Color)))
fd77911999-01-23Mirar (Pontus Hagland)  fail("not the same size of indices() and values()\n"); ok();
ccedb81999-05-24Mirar (Pontus Hagland)  #test modifiers (no-crash) foreach ( ({ ({ "black", ({ 0, 0, 0 }), ({ 0, 0, 0 }), 0 }), ({ "blue", ({ 0, 0, 255 }), ({ 170, 255, 255 }), 41 }), ({ "cyan", ({ 0, 255, 255 }), ({ 127, 255, 255 }), 168 }), ({ "green", ({ 0, 255, 0 }), ({ 85, 255, 255 }), 127 }), ({ "magenta", ({ 255, 0, 255 }), ({ 212, 255, 255 }), 128 }), ({ "red", ({ 255, 0, 0 }), ({ 0, 255, 255 }), 87 }), ({ "white", ({ 255, 255, 255 }), ({ 0, 0, 255 }), 255 }), ({ "yellow", ({ 255, 255, 0 }), ({ 42, 255, 255 }), 214 }) }), array i) foreach ( ({Image.Color(i[0]),Image.Color.rgb(@i[1])}), object z) { z->light(); z->dark(); z->neon(); z->dull(); z->bright(); } ok();
d8e7361999-05-24Mirar (Pontus Hagland)  dnl----------------------------------------------------- #chapter Computer Vision Functions #test make_ascii object Stina=Image.JPEG.decode(MIME.decode_base64( "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a\r\nHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy\r\nMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAhAD8DASIA\r\nAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAABgcABQgE/8QANhAAAgEEAAQDAwkJAAAAAAAAAQID\r\nAAQFEQYSITEHE3EiQYEUMjNCYXOhscEVIzY3UVJicsL/xAAZAQACAwEAAAAAAAAAAAAAAAACBAAB\r\nAwX/xAAdEQACAgMBAQEAAAAAAAAAAAABAgARAyExEjJB/9oADAMBAAIRAxEAPwBcXMazCMT3wOjy\r\nhAOpPpXaOEs2bIXdhib2WJVIJW31sfO3vfpXXaWlrd35SUDn0PLHYg9/0p44HiS1yWIgCSwRXcQ8\r\nuW3kl8vlK9NjferZ1X65JlORVtBZmW7iSWFJreTzUZG5ikq6ZTrtqtQ+EuLixvh7jm8tRLcp5khD\r\ndT16b+FLDxltcZe5DFXWPlglyLs0d38nYHYGtA6+3dPvERfJ8JYwBQnJbouh00eUVRbViXbeR67M\r\nzeIRi4f8QLlLNFhVFdF+tok73+PauK3s5r20DLEsS82/PufYD0x48Ri8/wCPGVkybQPBYBWSCYjT\r\nyFQOx79wfhTNzj4+2w8sV9bxtC6FEhZRo9PcKFcwA3I7MpAAmbplvYomtXijcluUSxN8emvdRH4X\r\nAW0eYLHmlWVUHOSTqhG/hW1zTShnWLQ1pui9e1GvhwD+xrqYczefcMQT3IFBme01GMCn1uC1/byT\r\nsGtWKuDtXB67qxsM0l9bbyYhM8Oo9gA85Hp1owfwltZnaK1y1xBNolY/L3v0oLfgjHxZg2drkMjL\r\nfxvp0ktBErH7Dvr/AEregTMzctsJjocnx5gbVIIzbef50qqhGuXZ0a0Yw6dunuA+ND/CmDhxOItW\r\ne3C3xQhmce0P8d1ci7jZuQnUv9g70LVwQCSxiu8ROBpJc1LxJas0qzRrHcQbJ0yjQZT6dDSxzWdF\r\ngqRq9xJMy8qhm3yDtqtSMiSRGN0DK406nsd96UOd8PcFJxiTc/uIki505j0cH6o9DUpSNw1Y3UR7\r\nJc3kq24V3uJ/ZCjZK799PPCY6LA4a2s9FgqDm9nR37/xroseG8bip2nsrSAvrQk5tsBVkyEqpCk/\r\nHdJ5snrQjmJaNmWkP0ll/sPzpdZz+Z0Hr/1UqU4nYs3I9F+ji9BVUf4kP3VSpVHsyWWMvYeo/OhT\r\njT59v92f1qVKFvmFj+oL475g9Ksrbs1SpSB7Oj+T/9k=")); array(object) Stina4; Stina4=Stina->orient4(); Stina4[1]*=215; Stina4[3]*=215; string foo=Stina->make_ascii(@Stina4,40,2,4); if (foo[0..200]!= " /* *| || \n /-\\*-\\ */ || ----- || \n /* \\\\\\|| ||/// \\*\\ | \n +\\*-**|/| ||*X // | | \n \\\\ |* \\*\\--- // */ \n \\- |*| \\\\\\ // // \n ---/--//// \\\\\\//--// \n -\\*-|// \\|- \n1\0\0\0P\24\20@P\24\20@\b\0\0\08\0\0\0\4\0\6\0\200\35 \b\6\0\0\0\n"[0..200]) fail("Wrong ascii-picture"); ok(); #test match_X float, object, void|object, void|int object Stina=Image.JPEG.decode(MIME.decode_base64( "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a\r\nHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy\r\nMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAhAD8DASIA\r\nAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAABgcABQgE/8QANhAAAgEEAAQDAwkJAAAAAAAAAQID\r\nAAQFEQYSITEHE3EiQYEUMjNCYXOhscEVIzY3UVJicsL/xAAZAQACAwEAAAAAAAAAAAAAAAACBAAB\r\nAwX/xAAdEQACAgMBAQEAAAAAAAAAAAABAgARAyExEjJB/9oADAMBAAIRAxEAPwBcXMazCMT3wOjy\r\nhAOpPpXaOEs2bIXdhib2WJVIJW31sfO3vfpXXaWlrd35SUDn0PLHYg9/0p44HiS1yWIgCSwRXcQ8\r\nuW3kl8vlK9NjferZ1X65JlORVtBZmW7iSWFJreTzUZG5ikq6ZTrtqtQ+EuLixvh7jm8tRLcp5khD\r\ndT16b+FLDxltcZe5DFXWPlglyLs0d38nYHYGtA6+3dPvERfJ8JYwBQnJbouh00eUVRbViXbeR67M\r\nzeIRi4f8QLlLNFhVFdF+tok73+PauK3s5r20DLEsS82/PufYD0x48Ri8/wCPGVkybQPBYBWSCYjT\r\nyFQOx79wfhTNzj4+2w8sV9bxtC6FEhZRo9PcKFcwA3I7MpAAmbplvYomtXijcluUSxN8emvdRH4X\r\nAW0eYLHmlWVUHOSTqhG/hW1zTShnWLQ1pui9e1GvhwD+xrqYczefcMQT3IFBme01GMCn1uC1/byT\r\nsGtWKuDtXB67qxsM0l9bbyYhM8Oo9gA85Hp1owfwltZnaK1y1xBNolY/L3v0oLfgjHxZg2drkMjL\r\nfxvp0ktBErH7Dvr/AEregTMzctsJjocnx5gbVIIzbef50qqhGuXZ0a0Yw6dunuA+ND/CmDhxOItW\r\ne3C3xQhmce0P8d1ci7jZuQnUv9g70LVwQCSxiu8ROBpJc1LxJas0qzRrHcQbJ0yjQZT6dDSxzWdF\r\ngqRq9xJMy8qhm3yDtqtSMiSRGN0DK406nsd96UOd8PcFJxiTc/uIki505j0cH6o9DUpSNw1Y3UR7\r\nJc3kq24V3uJ/ZCjZK799PPCY6LA4a2s9FgqDm9nR37/xroseG8bip2nsrSAvrQk5tsBVkyEqpCk/\r\nHdJ5snrQjmJaNmWkP0ll/sPzpdZz+Z0Hr/1UqU4nYs3I9F+ji9BVUf4kP3VSpVHsyWWMvYeo/OhT\r\njT59v92f1qVKFvmFj+oL475g9Ksrbs1SpSB7Oj+T/9k=")); object Stinamini=Stina->copy(10, 5, 15, 25); object Stinares=Stina->match_norm(0.00002, Stinamini, Image.image(63,33)->polyfill(({0,0,60,0,60,30})), 10); object expected_result=Image.JPEG.decode(MIME.decode_base64( "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a\r\nHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy\r\nMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAhAD8DASIA\r\nAhEBAxEB/8QAGQABAQEBAQEAAAAAAAAAAAAAAAYFAwII/8QAJhAAAQMDAwQCAwAAAAAAAAAAAAEC\r\nBAMFERKi0RMVIVExQzNBkv/EABkBAQADAQEAAAAAAAAAAAAAAAABAgMFBP/EACMRAAEDBAICAwEA\r\nAAAAAAAAAAEAAgQDBRHREqEUcRUhMVH/2gAMAwEAAhEDEQA/APn8GxaYMeTFc+tT1OR6pnUqeMJ6\r\nNFLJEc3LaK/0vJ53yWMOCuxHskmRTFRhGD70pYFG+1RGfNHcvIp2uG5MrR3LyR5TMZVvgpPLjkd6\r\nU4Ch7ZE1Y6O5eTq2zRFTK0dy8gymBG2KS78I70pkFP2mCnzR3u5Mm6xaEZaXRZp1Zz5VfXssyQ17\r\nuIWUq0V41M1XkYH8zpdrVPoRYzmVX6XK9VxhV/SGgl5iJ9+1eCYBD4zHHJVo96kUKYpsAwPe1RVb\r\nrFev5tq8Htl0hNbha213BNAjxWYx9q4vskO5Yb3tUC3OIj8pW2rwde8xcY621eCaAMVhRt9kt/AO\r\n9qiddYq/btXgzbnJoyEpdJ+rTnPhU9GeC7KDWHIWEi615FM03gYPvaAA2XMQABEAARAAEX//2Q==" )); if (!(Stinares-expected_result<80)) fail("->match_norm(float f, object needle, object haystack_avoid, int foo) differ too much"); Stinares=Stina->match_norm(0.00002, Stinamini); expected_result=Image.JPEG.decode(MIME.decode_base64( "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a\r\nHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy\r\nMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAhAD8DASIA\r\nAhEBAxEB/8QAGQABAQEBAQEAAAAAAAAAAAAAAAYFAwII/8QAJhAAAQMDAwQCAwAAAAAAAAAAAAEC\r\nBAMFERKi0RMVIVExQzNBkv/EABkBAQADAQEAAAAAAAAAAAAAAAABAgMFBP/EACMRAAEDBAICAwEA\r\nAAAAAAAAAAEAAgQDBRHREqEUcRUhMVH/2gAMAwEAAhEDEQA/APn8GxaYMeTFc+tT1OR6pnUqeMJ6\r\nNFLJEc3LaK/0vJ53yWMOCuxHskmRTFRhGD70pYFG+1RGfNHcvIp2uG5MrR3LyR5TMZVvgpPLjkd6\r\nU4Ch7ZE1Y6O5eTq2zRFTK0dy8gymBG2KS78I70pkFP2mCnzR3u5Mm6xaEZaXRZp1Zz5VfXssyQ17\r\nuIWUq0V41M1XkYH8zpdrVPoRYzmVX6XK9VxhV/SGgl5iJ9+1eCYBD4zHHJVo96kUKYpsAwPe1RVb\r\nrFev5tq8Htl0hNbha213BNAjxWYx9q4vskO5Yb3tUC3OIj8pW2rwde8xcY621eCaAMVhRt9kt/AO\r\n9qiddYq/btXgzbnJoyEpdJ+rTnPhU9GeC7KDWHIWEi615FM03gYPvaAA2XMQABEAARAAEX//2Q==" )); if (!(Stinares-expected_result<80)) fail("->match_norm(float f, object needle) differ too much"); Stinares=Stina->match(0.00002, Stinamini); expected_result=Image.JPEG.decode(MIME.decode_base64( "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a\r\nHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy\r\nMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAhAD8DASIA\r\nAhEBAxEB/8QAGQABAQEBAQEAAAAAAAAAAAAAAAUGAwII/8QAJhAAAgAFBAEEAwAAAAAAAAAAAAEC\r\nBAURogMSE9EhM0NRUxUxQf/EABkBAAIDAQAAAAAAAAAAAAAAAAACAQMFBP/EAB8RAAICAgMBAQEA\r\nAAAAAAAAAAECAAQDEQWh0XExUf/aAAwDAQACEQMRAD8A+fwV6XJS8zLRR6unuiUbV9zXiyKSokpF\r\nDeHRyfZzvZRDozYr8JYsYxkQjR++TLA0WpSpWD2sn2eFTpT6sn2AsoYNwlhTokd+SADQKmyjduHJ\r\n9naGjSjV3o5Psg2kEZOCst+Ed+TMg0cVLkk/RyfZNqktoy/FxQbd17+W/gdM6udCUWeKzV8ZyORo\r\nfzfk60ue0JaWig1I9sTjb/Tf8RQhrMqvfxfRmQK9ZGOzHr8zYwIMaAaH32aLVqsrG/VxfR4VRlPt\r\nxfRAACsgjNzdhjsgd+y+qlKqK/Li+jt+ZlbW5sX0ZoEGqhkrzllfwDv2aCKpyjfq4von1OZ0ZhaX\r\nFHu23v4a+CeB0wKp2JRY5TNnxnG4Gj99gAF0zYAAQgABCAAEJ//Z" )); if (!(Stinares-expected_result<80)) fail("->match(float f, object needle) differ too much"); Stinares=Stina->match(0.00002, Stinamini,Image.image(63,33)->polyfill(({0,0,60,0,60,30})), 10); expected_result=Image.JPEG.decode(MIME.decode_base64( "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a\r\nHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy\r\nMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAhAD8DASIA\r\nAhEBAxEB/8QAGQABAQEBAQEAAAAAAAAAAAAAAAUGAwII/8QAJhAAAgAFBAEEAwAAAAAAAAAAAAEC\r\nBAURogMSE9EhM0NRUxUxQf/EABkBAAIDAQAAAAAAAAAAAAAAAAACAQMFBP/EAB8RAAICAgMBAQEA\r\nAAAAAAAAAAECAAQDEQWh0XExUf/aAAwDAQACEQMRAD8A+fwV6XJS8zLRR6unuiUbV9zXiyKSokpF\r\nDeHRyfZzvZRDozYr8JYsYxkQjR++TLA0WpSpWD2sn2eFTpT6sn2AsoYNwlhTokd+SADQKmyjduHJ\r\n9naGjSjV3o5Psg2kEZOCst+Ed+TMg0cVLkk/RyfZNqktoy/FxQbd17+W/gdM6udCUWeKzV8ZyORo\r\nfzfk60ue0JaWig1I9sTjb/Tf8RQhrMqvfxfRmQK9ZGOzHr8zYwIMaAaH32aLVqsrG/VxfR4VRlPt\r\nxfRAACsgjNzdhjsgd+y+qlKqK/Li+jt+ZlbW5sX0ZoEGqhkrzllfwDv2aCKpyjfq4von1OZ0ZhaX\r\nFHu23v4a+CeB0wKp2JRY5TNnxnG4Gj99gAF0zYAAQgABCAAEJ//Z" )); if (!(Stinares-expected_result<80)) fail("->match(float f, object needle, object haystack_avoid, int foo) differ too much"); Stinares=Stina->match_phase(0.00002, Stinamini,Image.image(63,33)->polyfill(({0,0,60,0,60,30})), 10); expected_result=Image.JPEG.decode(MIME.decode_base64( "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a\r\nHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy\r\nMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAhAD8DASIA\r\nAhEBAxEB/8QAGgABAQEBAAMAAAAAAAAAAAAAAAYFAgEDCP/EACUQAAEDAgUFAQEAAAAAAAAAAAAB\r\nAgQFogMREiHRExVDUVMxM//EABkBAAIDAQAAAAAAAAAAAAAAAAACAQMEBf/EACQRAAEDAgYDAQEA\r\nAAAAAAAAAAEAAgQDEQUGFFFx0RIxkWEh/9oADAMBAAIRAxEAPwD5/Bs0iDGkxXPxsPU5HqmepU2y\r\nT0aSUSE5M24FzuTM+UxhsV2Y+ByZFMVGEWPPSlAVC0eE39wL3cnPaYXwvdyRq2bFWHL8oe3N+npT\r\nIKdKRCXwXu5OuzQvje7kNWz9UjL0o+i36elLAp1pMFPBe7ky6vEwIvR6LNOrVnuq+vY7JDXu8Qs0\r\nnB68akaryLDa+9tl7aTOjxYrmYuJpcr1XLSq7ZIaDazDb57XcEuCHxmOJJTx8bkUKYpsAsOe1Tur\r\nEJfNa7g8d2hfax3BMgXSM3KtOYJR/vi34e1TJV4SL/a1eDt1Zhqm2PavBLANIz9QMwygLAN+HtUv\r\ndYX3tdwZtXl4Ero9F+rTqz2VPXszAOyO1jvILPJxevIpGk8Cx553QAF65SAAEIAAQgABC//Z" )); if (!(Stinares-expected_result<80)) fail("->match_phase(float f, object needle, object haystack_avoid, int foo) differ too much"); Stinares=Stina->match_phase(0.00002, Stinamini); expected_result=Image.JPEG.decode(MIME.decode_base64( "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a\r\nHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy\r\nMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAhAD8DASIA\r\nAhEBAxEB/8QAGgABAQEBAAMAAAAAAAAAAAAAAAYFAgEDCP/EACUQAAEDAgUFAQEAAAAAAAAAAAAB\r\nAgQFogMREiHRExVDUVMxM//EABkBAAIDAQAAAAAAAAAAAAAAAAACAQMEBf/EACQRAAEDAgYDAQEA\r\nAAAAAAAAAAEAAgQDEQUGFFFx0RIxkWEh/9oADAMBAAIRAxEAPwD5/Bs0iDGkxXPxsPU5HqmepU2y\r\nT0aSUSE5M24FzuTM+UxhsV2Y+ByZFMVGEWPPSlAVC0eE39wL3cnPaYXwvdyRq2bFWHL8oe3N+npT\r\nIKdKRCXwXu5OuzQvje7kNWz9UjL0o+i36elLAp1pMFPBe7ky6vEwIvR6LNOrVnuq+vY7JDXu8Qs0\r\nnB68akaryLDa+9tl7aTOjxYrmYuJpcr1XLSq7ZIaDazDb57XcEuCHxmOJJTx8bkUKYpsAsOe1Tur\r\nEJfNa7g8d2hfax3BMgXSM3KtOYJR/vi34e1TJV4SL/a1eDt1Zhqm2PavBLANIz9QMwygLAN+HtUv\r\ndYX3tdwZtXl4Ero9F+rTqz2VPXszAOyO1jvILPJxevIpGk8Cx553QAF65SAAEIAAQgABC//Z" )); if (!(Stinares-expected_result<80)) fail("->match_phase(float f, object needle) differ too much"); /*
0e756f1999-05-24Mirar (Pontus Hagland)  This is used to create more tests. Please don't remMIME.encode_base64ove!
d8e7361999-05-24Mirar (Pontus Hagland)  MIME.encode_base64(Image.JPEG.encode(Stinares)); */ ok();