[cairo-commit] cairo-ocaml/src cairo.ml,1.5,1.6 cairo.mli,1.5,1.6 ml_cairo.c,1.7,1.8 ocairo.ml,1.5,1.6 ocairo.mli,1.5,1.6
Olivier Andrieu
commit at pdx.freedesktop.org
Mon Aug 15 11:12:59 PDT 2005
Committed by: oandrieu
Update of /cvs/cairo/cairo-ocaml/src
In directory pdx:/tmp/cvs-serv25130/src
Modified Files:
cairo.ml cairo.mli ml_cairo.c ocairo.ml ocairo.mli
Log Message:
PNG backend
Index: cairo.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo.ml,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/cairo.ml 22 Feb 2004 22:41:26 -0000 1.5
--- b/cairo.ml 27 Feb 2004 22:49:12 -0000 1.6
***************
*** 32,35 ****
--- 32,37 ----
x_pixels_per_inch:float -> y_pixels_per_inch:float ->
unit = "ml_cairo_set_target_ps_bc" "ml_cairo_set_target_ps"
+ external set_target_png :
+ cr:t -> file:Cairo_channel.t -> format -> width:float -> height:float -> unit = "ml_cairo_set_target_png"
type operator =
OPERATOR_CLEAR
***************
*** 219,222 ****
--- 221,228 ----
x_pixels_per_inch:float -> y_pixels_per_inch:float ->
surface = "ml_cairo_ps_surface_create"
+ external png_surface_create :
+ file:Cairo_channel.t -> format -> width:float -> height:float ->
+ surface = "ml_cairo_png_surface_create"
+
external matrix_create : unit -> matrix = "ml_cairo_matrix_create"
external matrix_destroy : matrix:matrix -> unit = "ml_cairo_matrix_destroy"
Index: cairo.mli
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo.mli,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/cairo.mli 22 Feb 2004 22:41:26 -0000 1.5
--- b/cairo.mli 27 Feb 2004 22:49:12 -0000 1.6
***************
*** 23,26 ****
--- 23,32 ----
type image
+ type format =
+ | FORMAT_ARGB32
+ | FORMAT_RGB24
+ | FORMAT_A8
+ | FORMAT_A1
+
(** {3 Core API} *)
***************
*** 41,44 ****
--- 47,52 ----
x_pixels_per_inch:float -> y_pixels_per_inch:float -> unit
= "ml_cairo_set_target_ps_bc" "ml_cairo_set_target_ps"
+ external set_target_png :
+ cr:t -> file:Cairo_channel.t -> format -> width:float -> height:float -> unit = "ml_cairo_set_target_png"
external finalise_target : cr:t -> unit = "ml_cairo_finalise_target"
***************
*** 230,239 ****
(** {3 Surface API} *)
- type format =
- | FORMAT_ARGB32
- | FORMAT_RGB24
- | FORMAT_A8
- | FORMAT_A1
-
external surface_create_for_image : image -> surface
= "ml_cairo_surface_create_for_image"
--- 238,241 ----
***************
*** 274,277 ****
--- 276,286 ----
= "ml_cairo_ps_surface_create"
+ (** {4 PNG surface} *)
+
+ external png_surface_create :
+ file:Cairo_channel.t -> format -> width:float -> height:float ->
+ surface = "ml_cairo_png_surface_create"
+
+
(** {3 Matrix API} *)
Index: ml_cairo.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/ml_cairo.c 22 Feb 2004 22:41:26 -0000 1.7
--- b/ml_cairo.c 27 Feb 2004 22:49:12 -0000 1.8
***************
*** 1018,1019 ****
--- 1018,1040 ----
return Val_unit;
}
+
+ #ifdef CAIRO_HAS_PNG_SURFACE
+ CAMLprim value
+ ml_cairo_set_target_png(value v_cr, value v_file, value v_format,
+ value v_width, value v_height)
+ {
+ cairo_set_target_png(cairo_t_val(v_cr), FILE_val(v_file),
+ cairo_format_t_val(v_format),
+ Double_val(v_width), Double_val(v_height));
+ check_cairo_status(v_cr);
+ return Val_unit;
+ }
+ ML_4(cairo_png_surface_create, FILE_val, cairo_format_t_val, Double_val, Double_val, Val_cairo_surface_t)
+ #else
+ CAMLprim value
+ ml_cairo_set_target_png(value v_cr, value v_file, value v_format,
+ value v_width, value v_height)
+ { failwith("Cairo library does not support this backend") ; return Val_unit; }
+ ml_cairo_png_surface_create(value v1, value v2, value v3, value v4, value v5)
+ { failwith("Cairo library does not support this backend") ; return Val_unit; }
+ #endif /* CAIRO_HAS_PNG_SURFACE */
Index: ocairo.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ocairo.ml,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/ocairo.ml 27 Feb 2004 22:44:30 -0000 1.5
--- b/ocairo.ml 27 Feb 2004 22:49:12 -0000 1.6
***************
*** 83,86 ****
--- 83,88 ----
method set_target_ps chan w h xpi ypi =
Cairo.set_target_ps c chan w h xpi ypi
+ method set_target_png chan f w h =
+ Cairo.set_target_png c chan f w h
method finalise_target = Cairo.finalise_target
***************
*** 221,222 ****
--- 223,226 ----
let ps_surface_create chan w h xpi ypi =
new surface (Cairo.ps_surface_create chan w h xpi ypi)
+ let png_surface_create chan f w h =
+ new surface (Cairo.png_surface_create chan f w h)
Index: ocairo.mli
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ocairo.mli,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/ocairo.mli 27 Feb 2004 22:44:30 -0000 1.5
--- b/ocairo.mli 27 Feb 2004 22:49:12 -0000 1.6
***************
*** 133,136 ****
--- 133,138 ----
method set_rgb_color : float -> float -> float -> unit
method set_target_image : Cairo.image -> unit
+ method set_target_png :
+ Cairo_channel.t -> format -> float -> float -> unit
method set_target_ps :
Cairo_channel.t -> float -> float -> float -> float -> unit
***************
*** 190,191 ****
--- 192,195 ----
val ps_surface_create :
Cairo_channel.t -> float -> float -> float -> float -> surface
+ val png_surface_create :
+ Cairo_channel.t -> format -> float -> float -> surface
More information about the cairo-commit
mailing list