Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:03

0001 /* cairo - a vector graphics library with display and print output
0002  *
0003  * Copyright © 2008 Chris Wilson
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it either under the terms of the GNU Lesser General Public
0007  * License version 2.1 as published by the Free Software Foundation
0008  * (the "LGPL") or, at your option, under the terms of the Mozilla
0009  * Public License Version 1.1 (the "MPL"). If you do not alter this
0010  * notice, a recipient may use your version of this file under either
0011  * the MPL or the LGPL.
0012  *
0013  * You should have received a copy of the LGPL along with this library
0014  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
0015  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
0016  * You should have received a copy of the MPL along with this library
0017  * in the file COPYING-MPL-1.1
0018  *
0019  * The contents of this file are subject to the Mozilla Public License
0020  * Version 1.1 (the "License"); you may not use this file except in
0021  * compliance with the License. You may obtain a copy of the License at
0022  * http://www.mozilla.org/MPL/
0023  *
0024  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
0025  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
0026  * the specific language governing rights and limitations.
0027  *
0028  * The Original Code is the cairo graphics library.
0029  *
0030  * The Initial Developer of the Original Code is Chris Wilson
0031  *
0032  * Contributor(s):
0033  *  Chris Wilson <chris@chris-wilson.co.uk>
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 /* XXX expose csi_dictionary_t and pass to hooks */
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 /*CAIRO_SCRIPT_INTERPRETER_H*/