#include <amscppimglib4/amscppimglib4.hpp>

namespace ams
{

    void amscppimglib4_test1()
    {
        amsimage img1, img2;

        img1.resize(1000,2000);
        printf("img1:(%d,%d)\n",img1.width,img1.height);

        img2 = img1.transpose();
        img2 = img1.transpose().flipx();
        printf("img1:(%d,%d)\n",img2.width,img2.height);

        return;
    }

    void amscppimglib4_test2()
    {
        amsimage img,img2;
        const char *fname = "../testimg/testpfp0.png";
        char fname2[500];

        read_image(fname,&img);
        printf("image loaded: %s (%d,%d)\n",fname,img.width,img.height);

        img2 = img.rotcw();
        sprintf(fname2,"../testimg/test_rotcw.png");
        write_image(fname2,&img2);

        img2 = img.rotccw();
        sprintf(fname2,"../testimg/test_rotccw.png");
        write_image(fname2,&img2);

        img2 = img.flipx();
        sprintf(fname2,"../testimg/test_flipx.png");
        write_image(fname2,&img2);

        img2 = img.flipy();
        sprintf(fname2,"../testimg/test_flipy.png");
        write_image(fname2,&img2);

        img2 = img.transpose();
        sprintf(fname2,"../testimg/test_transpose.png");
        write_image(fname2,&img2);

        img2 = img;
        img2.resize(img.Nx/2,img.Ny/2);
        sprintf(fname2,"../testimg/test_resize.png");
        write_image(fname2,&img2);

        img2 = img;
        img2.resize(img.Nx*2,img.Ny*2);
        sprintf(fname2,"../testimg/test_resize2.png");
        write_image(fname2,&img2);

        img2.resize(200,100);
        img2.setall(amspixel(0,255,0,255));
        sprintf(fname2,"../testimg/test_green.png");
        write_image(fname2,&img2);



        return;
    }

};