head 1.7; access; symbols initial:1.1.1.1 start:1.1.1; locks; strict; comment @ * @; 1.7 date 2005.05.18.06.21.15; author keithp; state Exp; branches; next 1.6; commitid 431d428aded64567; 1.6 date 2005.02.11.21.15.46; author keithp; state Exp; branches; next 1.5; 1.5 date 2004.12.23.22.39.40; author keithp; state Exp; branches; next 1.4; 1.4 date 2004.12.17.09.40.43; author keithp; state Exp; branches; next 1.3; 1.3 date 2004.12.17.02.09.45; author keithp; state Exp; branches; next 1.2; 1.2 date 2004.12.14.08.34.27; 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.7 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 @/* $Id: draw.c,v 1.6 2005/02/11 21:15:46 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" Value do_Cairo_new_path (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) cairo_new_path (c5c->cr); return Void; } Value do_Cairo_move_to (Value cv, Value xv, Value yv) { cairo_5c_t *c5c = cairo_5c_get (cv); double x = DoublePart (xv, "invalid X value"); double y = DoublePart (yv, "invalid Y value"); if (!aborting) cairo_move_to (c5c->cr, x, y); return Void; } Value do_Cairo_line_to (Value cv, Value xv, Value yv) { cairo_5c_t *c5c = cairo_5c_get (cv); double x = DoublePart (xv, "invalid X value"); double y = DoublePart (yv, "invalid Y value"); if (!aborting) cairo_line_to (c5c->cr, x, y); return Void; } Value do_Cairo_curve_to (Value cv, Value x1v, Value y1v, Value x2v, Value y2v, Value x3v, Value y3v) { cairo_5c_t *c5c = cairo_5c_get (cv); double x1 = DoublePart (x1v, "invalid X1 value"); double y1 = DoublePart (y1v, "invalid Y1 value"); double x2 = DoublePart (x2v, "invalid X2 value"); double y2 = DoublePart (y2v, "invalid Y2 value"); double x3 = DoublePart (x3v, "invalid X3 value"); double y3 = DoublePart (y3v, "invalid Y3 value"); if (!aborting) cairo_curve_to (c5c->cr, x1, y1, x2, y2, x3, y3); return Void; } Value do_Cairo_arc (Value cv, Value xcv, Value ycv, Value rv, Value a1v, Value a2v) { cairo_5c_t *c5c = cairo_5c_get (cv); double xc = DoublePart (xcv, "invalid xc value"); double yc = DoublePart (ycv, "invalid yc value"); double r = DoublePart (rv, "invalid radius"); double a1 = DoublePart (a1v, "invalid angle1 value"); double a2 = DoublePart (a2v, "invalid angle2 value"); if (!aborting) cairo_arc (c5c->cr, xc, yc, r, a1, a2); return Void; } Value do_Cairo_arc_negative (Value cv, Value xcv, Value ycv, Value rv, Value a1v, Value a2v) { cairo_5c_t *c5c = cairo_5c_get (cv); double xc = DoublePart (xcv, "invalid xc value"); double yc = DoublePart (ycv, "invalid yc value"); double r = DoublePart (rv, "invalid radius"); double a1 = DoublePart (a1v, "invalid angle1 value"); double a2 = DoublePart (a2v, "invalid angle2 value"); if (!aborting) cairo_arc_negative (c5c->cr, xc, yc, r, a1, a2); return Void; } Value do_Cairo_rel_move_to (Value cv, Value xv, Value yv) { cairo_5c_t *c5c = cairo_5c_get (cv); double x = DoublePart (xv, "invalid X value"); double y = DoublePart (yv, "invalid Y value"); if (!aborting) cairo_rel_move_to (c5c->cr, x, y); return Void; } Value do_Cairo_rel_line_to (Value cv, Value xv, Value yv) { cairo_5c_t *c5c = cairo_5c_get (cv); double x = DoublePart (xv, "invalid X value"); double y = DoublePart (yv, "invalid Y value"); if (!aborting) cairo_rel_line_to (c5c->cr, x, y); return Void; } Value do_Cairo_rel_curve_to (Value cv, Value x1v, Value y1v, Value x2v, Value y2v, Value x3v, Value y3v) { cairo_5c_t *c5c = cairo_5c_get (cv); double x1 = DoublePart (x1v, "invalid X1 value"); double y1 = DoublePart (y1v, "invalid Y1 value"); double x2 = DoublePart (x2v, "invalid X2 value"); double y2 = DoublePart (y2v, "invalid Y2 value"); double x3 = DoublePart (x3v, "invalid X3 value"); double y3 = DoublePart (y3v, "invalid Y3 value"); if (!aborting) cairo_rel_curve_to (c5c->cr, x1, y1, x2, y2, x3, y3); return Void; } Value do_Cairo_rectangle (Value cv, Value xv, Value yv, Value wv, Value hv) { cairo_5c_t *c5c = cairo_5c_get (cv); double x = DoublePart (xv, "invalid x value"); double y = DoublePart (yv, "invalid y value"); double w = DoublePart (wv, "invalid width value"); double h = DoublePart (hv, "invalid height value"); if (!aborting) cairo_rectangle (c5c->cr, x, y, w, h); return Void; } Value do_Cairo_close_path (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) cairo_close_path (c5c->cr); return Void; } Value do_Cairo_paint (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) { cairo_paint (c5c->cr); cairo_5c_dirty (c5c); } return Void; } Value do_Cairo_paint_with_alpha (Value cv, Value av) { cairo_5c_t *c5c = cairo_5c_get (cv); double alpha = DoublePart (av, "invalid alpha value"); if (!aborting) { cairo_paint_with_alpha (c5c->cr, alpha); cairo_5c_dirty (c5c); } return Void; } Value do_Cairo_mask (Value cv, Value pv) { cairo_5c_t *c5c = cairo_5c_get (cv); cairo_pattern_t *pat = get_cairo_pattern (pv); if (!aborting) { cairo_mask (c5c->cr, pat); cairo_5c_dirty (c5c); } return Void; } Value do_Cairo_mask_surface (Value cv, Value sv, Value xv, Value yv) { cairo_5c_t *c5c = cairo_5c_get (cv); cairo_5c_surface_t *c5s = cairo_5c_surface_get (sv); double x = DoublePart (xv, "invalid X value"); double y = DoublePart (yv, "invalid Y value"); if (!aborting) { cairo_mask_surface (c5c->cr, c5s->surface, x, y); cairo_5c_dirty (c5c); } return Void; } Value do_Cairo_fill (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) { cairo_fill (c5c->cr); cairo_5c_dirty (c5c); } return Void; } Value do_Cairo_fill_preserve (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) { cairo_fill_preserve (c5c->cr); cairo_5c_dirty (c5c); } return Void; } Value do_Cairo_stroke (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) { cairo_stroke (c5c->cr); cairo_5c_dirty (c5c); } return Void; } Value do_Cairo_stroke_preserve (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) { cairo_stroke_preserve (c5c->cr); cairo_5c_dirty (c5c); } return Void; } Value do_Cairo_copy_page (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) return Void; if (c5c->surface != Void) { cairo_5c_surface_t *c5s = cairo_5c_surface_get (c5c->surface); if (!c5s) return 0; c5s->copied = True; cairo_copy_page (c5c->cr); } return Void; } Value do_Cairo_show_page (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) return Void; if (c5c->surface != Void) { cairo_5c_surface_t *c5s = cairo_5c_surface_get (c5c->surface); if (!c5s) return 0; c5s->copied = True; cairo_show_page (c5c->cr); } return Void; } Value do_Cairo_in_stroke (Value cv, Value xv, Value yv) { cairo_5c_t *c5c = cairo_5c_get (cv); double x = DoublePart (xv, "invalid X value"); double y = DoublePart (yv, "invalid Y value"); if (aborting) return Void; return cairo_in_stroke (c5c->cr, x, y) ? TrueVal : FalseVal; } Value do_Cairo_in_fill (Value cv, Value xv, Value yv) { cairo_5c_t *c5c = cairo_5c_get (cv); double x = DoublePart (xv, "invalid X value"); double y = DoublePart (yv, "invalid Y value"); if (aborting) return Void; return cairo_in_fill (c5c->cr, x, y) ? TrueVal : FalseVal; } Value do_Cairo_stroke_extents (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); double x, y, w, h; Value ret; static int dims[2] = { 2, 2 }; if (aborting) RETURN(Void); cairo_stroke_extents (c5c->cr, &x, &y, &w, &h); ret = NewArray (False, False, typePrim[rep_float], 2, dims); ArrayValueSet(&ret->array, 0, NewDoubleFloat (x)); ArrayValueSet(&ret->array, 1, NewDoubleFloat (y)); ArrayValueSet(&ret->array, 2, NewDoubleFloat (w)); ArrayValueSet(&ret->array, 3, NewDoubleFloat (h)); RETURN (ret); } Value do_Cairo_fill_extents (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); double x, y, w, h; Value ret; static int dims[2] = { 2, 2 }; if (aborting) RETURN(Void); cairo_fill_extents (c5c->cr, &x, &y, &w, &h); ret = NewArray (False, False, typePrim[rep_float], 2, dims); ArrayValueSet(&ret->array, 0, NewDoubleFloat (x)); ArrayValueSet(&ret->array, 1, NewDoubleFloat (y)); ArrayValueSet(&ret->array, 2, NewDoubleFloat (w)); ArrayValueSet(&ret->array, 3, NewDoubleFloat (h)); RETURN (ret); } static Value path_new (char *tag, Value value) { ENTER (); Value pt = NewUnion (TypeCanon (typeCairoPath)->structs.structs, False); BoxPtr box = pt->unions.value; pt->unions.tag = AtomId (tag); BoxValueSet (box, 0, value); RETURN (pt); } static Value path_elt_new (Type *type) { return NewStruct (TypeCanon (type)->structs.structs, False); } static Value path_array (Value cv, cairo_path_t* (*copy_path) (cairo_t *cr)) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); cairo_path_t *path; Value pv; Value pev; Value e; BoxPtr box; int zero = 0; int n = 0; int i, j; cairo_path_data_t *data; char *tag; if (aborting) RETURN (Void); path = (*copy_path) (c5c->cr); if (!path) { RaiseStandardException (exception_invalid_argument, "Can't copy path", 2, cv, IntToEnum (typeCairoStatus, cairo_status (c5c->cr))); RETURN (Void); } pv = NewArray (False, True, typeCairoPath, 1, &zero); for (i=0; i < path->num_data; i += path->data[i].header.length) { data = &path->data[i]; switch (data->header.type) { case CAIRO_PATH_MOVE_TO: case CAIRO_PATH_LINE_TO: tag = data->header.type == CAIRO_PATH_MOVE_TO ? "move_to" : "line_to"; e = path_elt_new (typeCairoPoint); box = e->structs.values; BoxValueSet (box, 0, NewDoubleFloat (data[1].point.x)); BoxValueSet (box, 1, NewDoubleFloat (data[1].point.y)); break; case CAIRO_PATH_CURVE_TO: tag = "curve_to"; e = path_elt_new (typeCairoCurveTo); box = e->structs.values; for (j = 0; j < 3; j++) { BoxValueSet (box, j*2+0, NewDoubleFloat (data[j+1].point.x)); BoxValueSet (box, j*2+1, NewDoubleFloat (data[j+1].point.y)); } break; case CAIRO_PATH_CLOSE_PATH: tag = "close_path"; e = Void; break; default: tag = "unknown"; e = Void; break; } pev = path_new (tag, e); ArrayResize (pev, 0, n+1); ArrayValueSet (&pv->array, n, pev); n++; } RETURN(pv); } Value do_Cairo_copy_path (Value cv) { ENTER (); RETURN (path_array (cv, cairo_copy_path)); } Value do_Cairo_copy_path_flat (Value cv) { ENTER (); RETURN (path_array (cv, cairo_copy_path_flat)); } Value do_Cairo_append_path (Value cv, Value pv) { ENTER (); /* XXX */ RETURN (Void); } @ 1.6 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: draw.c,v 1.5 2004/12/23 22:39:40 keithp Exp $ d192 57 d262 13 d287 12 a399 5 typedef struct _path_closure { Value head; Value *tail; } path_closure_t; d412 1 a412 1 path_box (void *closure, Type *type, char *tag) d414 1 a414 14 ENTER (); path_closure_t *pc = closure; Value elt = NewStruct (TypeCanon (type)->structs.structs, False); Value elt_ref = NewRef (NewBox (False, False, 1, type), 0); Value path = path_new (tag, elt_ref); BoxPtr box = elt->structs.values; RefValueSet (elt_ref, elt); /* move End element after this element */ BoxValueSet (box, 0, *pc->tail); /* append element to list */ *pc->tail = path; pc->tail = &BoxElements(box)[0]; RETURN (elt); d417 2 a418 2 static void cairo_5c_move_to (void *closure, double x, double y) d421 64 a484 5 Value elt = path_box (closure, typeCairoMoveTo, "move_to"); BoxPtr box = elt->structs.values; BoxValueSet (box, 1, NewDoubleFloat (x)); BoxValueSet (box, 2, NewDoubleFloat (y)); EXIT (); d487 2 a488 31 static void cairo_5c_line_to (void *closure, double x, double y) { ENTER (); Value elt = path_box (closure, typeCairoLineTo, "line_to"); BoxPtr box = elt->structs.values; BoxValueSet (box, 1, NewDoubleFloat (x)); BoxValueSet (box, 2, NewDoubleFloat (y)); EXIT (); } static void cairo_5c_curve_to (void *closure, double x1, double y1, double x2, double y2, double x3, double y3) { ENTER (); Value elt = path_box (closure, typeCairoCurveTo, "curve_to"); BoxPtr box = elt->structs.values; BoxValueSet (box, 1, NewDoubleFloat (x1)); BoxValueSet (box, 2, NewDoubleFloat (y1)); BoxValueSet (box, 3, NewDoubleFloat (x2)); BoxValueSet (box, 4, NewDoubleFloat (y2)); BoxValueSet (box, 5, NewDoubleFloat (x3)); BoxValueSet (box, 6, NewDoubleFloat (y3)); EXIT (); } static void cairo_5c_close_path (void *closure) d491 1 a491 2 (void) path_box (closure, typeCairoClosePath, "close_path"); EXIT (); d495 1 a495 1 do_Cairo_current_path_list (Value cv) d498 1 a498 14 path_closure_t close; cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) RETURN (Void); close.head = path_new ("end", Void); close.tail = &close.head; cairo_current_path (c5c->cr, cairo_5c_move_to, cairo_5c_line_to, cairo_5c_curve_to, cairo_5c_close_path, &close); RETURN(close.head); d502 1 a502 1 do_Cairo_current_path_flat_list (Value cv) d505 2 a506 13 path_closure_t close; cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) RETURN (Void); close.head = path_new ("end", Void); close.tail = &close.head; cairo_current_path_flat (c5c->cr, cairo_5c_move_to, cairo_5c_line_to, cairo_5c_close_path, &close); RETURN(close.head); @ 1.5 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: draw.c,v 1.4 2004/12/17 09:40:43 keithp Exp $ d92 2 a93 3 Value x1v, Value y1v, Value x2v, Value y2v, Value rv) d96 2 a97 4 double x1 = DoublePart (x1v, "invalid X1 value"); double y1 = DoublePart (y1v, "invalid Y1 value"); double x2 = DoublePart (x2v, "invalid X2 value"); double y2 = DoublePart (y2v, "invalid Y2 value"); d99 2 d103 1 a103 1 cairo_arc (c5c->cr, x1, y1, x2, y2, r); d109 2 a110 3 Value x1v, Value y1v, Value x2v, Value y2v, Value rv) d113 2 a114 4 double x1 = DoublePart (x1v, "invalid X1 value"); double y1 = DoublePart (y1v, "invalid Y1 value"); double x2 = DoublePart (x2v, "invalid X2 value"); double y2 = DoublePart (y2v, "invalid Y2 value"); d116 2 d120 1 a120 1 cairo_arc_negative (c5c->cr, x1, y1, x2, y2, r); d217 36 @ 1.4 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: draw.c,v 1.3 2004/12/17 02:09:45 keithp Exp $ d40 1 a40 1 cairo_5c_t *c5c = get_cairo_5c (cv); d50 1 a50 1 cairo_5c_t *c5c = get_cairo_5c (cv); d62 1 a62 1 cairo_5c_t *c5c = get_cairo_5c (cv); d77 1 a77 1 cairo_5c_t *c5c = get_cairo_5c (cv); d96 1 a96 1 cairo_5c_t *c5c = get_cairo_5c (cv); d114 1 a114 1 cairo_5c_t *c5c = get_cairo_5c (cv); d129 1 a129 1 cairo_5c_t *c5c = get_cairo_5c (cv); d141 1 a141 1 cairo_5c_t *c5c = get_cairo_5c (cv); d156 1 a156 1 cairo_5c_t *c5c = get_cairo_5c (cv); d172 1 a172 1 cairo_5c_t *c5c = get_cairo_5c (cv); d186 1 a186 1 cairo_5c_t *c5c = get_cairo_5c (cv); d196 1 a196 1 cairo_5c_t *c5c = get_cairo_5c (cv); d201 1 a201 1 dirty_cairo_5c (c5c); d209 1 a209 1 cairo_5c_t *c5c = get_cairo_5c (cv); d213 1 a213 1 dirty_cairo_5c (c5c); d221 1 a221 1 cairo_5c_t *c5c = get_cairo_5c (cv); d234 1 a234 1 cairo_5c_t *c5c = get_cairo_5c (cv); d248 1 a248 1 cairo_5c_t *c5c = get_cairo_5c (cv); d268 1 a268 1 cairo_5c_t *c5c = get_cairo_5c (cv); d372 1 a372 1 cairo_5c_t *c5c = get_cairo_5c (cv); d392 1 a392 1 cairo_5c_t *c5c = get_cairo_5c (cv); @ 1.3 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: draw.c,v 1.1.1.1 2004/12/11 06:26:52 keithp Exp $ d284 35 a318 1 #if 0 d323 41 a365 1 #endif d368 1 a368 1 do_Cairo_current_path (Value cv, Value mv, Value lv, Value cuv, Value clp) d370 15 a384 2 /* XXX */ return Void; d388 1 a388 1 do_Cairo_current_path_flat (Value cv, Value mv, Value lv, Value clp) d390 14 a403 2 /* XXX */ return Void; @ 1.2 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 @d170 14 d217 89 @ 1.1 log @Initial revision @ text @d1 1 a1 1 /* $Id: $ d187 1 a187 1 c5c->dirty = True; d199 1 a199 1 c5c->dirty = True; @ 1.1.1.1 log @Add cairo-5c to repository @ text @@