[cairo-commit] cairo-ocaml/src svg_cairo.mli, 1.3, 1.4 svg_cairo.ml, 1.3, 1.4 ml_svg_cairo.c, 1.3, 1.4 ml_cairo_wrappers.h, 1.9, 1.10 ml_cairo_surface.c, 1.2, 1.3 ml_cairo_status.c, 1.6, 1.7 ml_cairo_pattern.c, 1.1, 1.2 ml_cairo_path.c, 1.4, 1.5 ml_cairo.h, 1.10, 1.11 ml_cairo.c, 1.22, 1.23 cairo.mli, 1.17, 1.18 cairo.ml, 1.15, 1.16

Olivier Andrieu commit at pdx.freedesktop.org
Mon Jul 18 12:11:07 PDT 2005


Committed by: oandrieu

Update of /cvs/cairo/cairo-ocaml/src
In directory gabe:/tmp/cvs-serv27098/src

Modified Files:
	svg_cairo.mli svg_cairo.ml ml_svg_cairo.c ml_cairo_wrappers.h 
	ml_cairo_surface.c ml_cairo_status.c ml_cairo_pattern.c 
	ml_cairo_path.c ml_cairo.h ml_cairo.c cairo.mli cairo.ml 
Log Message:
* configure.ac, README: require cairo 0.5.2

