source: libpipi/trunk/examples/bezier.c @ 2902

Last change on this file since 2902 was 2902, checked in by Sam Hocevar, 11 years ago

Support C99 types on Win32 through the same hacks as in libcaca.

File size: 891 bytes
Line 
1#include "config.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6
7#include <pipi.h>
8
9int main(int argc, char *argv[])
10{
11    char *srcname = NULL, *dstname = NULL;
12    pipi_image_t *img, *newimg;
13    int ret = 0;
14    if(argc < 2)
15    {
16        fprintf(stderr, "%s: too few arguments\n", argv[0]);
17        fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]);
18        return EXIT_FAILURE;
19    }
20
21    srcname = argv[1];
22    dstname = argv[2];
23
24    img = pipi_load(srcname);
25
26    if(!img) {
27        fprintf(stderr, "Can't open %s for reading\n", srcname);
28        return -1;
29    }
30
31    newimg = pipi_copy(img);
32    pipi_free(img);
33
34    int w = pipi_get_image_width(newimg);
35    int h = pipi_get_image_height(newimg);
36
37
38    pipi_draw_bezier4(newimg , 1, 1, w-1, 1, w-1, h-1, 1, h-1 , 0x00FF0000, 20, 1);
39
40    pipi_save(newimg, dstname);
41
42    pipi_free(newimg);
43
44    return ret;
45}
46
Note: See TracBrowser for help on using the repository browser.