source: trunk/third/librsvg/test-rsvg.c @ 18352

Revision 18352, 1.9 KB checked in by ghudson, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18351, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
2
3   test-rsvg.c: Command line utility for exercising rsvg.
4 
5   Copyright (C) 2000 Eazel, Inc.
6 
7   This program is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Library General Public License as
9   published by the Free Software Foundation; either version 2 of the
10   License, or (at your option) any later version.
11 
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   Library General Public License for more details.
16 
17   You should have received a copy of the GNU Library General Public
18   License along with this program; if not, write to the
19   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20   Boston, MA 02111-1307, USA.
21 
22   Author: Raph Levien <raph@artofcode.com>
23*/
24
25#include "config.h"
26#include "rsvg.h"
27
28#include <popt.h>
29#include <stdio.h>
30#include <stdlib.h>
31
32int
33main (int argc, const char **argv)
34{
35        poptContext popt_context;
36        char *x_zoom_str = "1.0";
37        char *y_zoom_str = "1.0";
38        struct poptOption options_table[] = {
39                { "x-zoom", 'x', POPT_ARG_STRING, &x_zoom_str, 0, NULL, "zoom factor" },
40                { "y-zoom", 'y', POPT_ARG_STRING, &y_zoom_str, 0, NULL, "zoom factor" },
41                POPT_AUTOHELP
42                { NULL, 0, 0, NULL, 0 }
43        };
44        char c;
45        const char * const *args;
46        GdkPixbuf *pixbuf;
47
48        g_type_init ();
49
50        popt_context = poptGetContext ("test-rsvg", argc, argv, options_table, 0);
51
52        c = poptGetNextOpt (popt_context);
53        args = poptGetArgs (popt_context);
54
55        pixbuf = rsvg_pixbuf_from_file_at_zoom (args[0],
56                                                atof (x_zoom_str),
57                                                atof (y_zoom_str),
58                                                NULL);
59        if (pixbuf) {
60                if (args[1] != NULL)
61                        gdk_pixbuf_save (pixbuf, args[1], "png", NULL, NULL);
62        } else {
63                fprintf (stderr, "Error loading SVG file.\n");
64                return 1;
65        }
66        return 0;
67}
Note: See TracBrowser for help on using the repository browser.