* src/*: adapt to cairo 0.5.1 and 0.5.2 API changes (new status values
and functions, new pattern functions)

* test/knockout.ml: adapt to API change


Index: svg_cairo.mli
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/svg_cairo.mli,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- svg_cairo.mli	22 May 2005 20:03:15 -0000	1.3
+++ svg_cairo.mli	18 Jul 2005 19:11:05 -0000	1.4
@@ -10,7 +10,8 @@
  cairo *)
 
 type status =
-    NO_MEMORY
+    SUCCESS
+  | NO_MEMORY
   | IO_ERROR
   | FILE_NOT_FOUND
   | INVALID_VALUE

Index: svg_cairo.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/svg_cairo.ml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- svg_cairo.ml	22 May 2005 20:03:15 -0000	1.3
+++ svg_cairo.ml	18 Jul 2005 19:11:05 -0000	1.4
@@ -7,7 +7,8 @@
 (**************************************************************************)
 
 type status =
-    NO_MEMORY
+    SUCCESS
+  | NO_MEMORY
   | IO_ERROR
   | FILE_NOT_FOUND
   | INVALID_VALUE

Index: ml_svg_cairo.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_svg_cairo.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ml_svg_cairo.c	22 May 2005 20:03:15 -0000	1.3
+++ ml_svg_cairo.c	18 Jul 2005 19:11:05 -0000	1.4
@@ -20,6 +20,9 @@
   static value *exn;
   assert (s != SVG_CAIRO_STATUS_SUCCESS);
 
+  if (s == SVG_CAIRO_STATUS_NO_MEMORY)
+    caml_raise_out_of_memory ();
+
   if (exn == NULL)
     {
       exn = caml_named_value ("svg_cairo_status_exn");
@@ -27,7 +30,7 @@
 	caml_failwith ("svg-cairo exception");
     }
 
-  caml_raise_with_arg (*exn, Val_int (s - 1));
+  caml_raise_with_arg (*exn, Val_int (s));
 }
 
 #define check_svg_cairo_status(s)	if (s != SVG_CAIRO_STATUS_SUCCESS) ml_svg_cairo_status (s)
@@ -119,11 +122,11 @@
 CAMLprim value
 ml_svg_cairo_get_size (value s)
 {
-  int w, h;
+  unsigned int w, h;
   value r;
   svg_cairo_get_size (svg_cairo_t_val (s), &w, &h);
   r = caml_alloc_small (2, 0);
-  Field (r, 0) = Val_int (w);
-  Field (r, 1) = Val_int (h);
+  Field (r, 0) = Val_long (w);
+  Field (r, 1) = Val_long (h);
   return r;
 }

Index: ml_cairo_wrappers.h
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_wrappers.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ml_cairo_wrappers.h	22 May 2005 20:03:15 -0000	1.9
+++ ml_cairo_wrappers.h	18 Jul 2005 19:11:05 -0000	1.10
@@ -101,50 +101,56 @@
 CAMLprim value ml_##cname##_bc (value *argv, int argn) \
 { return ml_##cname(argv[0],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6]); }
 
+#ifndef W_CHECK_STATUS
+# define W_CHECK_STATUS check_cairo_status
+#endif
+#ifndef W_CONV_CAIRO
+# define W_CONV_CAIRO cairo_t_val
+#endif
+
 #define wML_0_cairo(cname) \
 CAMLprim value ml_cairo_##cname (value v_cr) \
-{ cairo_##cname (cairo_t_val (v_cr)); \
-  check_cairo_status (v_cr); \
+{ cairo_##cname (W_CONV_CAIRO(v_cr)); \
+  W_CHECK_STATUS(v_cr); \
   return Val_unit; \
 }
 #define wML_1_cairo(cname, conv1) \
 CAMLprim value ml_cairo_##cname (value v_cr, value arg1) \
-{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1)); \
-  check_cairo_status (v_cr); \
+{ cairo_##cname (W_CONV_CAIRO(v_cr), conv1 (arg1)); \
+  W_CHECK_STATUS(v_cr); \
   return Val_unit; \
 }
 #define wML_2_cairo(cname, conv1, conv2) \
 CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2) \
-{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2)); \
-  check_cairo_status (v_cr); \
+{ cairo_##cname (W_CONV_CAIRO(v_cr), conv1 (arg1), conv2 (arg2)); \
+  W_CHECK_STATUS(v_cr); \
   return Val_unit; \
 }
 #define wML_3_cairo(cname, conv1, conv2, conv3) \
 CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2, value arg3) \
-{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3)); \
-  check_cairo_status (v_cr); \
+{ cairo_##cname (W_CONV_CAIRO(v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3)); \
+  W_CHECK_STATUS(v_cr); \
   return Val_unit; \
 }
 #define wML_4_cairo(cname, conv1, conv2, conv3, conv4) \
 CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2, value arg3, value arg4) \
-{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3), conv4 (arg4)); \
-  check_cairo_status (v_cr); \
+{ cairo_##cname (W_CONV_CAIRO(v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3), conv4 (arg4)); \
+  W_CHECK_STATUS(v_cr); \
   return Val_unit; \
 }
 #define wML_5_cairo(cname, conv1, conv2, conv3, conv4, conv5) \
 CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2, value arg3, value arg4, value arg5) \
-{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3), conv4 (arg4), conv5 (arg5)); \
-  check_cairo_status (v_cr); \
+{ cairo_##cname (W_CONV_CAIRO(v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3), conv4 (arg4), conv5 (arg5)); \
+  W_CHECK_STATUS(v_cr); \
   return Val_unit; \
 } \
 CAMLprim value ml_cairo_##cname##_bc (value *argv, int argn) \
 { return ml_cairo_##cname (argv[0],argv[1],argv[2],argv[3],argv[4],argv[5]); }
 #define wML_6_cairo(cname, conv1, conv2, conv3, conv4, conv5, conv6) \
 CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2, value arg3, value arg4, value arg5, value arg6) \
-{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3), conv4 (arg4), conv5 (arg5), conv6 (arg6)); \
-  check_cairo_status (v_cr); \
+{ cairo_##cname (W_CONV_CAIRO(v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3), conv4 (arg4), conv5 (arg5), conv6 (arg6)); \
+  W_CHECK_STATUS(v_cr); \
   return Val_unit; \
 } \
 CAMLprim value ml_cairo_##cname##_bc (value *argv, int argn) \
 { return ml_cairo_##cname (argv[0],argv[1],argv[2],argv[3],argv[4],argv[5], argv[6]); }
-

Index: ml_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_surface.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ml_cairo_surface.c	26 May 2005 23:56:10 -0000	1.2
+++ ml_cairo_surface.c	18 Jul 2005 19:11:05 -0000	1.3
@@ -10,8 +10,20 @@
 
 wMake_Val_final_pointer(cairo_surface_t, cairo_surface_destroy, 0)
 
+static cairo_content_t
+cairo_content_t_val (value v)
+{
+  switch (Long_val (v))
+    {
+    case 0: return CAIRO_CONTENT_COLOR;
+    case 1: return CAIRO_CONTENT_ALPHA;
+    case 2: return CAIRO_CONTENT_COLOR_ALPHA;
+    default: assert (0);
+    }
+}
+
 wML_4(cairo_surface_create_similar, \
-     cairo_surface_t_val, cairo_format_t_val, \
+     cairo_surface_t_val, cairo_content_t_val, \
      Int_val, Int_val, Val_cairo_surface_t)
 
 /* surface_reference */

