head 1.3; access; symbols; locks; strict; comment @ * @; 1.3 date 2005.05.02.20.24.38; author keithp; state Exp; branches; next 1.2; commitid 416842768c824567; 1.2 date 2005.02.11.21.15.46; author keithp; state Exp; branches; next 1.1; 1.1 date 2004.12.18.01.09.40; author keithp; state Exp; branches; next ; desc @@ 1.3 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 @/* $Id: matrix.c,v 1.2 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" void cairo_matrix_part (Value mv, cairo_matrix_t *matrix, char *err) { matrix->xx = DoublePart (StructMemValue (mv, AtomId("xx")), "invalid xx"); matrix->yx = DoublePart (StructMemValue (mv, AtomId("yx")), "invalid yx"); matrix->xy = DoublePart (StructMemValue (mv, AtomId("xy")), "invalid xy"); matrix->yy = DoublePart (StructMemValue (mv, AtomId("yy")), "invalid yy"); matrix->x0 = DoublePart (StructMemValue (mv, AtomId("x0")), "invalid x0"); matrix->y0 = DoublePart (StructMemValue (mv, AtomId("y0")), "invalid y0"); } Value new_cairo_matrix (cairo_matrix_t *matrix) { ENTER (); Value ret; BoxPtr box; ret = NewStruct (TypeCanon (typeCairoMatrix)->structs.structs, False); box = ret->structs.values; BoxValueSet (box, 0, NewDoubleFloat (matrix->xx)); BoxValueSet (box, 1, NewDoubleFloat (matrix->yx)); BoxValueSet (box, 2, NewDoubleFloat (matrix->xy)); BoxValueSet (box, 3, NewDoubleFloat (matrix->yy)); BoxValueSet (box, 4, NewDoubleFloat (matrix->x0)); BoxValueSet (box, 5, NewDoubleFloat (matrix->y0)); RETURN (ret); } @ 1.2 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: matrix.c,v 1.1 2004/12/18 01:09:40 keithp Exp $ d38 2 a39 2 cairo_matrix_t * cairo_matrix_part (Value mv, char *err) d41 6 a46 21 double a = DoublePart (ArrayValue(&mv->array, 0), "invalid matrix"); double b = DoublePart (ArrayValue(&mv->array, 1), "invalid matrix"); double c = DoublePart (ArrayValue(&mv->array, 2), "invalid matrix"); double d = DoublePart (ArrayValue(&mv->array, 3), "invalid matrix"); double tx = DoublePart (ArrayValue(&mv->array, 4), "invalid matrix"); double ty = DoublePart (ArrayValue(&mv->array, 5), "invalid matrix"); cairo_matrix_t *matrix; if (aborting) return 0; matrix = cairo_matrix_create (); if (!matrix) { RaiseStandardException (exception_invalid_argument, err, 1, mv); return 0; } cairo_matrix_set_affine (matrix, a, b, c, d, tx, ty); return matrix; a52 1 double a, b, c, d, tx, ty; d54 10 a63 10 static int dims[2] = { 2, 3 }; cairo_matrix_get_affine (matrix, &a, &b, &c, &d, &tx, &ty); 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)); @ 1.1 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: $ d41 6 a46 6 double a = DoublePart (ArrayValueGet(&mv->array, 0), "invalid matrix"); double b = DoublePart (ArrayValueGet(&mv->array, 1), "invalid matrix"); double c = DoublePart (ArrayValueGet(&mv->array, 2), "invalid matrix"); double d = DoublePart (ArrayValueGet(&mv->array, 3), "invalid matrix"); double tx = DoublePart (ArrayValueGet(&mv->array, 4), "invalid matrix"); double ty = DoublePart (ArrayValueGet(&mv->array, 5), "invalid matrix"); @