filters: Make the linear covolutions general.
[gfxprim.git] / tests / loaders / PGM_test.c
blob8268f4dcfd10b347821366f7be0e799ec812591f
1 /*****************************************************************************
2 * This file is part of gfxprim library. *
3 * *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
18 * *
19 * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
20 * <jiri.bluebear.dluhos@gmail.com> *
21 * *
22 * Copyright (C) 2009-2010 Cyril Hrubis <metan@ucw.cz> *
23 * *
24 *****************************************************************************/
30 #include <GP.h>
31 #include <GP_PGM.h>
33 #define W 221
34 #define H 160
36 int main(void)
38 int i;
40 GP_Context *context = GP_ContextAlloc(W, H, GP_PIXEL_G2);
42 if (context == NULL) {
43 fprintf(stderr, "Couldn't allocate context\n");
44 return 1;
47 for (i = 0; i < 20; i++)
48 GP_HLineXYW(context, 0, i, i, 3);
50 for (i = 0; i < 20; i++)
51 GP_HLineXYW(context, 1, i + 20, i, 2);
53 for (i = 0; i < 20; i++)
54 GP_HLineXYW(context, 2, i + 40, i, 1);
56 for (i = 0; i < 20; i++)
57 GP_HLineXYW(context, 3, i + 60, i, 3);
59 for (i = 0; i < 20; i++)
60 GP_HLineXYW(context, 4, i + 80, i, 2);
62 GP_Line(context, 0, 0, W, H, 3);
63 GP_Line(context, 0, H, W, 0, 3);
65 GP_FillCircle(context, W/2, H/2, 19, 3);
66 GP_FillCircle(context, W/2, H/2, 7, 2);
67 GP_FillCircle(context, W/2, H/2, 5, 1);
68 GP_FillCircle(context, W/2, H/2, 2, 0);
69 GP_Text(context, NULL, 60, 10, GP_VALIGN_BELOW | GP_ALIGN_RIGHT, 0, 3, "Test");
70 GP_Text(context, NULL, 60, 20, GP_VALIGN_BELOW | GP_ALIGN_RIGHT, 0, 2, "Test");
71 GP_Text(context, NULL, 60, 30, GP_VALIGN_BELOW | GP_ALIGN_RIGHT, 0, 1, "Test");
73 if (GP_SavePGM("test.pgm", context)) {
74 fprintf(stderr, "Can't save context\n");
75 return 1;
78 GP_ContextFree(context);
80 return 0;