Index: ml_cairo_status.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_status.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ml_cairo_status.c	22 May 2005 20:03:15 -0000	1.6
+++ ml_cairo_status.c	18 Jul 2005 19:11:05 -0000	1.7
@@ -8,23 +8,10 @@
 
 #include "ml_cairo.h"
 
-CAMLprim value
-ml_cairo_status (value v_cr)
-{
-  value v;
-  cairo_status_t status = cairo_status (cairo_t_val (v_cr));
-
-  if (status == CAIRO_STATUS_SUCCESS)
-    v = Val_unit;
-  else
-    {
-      v = caml_alloc_small (1, 0);
-      Field (v, 0) = Val_int (status - 1);
-    }
-  return v;
-}
+wML_1 (cairo_status, cairo_t_val, Val_int)
+wML_1 (cairo_pattern_status, cairo_pattern_t_val, Val_int)
 
-wML_1(cairo_status_string, cairo_t_val, caml_copy_string)
+wML_1 (cairo_status_to_string, Int_val, caml_copy_string)
 
 void
 ml_cairo_treat_status (cairo_status_t status)
@@ -42,5 +29,5 @@
       if (cairo_exn == NULL)
 	caml_failwith ("cairo exception");
     }
-  caml_raise_with_arg (*cairo_exn, Val_int (status - 1));
+  caml_raise_with_arg (*cairo_exn, Val_int (status));
 }

Index: ml_cairo_pattern.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_pattern.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ml_cairo_pattern.c	22 May 2005 20:03:15 -0000	1.1
+++ ml_cairo_pattern.c	18 Jul 2005 19:11:05 -0000	1.2
@@ -6,70 +6,91 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
+#define W_CHECK_STATUS check_pattern_status
+#define W_CONV_CAIRO   cairo_pattern_t_val
+
 #include "ml_cairo.h"
 
 wMake_Val_final_pointer(cairo_pattern_t, cairo_pattern_destroy, 0)
 
-wML_1(cairo_pattern_create_for_surface, cairo_surface_t_val, Val_cairo_pattern_t)
-
-wML_4(cairo_pattern_create_linear, Double_val, Double_val, Double_val, Double_val, Val_cairo_pattern_t)
+CAMLprim value
+ml_cairo_pattern_create_rgb (value r, value g, value b)
+{
+  cairo_pattern_t *p = cairo_pattern_create_rgb (Double_val (r), Double_val (g), Double_val (b));
+  cairo_treat_status (cairo_pattern_status (p));
+  return Val_cairo_pattern_t (p);
+}
 
-wML_6(cairo_pattern_create_radial, Double_val, Double_val, Double_val, Double_val, Double_val, Double_val, Val_cairo_pattern_t)
+CAMLprim value
+ml_cairo_pattern_create_rgba (value r, value g, value b, value a)
+{
+  cairo_pattern_t *p = cairo_pattern_create_rgba (Double_val (r), Double_val (g), 
+						  Double_val (b), Double_val (a));
+  cairo_treat_status (cairo_pattern_status (p));
+  return Val_cairo_pattern_t (p);
+}
 
