File indexing completed on 2025-01-18 09:54:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #ifndef CAIRO_SCRIPT_INTERPRETER_H
0037 #define CAIRO_SCRIPT_INTERPRETER_H
0038
0039 #include <cairo.h>
0040 #include <stdio.h>
0041
0042 CAIRO_BEGIN_DECLS
0043
0044 typedef struct _cairo_script_interpreter cairo_script_interpreter_t;
0045
0046
0047 typedef void
0048 (*csi_destroy_func_t) (void *closure,
0049 void *ptr);
0050
0051 typedef cairo_surface_t *
0052 (*csi_surface_create_func_t) (void *closure,
0053 cairo_content_t content,
0054 double width,
0055 double height,
0056 long uid);
0057 typedef cairo_t *
0058 (*csi_context_create_func_t) (void *closure,
0059 cairo_surface_t *surface);
0060 typedef void
0061 (*csi_show_page_func_t) (void *closure,
0062 cairo_t *cr);
0063
0064 typedef void
0065 (*csi_copy_page_func_t) (void *closure,
0066 cairo_t *cr);
0067
0068 typedef cairo_surface_t *
0069 (*csi_create_source_image_t) (void *closure,
0070 cairo_format_t format,
0071 int width, int height,
0072 long uid);
0073
0074 typedef struct _cairo_script_interpreter_hooks {
0075 void *closure;
0076 csi_surface_create_func_t surface_create;
0077 csi_destroy_func_t surface_destroy;
0078 csi_context_create_func_t context_create;
0079 csi_destroy_func_t context_destroy;
0080 csi_show_page_func_t show_page;
0081 csi_copy_page_func_t copy_page;
0082 csi_create_source_image_t create_source_image;
0083 } cairo_script_interpreter_hooks_t;
0084
0085 cairo_public cairo_script_interpreter_t *
0086 cairo_script_interpreter_create (void);
0087
0088 cairo_public void
0089 cairo_script_interpreter_install_hooks (cairo_script_interpreter_t *ctx,
0090 const cairo_script_interpreter_hooks_t *hooks);
0091
0092 cairo_public cairo_status_t
0093 cairo_script_interpreter_run (cairo_script_interpreter_t *ctx,
0094 const char *filename);
0095
0096 cairo_public cairo_status_t
0097 cairo_script_interpreter_feed_stream (cairo_script_interpreter_t *ctx,
0098 FILE *stream);
0099
0100 cairo_public cairo_status_t
0101 cairo_script_interpreter_feed_string (cairo_script_interpreter_t *ctx,
0102 const char *line,
0103 int len);
0104
0105 cairo_public unsigned int
0106 cairo_script_interpreter_get_line_number (cairo_script_interpreter_t *ctx);
0107
0108 cairo_public cairo_script_interpreter_t *
0109 cairo_script_interpreter_reference (cairo_script_interpreter_t *ctx);
0110
0111 cairo_public cairo_status_t
0112 cairo_script_interpreter_finish (cairo_script_interpreter_t *ctx);
0113
0114 cairo_public cairo_status_t
0115 cairo_script_interpreter_destroy (cairo_script_interpreter_t *ctx);
0116
0117 cairo_public cairo_status_t
0118 cairo_script_interpreter_translate_stream (FILE *stream,
0119 cairo_write_func_t write_func,
0120 void *closure);
0121
0122 CAIRO_END_DECLS
0123
0124 #endif