#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <pipi.h>

int main(int argc, char *argv[])
{
    char *srcname = NULL, *dstname = NULL;
    pipi_image_t *img, *newimg;
    int ret = 0;
    if(argc < 2)
    {
        fprintf(stderr, "%s: too few arguments\n", argv[0]);
        fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]);
        return EXIT_FAILURE;
    }

    srcname = argv[1];
    dstname = argv[2];

    img = pipi_load(srcname);

    if(!img) {
        fprintf(stderr, "Can't open %s for reading\n", srcname);
        return -1;
    }

    newimg = pipi_copy(img);
    pipi_free(img);

    int w = pipi_get_image_width(newimg);
    int h = pipi_get_image_height(newimg);


    pipi_draw_bezier4(newimg , 1, 1, w-1, 1, w-1, h-1, 1, h-1 , 0x00FF0000, 20, 1);

    pipi_save(newimg, dstname);

    pipi_free(newimg);

    return ret;
}