-/* pattern_reference */
-/* pattern_destroy */
+CAMLprim value
+ml_cairo_pattern_create_for_surface (value surf)
+{
+  cairo_pattern_t *p = cairo_pattern_create_for_surface (cairo_surface_t_val (surf));
+  cairo_treat_status (cairo_pattern_status (p));
+  return Val_cairo_pattern_t (p);
+}
 
 CAMLprim value
-ml_cairo_pattern_add_color_stop_rgb (value p, value off, value r, value g, value b)
+ml_cairo_pattern_create_linear (value x0, value y0, value x1, value y1)
 {
-  cairo_status_t s;
-  s = cairo_pattern_add_color_stop_rgb (cairo_pattern_t_val (p), Double_val (off),
-					Double_val (r), Double_val (g), Double_val (b));
-  cairo_treat_status (s);
-  return Val_unit;
+  cairo_pattern_t *p = cairo_pattern_create_linear (Double_val (x0), Double_val (y0), 
+						    Double_val (x1), Double_val (y1));
+  cairo_treat_status (cairo_pattern_status (p));
+  return Val_cairo_pattern_t (p);
 }
 
 CAMLprim value
-ml_cairo_pattern_add_color_stop_rgba (value p, value off, value r, value g, value b, value a)
+ml_cairo_pattern_create_radial (value cx0, value cy0, value r0,
+				value cx1, value cy1, value r1)
 {
-  cairo_status_t s;
-  s = cairo_pattern_add_color_stop_rgba (cairo_pattern_t_val (p), Double_val (off),
-					 Double_val (r), Double_val (g), Double_val (b), 
-					 Double_val (a));
-  cairo_treat_status (s);
-  return Val_unit;
+  cairo_pattern_t *p = cairo_pattern_create_radial (Double_val (cx0), Double_val (cy0), Double_val (r0), 
+						    Double_val (cx1), Double_val (cy1), Double_val (r1));
+  cairo_treat_status (cairo_pattern_status (p));
+  return Val_cairo_pattern_t (p);
 }
-wML_bc6(cairo_pattern_add_color_stop_rgba)
+wML_bc6(cairo_pattern_create_radial)
+
+/* pattern_reference */
+/* pattern_destroy */
+
+wML_4_cairo(pattern_add_color_stop_rgb,  Double_val, Double_val, Double_val, Double_val)
+wML_5_cairo(pattern_add_color_stop_rgba, Double_val, Double_val, Double_val, Double_val, Double_val)
 
 CAMLprim value
 ml_cairo_pattern_set_matrix (value p, value m)
 {
-  cairo_status_t s;
 #ifdef ARCH_ALIGN_DOUBLE
   cairo_matrix_t mat;
   ml_convert_cairo_matrix_in (m, &mat);
-  s = cairo_pattern_set_matrix (cairo_pattern_t_val (p), &mat);
+  cairo_pattern_set_matrix (cairo_pattern_t_val (p), &mat);
 #else
-  s = cairo_pattern_set_matrix (cairo_pattern_t_val (p), cairo_matrix_t_val (m));
+  cairo_pattern_set_matrix (cairo_pattern_t_val (p), cairo_matrix_t_val (m));
 #endif
-  cairo_treat_status (s);
+  check_pattern_status (p);
   return Val_unit;
 }
 
 CAMLprim value
 ml_cairo_pattern_get_matrix (value p)
 {
-  cairo_status_t s;
 #ifdef ARCH_ALIGN_DOUBLE
   cairo_matrix_t mat;
-  s = cairo_pattern_get_matrix (cairo_pattern_t_val (p), &mat);
-  cairo_treat_status (s);
+  cairo_pattern_get_matrix (cairo_pattern_t_val (p), &mat);
+  check_pattern_status (p);
   return ml_convert_cairo_matrix_out (m, &mat);
 #else
   CAMLparam1(p);
   value m = caml_alloc_small (6 * Double_wosize, Double_array_tag);
-  s = cairo_pattern_get_matrix (cairo_pattern_t_val (p), cairo_matrix_t_val (m));
-  cairo_treat_status (s);
+  cairo_pattern_get_matrix (cairo_pattern_t_val (p), cairo_matrix_t_val (m));
+  check_pattern_status (p);
   CAMLreturn (m);
 #endif
 }
