summaryrefslogtreecommitdiff
path: root/src/cairo_pdf.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo_pdf.ml')
-rw-r--r--src/cairo_pdf.ml15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/cairo_pdf.ml b/src/cairo_pdf.ml
index a071c78..f0e8370 100644
--- a/src/cairo_pdf.ml
+++ b/src/cairo_pdf.ml
@@ -8,10 +8,19 @@
type surface = [`Any|`PDF] Cairo.surface
-external surface_create :
- string ->
+external surface_create_for_stream_unsafe :
+ (string -> int -> unit) ->
width_in_points:float ->
- height_in_points:float -> surface = "ml_cairo_pdf_surface_create"
+ height_in_points:float -> surface = "ml_cairo_pdf_surface_create_for_stream_unsafe"
+
+let unsafe_output_string oc s n =
+ for i = 0 to n - 1 do
+ output_char oc (String.unsafe_get s i)
+ done
+
+let surface_create_for_channel oc ~width_in_points ~height_in_points =
+ surface_create_for_stream_unsafe
+ (unsafe_output_string oc) ~width_in_points ~height_in_points
external surface_create_for_stream :
(string -> unit) ->