head 1.9; access; symbols initial:1.1.1.1 start:1.1.1; locks; strict; comment @ * @; 1.9 date 2005.05.18.06.21.15; author keithp; state Exp; branches; next 1.8; commitid 431d428aded64567; 1.8 date 2005.05.02.20.24.38; author keithp; state Exp; branches; next 1.7; commitid 416842768c824567; 1.7 date 2005.02.11.21.15.46; author keithp; state Exp; branches; next 1.6; 1.6 date 2004.12.23.22.39.40; author keithp; state Exp; branches; next 1.5; 1.5 date 2004.12.18.08.16.28; author keithp; state Exp; branches; next 1.4; 1.4 date 2004.12.18.01.09.40; 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.9 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: gstate.c,v 1.8 2005/05/02 20:24:38 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_save (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) cairo_save (c5c->cr); return Void; } Value do_Cairo_restore (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) cairo_restore (c5c->cr); return Void; } Value do_Cairo_set_operator (Value cv, Value ov) { cairo_5c_t *c5c = cairo_5c_get (cv); int o = EnumIntPart (ov, "invalid operator"); if (!aborting) cairo_set_operator (c5c->cr, o); return Void; } Value do_Cairo_set_source_rgb (Value cv, Value rv, Value gv, Value bv) { cairo_5c_t *c5c = cairo_5c_get (cv); double r = DoublePart (rv, "invalid red value"); double g = DoublePart (gv, "invalid green value"); double b = DoublePart (bv, "invalid blue value"); if (!aborting) cairo_set_source_rgb (c5c->cr, r, g, b); return Void; } Value do_Cairo_set_source_rgba (Value cv, Value rv, Value gv, Value bv, Value av) { cairo_5c_t *c5c = cairo_5c_get (cv); double r = DoublePart (rv, "invalid red value"); double g = DoublePart (gv, "invalid green value"); double b = DoublePart (bv, "invalid blue value"); double a = DoublePart (av, "invalid alpha value"); if (!aborting) cairo_set_source_rgba (c5c->cr, r, g, b, a); return Void; } Value do_Cairo_set_source_surface (Value cv, Value sv, Value xv, Value yv) { ENTER (); 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_set_source_surface (c5c->cr, c5s->surface, x, y); RETURN (Void); } Value do_Cairo_set_tolerance (Value cv, Value tv) { cairo_5c_t *c5c = cairo_5c_get (cv); double t = DoublePart (tv, "invalid tolerance"); if (!aborting) cairo_set_tolerance (c5c->cr, t); return Void; } Value do_Cairo_set_fill_rule (Value cv, Value fv) { cairo_5c_t *c5c = cairo_5c_get (cv); int f = EnumIntPart (fv, "invalid fill rule"); if (!aborting) cairo_set_fill_rule (c5c->cr, f); return Void; } Value do_Cairo_set_line_width (Value cv, Value lv) { cairo_5c_t *c5c = cairo_5c_get (cv); double l = DoublePart (lv, "invalid line_width"); if (!aborting) cairo_set_line_width (c5c->cr, l); return Void; } Value do_Cairo_set_line_cap (Value cv, Value lv) { cairo_5c_t *c5c = cairo_5c_get (cv); cairo_line_cap_t l = EnumIntPart (lv, "invalid line_cap"); if (!aborting) cairo_set_line_cap (c5c->cr, l); return Void; } Value do_Cairo_set_line_join (Value cv, Value lv) { cairo_5c_t *c5c = cairo_5c_get (cv); cairo_line_join_t l = EnumIntPart (lv, "invalid line_join"); if (!aborting) cairo_set_line_join (c5c->cr, l); return Void; } Value do_Cairo_set_dash (Value cv, Value dv, Value ov) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); double o = DoublePart (ov, "invalid dash offset"); int ndash = ArrayLimits (&dv->array)[0]; double *d = AllocateTemp (ndash * sizeof (double)); int i; if (aborting) RETURN (Void); for (i = 0; i < ndash; i++) { d[i] = DoublePart (ArrayValue(&dv->array, i), "invalid dash length"); if (aborting) RETURN (Void); } cairo_set_dash (c5c->cr, d, ndash, o); RETURN(Void); } Value do_Cairo_set_miter_limit (Value cv, Value mv) { cairo_5c_t *c5c = cairo_5c_get (cv); double m = DoublePart (mv, "invalid miter limit"); if (!aborting) cairo_set_miter_limit (c5c->cr, m); return Void; } Value do_Cairo_identity_matrix (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) cairo_identity_matrix (c5c->cr); return Void; } Value do_Cairo_translate (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_translate (c5c->cr, x, y); return Void; } Value do_Cairo_scale (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_scale (c5c->cr, x, y); return Void; } Value do_Cairo_rotate (Value cv, Value av) { cairo_5c_t *c5c = cairo_5c_get (cv); double a = DoublePart (av, "invalid angle"); if (!aborting) cairo_rotate (c5c->cr, a); return Void; } Value do_Cairo_get_matrix (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); cairo_matrix_t matrix; Value ret; if (aborting) RETURN(Void); cairo_get_matrix (c5c->cr, &matrix); ret = new_cairo_matrix (&matrix); RETURN (ret); } Value do_Cairo_transform (Value cv, Value mv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); cairo_matrix_t matrix; if (aborting) RETURN(Void); cairo_matrix_part (mv, &matrix, "invalid matrix"); if (aborting) RETURN(Void); cairo_transform (c5c->cr, &matrix); RETURN (Void); } Value do_Cairo_set_matrix (Value cv, Value mv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); cairo_matrix_t matrix; if (aborting) RETURN(Void); cairo_matrix_part (mv, &matrix, "invalid matrix"); if (aborting) RETURN(Void); cairo_set_matrix (c5c->cr, &matrix); RETURN (Void); } Value do_Cairo_user_to_device (Value cv, Value pv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); double x, y; Value ret; BoxPtr box; if (aborting) RETURN(Void); x = DoublePart (StructMemValue (pv, AtomId("x")), "invalid x coordinate"); y = DoublePart (StructMemValue (pv, AtomId("y")), "invalid y coordinate"); cairo_user_to_device (c5c->cr, &x, &y); ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False); box = ret->structs.values; BoxValueSet (box, 0, NewDoubleFloat (x)); BoxValueSet (box, 1, NewDoubleFloat (y)); RETURN (ret); } Value do_Cairo_user_to_device_distance (Value cv, Value pv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); double x, y; Value ret; BoxPtr box; if (aborting) RETURN(Void); x = DoublePart (StructMemValue (pv, AtomId("x")), "invalid x coordinate"); y = DoublePart (StructMemValue (pv, AtomId("y")), "invalid y coordinate"); cairo_user_to_device_distance (c5c->cr, &x, &y); ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False); box = ret->structs.values; BoxValueSet (box, 0, NewDoubleFloat (x)); BoxValueSet (box, 1, NewDoubleFloat (y)); RETURN (ret); } Value do_Cairo_device_to_user (Value cv, Value pv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); double x, y; Value ret; BoxPtr box; if (aborting) RETURN(Void); x = DoublePart (StructMemValue (pv, AtomId("x")), "invalid x coordinate"); y = DoublePart (StructMemValue (pv, AtomId("y")), "invalid y coordinate"); cairo_device_to_user (c5c->cr, &x, &y); ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False); box = ret->structs.values; BoxValueSet (box, 0, NewDoubleFloat (x)); BoxValueSet (box, 1, NewDoubleFloat (y)); RETURN (ret); } Value do_Cairo_device_to_user_distance (Value cv, Value pv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); double x, y; Value ret; BoxPtr box; if (aborting) RETURN(Void); x = DoublePart (StructMemValue (pv, AtomId("x")), "invalid x coordinate"); y = DoublePart (StructMemValue (pv, AtomId("y")), "invalid y coordinate"); cairo_device_to_user_distance (c5c->cr, &x, &y); ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False); box = ret->structs.values; BoxValueSet (box, 0, NewDoubleFloat (x)); BoxValueSet (box, 1, NewDoubleFloat (y)); RETURN (ret); } Value do_Cairo_reset_clip (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) cairo_reset_clip (c5c->cr); return Void; } Value do_Cairo_clip (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) cairo_clip (c5c->cr); return Void; } Value do_Cairo_clip_preserve (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (!aborting) cairo_clip_preserve (c5c->cr); return Void; } Value do_Cairo_get_operator (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) return Void; return IntToEnum (typeCairoOperator, cairo_get_operator (c5c->cr)); } #if 0 Value do_Cairo_current_rgb_color (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); double r, g, b; Value ret; BoxPtr box; if (aborting) return Void; cairo_current_rgb_color (c5c->cr, &r, &g, &b); ret = NewStruct (TypeCanon (typeCairoRgbColor)->structs.structs, False); box = ret->structs.values; BoxValueSet (box, 0, NewDoubleFloat (r)); BoxValueSet (box, 1, NewDoubleFloat (g)); BoxValueSet (box, 2, NewDoubleFloat (b)); RETURN (ret); } Value do_Cairo_current_alpha (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) RETURN(Void); RETURN (NewDoubleFloat (cairo_current_alpha (c5c->cr))); } #endif Value do_Cairo_get_tolerance (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) RETURN(Void); RETURN (NewDoubleFloat (cairo_get_tolerance (c5c->cr))); } Value do_Cairo_get_current_point (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); double x, y; Value ret; BoxPtr box; if (aborting) return Void; cairo_get_current_point (c5c->cr, &x, &y); ret = NewStruct (TypeCanon (typeCairoPoint)->structs.structs, False); box = ret->structs.values; BoxValueSet (box, 0, NewDoubleFloat (x)); BoxValueSet (box, 1, NewDoubleFloat (y)); RETURN (ret); } Value do_Cairo_get_fill_rule (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) RETURN(Void); RETURN(IntToEnum (typeCairoFillRule, cairo_get_fill_rule (c5c->cr))); } Value do_Cairo_get_line_width (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) RETURN(Void); RETURN(NewDoubleFloat (cairo_get_line_width (c5c->cr))); } Value do_Cairo_get_line_cap (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) RETURN(Void); RETURN(IntToEnum (typeCairoLineCap, cairo_get_line_cap (c5c->cr))); } Value do_Cairo_get_line_join (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) RETURN(Void); RETURN(IntToEnum (typeCairoLineJoin, cairo_get_line_join (c5c->cr))); } Value do_Cairo_get_miter_limit (Value cv) { ENTER (); cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) RETURN(Void); RETURN(NewDoubleFloat (cairo_get_miter_limit (c5c->cr))); } @ 1.8 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: gstate.c,v 1.7 2005/02/11 21:15:46 keithp Exp $ d95 14 a203 11 Value do_Cairo_default_matrix (Value cv) { cairo_5c_t *c5c = cairo_5c_get (cv); if (aborting) return Void; cairo_default_matrix (c5c->cr); return Void; } d257 1 a257 1 do_Cairo_concat_matrix (Value cv, Value mv) d268 1 a268 1 cairo_concat_matrix (c5c->cr, &matrix); d289 1 a289 1 do_Cairo_transform_point (Value cv, Value pv) d302 1 a302 1 cairo_transform_point (c5c->cr, &x, &y); d311 1 a311 1 do_Cairo_transform_distance (Value cv, Value pv) d324 1 a324 1 cairo_transform_distance (c5c->cr, &x, &y); d333 1 a333 1 do_Cairo_inverse_transform_point (Value cv, Value pv) d346 1 a346 1 cairo_inverse_transform_point (c5c->cr, &x, &y); d355 1 a355 1 do_Cairo_inverse_transform_distance (Value cv, Value pv) d368 1 a368 1 cairo_inverse_transform_distance (c5c->cr, &x, &y); d377 1 a377 1 do_Cairo_init_clip (Value cv) d381 1 a381 1 cairo_init_clip (c5c->cr); d395 9 @ 1.7 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: gstate.c,v 1.6 2004/12/23 22:39:40 keithp Exp $ d68 1 a68 1 do_Cairo_set_rgb_color (Value cv, Value rv, Value gv, Value bv) d76 1 a76 1 cairo_set_rgb_color (c5c->cr, r, g, b); d81 1 a81 1 do_Cairo_set_alpha (Value cv, Value av) d84 3 d88 1 a88 1 d90 1 a90 1 cairo_set_alpha (c5c->cr, a); d238 1 a238 1 do_Cairo_current_matrix (Value cv) d242 1 a242 1 cairo_matrix_t *matrix; d248 2 a249 12 matrix = cairo_matrix_create (); if (!matrix) { RaiseStandardException (exception_invalid_argument, "can't create matrix", 2, cv, Void); RETURN(Void); } cairo_current_matrix (c5c->cr, matrix); ret = new_cairo_matrix (matrix); cairo_matrix_destroy (matrix); d258 1 a258 1 cairo_matrix_t *matrix; d262 1 a262 1 matrix = cairo_matrix_part (mv, "invalid matrix"); d265 1 a265 2 cairo_concat_matrix (c5c->cr, matrix); cairo_matrix_destroy (matrix); d274 1 a274 1 cairo_matrix_t *matrix; d278 1 a278 1 matrix = cairo_matrix_part (mv, "invalid matrix"); d281 1 a281 2 cairo_set_matrix (c5c->cr, matrix); cairo_matrix_destroy (matrix); d392 1 a392 1 do_Cairo_current_operator (Value cv) d398 1 a398 1 return IntToEnum (typeCairoOperator, cairo_current_operator (c5c->cr)); d401 1 d432 1 d435 1 a435 1 do_Cairo_current_tolerance (Value cv) d442 1 a442 1 RETURN (NewDoubleFloat (cairo_current_tolerance (c5c->cr))); d446 1 a446 1 do_Cairo_current_point (Value cv) d456 1 a456 1 cairo_current_point (c5c->cr, &x, &y); d465 1 a465 1 do_Cairo_current_fill_rule (Value cv) d472 1 a472 1 RETURN(IntToEnum (typeCairoFillRule, cairo_current_fill_rule (c5c->cr))); d476 1 a476 1 do_Cairo_current_line_width (Value cv) d483 1 a483 1 RETURN(NewDoubleFloat (cairo_current_line_width (c5c->cr))); d487 1 a487 1 do_Cairo_current_line_cap (Value cv) d494 1 a494 1 RETURN(IntToEnum (typeCairoLineCap, cairo_current_line_cap (c5c->cr))); d498 1 a498 1 do_Cairo_current_line_join (Value cv) d505 1 a505 1 RETURN(IntToEnum (typeCairoLineJoin, cairo_current_line_join (c5c->cr))); d509 1 a509 1 do_Cairo_current_miter_limit (Value cv) d516 1 a516 1 RETURN(NewDoubleFloat (cairo_current_miter_limit (c5c->cr))); @ 1.6 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: gstate.c,v 1.5 2004/12/18 08:16:28 keithp Exp $ d160 1 a160 1 d[i] = DoublePart (ArrayValueGet(&dv->array, i), "invalid dash length"); @ 1.5 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: gstate.c,v 1.4 2004/12/18 01:09:40 keithp Exp $ d41 1 a41 1 cairo_5c_t *c5c = get_cairo_5c (cv); d50 1 a50 1 cairo_5c_t *c5c = get_cairo_5c (cv); d59 1 a59 1 cairo_5c_t *c5c = get_cairo_5c (cv); d70 1 a70 1 cairo_5c_t *c5c = get_cairo_5c (cv); d83 1 a83 1 cairo_5c_t *c5c = get_cairo_5c (cv); d94 1 a94 1 cairo_5c_t *c5c = get_cairo_5c (cv); d105 1 a105 1 cairo_5c_t *c5c = get_cairo_5c (cv); d116 1 a116 1 cairo_5c_t *c5c = get_cairo_5c (cv); d127 1 a127 1 cairo_5c_t *c5c = get_cairo_5c (cv); d138 1 a138 1 cairo_5c_t *c5c = get_cairo_5c (cv); d150 1 a150 1 cairo_5c_t *c5c = get_cairo_5c (cv); d171 1 a171 1 cairo_5c_t *c5c = get_cairo_5c (cv); d182 1 a182 1 cairo_5c_t *c5c = get_cairo_5c (cv); d191 1 a191 1 cairo_5c_t *c5c = get_cairo_5c (cv); d202 1 a202 1 cairo_5c_t *c5c = get_cairo_5c (cv); d214 1 a214 1 cairo_5c_t *c5c = get_cairo_5c (cv); d226 1 a226 1 cairo_5c_t *c5c = get_cairo_5c (cv); d238 1 a238 1 cairo_5c_t *c5c = get_cairo_5c (cv); d261 17 d281 1 a281 1 cairo_5c_t *c5c = get_cairo_5c (cv); d298 1 a298 1 cairo_5c_t *c5c = get_cairo_5c (cv); d320 1 a320 1 cairo_5c_t *c5c = get_cairo_5c (cv); d342 1 a342 1 cairo_5c_t *c5c = get_cairo_5c (cv); d364 1 a364 1 cairo_5c_t *c5c = get_cairo_5c (cv); d385 1 a385 1 cairo_5c_t *c5c = get_cairo_5c (cv); d394 1 a394 1 cairo_5c_t *c5c = get_cairo_5c (cv); d403 1 a403 1 cairo_5c_t *c5c = get_cairo_5c (cv); d414 1 a414 1 cairo_5c_t *c5c = get_cairo_5c (cv); d434 1 a434 1 cairo_5c_t *c5c = get_cairo_5c (cv); d445 1 a445 1 cairo_5c_t *c5c = get_cairo_5c (cv); d456 1 a456 1 cairo_5c_t *c5c = get_cairo_5c (cv); d475 1 a475 1 cairo_5c_t *c5c = get_cairo_5c (cv); d486 1 a486 1 cairo_5c_t *c5c = get_cairo_5c (cv); d497 1 a497 1 cairo_5c_t *c5c = get_cairo_5c (cv); d508 1 a508 1 cairo_5c_t *c5c = get_cairo_5c (cv); d519 1 a519 1 cairo_5c_t *c5c = get_cairo_5c (cv); @ 1.4 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: gstate.c,v 1.3 2004/12/17 02:09:45 keithp Exp $ d284 1 a284 1 static int dims[1] = { 2 }; d289 2 a290 2 x = DoublePart (ArrayValueGet (&pv->array, 0), "invalid coordinate"); y = DoublePart (ArrayValueGet (&pv->array, 1), "invalid coordinate"); d292 4 a295 3 ret = NewArray (False, False, typePrim[rep_float], 1, dims); ArrayValueSet(&ret->array, 0, NewDoubleFloat (x)); ArrayValueSet(&ret->array, 1, NewDoubleFloat (y)); d306 1 a306 1 static int dims[1] = { 2 }; d311 2 a312 2 x = DoublePart (ArrayValueGet (&pv->array, 0), "invalid coordinate"); y = DoublePart (ArrayValueGet (&pv->array, 1), "invalid coordinate"); d314 4 a317 3 ret = NewArray (False, False, typePrim[rep_float], 1, dims); ArrayValueSet(&ret->array, 0, NewDoubleFloat (x)); ArrayValueSet(&ret->array, 1, NewDoubleFloat (y)); d328 1 a328 1 static int dims[1] = { 2 }; d333 2 a334 2 x = DoublePart (ArrayValueGet (&pv->array, 0), "invalid coordinate"); y = DoublePart (ArrayValueGet (&pv->array, 1), "invalid coordinate"); d336 4 a339 3 ret = NewArray (False, False, typePrim[rep_float], 1, dims); ArrayValueSet(&ret->array, 0, NewDoubleFloat (x)); ArrayValueSet(&ret->array, 1, NewDoubleFloat (y)); d350 1 a350 1 static int dims[1] = { 2 }; d355 2 a356 2 x = DoublePart (ArrayValueGet (&pv->array, 0), "invalid coordinate"); y = DoublePart (ArrayValueGet (&pv->array, 1), "invalid coordinate"); d358 4 a361 3 ret = NewArray (False, False, typePrim[rep_float], 1, dims); ArrayValueSet(&ret->array, 0, NewDoubleFloat (x)); ArrayValueSet(&ret->array, 1, NewDoubleFloat (y)); @ 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: gstate.c,v 1.1.1.1 2004/12/11 06:26:52 keithp Exp $ d83 1 a83 1 cairo_5c_t *c5c = get_cairo_5c (cv); a239 1 double a, b, c, d, tx, ty; a240 1 static int dims[2] = { 2, 3 }; d255 1 a255 1 cairo_matrix_get_affine (matrix, &a, &b, &c, &d, &tx, &ty); a256 7 ret = NewArray (False, False, typePrim[rep_float], 2, dims); ArrayValueSet(&ret->array, 0, NewDoubleFloat (a)); ArrayValueSet(&ret->array, 1, NewDoubleFloat (b)); ArrayValueSet(&ret->array, 2, NewDoubleFloat (c)); ArrayValueSet(&ret->array, 3, NewDoubleFloat (d)); ArrayValueSet(&ret->array, 4, NewDoubleFloat (tx)); ArrayValueSet(&ret->array, 5, NewDoubleFloat (ty)); a265 1 double a, b, c, d, tx, ty; d269 2 a270 7 matrix = cairo_matrix_create (); if (!matrix) { RaiseStandardException (exception_invalid_argument, "can't create matrix", 2, cv, Void); a271 8 } a = DoublePart (ArrayValueGet(&mv->array, 0), "invalid matrix"); b = DoublePart (ArrayValueGet(&mv->array, 1), "invalid matrix"); c = DoublePart (ArrayValueGet(&mv->array, 2), "invalid matrix"); d = DoublePart (ArrayValueGet(&mv->array, 3), "invalid matrix"); tx = DoublePart (ArrayValueGet(&mv->array, 4), "invalid matrix"); ty = DoublePart (ArrayValueGet(&mv->array, 5), "invalid matrix"); cairo_matrix_set_affine (matrix, a, b, c, d, tx, ty); @ 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 @d57 11 d103 11 d128 1 a128 1 cairo_line_cap_t l = IntPart (lv, "invalid line_cap"); d139 1 a139 1 cairo_line_join_t l = IntPart (lv, "invalid line_join"); d147 33 d189 11 d300 227 @ 1.1 log @Initial revision @ text @d1 1 a1 1 /* $Id: $ d168 66 @ 1.1.1.1 log @Add cairo-5c to repository @ text @@