@@ -77,27 +98,11 @@
 #define cairo_extend_t_val(v) ((cairo_extend_t) Int_val(v))
 #define Val_cairo_extend_t(v) Val_int(v)
 
-CAMLprim value
-ml_cairo_pattern_set_extend (value p, value e)
-{
-  cairo_status_t s;
-  s = cairo_pattern_set_extend (cairo_pattern_t_val (p), cairo_extend_t_val (e));
-  cairo_treat_status (s);
-  return Val_unit;
-}
-
+wML_1_cairo(pattern_set_extend, cairo_extend_t_val)
 wML_1(cairo_pattern_get_extend, cairo_pattern_t_val, Val_cairo_extend_t)
 
 #define cairo_filter_t_val(v) ((cairo_filter_t) Int_val(v))
 #define Val_cairo_filter_t(v) Val_int(v)
 
-CAMLprim value
-ml_cairo_pattern_set_filter (value p, value e)
-{
-  cairo_status_t s;
-  s = cairo_pattern_set_filter (cairo_pattern_t_val (p), cairo_filter_t_val (e));
-  cairo_treat_status (s);
-  return Val_unit;
-}
-
+wML_1_cairo(pattern_set_filter, cairo_filter_t_val)
 wML_1(cairo_pattern_get_filter, cairo_pattern_t_val, Val_cairo_filter_t)

Index: ml_cairo_path.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_path.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ml_cairo_path.c	22 May 2005 20:03:15 -0000	1.4
+++ ml_cairo_path.c	18 Jul 2005 19:11:05 -0000	1.5
@@ -20,6 +20,8 @@
   CAMLlocal5(var, t, p1, p2, p3);
   int i;
 
