1 /*****************************************************************************
2 * This file is part of gfxprim library. *
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. *
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. *
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 *
19 * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
20 * <jiri.bluebear.dluhos@gmail.com> *
22 * Copyright (C) 2009-2010 Cyril Hrubis <metan@ucw.cz> *
24 *****************************************************************************/
40 GP_Context
*context
= GP_ContextAlloc(W
, H
, GP_PIXEL_G2
);
42 if (context
== NULL
) {
43 fprintf(stderr
, "Couldn't allocate context\n");
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
, "Test", 3);
70 GP_Text(context
, NULL
, 60, 20, GP_VALIGN_BELOW
| GP_ALIGN_RIGHT
, "Test", 2);
71 GP_Text(context
, NULL
, 60, 30, GP_VALIGN_BELOW
| GP_ALIGN_RIGHT
, "Test", 1);
73 if (GP_SavePGM("test.pgm", context
)) {
74 fprintf(stderr
, "Can't save context\n");
78 GP_ContextFree(context
);