source: trunk/third/libgnomeprintui/examples/example_01.c @ 18604

Revision 18604, 1.7 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18603, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2/*
3 *  example_01.c: sample gnome-print code
4 *
5 *  This program is free software; you can redistribute it and/or
6 *  modify it under the terms of the GNU Library General Public License
7 *  as published by the Free Software Foundation; either version 2 of
8 *  the License, or (at your option) any later version.
9 *
10 *  This program is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 *  GNU Library General Public License for more details.
14 *
15 *  You should have received a copy of the GNU Library General Public
16 *  License along with this program; if not, write to the Free Software
17 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 *  Authors:
20 *    Chema Celorio <chema@ximian.com>
21 *
22 *  Copyright (C) 2002 Ximian Inc. and authors
23 *
24 */
25
26/*
27 * See README
28 */
29
30#include <libgnomeprint/gnome-print.h>
31#include <libgnomeprint/gnome-print-job.h>
32
33static void
34my_draw (GnomePrintContext *gpc)
35{
36        gnome_print_beginpage (gpc, "1");
37
38        gnome_print_moveto (gpc, 100, 100);
39        gnome_print_lineto (gpc, 200, 200);
40        gnome_print_stroke (gpc);
41       
42        gnome_print_showpage (gpc);
43}
44
45static void
46my_print (void)
47{
48        GnomePrintContext *gpc;
49        GnomePrintJob *job;
50
51        job = gnome_print_job_new (NULL);
52        gpc = gnome_print_job_get_context (job);
53
54        my_draw (gpc);
55
56        gnome_print_job_close (job);
57        gnome_print_job_print (job);
58
59        g_object_unref (G_OBJECT (gpc));
60        g_object_unref (G_OBJECT (job));
61}
62
63int
64main (int argc, char * argv[])
65{
66        g_type_init ();
67       
68        my_print ();
69
70        g_print ("Done...\n");
71
72        return 0;
73}
Note: See TracBrowser for help on using the repository browser.