+  cairo_treat_status (path->status);
+
   for (i = 0; i < path->num_data; i += path->data[i].header.length)
     {
       cairo_path_data_t *data = &path->data[i];

Index: ml_cairo.h
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ml_cairo.h	26 May 2005 23:56:10 -0000	1.10
+++ ml_cairo.h	18 Jul 2005 19:11:05 -0000	1.11
@@ -63,6 +63,7 @@
 void ml_cairo_treat_status (cairo_status_t) Noreturn;
 #define cairo_treat_status(s)   if (s != CAIRO_STATUS_SUCCESS) ml_cairo_treat_status (s)
 #define check_cairo_status(cr)	cairo_treat_status (cairo_status (cairo_t_val (cr)))
+#define check_pattern_status(cr)	cairo_treat_status (cairo_pattern_status (cairo_pattern_t_val (cr)))
 #define report_null_pointer()	ml_cairo_treat_status (CAIRO_STATUS_NULL_POINTER)
 
 /* stream callbacks */

Index: ml_cairo.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ml_cairo.c	26 May 2005 23:56:10 -0000	1.22
+++ ml_cairo.c	18 Jul 2005 19:11:05 -0000	1.23
@@ -10,7 +10,13 @@
 
 wMake_Val_final_pointer(cairo_t, cairo_destroy, 0)
 
-wML_1(cairo_create, cairo_surface_t_val, Val_cairo_t)
+CAMLprim value
+ml_cairo_create (value surf)
+{
+  cairo_t *p = cairo_create (cairo_surface_t_val (surf));
+  cairo_treat_status (cairo_status (p));
+  return Val_cairo_t (p);
+}
 
 /* cairo_reference */
 /* cairo_destroy   */

Index: cairo.mli
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo.mli,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cairo.mli	26 May 2005 23:56:11 -0000	1.17
+++ cairo.mli	18 Jul 2005 19:11:05 -0000	1.18
@@ -11,12 +11,13 @@
 (** {3 Error reporting} *)
 
 type status =
-    NO_MEMORY
+    SUCCESS
+  | NO_MEMORY
   | INVALID_RESTORE
   | INVALID_POP_GROUP
   | NO_CURRENT_POINT
   | INVALID_MATRIX
-  | NO_TARGET_SURFACE
+  | INVALID_STATUS
   | NULL_POINTER
   | INVALID_STRING
   | INVALID_PATH_DATA
@@ -24,6 +25,7 @@
   | WRITE_ERROR
   | SURFACE_FINISHED
   | SURFACE_TYPE_MISMATCH
+  | PATTERN_TYPE_MISMATCH
 exception Error of status
 val init : unit
 
@@ -47,8 +49,9 @@
 external save    : t -> unit = "ml_cairo_save"
 external restore : t -> unit = "ml_cairo_restore"
 
-external status : t -> status option = "ml_cairo_status"
-external status_string : t -> string = "ml_cairo_status_string"
+external status : t -> status = "ml_cairo_status"
+external pattern_status : [> `Any] pattern -> status = "ml_cairo_pattern_status"
+external string_of_status : status -> string = "ml_cairo_status_to_string"
 
 (** {4 Renderer state} *)
 
@@ -219,13 +222,12 @@
 
 (** {3 Surface API} *)
 
-type format =
-    FORMAT_ARGB32
-  | FORMAT_RGB24
-  | FORMAT_A8
-  | FORMAT_A1
+type content =
+    CONTENT_COLOR
+  | CONTENT_ALPHA
+  | CONTENT_COLOR_ALPHA
 
-external surface_create_similar : 'a surface -> format -> width:int -> height:int -> 'a surface = "ml_cairo_surface_create_similar"
+external surface_create_similar : 'a surface -> content -> width:int -> height:int -> 'a surface = "ml_cairo_surface_create_similar"
 
 external surface_finish : 'a surface -> unit = "ml_cairo_surface_finish"
 
@@ -235,12 +237,19 @@
 
 type image_surface = [`Any|`Image] surface
 
+type format =
+    FORMAT_ARGB32
+  | FORMAT_RGB24
+  | FORMAT_A8
+  | FORMAT_A1
+
 external image_surface_create : format -> width:int -> height:int -> image_surface = "ml_cairo_image_surface_create"
 external image_surface_get_width  : [>`Image] surface -> int = "ml_cairo_image_surface_get_width"
 external image_surface_get_height : [>`Image] surface -> int = "ml_cairo_image_surface_get_height"
 
 (** {4 Patterns} *)
 
+type solid_pattern = [`Any|`Solid] pattern
 type surface_pattern  = [`Any|`Surface] pattern
 type gradient_pattern = [`Any|`Gradient] pattern
 
@@ -259,6 +268,8 @@
 
 (** Patterns functions *)
 module Pattern : sig
+external create_rgb  : red:float -> green:float -> blue:float -> solid_pattern = "ml_cairo_pattern_create_rgb"
+external create_rgba : red:float -> green:float -> blue:float -> alpha:float -> solid_pattern = "ml_cairo_pattern_create_rgba"
 external create_for_surface : 'a surface -> surface_pattern = "ml_cairo_pattern_create_for_surface"
 external create_linear : x0:float -> y0:float -> x1:float -> y1:float -> gradient_pattern = "ml_cairo_pattern_create_linear"
 external create_radial : cx0:float -> cy0:float -> radius0:float -> cx1:float -> cy1:float -> radius1:float -> gradient_pattern = "ml_cairo_pattern_create_radial_bc" "ml_cairo_pattern_create_radial"

Index: cairo.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo.ml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cairo.ml	26 May 2005 23:56:11 -0000	1.15
+++ cairo.ml	18 Jul 2005 19:11:05 -0000	1.16
@@ -7,12 +7,13 @@
 (**************************************************************************)
 
 type status =
-    NO_MEMORY
+    SUCCESS
+  | NO_MEMORY
   | INVALID_RESTORE
   | INVALID_POP_GROUP
   | NO_CURRENT_POINT
   | INVALID_MATRIX
-  | NO_TARGET_SURFACE
+  | INVALID_STATUS
   | NULL_POINTER
   | INVALID_STRING
   | INVALID_PATH_DATA
@@ -20,6 +21,7 @@
   | WRITE_ERROR
   | SURFACE_FINISHED
   | SURFACE_TYPE_MISMATCH
+  | PATTERN_TYPE_MISMATCH
 exception Error of status
 let init = Callback.register_exception "cairo_status_exn" (Error NULL_POINTER)
 
@@ -196,19 +198,19 @@
   | `CLOSE -> close_path cr
   | `CURVE_TO (p1, p2, p3) -> curve_to_point cr p1 p2 p3
 
-external status : t -> status option = "ml_cairo_status"
-external status_string : t -> string = "ml_cairo_status_string"
+external status : t -> status = "ml_cairo_status"
+external pattern_status : [> `Any] pattern -> status = "ml_cairo_pattern_status"
+external string_of_status : status -> string = "ml_cairo_status_to_string"
 
 
 
 (* surface *)
-type format =
-    FORMAT_ARGB32
-  | FORMAT_RGB24
-  | FORMAT_A8
-  | FORMAT_A1
+type content =
+    CONTENT_COLOR
+  | CONTENT_ALPHA
+  | CONTENT_COLOR_ALPHA
 
-external surface_create_similar : 'a surface -> format -> width:int -> height:int -> 'a surface = "ml_cairo_surface_create_similar"
+external surface_create_similar : 'a surface -> content -> width:int -> height:int -> 'a surface = "ml_cairo_surface_create_similar"
 
 external surface_finish : 'a surface -> unit = "ml_cairo_surface_finish"
 
@@ -217,6 +219,12 @@
 
 type image_surface = [`Any|`Image] surface
 
+type format =
+    FORMAT_ARGB32
+  | FORMAT_RGB24
+  | FORMAT_A8
+  | FORMAT_A1
+
 external image_surface_create : format -> width:int -> height:int -> image_surface = "ml_cairo_image_surface_create"
 external image_surface_get_width  : [>`Image] surface -> int = "ml_cairo_image_surface_get_width"
 external image_surface_get_height : [>`Image] surface -> int = "ml_cairo_image_surface_get_height"
@@ -237,10 +245,13 @@
   | FILTER_BILINEAR
   | FILTER_GAUSSIAN
 
+type solid_pattern = [`Any|`Solid] pattern
 type surface_pattern  = [`Any|`Surface] pattern
 type gradient_pattern = [`Any|`Gradient] pattern
 
 module Pattern = struct
+external create_rgb  : red:float -> green:float -> blue:float -> solid_pattern = "ml_cairo_pattern_create_rgb"
+external create_rgba : red:float -> green:float -> blue:float -> alpha:float -> solid_pattern = "ml_cairo_pattern_create_rgba"
 external create_for_surface : 'a surface -> surface_pattern = "ml_cairo_pattern_create_for_surface"
 external create_linear : x0:float -> y0:float -> x1:float -> y1:float -> gradient_pattern = "ml_cairo_pattern_create_linear"
 external create_radial : cx0:float -> cy0:float -> radius0:float -> cx1:float -> cy1:float -> radius1:float -> gradient_pattern = "ml_cairo_pattern_create_radial_bc" "ml_cairo_pattern_create_radial"




More information about the cairo-commit mailing list