summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/renderdemo.c2
-rw-r--r--examples/viewer-main.c14
-rw-r--r--examples/viewer-pangocairo.c12
-rw-r--r--examples/viewer-pangoft2.c25
-rw-r--r--examples/viewer.h26
5 files changed, 53 insertions, 26 deletions
diff --git a/examples/renderdemo.c b/examples/renderdemo.c
index a4bbf3b7..2a157d2b 100644
--- a/examples/renderdemo.c
+++ b/examples/renderdemo.c
@@ -473,7 +473,7 @@ parse_options (int argc, char *argv[])
{"backend", 0, 0, G_OPTION_ARG_CALLBACK, &parse_backend,
"Pango backend to use for rendering", "id"},
{"no-display", 'q', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt_display,
- "Do not display (just save to file or whatever)", NULL},
+ "Do not display (just write to file or whatever)", NULL},
{"dpi", 0, 0, G_OPTION_ARG_INT, &opt_dpi,
"Set the resolution", "number"},
{"ellipsize", 0, 0, G_OPTION_ARG_CALLBACK, &parse_ellipsis,
diff --git a/examples/viewer-main.c b/examples/viewer-main.c
index 7823025b..cba50564 100644
--- a/examples/viewer-main.c
+++ b/examples/viewer-main.c
@@ -62,13 +62,13 @@ main (int argc,
if (opt_output)
{
- if (!view->save)
- fail ("%s viewer backend does not support saving", view->name);
+ if (!view->write)
+ fail ("%s viewer backend does not support writing", view->name);
else
{
FILE *stream;
- if (view->save_suffix && g_str_has_suffix (opt_output, view->save_suffix))
+ if (view->write_suffix && g_str_has_suffix (opt_output, view->write_suffix))
{
stream = g_fopen (opt_output, "wb");
if (!stream)
@@ -91,7 +91,7 @@ main (int argc,
fail ("When running ImageMagick 'convert' command: %s\n", error->message);
stream = fdopen (fd, "wb");
}
- view->save (instance, surface, stream, width, height);
+ view->write (instance, surface, stream, width, height);
fclose (stream);
}
}
@@ -129,8 +129,8 @@ main (int argc,
GError *error = NULL;
GPid pid;
- if (!view->save)
- fail ("%s viewer backend does not support displaying or saving", view->name);
+ if (!view->write)
+ fail ("%s viewer backend does not support displaying or writing", view->name);
display_argv[2] = title;
if (!g_spawn_async_with_pipes (NULL, (gchar **)display_argv, NULL,
@@ -141,7 +141,7 @@ main (int argc,
NULL, NULL, &pid, &fd, NULL, NULL, &error))
fail ("When running ImageMagick 'display' command: %s\n", error->message);
stream = fdopen (fd, "wb");
- view->save (instance, surface, stream, width, height);
+ view->write (instance, surface, stream, width, height);
fclose (stream);
#ifdef G_OS_UNIX
waitpid (pid, NULL, 0);
diff --git a/examples/viewer-pangocairo.c b/examples/viewer-pangocairo.c
index d2d64e6d..5638ffc9 100644
--- a/examples/viewer-pangocairo.c
+++ b/examples/viewer-pangocairo.c
@@ -251,11 +251,11 @@ write_func (void *closure,
}
static void
-pangocairo_view_save (gpointer instance,
- gpointer surface,
- FILE *stream,
- int width,
- int height)
+pangocairo_view_write (gpointer instance,
+ gpointer surface,
+ FILE *stream,
+ int width,
+ int height)
{
CairoSurface *c_surface = (CairoSurface *) surface;
@@ -314,7 +314,7 @@ const PangoViewer pangocairo_viewer = {
pangocairo_view_destroy_surface,
pangocairo_view_render,
#ifdef HAVE_CAIRO_PNG
- pangocairo_view_save,
+ pangocairo_view_write,
#else
NULL,
#endif
diff --git a/examples/viewer-pangoft2.c b/examples/viewer-pangoft2.c
index 372ccb30..5daad04b 100644
--- a/examples/viewer-pangoft2.c
+++ b/examples/viewer-pangoft2.c
@@ -27,6 +27,9 @@
#include "renderdemo.h"
#include "viewer.h"
+#ifdef HAVE_X
+#include "viewer-x.h"
+#endif
#include <pango/pangoft2.h>
@@ -127,11 +130,11 @@ pangoft2_view_render (gpointer instance,
}
static void
-pangoft2_view_save (gpointer instance,
- gpointer surface,
- FILE *stream,
- int width,
- int height)
+pangoft2_view_write (gpointer instance,
+ gpointer surface,
+ FILE *stream,
+ int width,
+ int height)
{
int row;
FT_Bitmap *bitmap = (FT_Bitmap *) surface;
@@ -155,8 +158,18 @@ const PangoViewer pangoft2_viewer = {
pangoft2_view_create_surface,
pangoft2_view_destroy_surface,
pangoft2_view_render,
- pangoft2_view_save,
+ pangoft2_view_write,
+ /*
+#ifdef HAVE_X
+ x_view_create_window,
+ x_view_destroy_window,
+ pangoft2_x_view_display
+#else
+*/
NULL,
NULL,
NULL
+ /*
+#endif
+*/
};
diff --git a/examples/viewer.h b/examples/viewer.h
index e99d5f9e..4d1d836a 100644
--- a/examples/viewer.h
+++ b/examples/viewer.h
@@ -32,7 +32,7 @@ struct _PangoViewer {
const char *id;
- const char *save_suffix;
+ const char *write_suffix;
gpointer (*create) (const PangoViewer *klass);
@@ -56,11 +56,11 @@ struct _PangoViewer {
/* The following can be NULL */
- void (*save) (gpointer instance,
- gpointer surface,
- FILE *stream,
- int width,
- int height);
+ void (*write) (gpointer instance,
+ gpointer surface,
+ FILE *stream,
+ int width,
+ int height);
gpointer (*create_window) (gpointer instance,
const char *title,
@@ -77,6 +77,20 @@ struct _PangoViewer {
int height,
gpointer state);
+ void (*load) (gpointer instance,
+ gpointer surface,
+ guchar *buffer,
+ int width,
+ int height,
+ int stride);
+
+ void (*save) (gpointer instance,
+ gpointer surface,
+ guchar *buffer,
+ int width,
+ int height,
+ int stride);
+
};
extern const PangoViewer *fallback_viewer;