head 1.17; access; symbols initial:1.1.1.1 start:1.1.1; locks; strict; comment @ * @; 1.17 date 2006.01.25.22.20.27; author keithp; state Exp; branches; next 1.16; commitid b4243d7f9984567; 1.16 date 2005.07.07.08.09.21; author keithp; state Exp; branches; next 1.15; commitid 1de242cce3254567; 1.15 date 2005.06.07.05.09.35; author keithp; state Exp; branches; next 1.14; commitid 28e542a52c0b4567; 1.14 date 2005.05.18.06.21.15; author keithp; state Exp; branches; next 1.13; commitid 431d428aded64567; 1.13 date 2005.05.02.20.24.38; author keithp; state Exp; branches; next 1.12; commitid 416842768c824567; 1.12 date 2005.02.11.21.15.46; author keithp; state Exp; branches; next 1.11; 1.11 date 2004.12.24.09.00.10; author keithp; state Exp; branches; next 1.10; 1.10 date 2004.12.23.22.39.40; author keithp; state Exp; branches; next 1.9; 1.9 date 2004.12.19.00.06.26; author keithp; state Exp; branches; next 1.8; 1.8 date 2004.12.18.08.16.28; author keithp; state Exp; branches; next 1.7; 1.7 date 2004.12.18.01.09.40; author keithp; state Exp; branches; next 1.6; 1.6 date 2004.12.17.09.40.43; author keithp; state Exp; branches; next 1.5; 1.5 date 2004.12.17.02.09.45; author keithp; state Exp; branches; next 1.4; 1.4 date 2004.12.15.07.04.50; author keithp; state Exp; branches; next 1.3; 1.3 date 2004.12.14.08.34.27; author keithp; state Exp; branches; next 1.2; 1.2 date 2004.12.11.07.45.42; author keithp; state Exp; branches; next 1.1; 1.1 date 2004.12.11.06.26.52; author keithp; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2004.12.11.06.26.52; author keithp; state Exp; branches; next ; desc @@ 1.17 log @2006-01-26 Keith Packard * Makefile.am: * cairo-5c.h: Ick! Date format changes. Sigh. * init.c: (init_types): Oops -- wrong argument count for typeCairoRgbaColor constructor. @ text @/* $Id: init.c,v 1.16 2005/07/07 08:09:21 keithp Exp $ * * Copyright © 2004 Keith Packard * * This library is free software; you can redistribute it and/or * modify it either under the terms of the GNU Lesser General Public * License version 2.1 as published by the Free Software Foundation * (the "LGPL") or, at your option, under the terms of the Mozilla * Public License Version 1.1 (the "MPL"). If you do not alter this * notice, a recipient may use your version of this file under either * the MPL or the LGPL. * * You should have received a copy of the LGPL along with this library * in the file COPYING-LGPL-2.1; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * You should have received a copy of the MPL along with this library * in the file COPYING-MPL-1.1 * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY * OF ANY KIND, either express or implied. See the LGPL or the MPL for * the specific language governing rights and limitations. * * The Original Code is the cairo graphics library. * * The Initial Developer of the Original Code is Keith Packard * * Contributor(s): * Keith Packard */ #include "cairo-5c.h" NamespacePtr CairoNamespace; NamespacePtr CairoSurfaceNamespace; NamespacePtr CairoPatternNamespace; NamespacePtr CairoImageNamespace; NamespacePtr CairoPdfNamespace; Type *typeCairo; Type *typeCairoSurface; Type *typeCairoStatus; Type *typeCairoOperator; Type *typeCairoFillRule; Type *typeCairoLineCap; Type *typeCairoLineJoin; Type *typeCairoFontSlant; Type *typeCairoFontWeight; Type *typeCairoTextExtents; Type *typeCairoFontExtents; Type *typeCairoMatrix; Type *typeCairoPoint; Type *typeCairoRect; Type *typeCairoRgbColor; Type *typeCairoRgbaColor; Type *typeCairoPattern; Type *typeCairoPath; Type *typeCairoCurveTo; Type *typeCairoScaledFont; Type *typeCairoFontFace; Type *typeCairoPatternExtend; Type *typeCairoPatternFilter; #define CAIRO_I 0 #define CAIRO_S "00" #define SURFACE_I 1 #define SURFACE_S "01" #define STATUS_I 2 #define STATUS_S "02" #define OPERATOR_I 3 #define OPERATOR_S "03" #define FILL_RULE_I 4 #define FILL_RULE_S "04" #define LINE_CAP_I 5 #define LINE_CAP_S "05" #define LINE_JOIN_I 6 #define LINE_JOIN_S "06" #define FONT_SLANT_I 7 #define FONT_SLANT_S "07" #define FONT_WEIGHT_I 8 #define FONT_WEIGHT_S "08" #define TEXT_EXTENTS_I 9 #define TEXT_EXTENTS_S "09" #define FONT_EXTENTS_I 10 #define FONT_EXTENTS_S "10" #define MATRIX_I 11 #define MATRIX_S "11" #define POINT_I 12 #define POINT_S "12" #define RECT_I 13 #define RECT_S "13" #define RGB_COLOR_I 14 #define RGB_COLOR_S "14" #define RGBA_COLOR_I 15 #define RGBA_COLOR_S "15" #define PATTERN_I 16 #define PATTERN_S "16" #define PATH_I 17 #define PATH_S "17" #define CURVE_TO_I 20 #define CURVE_TO_S "20" #define SCALED_FONT_I 22 #define SCALED_FONT_S "22" #define FONT_FACE_I 23 #define FONT_FACE_S "23" #define EXTEND_I 30 #define EXTEND_S "30" #define FILTER_I 31 #define FILTER_S "31" static Type * make_typedef (char *name_str, Namespace *namespace, Publish publish, int usertype_id, Symbol **sret, Type *type) { ENTER (); Atom name = AtomId (name_str); Symbol *sym = NewSymbolType (name, type); Type *typed = NewTypeName (NewExprAtom (name, 0, False), sym); NamespaceAddName (namespace, sym, publish); BuiltinSetUserdefType (typed, usertype_id); MemAddRoot (typed); if (sret) *sret = sym; RETURN (typed); } static void init_types (void) { Symbol *ct, *path; ENTER (); CairoNamespace = BuiltinNamespace (/* parent */ 0, "Cairo")->namespace.namespace; typeCairo = make_typedef ("cairo_t", CairoNamespace, publish_public, CAIRO_I, NULL, typePrim[rep_foreign]); typeCairoSurface = make_typedef ("surface_t", CairoNamespace, publish_public, SURFACE_I, NULL, typePrim[rep_foreign]); typeCairoStatus = make_typedef ("status_t", CairoNamespace, publish_public, STATUS_I, NULL, BuildEnumType (14, "SUCCESS", "NO_MEMORY", "INVALID_RESTORE", "INVALID_POP_GROUP", "NO_CURRENT_POINT", "INVALID_MATRIX", "NO_TARGET_SURFACE", "NULL_POINTER", "INVALID_STRING", "INVALID_PATH_DATA", "READ_ERROR", "WRITE_ERROR", "SURFACE_FINISHED", "SURFACE_TYPE_MISMATCH")); typeCairoOperator = make_typedef ("operator_t", CairoNamespace, publish_public, OPERATOR_I, NULL, BuildEnumType (14, "CLEAR", "SOURCE", "OVER", "IN", "OUT", "ATOP", "DEST", "DEST_OVER", "DEST_IN", "DEST_OUT", "DEST_ATOP", "XOR", "ADD", "SATURATE")); typeCairoFillRule = make_typedef ("fill_rule_t", CairoNamespace, publish_public, FILL_RULE_I, NULL, BuildEnumType (2, "WINDING", "EVEN_ODD")); typeCairoLineCap = make_typedef ("line_cap_t", CairoNamespace, publish_public, LINE_CAP_I, NULL, BuildEnumType (3, "BUTT", "ROUND", "SQUARE")); typeCairoLineJoin = make_typedef ("line_join_t", CairoNamespace, publish_public, LINE_JOIN_I, NULL, BuildEnumType (3, "MITER", "ROUND", "BEVEL")); typeCairoFontSlant = make_typedef ("font_slant_t", CairoNamespace, publish_public, FONT_SLANT_I, NULL, BuildEnumType (3, "NORMAL", "ITALIC", "OBLIQUE")); typeCairoFontWeight = make_typedef ("font_weight_t", CairoNamespace, publish_public, FONT_WEIGHT_I, NULL, BuildEnumType (2, "NORMAL", "BOLD")); typeCairoTextExtents = make_typedef ("text_extents_t", CairoNamespace, publish_public, TEXT_EXTENTS_I, NULL, BuildStructType (6, typePrim[rep_float], "x_bearing", typePrim[rep_float], "y_bearing", typePrim[rep_float], "width", typePrim[rep_float], "height", typePrim[rep_float], "x_advance", typePrim[rep_float], "y_advance")); typeCairoFontExtents = make_typedef ("font_extents_t", CairoNamespace, publish_public, FONT_EXTENTS_I, NULL, BuildStructType (5, typePrim[rep_float], "ascent", typePrim[rep_float], "descent", typePrim[rep_float], "height", typePrim[rep_float], "max_x_advance", typePrim[rep_float], "max_y_advance")); typeCairoMatrix = make_typedef ("matrix_t", CairoNamespace, publish_public, MATRIX_I, NULL, BuildStructType (6, typePrim[rep_float], "xx", typePrim[rep_float], "yx", typePrim[rep_float], "xy", typePrim[rep_float], "yy", typePrim[rep_float], "x0", typePrim[rep_float], "y0")); typeCairoPoint = make_typedef ("point_t", CairoNamespace, publish_public, POINT_I, NULL, BuildStructType (2, typePrim[rep_float], "x", typePrim[rep_float], "y")); typeCairoRect = make_typedef ("rect_t", CairoNamespace, publish_public, RECT_I, NULL, BuildStructType (4, typePrim[rep_float], "x", typePrim[rep_float], "y", typePrim[rep_float], "width", typePrim[rep_float], "height")); typeCairoRgbColor = make_typedef ("rgb_color_t", CairoNamespace, publish_public, RGB_COLOR_I, NULL, BuildStructType (3, typePrim[rep_float], "red", typePrim[rep_float], "green", typePrim[rep_float], "blue")); typeCairoRgbaColor = make_typedef ("rgba_color_t", CairoNamespace, publish_public, RGBA_COLOR_I, NULL, BuildStructType (4, typePrim[rep_float], "red", typePrim[rep_float], "green", typePrim[rep_float], "blue", typePrim[rep_float], "alpha")); typeCairoPattern = make_typedef ("pattern_t", CairoNamespace, publish_public, PATTERN_I, NULL, typePrim[rep_foreign]); /* * Path data structures */ typeCairoCurveTo = make_typedef ("curve_to_t", CairoNamespace, publish_public, CURVE_TO_I, &ct, 0); ct->symbol.type = BuildStructType (6, typePrim[rep_float], "x1", typePrim[rep_float], "y1", typePrim[rep_float], "x2", typePrim[rep_float], "y2", typePrim[rep_float], "x3", typePrim[rep_float], "y3"); typeCairoPath = make_typedef ("path_t", CairoNamespace, publish_public, PATH_I, &path, BuildUnionType(4, NewTypeRef (typeCairoPoint, True), "move_to", NewTypeRef (typeCairoPoint, True), "line_to", NewTypeRef (typeCairoCurveTo, True), "curve_to", typePrim[rep_void], "close_path")); CairoSurfaceNamespace = BuiltinNamespace (&CairoNamespace, "Surface")->namespace.namespace; CairoImageNamespace = BuiltinNamespace (&CairoNamespace, "Image")->namespace.namespace; CairoPdfNamespace = BuiltinNamespace (&CairoNamespace, "Pdf")->namespace.namespace; CairoPatternNamespace = BuiltinNamespace (&CairoNamespace, "Pattern")->namespace.namespace; typeCairoPatternExtend = make_typedef ("extend_t", CairoPatternNamespace, publish_public, EXTEND_I, NULL, BuildEnumType (3, "NONE", "REPEAT", "REFLECT")); typeCairoPatternFilter = make_typedef ("filter_t", CairoPatternNamespace, publish_public, FILTER_I, NULL, BuildEnumType (6, "FAST", "GOOD", "BEST", "NEAREST", "BILINEAR", "GAUSSIAN")); typeCairoScaledFont = make_typedef ("scaled_font_t", CairoNamespace, publish_public, SCALED_FONT_I, NULL, typePrim[rep_foreign]); typeCairoFontFace = make_typedef ("font_face_t", CairoNamespace, publish_public, FONT_FACE_I, NULL, typePrim[rep_foreign]); EXIT(); } int EnumIntPart (Value ev, char *err) { Union *u = &ev->unions; StructType *st = u->type; int i; for (i = 0; i < st->nelements; i++) if (StructTypeAtoms(st)[i] == u->tag) return i; RaiseStandardException (exception_invalid_argument, err, 2, ev); return -1; } Value IntToEnum (Type *type, int i) { ENTER (); Type *ctype = TypeCanon (type); StructType *st = ctype->structs.structs; Value v = NewUnion (st, False); if (i < 0 || st->nelements <= i) { RaiseStandardException (exception_invalid_argument, "invalid enum index", 2, NewInt (i), v); RETURN (Void); } v->unions.tag = StructTypeAtoms(st)[i]; BoxValueSet (v->unions.value, 0, Void); RETURN (v); } Value nickle_init (void) { ENTER (); static const struct fbuiltin_1 funcs_1[] = { { do_Cairo_create, "create", CAIRO_S, SURFACE_S, "\n" " cairo_t create (surface_t sv)\n" "\n" " Create a cairo context for the specified surface.\n" }, { do_Cairo_destroy, "destroy", "v", CAIRO_S, "\n" " void destroy (cairo_t cr)\n" "\n" " destroy a rendering context.\n"}, { do_Cairo_get_target, "get_target", SURFACE_S, CAIRO_S, "\n" " surface_t get_target (cairo_t cr)\n" "\n" " Return current target surface\n" }, { do_Cairo_status, "status", STATUS_S, CAIRO_S, "\n" " status_t status (cairo_t cr)\n" "\n" " Return the status of a cairo surface\n" }, { do_Cairo_status_to_string, "status_string", "s", STATUS_S, "\n" " string status_to_string (status_t status)\n" "\n" " Return a string describing the status\n" }, { do_Cairo_enable, "enable", "v", CAIRO_S, "\n" " void enable (cairo_t cr)\n" "\n" " Enable screen updates from a cairo surface\n" }, { do_Cairo_disable, "disable", "v", CAIRO_S, "\n" " void disable (cairo_t cr)\n" "\n" " Disable screen updates from a cairo surface\n" }, { do_Cairo_save, "save", "v", CAIRO_S, "\n" " void save (cairo_t cr)\n" "\n" " Save graphics state\n" }, { do_Cairo_restore, "restore", "v", CAIRO_S, "\n" " void restore (cairo_t cr)\n" "\n" " Restore graphics state\n" }, { do_Cairo_identity_matrix, "identity_matrix", "v", CAIRO_S, "\n" " void identity_matrix (cairo_t cr)\n" "\n" " Set transformation matrix to identity\n" }, { do_Cairo_new_path, "new_path", "v", CAIRO_S, "\n" " void new_path (cairo_t cr)\n" "\n" " Starts a new path\n" }, { do_Cairo_close_path, "close_path", "v", CAIRO_S, "\n" " void close_path (cairo_t cr)\n" "\n" " Closes the current path\n" }, { do_Cairo_fill, "fill", "v", CAIRO_S, "\n" " void fill (cairo_t cr)\n" "\n" " Fill the current path\n" }, { do_Cairo_fill_preserve, "fill_preserve", "v", CAIRO_S, "\n" " void fill_preserve (cairo_t cr)\n" "\n" " Fill the current path without making an implicit call to new_path\n" }, { do_Cairo_stroke, "stroke", "v", CAIRO_S, "\n" " void stroke (cairo_t cr)\n" "\n" " Stroke the current path\n" }, { do_Cairo_stroke_preserve, "stroke_preserve", "v", CAIRO_S, "\n" " void stroke_preserve (cairo_t cr)\n" "\n" " Stroke the current path without making an implicit call to new_path\n" }, { do_Cairo_copy_page, "copy_page", "v", CAIRO_S, "\n" " void copy_page (cairo_t cr)\n" "\n" " Write out the current page, leaving it intact.\n" }, { do_Cairo_show_page, "show_page", "v", CAIRO_S, "\n" " void show_page (cairo_t cr)\n" "\n" " Write out the current page, and erase it.\n" }, { do_Cairo_copy_path, "copy_path", PATH_S, CAIRO_S, "\n" " void copy_path (cairo_t cr)\n" "\n" " Returns the current path\n" }, { do_Cairo_copy_path_flat, "copy_path_flat", PATH_S, CAIRO_S, "\n" " void copy_path (cairo_t cr)\n" "\n" " Returns the current path with curves tesselated to lines\n" }, { do_Cairo_reset_clip, "reset_clip", "v", CAIRO_S, "\n" " void reset_clip (cairo_t cr)\n" "\n" " Reset clip to the entire surface.\n" }, { do_Cairo_clip, "clip", "v", CAIRO_S, "\n" " void clip (cairo_t cr)\n" "\n" " Clip to current path. Consumes path.\n" }, { do_Cairo_clip_preserve, "clip_preserve", "v", CAIRO_S, "\n" " void clip_preserve (cairo_t cr)\n" "\n" " Clip to current path without consuming path.\n" }, { do_Cairo_stroke_extents, "stroke_extents", RECT_S, CAIRO_S, "\n" " rect_t stroke_extents (cairo_t cr)\n" "\n" " Returns bounding box of stroking current path\n" }, { do_Cairo_fill_extents, "fill_extents", RECT_S, CAIRO_S, "\n" " rect_t fill_extents (cairo_t cr)\n" "\n" " Returns bounding box of filling current path\n" }, { do_Cairo_get_operator, "get_operator", OPERATOR_S, CAIRO_S, "\n" " operator_t get_operator (cairo_t cr)\n" "\n" " Returns the current operator\n" }, { do_Cairo_get_source, "get_source", PATTERN_S, CAIRO_S, "\n" " pattern_t get_source (cairo_t cr)\n" "\n" " Returns the current source pattern\n" }, { do_Cairo_get_tolerance, "get_tolerance", "n", CAIRO_S, "\n" " real get_tolerance (cairo_t cr)\n" "\n" " Returns the current tolerance\n" }, { do_Cairo_get_current_point, "get_current_point", POINT_S, CAIRO_S, "\n" " point_t current_point (cairo_t cr)\n" "\n" " Returns the current point\n" }, { do_Cairo_get_fill_rule, "get_fill_rule", FILL_RULE_S, CAIRO_S, "\n" " fill_rule_t get_fill_rule (cairo_t cr)\n" "\n" " Returns the current fill rule\n" }, { do_Cairo_get_line_width, "get_line_width", "n", CAIRO_S, "\n" " real get_line_width (cairo_t cr)\n" "\n" " Returns the current line width\n" }, { do_Cairo_get_line_cap, "get_line_cap", LINE_CAP_S, CAIRO_S, "\n" " line_cap_t get_line_cap (cairo_t cr)\n" "\n" " Returns the current line_cap\n" }, { do_Cairo_get_line_join, "get_line_join", LINE_JOIN_S, CAIRO_S, "\n" " line_join_t get_line_join (cairo_t cr)\n" "\n" " Returns the current line join\n" }, { do_Cairo_get_miter_limit, "get_miter_limit", "n", CAIRO_S, "\n" " real get_miter_limit (cairo_t cr)\n" "\n" " Returns the current miter limit\n" }, { do_Cairo_get_matrix, "get_matrix", MATRIX_S, CAIRO_S, "\n" " matrix_t get_matrix (cairo_t cr)\n" "\n" " Returns the current transformation matrix\n" }, { do_Cairo_paint, "paint", "v", CAIRO_S, "\n" " void paint (cairo_t cr)\n" "\n" " Fill cr with the pattern\n" }, { do_Cairo_get_font_matrix, "get_font_matrix", MATRIX_S, CAIRO_S, "\n" " matrix_t get_font_matrix (cairo_t cr)\n" "\n" " Returns the current font matrix\n" }, { do_Cairo_font_extents, "font_extents", FONT_EXTENTS_S, CAIRO_S, "\n" " font_extents_t font_extents (cairo_t cr)\n" "\n" " Returns metrics for current font\n" }, { 0 } }; static const struct fbuiltin_2 funcs_2[] = { { do_Cairo_set_operator, "set_operator", "v", CAIRO_S OPERATOR_S, "\n" " void set_operator (cairo_t cr, operator_t operator)\n" "\n" " Set current operator\n" }, { do_Cairo_set_source, "set_source", "v", CAIRO_S PATTERN_S, "\n" " void set_source (cairo_t cr, pattern_t pattern)\n" "\n" " Set current source pattern\n" }, { do_Cairo_set_tolerance, "set_tolerance", "v", CAIRO_S "n", "\n" " void set_tolerance (cairo_t cr, real alpha)\n" "\n" " Set current tolerance\n" }, { do_Cairo_set_fill_rule, "set_fill_rule", "v", CAIRO_S FILL_RULE_S, "\n" " void set_fill_rule (cairo_t cr, fill_rule_t rule)\n" "\n" " Set current fill rule\n" }, { do_Cairo_set_line_width, "set_line_width", "v", CAIRO_S "n", "\n" " void set_line_width (cairo_t cr, real alpha)\n" "\n" " Set current line width\n" }, { do_Cairo_set_line_cap, "set_line_cap", "v", CAIRO_S LINE_CAP_S, "\n" " void set_line_cap (cairo_t cr, line_cap_t cap)\n" "\n" " Set current line cap style\n" }, { do_Cairo_set_line_join, "set_line_join", "v", CAIRO_S LINE_JOIN_S, "\n" " void set_line_join (cairo_t cr, line_join_t join)\n" "\n" " Set current line join style\n" }, { do_Cairo_set_miter_limit, "set_miter_limit", "v", CAIRO_S "n", "\n" " void set_miter_limit (cairo_t cr, real limit)\n" "\n" " Set current miter join limit\n" }, { do_Cairo_rotate, "rotate", "v", CAIRO_S "n", "\n" " void rotate (cairo_t cr, real radians)\n" "\n" " Rotate current transformation matrix by specified amount\n" }, { do_Cairo_paint_with_alpha, "paint_with_alpha", "v", CAIRO_S "n", "\n" " void paint_with_alpha (cairo_t cr, real alpha)\n" "\n" " Fill cr with the source with the constant mask alpha\n" }, { do_Cairo_mask, "mask", "v", CAIRO_S PATTERN_S, "\n" " void mask (cairo_t cr, pattern_t pattern)\n" "\n" " Fill cr with the source with the specified mask\n" }, { do_Cairo_append_path, "append_path", "v", CAIRO_S PATH_S, "\n" " void append_path (cairo_t cr, path_t path)\n" "\n" " Append path to cr\n" }, { do_Cairo_set_font, "set_font", "v", CAIRO_S "s", "\n" " void set_font (cairo_t cr, string fontname)\n" "\n" " Sets the current font using fontname\n" }, { do_Cairo_set_font_size, "set_font_size", "v", CAIRO_S "n", "\n" " void set_font_size (cairo_t cr, real size)\n" "\n" " Sets font size\n" }, { do_Cairo_set_font_matrix, "set_font_matrix", "v", CAIRO_S MATRIX_S, "\n" " void set_font_matrix (cairo_t cr, matrix_t matrix)\n" "\n" " Sets current font matrix\n" }, { do_Cairo_show_text, "show_text", "v", CAIRO_S "s", "\n" " void show_text (cairo_t cr, string text)\n" "\n" " Shows text at current position\n" }, { do_Cairo_text_path, "text_path", "v", CAIRO_S "s", "\n" " void text_path (cairo_t cr, string text)\n" "\n" " Appends text to current path\n" }, { do_Cairo_text_extents, "text_extents", TEXT_EXTENTS_S, CAIRO_S "s", "\n" " text_extents_t text_extents (cairo_t cr, string text)\n" "\n" " Appends text to current path\n" }, { do_Cairo_transform, "transform", "v", CAIRO_S MATRIX_S, "\n" " void transform (cairo_t cr, matrix_t matrix)\n" "\n" " Mixes in another matrix to the current transformation\n" }, { do_Cairo_set_matrix, "set_matrix", "v", CAIRO_S MATRIX_S, "\n" " void set_matrix (cairo_t cr, matrix_t matrix)\n" "\n" " Sets the transformation matrix\n" }, { do_Cairo_user_to_device, "user_to_device", POINT_S, CAIRO_S POINT_S, "\n" " point_t user_to_device (cairo_t cr, point_t)\n" "\n" " Transform a point from user to device space\n" }, { do_Cairo_user_to_device_distance, "user_to_device_distance", POINT_S, CAIRO_S POINT_S, "\n" " point_t user_to_device_distance (cairo_t cr, point_t point)\n" "\n" " Transform a distance from user to device space\n" }, { do_Cairo_device_to_user, "device_to_user", POINT_S, CAIRO_S POINT_S, "\n" " point_t device_to_user (cairo_t cr, point_t point)\n" "\n" " Transform a point from device to user space\n" }, { do_Cairo_device_to_user_distance, "device_to_user_distance", POINT_S, CAIRO_S POINT_S, "\n" " point_t device_to_user_distance (cairo_t cr, point_t point)\n" "\n" " Transform a distance from device to user space\n" }, { 0 } }; static const struct fbuiltin_3 funcs_3[] = { { do_Cairo_move_to, "move_to", "v", CAIRO_S "nn", "\n" " void move_to (cairo_t cr, real x, real y)\n" "\n" " Move to specified position\n" }, { do_Cairo_line_to, "line_to", "v", CAIRO_S "nn", "\n" " void line_to (cairo_t cr, real x, real y)\n" "\n" " Draw line to specified position\n" }, { do_Cairo_rel_move_to, "rel_move_to", "v", CAIRO_S "nn", "\n" " void rel_move_to (cairo_t cr, real x, real y)\n" "\n" " Move to specified offset from the current position\n" }, { do_Cairo_rel_line_to, "rel_line_to", "v", CAIRO_S "nn", "\n" " void rel_line_to (cairo_t cr, real x, real y)\n" "\n" " Draw line to specified offset from the current position\n" }, { do_Cairo_translate, "translate", "v", CAIRO_S "nn", "\n" " void translate (cairo_t cr, real x, real y)\n" "\n" " Offset current transformation matrix by specified amount\n" }, { do_Cairo_scale, "scale", "v", CAIRO_S "nn", "\n" " void scale (cairo_t cr, real x, real y)\n" "\n" " Scale current transformation matrix by specified amount\n" }, { do_Cairo_set_dash, "set_dash", "v", CAIRO_S "A*nn", "\n" " void set_dash (cairo_t cr, real[*] dashes, real dash_offset)\n" "\n" " Sets current dash pattern and offset\n" }, { do_Cairo_in_fill, "in_fill", "b", CAIRO_S "nn", "\n" " bool in_fill (cairo_t cr, real x, real y)\n" "\n" " Test whether (x,y) would be covered by filling the current path\n" }, { do_Cairo_in_stroke, "in_stroke", "b", CAIRO_S "nn", "\n" " bool in_stroke (cairo_t cr, real x, real y)\n" "\n" " Test whether (x,y) would be covered by stroking the current path\n" }, { 0 } }; static const struct fbuiltin_4 funcs_4[] = { { do_Cairo_set_source_rgb, "set_source_rgb", "v", CAIRO_S "nnn", "\n" " void set_source_rgb (cairo_t cr, real red, real green, real blue)\n" "\n" " Set solid color source\n" }, { do_Cairo_set_source_surface, "set_source_surface", "v", CAIRO_S SURFACE_S "nn", "\n" " void set_source_surface (cairo_t cr, surface_t surface, real x, real y)\n" "\n" " Set the source to surface and offset by x,y\n" }, { do_Cairo_mask_surface, "mask_surface", "v", CAIRO_S SURFACE_S "nn", "\n" " void mask_surface (cairo_t cr, surface_t surface, real x, real y)\n" "\n" " Fill cr with the source using surface, offset by x,y, as the mask\n" }, { do_Cairo_select_font_face, "select_font_face", "v", CAIRO_S "s" FONT_SLANT_S FONT_WEIGHT_S, "\n" " void select_font_face (cairo_t cr, string family, font_slant_t slant, font_weight_t weight)\n" "\n" " Select a font face using the specified family, slant and weight\n" }, { 0 } }; static const struct fbuiltin_5 funcs_5[] = { { do_Cairo_rectangle, "rectangle", "v", CAIRO_S "nnnn", "\n" " void rectangle (cairo_t cr, real x, real y, real width, real height)\n" "\n" " Adds the specified rectangle to the current path\n" }, { do_Cairo_set_source_rgba, "set_source_rgba", "v", CAIRO_S "nnnn", "\n" " void set_source_rgba (cairo_t cr, real red, real green, real blue, real alpha)\n" "\n" " Set solid color source with alpha (premultiplied)\n" }, { 0 } }; static const struct fbuiltin_6 funcs_6[] = { { do_Cairo_arc, "arc", "v", CAIRO_S "nnnnn", "\n" " void arc (cairo_t cr, real xc, real yc, real r, real angle1, real angle2)\n" "\n" " Draw a clockwise arc centered at xc,yc from angle1 to angle2 with the given radius\n" }, { do_Cairo_arc_negative, "arc_negative", "v", CAIRO_S "nnnnn", "\n" " void arc (cairo_t cr, real xc, real yc, real r, real angle1, real angle2)\n" "\n" " Draw a counter-clockwise arc centered at xc,yc from angle1 to angle2 with the given radius\n" }, { 0 } }; static const struct fbuiltin_7 funcs_7[] = { { do_Cairo_curve_to, "curve_to", "v", CAIRO_S "nnnnnn", "\n" " void curve_to (cairo_t cr, real x1, real y1, real x2, real y2, real x3, real y3)\n" "\n" " Draw Bézier spline to specified position\n" }, { do_Cairo_rel_curve_to, "rel_curve_to", "v", CAIRO_S "nnnnnn", "\n" " void curve_to (cairo_t cr, real x1, real y1, real x2, real y2, real x3, real y3)\n" "\n" " Draw Bézier spline to specified offset from the current position\n" }, { 0 } }; static const struct fbuiltin_1 surfuncs_1[] = { { do_Cairo_Surface_finish, "finish", "v", SURFACE_S, "\n" " void finish (surface_t surface)\n" "\n" " Finish a surface. All output to the surface is finalized\n" }, { do_Cairo_Surface_destroy, "destroy", "v", SURFACE_S, "\n" " void destroy (surface_t surface)\n" "\n" " Destroy a surface. Further usage will raise an exception.\n" }, { do_Cairo_Surface_width, "width", "i", SURFACE_S, "\n" " int width (surface_t surface)\n" "\n" " Returns the width of the given surface\n" }, { do_Cairo_Surface_height, "height", "i", SURFACE_S, "\n" " int height (surface_t surface)\n" "\n" " Returns the height of the given surface\n" }, { do_Cairo_Surface_open_event, "open_event", "f", SURFACE_S, "\n" " file open_event (surface_t surface)\n" "\n" " Returns a file which will receive events\n" }, { 0 } }; static const struct fbuiltin_2 surfuncs_2[] = { { do_Cairo_Surface_write_to_png, "write_to_png", "v", SURFACE_S "s", "\n" " void write_to_png (surface_t surface, string filename)\n" "\n" " Write a surface to filename in png format\n" }, { do_Cairo_Surface_write_to_png_file, "write_to_png_file", "v", SURFACE_S "f", "\n" " void write_to_png (surface_t surface, file f)\n" "\n" " Write a surface to f in png format\n" }, { 0 } }; static const struct fbuiltin_3 surfuncs_3[] = { { do_Cairo_Surface_create_window, "create_window", SURFACE_S, "snn", "\n" " surface_t create_window (real width, real height)\n" "\n" " Create a window and return a surface pointer for it\n" }, { do_Cairo_Surface_create_similar, "create_similar", SURFACE_S, SURFACE_S "nn", "\n" " surface_t create_similar (surface_t related, real width, real height)\n" "\n" " Create a similar surface related to another surface\n" }, { do_Cairo_Surface_set_device_offset, "set_device_offset", "v", SURFACE_S "nn", "\n" " void set_device_offset (surface_t surface, real x, real y)\n" "\n" " Sets the device offset for surface to x,y\n" }, { 0 } }; static const struct fbuiltin_1 patfuncs_1[] = { { do_Cairo_Pattern_create_for_surface, "create_for_surface", PATTERN_S, CAIRO_S, "\n" " pattern_t create_for_surface (cairo_t cr)\n" "\n" " Returns a pattern referencing the specified surface\n" }, { do_Cairo_Pattern_get_matrix, "get_matrix", MATRIX_S, PATTERN_S, "\n" " matrix_t get_matrix (pattern_t pattern)\n" "\n" " Returns current pattern transformation matrix\n" }, { do_Cairo_Pattern_get_extend, "get_extend", EXTEND_S, PATTERN_S, "\n" " status_t get_extend (pattern_t pattern, extend_t extend)\n" "\n" " Returns current pattern extend method\n" }, { do_Cairo_Pattern_get_filter, "get_filter", FILTER_S, PATTERN_S, "\n" " status_t get_filter (pattern_t pattern, filter_t filter)\n" "\n" " Returns current pattern filter method\n" }, { 0 } }; static const struct fbuiltin_2 patfuncs_2[] = { { do_Cairo_Pattern_set_matrix, "set_matrix", "v", PATTERN_S MATRIX_S, "\n" " void set_matrix (pattern_t pattern, matrix_t matrix)\n" "\n" " Set a transformation matrix for a pattern\n" }, { do_Cairo_Pattern_set_extend, "set_extend", "v", PATTERN_S EXTEND_S, "\n" " void set_extend (pattern_t pattern, extend_t extend)\n" "\n" " Set a extend method for a pattern\n" }, { do_Cairo_Pattern_set_filter, "set_filter", "v", PATTERN_S FILTER_S, "\n" " void set_filter (pattern_t pattern, filter_t filter)\n" "\n" " Set a filter method for a pattern\n" }, { 0 } }; static const struct fbuiltin_4 patfuncs_4[] = { { do_Cairo_Pattern_create_linear, "create_linear", PATTERN_S, "nnnn", "\n" " pattern_t create_linear (real x0, real y0, real x1, real y1)\n" "\n" " Create a linear gradient pattern\n" }, { 0 } }; static const struct fbuiltin_5 patfuncs_5[] = { { do_Cairo_Pattern_add_color_stop_rgb, "add_color_stop_rgb", "v", PATTERN_S "nnnn", "\n" " void add_color_stop_rgba (pattern_t cr, real offset, real red, real green, real blue)\n" "\n" " Add a color stop in a gradient pattern.\n" }, { 0 } }; static const struct fbuiltin_6 patfuncs_6[] = { { do_Cairo_Pattern_create_radial, "create_radial", PATTERN_S, "nnnnnn", "\n" " pattern_t create_radial (real cx0, real cy0, real radius0, real cx1, real cy1, real radius1)\n" "\n" " Create a radial gradient pattern\n" }, { do_Cairo_Pattern_add_color_stop_rgba, "add_color_stop_rgba", "v", PATTERN_S "nnnnn", "\n" " void add_color_stop_rgba (pattern_t cr, real offset, real red, real green, real blue, real alpha)\n" "\n" " Add a color and opacity stop in a gradient pattern.\n" }, { 0 } }; static const struct fbuiltin_1 imgfuncs_1[] = { { do_Cairo_Image_surface_create_from_png, "surface_create_from_png", SURFACE_S, "s", "\n" " surface_t surface_create_from_png (string filename)\n" "\n" " Create an image surface from the png image in filename\n" }, { do_Cairo_Image_surface_create_from_png_file, "surface_create_from_png_file", SURFACE_S, "f", "\n" " surface_t surface_create_from_png_file (file f)\n" "\n" " Create an image surface from the png image in f\n" }, { 0 } }; static const struct fbuiltin_3 imgfuncs_3[] = { { do_Cairo_Image_surface_create, "surface_create", SURFACE_S, "iii", "\n" " surface_t surface_create (int format, int width, int height)\n" "\n" " Create an image surface of the specified size in pixels\n" }, { 0 } }; static const struct fbuiltin_3 pdffuncs_3[] = { { do_Cairo_Pdf_surface_create, "surface_create", SURFACE_S, "snn", "\n" " surface_t surface_create (string filename, real width, real height)\n" "\n" " Create a PDF surface of the specified size in points, written to filename\n" }, { do_Cairo_Pdf_surface_create, "surface_create_for_file", SURFACE_S, "snn", "\n" " surface_t surface_create (file f, real width, real height)\n" "\n" " Create a PDF surface of the specified size in points, written to f\n" }, { 0 } }; init_types (); BuiltinFuncs1 (&CairoNamespace, funcs_1); BuiltinFuncs2 (&CairoNamespace, funcs_2); BuiltinFuncs3 (&CairoNamespace, funcs_3); BuiltinFuncs4 (&CairoNamespace, funcs_4); BuiltinFuncs5 (&CairoNamespace, funcs_5); BuiltinFuncs6 (&CairoNamespace, funcs_6); BuiltinFuncs7 (&CairoNamespace, funcs_7); BuiltinFuncs1 (&CairoSurfaceNamespace, surfuncs_1); BuiltinFuncs2 (&CairoSurfaceNamespace, surfuncs_2); BuiltinFuncs3 (&CairoSurfaceNamespace, surfuncs_3); BuiltinFuncs1 (&CairoPatternNamespace, patfuncs_1); BuiltinFuncs2 (&CairoPatternNamespace, patfuncs_2); BuiltinFuncs4 (&CairoPatternNamespace, patfuncs_4); BuiltinFuncs5 (&CairoPatternNamespace, patfuncs_5); BuiltinFuncs6 (&CairoPatternNamespace, patfuncs_6); BuiltinFuncs1 (&CairoImageNamespace, imgfuncs_1); BuiltinFuncs3 (&CairoImageNamespace, imgfuncs_3); BuiltinFuncs3 (&CairoPdfNamespace, pdffuncs_3); RETURN(TrueVal); } @ 1.16 log @2005-07-07 Keith Packard * cairo-5c.h: * cairo.c: (do_Cairo_status_to_string): * examples/fob.5c: * gtk.c: (create_gtk_global): * init.c: (nickle_init): * pattern.c: (do_Cairo_Pattern_add_color_stop_rgba), (do_Cairo_Pattern_add_color_stop_rgb), (do_Cairo_Pattern_set_matrix), (do_Cairo_Pattern_set_extend), (do_Cairo_Pattern_set_filter): Match current cairo API. Use XInitThreads, as it's necessary for stable operation. Requires at least one bug fix not yet in Xlib CVS to work @ text @d1 1 a1 1 /* $Id: init.c,v 1.15 2005/06/07 05:09:35 keithp Exp $ d360 1 a360 1 BuildUnionType(5, @ 1.15 log @2005-06-06 Keith Packard * cairo.5c: * init.c: (init_types), (nickle_init): Enum order and names changed in API shuffle. * examples/fob.5c: Create .png files by default @ text @d1 1 a1 1 /* $Id: init.c,v 1.14 2005/05/18 06:21:15 keithp Exp $ d474 2 a475 2 { do_Cairo_status_string, "status_string", "s", CAIRO_S, "\n" " string status_string (cairo_t cr)\n" d477 1 a477 1 " Return the status string of a cairo surface\n" }, d900 2 a901 2 { do_Cairo_Pattern_set_matrix, "set_matrix", STATUS_S, PATTERN_S MATRIX_S, "\n" " status_t set_matrix (pattern_t pattern, matrix_t matrix)\n" d904 2 a905 2 { do_Cairo_Pattern_set_extend, "set_extend", STATUS_S, PATTERN_S EXTEND_S, "\n" " status_t set_extend (pattern_t pattern, extend_t extend)\n" d908 2 a909 2 { do_Cairo_Pattern_set_filter, "set_filter", STATUS_S, PATTERN_S FILTER_S, "\n" " status_t set_filter (pattern_t pattern, filter_t filter)\n" d923 8 d936 2 a937 2 { do_Cairo_Pattern_add_color_stop_rgba, "add_color_stop", STATUS_S, PATTERN_S "nnnnn", "\n" " status_t add_color_stop_rgba (pattern_t cr, real offset, real red, real green, real blue, real alpha)\n" d939 1 a939 1 " Add a color stop in a gradient pattern.\n" }, d992 1 @ 1.14 log @2005-05-17 Keith Packard * cairo-5c.h: * cairo.5c: * cairo.c: (cairo_5c_get), (do_Cairo_create), (cairo_5c_dirty), (cairo_5c_enable), (cairo_5c_disable), (do_Cairo_get_target): * draw.c: (do_Cairo_paint), (do_Cairo_paint_with_alpha), (do_Cairo_mask), (do_Cairo_mask_surface), (do_Cairo_fill_preserve), (do_Cairo_stroke_preserve), (path_elt_new), (path_array), (do_Cairo_copy_path), (do_Cairo_copy_path_flat), (do_Cairo_append_path): * event.c: (do_Cairo_Surface_open_event): * examples/animate.5c: * examples/draw.5c: * examples/fob.5c: * examples/metrics.5c: * examples/sin.5c: * examples/spin.5c: * examples/spinman.5c: * examples/test.5c: * gstate.c: (do_Cairo_set_source_surface), (do_Cairo_identity_matrix), (do_Cairo_transform), (do_Cairo_user_to_device), (do_Cairo_user_to_device_distance), (do_Cairo_device_to_user), (do_Cairo_device_to_user_distance), (do_Cairo_reset_clip), (do_Cairo_clip_preserve): * gtk.c: (create_gtk_global): * init.c: (init_types), (nickle_init): * pattern.c: (do_Cairo_Pattern_create_for_surface), (do_Cairo_Pattern_add_color_stop_rgba), (do_Cairo_Pattern_add_color_stop_rgb): * surface.c: (cairo_5c_surface_get), (cairo_5c_surface_mark), (cairo_5c_surface_destroy), (do_Cairo_Surface_write_to_png), (do_Cairo_Surface_write_to_png_file), (do_Cairo_Surface_set_device_offset), (do_Cairo_Surface_create_similar), (do_Cairo_Surface_finish), (do_Cairo_Surface_destroy), (do_Cairo_Surface_width), (do_Cairo_Surface_height), (do_Cairo_Image_surface_create), (do_Cairo_Image_surface_create_from_png), (do_Cairo_Image_surface_create_from_png_file), (do_Cairo_Pdf_surface_create): * text.c: (do_Cairo_select_font_face), (do_Cairo_get_font_matrix): Another round of API changes for cairo 0.5, the putative final API structure. @ text @d1 1 a1 1 /* $Id: init.c,v 1.13 2005/05/02 20:24:38 keithp Exp $ d166 1 a166 1 BuildEnumType (8, d174 7 a180 1 "NULL_POINTER")); d188 2 a189 2 "SRC", "DST", a190 1 "OVER_REVERSE", a191 1 "IN_REVERSE", a192 1 "OUT_REVERSE", d194 7 a200 1 "ATOP_REVERSE", d948 1 a948 1 { do_Cairo_Image_surface_create, "surface_create", SURFACE_S, "nnn", "\n" @ 1.13 log @2005-05-02 Keith Packard * cairo-5c.h: * cairo.5c: * cairo.c: (cairo_5c_dirty), (cairo_5c_enable), (cairo_5c_disable), (do_Cairo_get_target_surface): * event.c: (do_Cairo_Surface_open_event): * gstate.c: (do_Cairo_set_source_rgb), (do_Cairo_set_source_rgba), (do_Cairo_get_matrix), (do_Cairo_concat_matrix), (do_Cairo_set_matrix), (do_Cairo_get_operator), (do_Cairo_get_tolerance), (do_Cairo_get_current_point), (do_Cairo_get_fill_rule), (do_Cairo_get_line_width), (do_Cairo_get_line_cap), (do_Cairo_get_line_join), (do_Cairo_get_miter_limit): * gtk.c: (delete_drawing_area), (motion_notify_event), (button_press_event), (button_release_event), (gtk_repaint_timeout), (gtk_thread_main), (gtk_global_free), (create_gtk_global), (cairo_5c_tool_dirty), (cairo_5c_tool_enable): * init.c: (init_types), (nickle_init): * matrix.c: (cairo_matrix_part), (new_cairo_matrix): * pattern.c: (do_Cairo_set_source), (do_Cairo_get_source), (do_Cairo_Pattern_set_matrix), (do_Cairo_Pattern_get_matrix): * surface.c: (cairo_5c_surface_get), (cairo_5c_surface_mark), (cairo_5c_surface_destroy), (do_Cairo_Surface_create_image), (do_Cairo_Surface_write_to_png): * text.c: (do_Cairo_set_font), (do_Cairo_set_font_size), (do_Cairo_set_font_matrix), (do_Cairo_font_extents): Match cairo API as of today. * examples/draw.5c: * examples/fob.5c: * examples/graph.5c: * examples/grid.5c: * examples/led.5c: * examples/pie-new.5c: * examples/pie.5c: * examples/rottext.5c: * examples/sin.5c: * examples/spin-cairo.5c: * examples/spin.5c: * examples/spinman.5c: * examples/test.5c: * examples/text45.5c: Update examples to match API changes @ text @d1 1 a1 1 /* $Id: init.c,v 1.12 2005/02/11 21:15:46 keithp Exp $ d41 2 a60 2 Type *typeCairoMoveTo; Type *typeCairoLineTo; d62 2 a63 1 Type *typeCairoClosePath; a103 4 #define MOVE_TO_I 18 #define MOVE_TO_S "18" #define LINE_TO_I 19 #define LINE_TO_S "19" d106 4 a109 2 #define CLOSE_PATH_I 21 #define CLOSE_PATH_S "21" d142 1 a142 1 Symbol *mt, *lt, *ct, *cp, *path; d328 1 a328 1 * Recursive datatypes aren't supported by the simple API d330 1 a330 15 typeCairoMoveTo = make_typedef ("move_to_t", CairoNamespace, publish_public, MOVE_TO_I, &mt, 0); typeCairoLineTo = make_typedef ("line_to_t", CairoNamespace, publish_public, LINE_TO_I, <, 0); d338 7 a344 6 typeCairoClosePath = make_typedef ("close_path_t", CairoNamespace, publish_public, CLOSE_PATH_I, &cp, 0); d352 2 a353 2 NewTypeRef (typeCairoMoveTo, True), "move_to", NewTypeRef (typeCairoLineTo, True), "line_to", d355 1 a355 2 NewTypeRef (typeCairoClosePath, True), "close_path", typePrim[rep_void], "end")); a356 9 mt->symbol.type = BuildStructType (3, typeCairoPath, "next", typePrim[rep_float], "x", typePrim[rep_float], "y"); lt->symbol.type = BuildStructType (3, typeCairoPath, "next", typePrim[rep_float], "x", typePrim[rep_float], "y"); d358 1 a358 11 ct->symbol.type = BuildStructType (7, typeCairoPath, "next", typePrim[rep_float], "x1", typePrim[rep_float], "y1", typePrim[rep_float], "x2", typePrim[rep_float], "y2", typePrim[rep_float], "x3", typePrim[rep_float], "y3"); cp->symbol.type = BuildStructType (1, typeCairoPath, "next"); d360 1 d362 1 a362 3 CairoSurfaceNamespace = BuiltinNamespace (&CairoNamespace, "Surface")->namespace.namespace; d389 13 d447 3 a449 3 static const struct fbuiltin_0 funcs_0[] = { { do_Cairo_create, "create", CAIRO_S, "", "\n" " cairo_t create ()\n" d451 1 a451 1 " Create a cairo context.\n" a452 4 { 0 }, }; static const struct fbuiltin_1 funcs_1[] = { d454 1 a454 1 " void destroy (cairo_t cairo)\n" d457 2 a458 2 { do_Cairo_get_target_surface, "get_target_surface", SURFACE_S, CAIRO_S, "\n" " surface_t get_target_surface (cairo_t cairo)\n" d462 1 a462 1 " status_t status (cairo_t cairo)\n" d466 1 a466 1 " string status_string (cairo_t cairo)\n" d470 1 a470 1 " void enable (cairo_t cairo)\n" d474 1 a474 1 " void disable (cairo_t cairo)\n" d478 1 a478 1 " void save (cairo_t cairo)\n" d482 1 a482 1 " void restore (cairo_t cairo)\n" d486 1 a486 1 " void identity_matrix (cairo_t cairo)\n" a488 4 { do_Cairo_default_matrix, "default_matrix", "v", CAIRO_S, "\n" " void default_matrix (cairo_t cairo)\n" "\n" " Set transformation matrix to default\n" }, d490 1 a490 1 " void new_path (cairo_t cairo)\n" d494 1 a494 1 " void close_path (cairo_t cairo)\n" d498 1 a498 1 " void fill (cairo_t cairo)\n" d502 5 d508 1 a508 1 " void stroke (cairo_t cairo)\n" d512 5 d518 1 a518 1 " void copy_page (cairo_t cairo)\n" d523 1 a523 1 " void show_page (cairo_t cairo)\n" d527 2 a528 2 { do_Cairo_current_path_flat_list, "current_path_flat_list", PATH_S, CAIRO_S, "\n" " void current_path_flat (cairo_t cr)\n" d530 1 a530 1 " Returns the current path with curves tesselated to lines\n" }, d532 2 a533 2 { do_Cairo_current_path_list, "current_path_list", PATH_S, CAIRO_S, "\n" " void current_path (cairo_t cr)\n" d535 1 a535 1 " Returns the current path\n" }, d537 2 a538 2 { do_Cairo_init_clip, "init_clip", "v", CAIRO_S, "\n" " void init_clip (cairo_t cairo)\n" d540 2 a541 2 " Resets clip list to whole surface\n" }, d543 6 a548 1 " void clip (cairo_t cairo)\n" d550 1 a550 1 " Clip to current path. Does not empty path.\n" }, d553 1 a553 1 " rect_t stroke_extents (cairo_t cairo)\n" d558 1 a558 1 " rect_t fill_extents (cairo_t cairo)\n" d563 1 a563 1 " operator_t get_operator (cairo_t cairo)\n" d568 1 a568 1 " pattern_t get_source (cairo_t cairo)\n" d573 1 a573 1 " real get_tolerance (cairo_t cairo)\n" d578 1 a578 1 " point_t current_point (cairo_t cairo)\n" d583 1 a583 1 " fill_rule_t get_fill_rule (cairo_t cairo)\n" d588 1 a588 1 " real get_line_width (cairo_t cairo)\n" a590 1 d592 1 a592 1 " line_cap_t get_line_cap (cairo_t cairo)\n" a594 1 d596 1 a596 1 " line_join_t get_line_join (cairo_t cairo)\n" a598 1 d600 1 a600 1 " real get_miter_limit (cairo_t cairo)\n" a602 1 d604 1 a604 1 " matrix_t get_matrix (cairo_t cairo)\n" d607 8 a614 1 d616 1 a616 1 " font_extents_t font_extents (cairo_t cairo)\n" a622 8 { do_Cairo_set_target_surface, "set_target_surface", "v", CAIRO_S SURFACE_S, "\n" " void set_target_surface (cairo_t cr, surface_t surface)\n" "\n" " Set target surface for drawing operations\n" }, { do_Cairo_copy, "copy", "v", CAIRO_S CAIRO_S, "\n" " void copy (cairo_t dst, cairo_t src)\n" "\n" " Copy state from one rendering context to another\n" }, d659 12 d672 1 a672 1 " void set_font (cairo_t cr, string name)\n" d674 1 a674 1 " Select and set current font from name.\n" }, d695 2 a696 2 { do_Cairo_concat_matrix, "concat_matrix", "v", CAIRO_S MATRIX_S, "\n" " void concat_matrix (cairo_t cr, matrix_t matrix)\n" d703 2 a704 2 { do_Cairo_transform_point, "transform_point", POINT_S, CAIRO_S POINT_S, "\n" " point_t transform_point (cairo_t cr, point_t)\n" d707 2 a708 2 { do_Cairo_transform_distance, "transform_distance", POINT_S, CAIRO_S POINT_S, "\n" " point_t transform_distance (cairo_t cr, point_t point)\n" d711 2 a712 2 { do_Cairo_inverse_transform_point, "inverse_transform_point", POINT_S, CAIRO_S POINT_S, "\n" " point_t inverse_transform_point (cairo_t cr, point_t point)\n" d715 2 a716 2 { do_Cairo_inverse_transform_distance, "inverse_transform_distance", POINT_S, CAIRO_S POINT_S, "\n" " point_t inverse_transform_distance (cairo_t cr, point_t point)\n" a722 10 #if 0 { do_Cairo_new_png, "new_png", CAIRO_S, "sii", "\n" " cairo_t new_png (string filename, int width, int height)\n" "\n" " Create a cairo png file.\n" }, { do_Cairo_new_scratch, "new_scratch", CAIRO_S, CAIRO_S "ii", "\n" " cairo_t new_scratch (cairo_t cr, int width, int height)\n" "\n" " Create a scratch surface related to the given surface.\n" }, #endif d752 1 a752 1 " bool in_fill (cairo_t cairo, real x, real y)\n" d756 1 a756 1 " bool in_stroke (cairo_t cairo, real x, real y)\n" d767 2 a768 2 { do_Cairo_select_font, "select_font", "v", CAIRO_S "s" FONT_SLANT_S FONT_WEIGHT_S, "\n" " void select_font (cairo_t cr, string family, slant_t slant, weight_t weight)\n" d770 9 a778 1 " Set current font\n" }, d819 4 d843 2 a844 2 { do_Cairo_Surface_create_image, "create_image", SURFACE_S, "nn", "\n" " surface_t create_image (real width, real height)\n" d846 3 a848 3 " Create an image surface\n" }, { do_Cairo_Surface_write_to_png, "write_to_png", "v", SURFACE_S "s", "\n" " surface_t write_to_png (surface_t surface, string filename)\n" d850 1 a850 1 " Write a surface to a file in png format\n" }, d863 2 a864 6 { 0 } }; static const struct fbuiltin_5 surfuncs_5[] = { { do_Cairo_Surface_create_ps, "create_ps", SURFACE_S, "snnnn", "\n" " surface_t create_ps (string filename, real width_inches, real height_inches, real xppi, real yppi)\n" d866 1 a866 1 " Create a PostScript file and return a surface pointer for it\n" }, a870 4 { do_Cairo_Pattern_create_png, "create_png", PATTERN_S, "s", "\n" " pattern_t create_png (string filename)\n" "\n" " Returns a pattern containing the specified png image\n" }, d919 2 a920 2 { do_Cairo_Pattern_add_color_stop, "add_color_stop", STATUS_S, PATTERN_S "nnnnn", "\n" " status_t add_color_stop (pattern_t cr, real offset, real red, real green, real blue, real alpha)\n" d926 32 a959 1 BuiltinFuncs0 (&CairoNamespace, funcs_0); a970 1 BuiltinFuncs5 (&CairoSurfaceNamespace, surfuncs_5); d977 5 @ 1.12 log @2005-01-02 Keith Packard * cairo-5c.h: Add do_Cairo_copy_page and do_Cairo_show_page. Track whether copy_page/show_page have ever been called so that they can be when the surface is destroyed. * cairo.c: (cairo_5c_free), (cairo_5c_dirty): * draw.c: (do_Cairo_arc), (do_Cairo_arc_negative), (do_Cairo_copy_page), (do_Cairo_show_page): Fix arc arguments * event.c: (do_Cairo_Surface_open_event): * gtk.c: (cairo_5c_tool_destroy): * init.c: (nickle_init): * surface.c: (cairo_5c_surface_mark), (cairo_5c_surface_destroy), (cairo_5c_surface_free), (do_Cairo_Surface_create_window), (do_Cairo_Surface_create_png), (do_Cairo_Surface_create_ps), (do_Cairo_Surface_create_similar), (do_Cairo_Surface_destroy): dunno @ text @d1 1 a1 1 /* $Id: init.c,v 1.11 2004/12/24 09:00:10 keithp Exp $ d56 1 d97 14 a110 12 #define PATTERN_I 15 #define PATTERN_S "15" #define PATH_I 16 #define PATH_S "16" #define MOVE_TO_I 17 #define MOVE_TO_S "17" #define LINE_TO_I 18 #define LINE_TO_S "18" #define CURVE_TO_I 19 #define CURVE_TO_S "19" #define CLOSE_PATH_I 20 #define CLOSE_PATH_S "20" d272 7 a278 2 BuildArrayType (typePrim[rep_float], 2, 2, 3)); d310 11 d483 2 a484 2 { do_Cairo_current_target_surface, "current_target_surface", SURFACE_S, CAIRO_S, "\n" " surface_t current_target_surface (cairo_t cairo)\n" d577 2 a578 2 { do_Cairo_current_operator, "current_operator", OPERATOR_S, CAIRO_S, "\n" " operator_t current_operator (cairo_t cairo)\n" d582 2 a583 2 { do_Cairo_current_rgb_color, "current_rgb_color", RGB_COLOR_S, CAIRO_S, "\n" " rgb_color_t current_rgb_color (cairo_t cairo)\n" d585 1 a585 1 " Returns the current rgb color\n" }, d587 2 a588 11 { do_Cairo_current_alpha, "current_alpha", "n", CAIRO_S, "\n" " real current_alpha (cairo_t cairo)\n" "\n" " Returns the current alpha\n" }, { do_Cairo_current_pattern, "current_pattern", PATTERN_S, CAIRO_S, "\n" " pattern_t current_pattern (cairo_t cairo)\n" "\n" " Returns the current pattern\n" }, { do_Cairo_current_tolerance, "current_tolerance", "n", CAIRO_S, "\n" " real current_tolerance (cairo_t cairo)\n" d592 1 a592 1 { do_Cairo_current_point, "current_point", RGB_COLOR_S, CAIRO_S, "\n" d597 2 a598 2 { do_Cairo_current_fill_rule, "current_fill_rule", FILL_RULE_S, CAIRO_S, "\n" " fill_rule_t current_fill_rule (cairo_t cairo)\n" d602 2 a603 2 { do_Cairo_current_line_width, "current_line_width", "n", CAIRO_S, "\n" " real current_line_width (cairo_t cairo)\n" d607 2 a608 2 { do_Cairo_current_line_cap, "current_line_cap", LINE_CAP_S, CAIRO_S, "\n" " line_cap_t current_line_cap (cairo_t cairo)\n" d612 2 a613 2 { do_Cairo_current_line_join, "current_line_join", LINE_JOIN_S, CAIRO_S, "\n" " line_join_t current_line_join (cairo_t cairo)\n" d617 2 a618 2 { do_Cairo_current_miter_limit, "current_miter_limit", "n", CAIRO_S, "\n" " real current_miter_limit (cairo_t cairo)\n" d622 2 a623 2 { do_Cairo_current_matrix, "current_matrix", MATRIX_S, CAIRO_S, "\n" " matrix_t current_matrix (cairo_t cairo)\n" d627 2 a628 2 { do_Cairo_current_font_extents, "current_font_extents", FONT_EXTENTS_S, CAIRO_S, "\n" " font_extents_t current_font_extents (cairo_t cairo)\n" d647 2 a648 2 { do_Cairo_set_pattern, "set_pattern", "v", CAIRO_S PATTERN_S, "\n" " void set_pattern (cairo_t cr, pattern_t pattern)\n" d650 1 a650 5 " Set current pattern\n" }, { do_Cairo_set_alpha, "set_alpha", "v", CAIRO_S "n", "\n" " void set_alpha (cairo_t cr, real alpha)\n" "\n" " Set current alpha\n" }, d683 2 a684 2 { do_Cairo_scale_font, "scale_font", "v", CAIRO_S "n", "\n" " void scale_font (cairo_t cr, real scale)\n" d686 3 a688 3 " Scales current font by specified amount\n" }, { do_Cairo_transform_font, "transform_font", "v", CAIRO_S MATRIX_S, "\n" " void transform_font (cairo_t cr, matrix_t matrix)\n" d690 1 a690 1 " Transforms current font by specified matrix\n" }, d781 2 a782 2 { do_Cairo_set_rgb_color, "set_rgb_color", "v", CAIRO_S "nnn", "\n" " void set_rgb_color (cairo_t cr, real red, real green, real blue)\n" d784 1 a784 1 " Set current color\n" }, d797 4 d848 12 a864 4 { do_Cairo_Surface_create_png, "create_png", SURFACE_S, "snn", "\n" " surface_t create_png (string filename, real width, real height)\n" "\n" " Create a png file and return a surface pointer for it\n" }, d952 1 @ 1.11 log @2004-12-24 Keith Packard * cairo-5c.h: * cairo.5c: * cairo.c: (do_Cairo_set_target_surface): * gtk.c: (delete_drawing_area), (gtk_tool_free), (cairo_5c_tool_create), (cairo_5c_tool_destroy): * init.c: (nickle_init): * surface.c: (create_cairo_window), (cairo_5c_surface_get), (do_Cairo_Surface_create_window): Handle window delete more gracefully; report exception on drawing, report 'delete' event to event reader. Have default surface creation code re-create a surface when the old default surface has been destroyed. @ text @d1 1 a1 1 /* $Id: init.c,v 1.10 2004/12/23 22:39:40 keithp Exp $ d518 10 d796 1 a796 1 " void arc (cairo_t cr, real x1, real y1, real x2, real y2, real radius)\n" d798 1 a798 1 " Draw a clockwise arc from x1,y1 to x2,y2 with the given radius\n" }, d800 1 a800 1 " void arc (cairo_t cr, real x1, real y1, real x2, real y2, real radius)\n" d802 1 a802 1 " Draw a counter-clockwise arc from x1,y1 to x2,y2 with the given radius\n" }, @ 1.10 log @2004-12-23 Keith Packard * Makefile.am: * cairo-5c.h: * cairo.5c: * cairo.c: (cairo_5c_get), (cairo_5c_mark), (cairo_5c_free), (cairo_foreign_mark), (cairo_foreign_free), (do_Cairo_create), (cairo_5c_dirty), (cairo_5c_enable), (cairo_5c_disable), (do_Cairo_set_target_surface), (do_Cairo_current_target_surface), (do_Cairo_destroy), (do_Cairo_copy), (do_Cairo_status), (do_Cairo_status_string), (do_Cairo_enable), (do_Cairo_disable): * draw.c: (do_Cairo_new_path), (do_Cairo_move_to), (do_Cairo_line_to), (do_Cairo_curve_to), (do_Cairo_arc), (do_Cairo_arc_negative), (do_Cairo_rel_move_to), (do_Cairo_rel_line_to), (do_Cairo_rel_curve_to), (do_Cairo_rectangle), (do_Cairo_close_path), (do_Cairo_fill), (do_Cairo_stroke), (do_Cairo_in_stroke), (do_Cairo_in_fill), (do_Cairo_stroke_extents), (do_Cairo_fill_extents), (do_Cairo_current_path_list), (do_Cairo_current_path_flat_list): * event.c: (do_Cairo_Surface_open_event): * examples/draw.5c: * examples/graph.5c: * examples/grid.5c: * examples/rottext.5c: * gstate.c: (do_Cairo_save), (do_Cairo_restore), (do_Cairo_set_operator), (do_Cairo_set_rgb_color), (do_Cairo_set_alpha), (do_Cairo_set_tolerance), (do_Cairo_set_fill_rule), (do_Cairo_set_line_width), (do_Cairo_set_line_cap), (do_Cairo_set_line_join), (do_Cairo_set_dash), (do_Cairo_set_miter_limit), (do_Cairo_identity_matrix), (do_Cairo_default_matrix), (do_Cairo_translate), (do_Cairo_scale), (do_Cairo_rotate), (do_Cairo_current_matrix), (do_Cairo_concat_matrix), (do_Cairo_set_matrix), (do_Cairo_transform_point), (do_Cairo_transform_distance), (do_Cairo_inverse_transform_point), (do_Cairo_inverse_transform_distance), (do_Cairo_init_clip), (do_Cairo_clip), (do_Cairo_current_operator), (do_Cairo_current_rgb_color), (do_Cairo_current_alpha), (do_Cairo_current_tolerance), (do_Cairo_current_point), (do_Cairo_current_fill_rule), (do_Cairo_current_line_width), (do_Cairo_current_line_cap), (do_Cairo_current_line_join), (do_Cairo_current_miter_limit): * gtk.c: (configure_event), (expose_event), (delete_drawing_area), (delete_event), (motion_notify_event), (button_press_event), (button_release_event), (gtk_repaint), (gtk_repaint_timeout), (gtk_global_mark), (gtk_global_free), (create_gtk_global), (gtk_tool_mark), (gtk_tool_free), (cairo_5c_tool_create), (cairo_5c_tool_destroy), (cairo_5c_tool_mark), (cairo_5c_tool_dirty), (cairo_5c_tool_disable), (cairo_5c_tool_enable), (cairo_5c_tool_display): * init.c: (init_types), (nickle_init): * pattern.c: (mark_cairo_pattern), (make_pattern_value), (do_Cairo_set_pattern), (do_Cairo_current_pattern), (do_Cairo_Pattern_create_for_surface): * surface.c: (create_cairo_window), (cairo_5c_surface_get), (cairo_5c_surface_mark), (cairo_5c_surface_free), (cairo_surface_foreign_mark), (cairo_surface_foreign_free), (do_Cairo_Surface_create_window), (do_Cairo_Surface_create_png), (do_Cairo_Surface_create_ps), (do_Cairo_Surface_create_similar), (do_Cairo_Surface_destroy), (do_Cairo_Surface_width), (do_Cairo_Surface_height): * text.c: (do_Cairo_select_font), (do_Cairo_set_font), (do_Cairo_scale_font), (do_Cairo_transform_font), (do_Cairo_current_font_extents), (do_Cairo_show_text), (do_Cairo_text_path), (do_Cairo_text_extents): Split cairo_t and cairo_surface_t functions apart, permitting more complex programs to be written that use more than a single window. Switch allocations around to mostly use the nickle memory allocator now. Requires updated nickle bits that expose this change in the foreign object API. @ text @d1 1 a1 1 /* $Id: init.c,v 1.9 2004/12/19 00:06:26 keithp Exp $ d828 2 a829 2 static const struct fbuiltin_2 surfuncs_2[] = { { do_Cairo_Surface_create_window, "create_window", SURFACE_S, "nn", "\n" a832 4 { 0 } }; static const struct fbuiltin_3 surfuncs_3[] = { a923 1 BuiltinFuncs2 (&CairoSurfaceNamespace, surfuncs_2); @ 1.9 log @2004-12-18 Keith Packard * cairo.5c: Add matrix operations * cairo-5c.h: * text.c: (do_Cairo_set_font), (do_Cairo_transform_font): * init.c: (nickle_init): Add set_font and transform_font interfaces * examples/animate.5c: * examples/pie.5c: use set_font interface * surface.c: (do_Cairo_dup): Duplicate gstate in dup operator @ text @d1 1 a1 1 /* $Id: init.c,v 1.8 2004/12/18 08:16:28 keithp Exp $ d39 1 d42 1 d51 1 d68 40 a107 36 #define STATUS_I 1 #define STATUS_S "01" #define OPERATOR_I 2 #define OPERATOR_S "02" #define FILL_RULE_I 3 #define FILL_RULE_S "03" #define LINE_CAP_I 4 #define LINE_CAP_S "04" #define LINE_JOIN_I 5 #define LINE_JOIN_S "05" #define FONT_SLANT_I 6 #define FONT_SLANT_S "06" #define FONT_WEIGHT_I 7 #define FONT_WEIGHT_S "07" #define TEXT_EXTENTS_I 8 #define TEXT_EXTENTS_S "08" #define MATRIX_I 9 #define MATRIX_S "09" #define POINT_I 10 #define POINT_S "10" #define RECT_I 11 #define RECT_S "11" #define RGB_COLOR_I 12 #define RGB_COLOR_S "12" #define PATTERN_I 13 #define PATTERN_S "13" #define PATH_I 14 #define PATH_S "14" #define MOVE_TO_I 15 #define MOVE_TO_S "15" #define LINE_TO_I 16 #define LINE_TO_S "16" #define CURVE_TO_I 17 #define CURVE_TO_S "17" #define CLOSE_PATH_I 18 #define CLOSE_PATH_S "18" d152 7 d253 11 d375 5 d449 9 a458 8 static const struct fbuiltin_v funcs_v[] = { { do_Cairo_new, "new", CAIRO_S, ".i", "\n" " cairo_t new (int...)\n" "\n" " Create a cairo window. Optional arguments are width, height\n" }, { 0 } }; d460 2 a461 2 { do_Cairo_dup, "dup", CAIRO_S, CAIRO_S, "\n" " cairo_t dup (cairo_t cairo)\n" d463 3 a465 7 " Creates another rendering context pointing at the same surface\n"}, { do_Cairo_width, "width", "i", CAIRO_S, "\n" " void width (cairo_t cairo)\n" "\n" " Return the width of a cairo surface\n" }, { do_Cairo_height, "height", "i", CAIRO_S, "\n" " void height (cairo_t cairo)\n" d467 1 a467 1 " Return the height of a cairo surface\n" }, d469 1 a469 1 " void status (cairo_t cairo)\n" d473 1 a473 1 " void status_string (cairo_t cairo)\n" a475 4 { do_Cairo_dispose, "dispose", "v", CAIRO_S, "\n" " void dispose (cairo_t cairo)\n" "\n" " Dispose a cairo surface\n" }, d607 2 a608 2 { do_Cairo_open_event, "open_event", "f", CAIRO_S, "\n" " file open_event (cairo_t cairo)\n" d610 1 a610 1 " Returns a file which will receive events\n" }, d615 8 d687 5 a691 1 { do_Cairo_set_matrix, "set_matrix", "v", CAIRO_S "A**n", "\n" d715 1 d724 1 d808 48 d918 1 a918 1 BuiltinFuncsV (&CairoNamespace, funcs_v); d927 5 @ 1.8 log @2004-12-18 Keith Packard * Makefile.am: * cairo.5c: * examples/animate.5c: * examples/draw.5c: * examples/pie.5c: * examples/rottext.5c: Fix examples to match API changes * gstate.c: (do_Cairo_transform_point), (do_Cairo_transform_distance), (do_Cairo_inverse_transform_point), (do_Cairo_inverse_transform_distance): transforms take point_t, return point_t * cairo-5c.h: * init.c: (nickle_init): * pattern.c: (do_Cairo_Pattern_create_for_surface), (premultiply_data), (create_surface_from_png), (do_Cairo_Pattern_create_png): * surface.c: (get_cairo_5c), (free_cairo_5c), (dirty_cairo_5c), (enable_cairo_5c), (disable_cairo_5c), (do_Cairo_new_png), (do_Cairo_new_scratch), (do_Cairo_dup), (do_Cairo_status): Add png loading, scratch surfaces and surface patterns @ text @d1 1 a1 1 /* $Id: init.c,v 1.7 2004/12/18 01:09:40 keithp Exp $ d632 4 d640 4 @ 1.7 log @2004-12-17 Keith Packard * Makefile.am: * cairo-5c.h: * cairo.5c: * gstate.c: (do_Cairo_set_alpha), (do_Cairo_current_matrix), (do_Cairo_set_matrix): * init.c: (make_typedef), (init_types), (nickle_init): * matrix.c: (cairo_matrix_part), (new_cairo_matrix): * pattern.c: (get_cairo_pattern), (free_cairo_pattern), (make_pattern_value), (do_Cairo_set_pattern), (do_Cairo_current_pattern), (do_Cairo_Pattern_create_linear), (do_Cairo_Pattern_create_radial), (do_Cairo_Pattern_add_color_stop), (do_Cairo_Pattern_set_matrix), (do_Cairo_Pattern_get_matrix), (do_Cairo_Pattern_set_extend), (do_Cairo_Pattern_get_extend), (do_Cairo_Pattern_set_filter), (do_Cairo_Pattern_get_filter): Add gradient pattern support. Split out matrix support to share. @ text @d1 1 a1 1 /* $Id: init.c,v 1.6 2004/12/17 09:40:43 keithp Exp $ d429 4 d676 4 d764 8 @ 1.6 log @2004-12-17 Keith Packard * cairo-5c.h: * cairo.5c: * draw.c: (path_new), (path_box), (cairo_5c_move_to), (cairo_5c_line_to), (cairo_5c_curve_to), (cairo_5c_close_path), (do_Cairo_current_path_list), (do_Cairo_current_path_flat_list): * init.c: (make_typedef), (init_types), (nickle_init): * surface.c: (get_cairo_5c): Add current_path/current_path_flat by creating nickle structure in C code holding the entire path and walking it in nickle code. * examples/.cvsignore: ignore build files @ text @d1 1 a1 1 /* $Id: init.c,v 1.5 2004/12/17 02:09:45 keithp Exp $ d39 1 d60 3 d102 5 d109 1 d121 1 a121 1 NamespaceAddName (CairoNamespace, sym, publish); d139 1 d146 1 d160 1 d181 1 d190 1 d200 1 d210 1 d219 1 d228 1 d240 1 d248 1 d257 1 d268 1 d278 1 d289 1 d296 1 d303 1 d310 1 d317 1 d350 25 d536 4 d588 1 a588 1 { do_Cairo_set_operator, "set_alpha", "v", CAIRO_S OPERATOR_S, "\n" d592 4 d755 52 d818 5 @ 1.5 log @2004-12-16 Keith Packard * Makefile.am: * autogen.sh: * cairo.5c: * configure.in: Add cairo.5c and install it to nickle libary * cairo-5c.h: * draw.c: (do_Cairo_rectangle), (do_Cairo_in_stroke), (do_Cairo_in_fill), (do_Cairo_stroke_extents), (do_Cairo_fill_extents), (cairo_5c_move_to), (do_Cairo_current_path), (do_Cairo_current_path_flat): * gstate.c: (do_Cairo_set_operator), (do_Cairo_set_fill_rule), (do_Cairo_set_line_cap), (do_Cairo_set_line_join), (do_Cairo_set_dash), (do_Cairo_set_miter_limit), (do_Cairo_default_matrix), (do_Cairo_transform_point), (do_Cairo_transform_distance), (do_Cairo_inverse_transform_point), (do_Cairo_inverse_transform_distance), (do_Cairo_init_clip), (do_Cairo_clip), (do_Cairo_current_operator), (do_Cairo_current_rgb_color), (do_Cairo_current_alpha), (do_Cairo_current_tolerance), (do_Cairo_current_point), (do_Cairo_current_fill_rule), (do_Cairo_current_line_width), (do_Cairo_current_line_cap), (do_Cairo_current_line_join), (do_Cairo_current_miter_limit): * init.c: (make_typedef), (init_types), (EnumIntPart), (IntToEnum), (nickle_init): * text.c: (do_Cairo_select_font), (do_Cairo_text_extents), (do_Cairo_select_ft_font): Add a bunch more bindings. Still more to do, especially the path walkers. Switch from int constants to enums for enumerated types. * gtk.c: (motion_notify_event), (button_press_event), (button_release_event), (cairo_5c_window_new): * surface.c: (do_Cairo_new): Add mouse input support. * examples/animate.5c: * examples/cairo.5c: * examples/draw.5c: * examples/graph.5c: * examples/pie.5c: * examples/rottext.5c: * examples/sin.5c: * examples/test.5c: Change examples to use cairo.5c file with autoimport @ text @d1 1 a1 1 /* $Id: init.c,v 1.4 2004/12/15 07:04:50 keithp Exp $ d52 6 d85 12 d99 5 a103 3 make_typedef (char *name_str, int usertype_id, Type *type) d111 1 a111 1 NamespaceAddName (CairoNamespace, sym, publish_public); d115 2 d123 1 d129 1 d131 1 d135 1 d137 1 d148 1 d150 1 d168 1 d170 1 d176 1 d178 1 d185 1 d187 1 d194 1 d196 1 d202 1 d204 1 d210 1 d212 1 d221 1 d223 1 d228 1 d230 1 d236 1 d238 1 d246 1 d248 1 d253 68 a320 1 d365 1 d437 10 @ 1.4 log @2004-12-14 Keith Packard * cairo-5c.h: * gtk.c: (gtk_repaint_timeout), (dirty_x), (disable_x), (enable_x): * init.c: (nickle_init): * surface.c: (enable_cairo_5c), (disable_cairo_5c), (do_Cairo_enable), (do_Cairo_disable): Add enable/disable to take advantage of double buffering for smooth animation. * examples/animate.5c: Use enable/disable to smooth this animation out @ text @d1 1 a1 1 /* $Id: init.c,v 1.3 2004/12/14 08:34:27 keithp Exp $ d39 205 a243 1 Type *typeTextExtents; d250 2 a251 2 { do_Cairo_new, "new", "F", ".i", "\n" " foreign new (int...)\n" d258 2 a259 2 { do_Cairo_width, "width", "i", "F", "\n" " void width (foreign cairo)\n" d262 2 a263 2 { do_Cairo_height, "height", "i", "F", "\n" " void height (foreign cairo)\n" d266 2 a267 2 { do_Cairo_status, "status", "i", "F", "\n" " void status (foreign cairo)\n" d270 2 a271 2 { do_Cairo_status_string, "status_string", "s", "F", "\n" " void status_string (foreign cairo)\n" d274 2 a275 2 { do_Cairo_dispose, "dispose", "v", "F", "\n" " void dispose (foreign cairo)\n" d278 2 a279 2 { do_Cairo_enable, "enable", "v", "F", "\n" " void enable (foreign cairo)\n" d282 2 a283 2 { do_Cairo_disable, "disable", "v", "F", "\n" " void disable (foreign cairo)\n" d286 2 a287 2 { do_Cairo_save, "save", "v", "F", "\n" " void save (foreign cairo)\n" d290 2 a291 2 { do_Cairo_restore, "restore", "v", "F", "\n" " void restore (foreign cairo)\n" d294 2 a295 2 { do_Cairo_identity_matrix, "identity_matrix", "v", "F", "\n" " void identity_matrix (foreign cairo)\n" d298 6 a303 2 { do_Cairo_new_path, "new_path", "v", "F", "\n" " void new_path (foreign cairo)\n" d306 2 a307 2 { do_Cairo_close_path, "close_path", "v", "F", "\n" " void close_path (foreign cairo)\n" d310 2 a311 2 { do_Cairo_fill, "fill", "v", "F", "\n" " void fill (foreign cairo)\n" d314 3 a316 2 { do_Cairo_stroke, "stroke", "v", "F", "\n" " void stroke (foreign cairo)\n" d319 73 a391 2 { do_Cairo_current_matrix, "current_matrix", "A**n", "F", "\n" " real[3,2] current_matrix (foreign cairo)\n" d394 5 d403 6 a408 2 { do_Cairo_set_alpha, "set_alpha", "v", "Fn", "\n" " void set_alpha (foreign cr, real alpha)\n" d411 2 a412 2 { do_Cairo_set_tolerance, "set_tolerance", "v", "Fn", "\n" " void set_tolerance (foreign cr, real alpha)\n" d415 6 a420 2 { do_Cairo_set_line_width, "set_line_width", "v", "Fn", "\n" " void set_line_width (foreign cr, real alpha)\n" d423 2 a424 2 { do_Cairo_set_line_cap, "set_line_cap", "v", "Fi", "\n" " void set_line_cap (foreign cr, int cap)\n" d427 2 a428 2 { do_Cairo_set_line_join, "set_line_join", "v", "Fi", "\n" " void set_line_join (foreign cr, int join)\n" d431 6 a436 2 { do_Cairo_rotate, "rotate", "v", "Fn", "\n" " void rotate (foreign cr, real radians)\n" d439 2 a440 2 { do_Cairo_scale_font, "scale_font", "v", "Fn", "\n" " void scale_font (foreign cr, real scale)\n" d443 2 a444 2 { do_Cairo_show_text, "show_text", "v", "Fs", "\n" " void show_text (foreign cr, string text)\n" d447 2 a448 2 { do_Cairo_text_path, "text_path", "v", "Fs", "\n" " void text_path (foreign cr, string text)\n" d451 2 a452 2 { do_Cairo_text_extents, "text_extents", "u", "Fs", "\n" " text_extents_t text_extents (foreign cr, string text)\n" d455 2 a456 2 { do_Cairo_set_matrix, "set_matrix", "v", "FA**n", "\n" " void set_matrix (foreign cr, real[3,2] matrix)\n" d459 16 d479 2 a480 2 { do_Cairo_new_png, "new_png", "F", "sii", "\n" " foreign new_png (string filename, int width, int height)\n" d483 2 a484 2 { do_Cairo_move_to, "move_to", "v", "Fnn", "\n" " void move_to (foreign cr, real x, real y)\n" d487 2 a488 2 { do_Cairo_line_to, "line_to", "v", "Fnn", "\n" " void line_to (foreign cr, real x, real y)\n" d491 2 a492 2 { do_Cairo_rel_move_to, "rel_move_to", "v", "Fnn", "\n" " void rel_move_to (foreign cr, real x, real y)\n" d495 2 a496 2 { do_Cairo_rel_line_to, "rel_line_to", "v", "Fnn", "\n" " void rel_line_to (foreign cr, real x, real y)\n" d499 2 a500 2 { do_Cairo_translate, "translate", "v", "Fnn", "\n" " void translate (foreign cr, real x, real y)\n" d503 2 a504 2 { do_Cairo_scale, "scale", "v", "Fnn", "\n" " void scale (foreign cr, real x, real y)\n" d507 12 d523 2 a524 2 { do_Cairo_set_rgb_color, "set_rgb_color", "v", "Fnnn", "\n" " void set_rgb_color (foreign cr, real red, real green, real blue)\n" d527 2 a528 2 { do_Cairo_select_font, "select_font", "v", "Fsii", "\n" " void select_font (foreign cr, string family, int slant, int weight)\n" d534 8 d543 2 a544 2 { do_Cairo_arc, "arc", "v", "Fnnnnn", "\n" " void arc (foreign cr, real x1, real y1, real x2, real y2, real radius)\n" d547 2 a548 2 { do_Cairo_arc_negative, "arc_negative", "v", "Fnnnnn", "\n" " void arc (foreign cr, real x1, real y1, real x2, real y2, real radius)\n" d555 2 a556 2 { do_Cairo_curve_to, "curve_to", "v", "Fnnnnnn", "\n" " void curve_to (foreign cr, real x1, real y1, real x2, real y2, real x3, real y3)\n" d559 2 a560 2 { do_Cairo_rel_curve_to, "rel_curve_to", "v", "Fnnnnnn", "\n" " void curve_to (foreign cr, real x1, real y1, real x2, real y2, real x3, real y3)\n" d566 1 a566 34 static const struct ibuiltin ivars[] = { { CAIRO_LINE_CAP_BUTT, "CAP_BUTT", &CairoNamespace }, { CAIRO_LINE_CAP_ROUND, "CAP_ROUND", &CairoNamespace }, { CAIRO_LINE_CAP_SQUARE, "CAP_SQUARE", &CairoNamespace }, { CAIRO_LINE_JOIN_MITER, "JOIN_MITER", &CairoNamespace }, { CAIRO_LINE_JOIN_ROUND, "JOIN_ROUND", &CairoNamespace }, { CAIRO_LINE_JOIN_BEVEL, "JOIN_BEVEL", &CairoNamespace }, { CAIRO_FILL_RULE_WINDING, "RULE_WINDING", &CairoNamespace }, { CAIRO_FILL_RULE_EVEN_ODD, "RULE_EVEN_ODD", &CairoNamespace }, { CAIRO_FONT_WEIGHT_NORMAL, "WEIGHT_NORMAL", &CairoNamespace }, { CAIRO_FONT_WEIGHT_BOLD, "WEIGHT_BOLD", &CairoNamespace }, { CAIRO_FONT_SLANT_NORMAL, "SLANT_NORMAL", &CairoNamespace }, { CAIRO_FONT_SLANT_ITALIC, "SLANT_ITALIC", &CairoNamespace }, { CAIRO_FONT_SLANT_OBLIQUE, "SLANT_OBLIQUE", &CairoNamespace }, { 0 } }; SymbolPtr sym; Type *type; CairoNamespace = BuiltinNamespace (/* parent */ 0, "Cairo")->namespace.namespace; type = BuildStructType (6, typePrim[rep_float], "x_bearing", typePrim[rep_float], "y_bearing", typePrim[rep_float], "width", typePrim[rep_float], "height", typePrim[rep_float], "x_advance", typePrim[rep_float], "y_advance"); sym = NewSymbolType (AtomId ("text_extents_t"), type); typeTextExtents = NewTypeName (NewExprAtom (AtomId ("text_extents_t"), 0, False), sym); a567 4 BuiltinSetUserdefType (typeTextExtents); NamespaceAddName (CairoNamespace, sym, publish_public); d573 1 a576 2 BuiltinIntegers (ivars); @ 1.3 log @2004-12-14 Keith Packard * .cvsignore: * Makefile.am: * cairo-5c.h: * configure.in: * draw.c: (do_Cairo_fill), (do_Cairo_stroke): * gtk.c: (configure_event), (expose_event), (cairo_5c_window_new), (repaint_x), (gtk_repaint_timeout), (gtk_thread_main), (start_x), (dirty_x): * init.c: (nickle_init): * surface.c: (get_cairo_5c), (free_cairo_5c), (dirty_cairo_5c), (do_Cairo_new): * text.c: (do_Cairo_show_text): Replace lame Xlib-based output with more capable gtk+ based output, including backing storage and resize handling. Input still isn't hooked up. * gstate.c: (do_Cairo_current_matrix), (do_Cairo_set_matrix): Add current_matrix and set_matrix functions; these only do affine matrices. * examples/animate.5c: * examples/pie.5c: * examples/rottext.5c: * examples/sin.5c: * examples/test.5c: Update examples to use installed library @ text @d1 1 a1 1 /* $Id: init.c,v 1.2 2004/12/11 07:45:42 keithp Exp $ d74 8 @ 1.2 log @2004-12-10 Keith Packard * examples/pie.5c: Add text example * init.c: (nickle_init): Set return type of text_extents function correctly @ text @d1 1 a1 1 /* $Id: init.c,v 1.1.1.1 2004/12/11 06:26:52 keithp Exp $ d102 4 d150 4 @ 1.1 log @Initial revision @ text @d1 1 a1 1 /* $Id: $ d142 1 a142 1 { do_Cairo_text_extents, "text_extents", "a", "Fs", "\n" d252 2 @ 1.1.1.1 log @Add cairo-5c to repository @ text @@