Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | cairo improvements, added some tests |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ecd5997790c4995e28b48b923e73c818 |
User & Date: | ovenpasta@pizzahack.eu 2016-07-23 07:46:20 |
Context
2016-07-24
| ||
21:23 | more tests and improvements on cairo check-in: 6ea4d2df39 user: ovenpasta@pizzahack.eu tags: trunk | |
2016-07-23
| ||
07:46 | cairo improvements, added some tests check-in: ecd5997790 user: ovenpasta@pizzahack.eu tags: trunk | |
2016-07-21
| ||
11:27 | ffi-utils.sls check-in: f092b13da6 user: ovenpasta@pizzahack.eu tags: trunk | |
Changes
Added cairo-functions.scm.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
; THIS FILE WAS AUTOMATICALLY GENERATED, see at the end of cairo.sls (define-function* cairo_version () int) (define-function* cairo_version_string () const-char*) (define-function* cairo_create ((target cairo-surface-t*)) cairo-t*) (define-function* cairo_reference ((cr cairo-t*)) cairo-t*) (define-function* cairo_destroy ((cr cairo-t*)) void) (define-function* cairo_get_reference_count ((cr cairo-t*)) unsigned-int) (define-function* cairo_get_user_data ((cr cairo-t*) (key const-cairo-user-data-key-t*)) void*) (define-function* cairo_set_user_data ((cr cairo-t*) (key const-cairo-user-data-key-t*) (user-data void*) (destroy cairo-destroy-func-t)) cairo-status-t) (define-function* cairo_save ((cr cairo-t*)) void) (define-function* cairo_restore ((cr cairo-t*)) void) (define-function* cairo_push_group ((cr cairo-t*)) void) (define-function* cairo_push_group_with_content ((cr cairo-t*) (content cairo-content-t)) void) (define-function* cairo_pop_group ((cr cairo-t*)) cairo-pattern-t*) (define-function* cairo_pop_group_to_source ((cr cairo-t*)) void) (define-function* cairo_set_operator ((cr cairo-t*) (op cairo-operator-t)) void) (define-function* cairo_set_source ((cr cairo-t*) (source cairo-pattern-t*)) void) (define-function* cairo_set_source_rgb ((cr cairo-t*) (red double) (green double) (blue double)) void) (define-function* cairo_set_source_rgba ((cr cairo-t*) (red double) (green double) (blue double) (alpha double)) void) (define-function* cairo_set_source_surface ((cr cairo-t*) (surface cairo-surface-t*) (x double) (y double)) void) (define-function* cairo_set_tolerance ((cr cairo-t*) (tolerance double)) void) (define-function* cairo_set_antialias ((cr cairo-t*) (antialias cairo-antialias-t)) void) (define-function* cairo_set_fill_rule ((cr cairo-t*) (fill-rule cairo-fill-rule-t)) void) (define-function* cairo_set_line_width ((cr cairo-t*) (width double)) void) (define-function* cairo_set_line_cap ((cr cairo-t*) (line-cap cairo-line-cap-t)) void) (define-function* cairo_set_line_join ((cr cairo-t*) (line-join cairo-line-join-t)) void) (define-function* cairo_set_dash ((cr cairo-t*) (dashes const-double*) (num-dashes int) (offset double)) void) (define-function* cairo_set_miter_limit ((cr cairo-t*) (limit double)) void) (define-function* cairo_translate ((cr cairo-t*) (tx double) (ty double)) void) (define-function* cairo_scale ((cr cairo-t*) (sx double) (sy double)) void) (define-function* cairo_rotate ((cr cairo-t*) (angle double)) void) (define-function* cairo_transform ((cr cairo-t*) (matrix const-cairo-matrix-t*)) void) (define-function* cairo_set_matrix ((cr cairo-t*) (matrix const-cairo-matrix-t*)) void) (define-function* cairo_identity_matrix ((cr cairo-t*)) void) (define-function* cairo_user_to_device ((cr cairo-t*) (x double*) (y double*)) void) (define-function* cairo_user_to_device_distance ((cr cairo-t*) (dx double*) (dy double*)) void) (define-function* cairo_device_to_user ((cr cairo-t*) (x double*) (y double*)) void) (define-function* cairo_device_to_user_distance ((cr cairo-t*) (dx double*) (dy double*)) void) (define-function* cairo_new_path ((cr cairo-t*)) void) (define-function* cairo_move_to ((cr cairo-t*) (x double) (y double)) void) (define-function* cairo_new_sub_path ((cr cairo-t*)) void) (define-function* cairo_line_to ((cr cairo-t*) (x double) (y double)) void) (define-function* cairo_curve_to ((cr cairo-t*) (x1 double) (y1 double) (x2 double) (y2 double) (x3 double) (y3 double)) void) (define-function* cairo_arc ((cr cairo-t*) (xc double) (yc double) (radius double) (angle1 double) (angle2 double)) void) (define-function* cairo_arc_negative ((cr cairo-t*) (xc double) (yc double) (radius double) (angle1 double) (angle2 double)) void) (define-function* cairo_arc_to ((cr cairo-t*) (x1 double) (y1 double) (x2 double) (y2 double) (radius double)) void) (define-function* cairo_rel_move_to ((cr cairo-t*) (dx double) (dy double)) void) (define-function* cairo_rel_line_to ((cr cairo-t*) (dx double) (dy double)) void) (define-function* cairo_rel_curve_to ((cr cairo-t*) (dx1 double) (dy1 double) (dx2 double) (dy2 double) (dx3 double) (dy3 double)) void) (define-function* cairo_rectangle ((cr cairo-t*) (x double) (y double) (width double) (height double)) void) (define-function* cairo_stroke_to_path ((cr cairo-t*)) void) (define-function* cairo_close_path ((cr cairo-t*)) void) (define-function* cairo_path_extents ((cr cairo-t*) (x1 double*) (y1 double*) (x2 double*) (y2 double*)) void) (define-function* cairo_paint ((cr cairo-t*)) void) (define-function* cairo_paint_with_alpha ((cr cairo-t*) (alpha double)) void) (define-function* cairo_mask ((cr cairo-t*) (pattern cairo-pattern-t*)) void) (define-function* cairo_mask_surface ((cr cairo-t*) (surface cairo-surface-t*) (surface-x double) (surface-y double)) void) (define-function* cairo_stroke ((cr cairo-t*)) void) (define-function* cairo_stroke_preserve ((cr cairo-t*)) void) (define-function* cairo_fill ((cr cairo-t*)) void) (define-function* cairo_fill_preserve ((cr cairo-t*)) void) (define-function* cairo_copy_page ((cr cairo-t*)) void) (define-function* cairo_show_page ((cr cairo-t*)) void) (define-function* cairo_in_stroke ((cr cairo-t*) (x double) (y double)) cairo-bool-t) (define-function* cairo_in_fill ((cr cairo-t*) (x double) (y double)) cairo-bool-t) (define-function* cairo_in_clip ((cr cairo-t*) (x double) (y double)) cairo-bool-t) (define-function* cairo_stroke_extents ((cr cairo-t*) (x1 double*) (y1 double*) (x2 double*) (y2 double*)) void) (define-function* cairo_fill_extents ((cr cairo-t*) (x1 double*) (y1 double*) (x2 double*) (y2 double*)) void) (define-function* cairo_reset_clip ((cr cairo-t*)) void) (define-function* cairo_clip ((cr cairo-t*)) void) (define-function* cairo_clip_preserve ((cr cairo-t*)) void) (define-function* cairo_clip_extents ((cr cairo-t*) (x1 double*) (y1 double*) (x2 double*) (y2 double*)) void) (define-function* cairo_copy_clip_rectangle_list ((cr cairo-t*)) cairo-rectangle-list-t*) (define-function* cairo_rectangle_list_destroy ((rectangle-list cairo-rectangle-list-t*)) void) (define-function* cairo_glyph_allocate ((num-glyphs int)) cairo-glyph-t*) (define-function* cairo_glyph_free ((glyphs cairo-glyph-t*)) void) (define-function* cairo_text_cluster_allocate ((num-clusters int)) cairo-text-cluster-t*) (define-function* cairo_text_cluster_free ((clusters cairo-text-cluster-t*)) void) (define-function* cairo_font_options_create () cairo-font-options-t*) (define-function* cairo_font_options_copy ((original const-cairo-font-options-t*)) cairo-font-options-t*) (define-function* cairo_font_options_destroy ((options cairo-font-options-t*)) void) (define-function* cairo_font_options_status ((options cairo-font-options-t*)) cairo-status-t) (define-function* cairo_font_options_merge ((options cairo-font-options-t*) (other const-cairo-font-options-t*)) void) (define-function* cairo_font_options_equal ((options const-cairo-font-options-t*) (other const-cairo-font-options-t*)) cairo-bool-t) (define-function* cairo_font_options_hash ((options const-cairo-font-options-t*)) unsigned-long) (define-function* cairo_font_options_set_antialias ((options cairo-font-options-t*) (antialias cairo-antialias-t)) void) (define-function* cairo_font_options_get_antialias ((options const-cairo-font-options-t*)) cairo-antialias-t) (define-function* cairo_font_options_set_subpixel_order ((options cairo-font-options-t*) (subpixel-order cairo-subpixel-order-t)) void) (define-function* cairo_font_options_get_subpixel_order ((options const-cairo-font-options-t*)) cairo-subpixel-order-t) (define-function* cairo_font_options_set_hint_style ((options cairo-font-options-t*) (hint-style cairo-hint-style-t)) void) (define-function* cairo_font_options_get_hint_style ((options const-cairo-font-options-t*)) cairo-hint-style-t) (define-function* cairo_font_options_set_hint_metrics ((options cairo-font-options-t*) (hint-metrics cairo-hint-metrics-t)) void) (define-function* cairo_font_options_get_hint_metrics ((options const-cairo-font-options-t*)) cairo-hint-metrics-t) (define-function* cairo_select_font_face ((cr cairo-t*) (family const-char*) (slant cairo-font-slant-t) (weight cairo-font-weight-t)) void) (define-function* cairo_set_font_size ((cr cairo-t*) (size double)) void) (define-function* cairo_set_font_matrix ((cr cairo-t*) (matrix const-cairo-matrix-t*)) void) (define-function* cairo_get_font_matrix ((cr cairo-t*) (matrix cairo-matrix-t*)) void) (define-function* cairo_set_font_options ((cr cairo-t*) (options const-cairo-font-options-t*)) void) (define-function* cairo_get_font_options ((cr cairo-t*) (options cairo-font-options-t*)) void) (define-function* cairo_set_font_face ((cr cairo-t*) (font-face cairo-font-face-t*)) void) (define-function* cairo_get_font_face ((cr cairo-t*)) cairo-font-face-t*) (define-function* cairo_set_scaled_font ((cr cairo-t*) (scaled-font const-cairo-scaled-font-t*)) void) (define-function* cairo_get_scaled_font ((cr cairo-t*)) cairo-scaled-font-t*) (define-function* cairo_show_text ((cr cairo-t*) (utf8 const-char*)) void) (define-function* cairo_show_glyphs ((cr cairo-t*) (glyphs const-cairo-glyph-t*) (num-glyphs int)) void) (define-function* cairo_show_text_glyphs ((cr cairo-t*) (utf8 const-char*) (utf8-len int) (glyphs const-cairo-glyph-t*) (num-glyphs int) (clusters const-cairo-text-cluster-t*) (num-clusters int) (cluster-flags cairo-text-cluster-flags-t)) void) (define-function* cairo_text_path ((cr cairo-t*) (utf8 const-char*)) void) (define-function* cairo_glyph_path ((cr cairo-t*) (glyphs const-cairo-glyph-t*) (num-glyphs int)) void) (define-function* cairo_text_extents ((cr cairo-t*) (utf8 const-char*) (extents cairo-text-extents-t*)) void) (define-function* cairo_glyph_extents ((cr cairo-t*) (glyphs const-cairo-glyph-t*) (num-glyphs int) (extents cairo-text-extents-t*)) void) (define-function* cairo_font_extents ((cr cairo-t*) (extents cairo-font-extents-t*)) void) (define-function* cairo_font_face_reference ((font-face cairo-font-face-t*)) cairo-font-face-t*) (define-function* cairo_font_face_destroy ((font-face cairo-font-face-t*)) void) (define-function* cairo_font_face_get_reference_count ((font-face cairo-font-face-t*)) unsigned-int) (define-function* cairo_font_face_status ((font-face cairo-font-face-t*)) cairo-status-t) (define-function* cairo_font_face_get_type ((font-face cairo-font-face-t*)) cairo-font-type-t) (define-function* cairo_font_face_get_user_data ((font-face cairo-font-face-t*) (key const-cairo-user-data-key-t*)) void*) (define-function* cairo_font_face_set_user_data ((font-face cairo-font-face-t*) (key const-cairo-user-data-key-t*) (user-data void*) (destroy cairo-destroy-func-t)) cairo-status-t) (define-function* cairo_scaled_font_create ((font-face cairo-font-face-t*) (font-matrix const-cairo-matrix-t*) (ctm const-cairo-matrix-t*) (options const-cairo-font-options-t*)) cairo-scaled-font-t*) (define-function* cairo_scaled_font_reference ((scaled-font cairo-scaled-font-t*)) cairo-scaled-font-t*) (define-function* cairo_scaled_font_destroy ((scaled-font cairo-scaled-font-t*)) void) (define-function* cairo_scaled_font_get_reference_count ((scaled-font cairo-scaled-font-t*)) unsigned-int) (define-function* cairo_scaled_font_status ((scaled-font cairo-scaled-font-t*)) cairo-status-t) (define-function* cairo_scaled_font_get_type ((scaled-font cairo-scaled-font-t*)) cairo-font-type-t) (define-function* cairo_scaled_font_get_user_data ((scaled-font cairo-scaled-font-t*) (key const-cairo-user-data-key-t*)) void*) (define-function* cairo_scaled_font_set_user_data ((scaled-font cairo-scaled-font-t*) (key const-cairo-user-data-key-t*) (user-data void*) (destroy cairo-destroy-func-t)) cairo-status-t) (define-function* cairo_scaled_font_extents ((scaled-font cairo-scaled-font-t*) (extents cairo-font-extents-t*)) void) (define-function* cairo_scaled_font_text_extents ((scaled-font cairo-scaled-font-t*) (utf8 const-char*) (extents cairo-text-extents-t*)) void) (define-function* cairo_scaled_font_glyph_extents ((scaled-font cairo-scaled-font-t*) (glyphs const-cairo-glyph-t*) (num-glyphs int) (extents cairo-text-extents-t*)) void) (define-function* cairo_scaled_font_text_to_glyphs ((scaled-font cairo-scaled-font-t*) (x double) (y double) (utf8 const-char*) (utf8-len int) (*glyphs cairo-glyph-t*) (num-glyphs int*) (*clusters cairo-text-cluster-t*) (num-clusters int*) (cluster-flags cairo-text-cluster-flags-t*)) cairo-status-t) (define-function* cairo_scaled_font_get_font_face ((scaled-font cairo-scaled-font-t*)) cairo-font-face-t*) (define-function* cairo_scaled_font_get_font_matrix ((scaled-font cairo-scaled-font-t*) (font-matrix cairo-matrix-t*)) void) (define-function* cairo_scaled_font_get_ctm ((scaled-font cairo-scaled-font-t*) (ctm cairo-matrix-t*)) void) (define-function* cairo_scaled_font_get_scale_matrix ((scaled-font cairo-scaled-font-t*) (scale-matrix cairo-matrix-t*)) void) (define-function* cairo_scaled_font_get_font_options ((scaled-font cairo-scaled-font-t*) (options cairo-font-options-t*)) void) (define-function* cairo_toy_font_face_create ((family const-char*) (slant cairo-font-slant-t) (weight cairo-font-weight-t)) cairo-font-face-t*) (define-function* cairo_toy_font_face_get_family ((font-face cairo-font-face-t*)) const-char*) (define-function* cairo_toy_font_face_get_slant ((font-face cairo-font-face-t*)) cairo-font-slant-t) (define-function* cairo_toy_font_face_get_weight ((font-face cairo-font-face-t*)) cairo-font-weight-t) (define-function* cairo_user_font_face_create () cairo-font-face-t*) (define-function* cairo_user_font_face_set_init_func ((font-face cairo-font-face-t*) (init-func cairo-user-scaled-font-init-func-t*)) void) (define-function* cairo_user_font_face_set_render_glyph_func ((font-face cairo-font-face-t*) (render-glyph-func cairo-user-scaled-font-render-glyph-func-t)) void) (define-function* cairo_user_font_face_set_text_to_glyphs_func ((font-face cairo-font-face-t*) (text-to-glyphs-func cairo-user-scaled-font-text-to-glyphs-func-t)) void) (define-function* cairo_user_font_face_set_unicode_to_glyph_func ((font-face cairo-font-face-t*) (unicode-to-glyph-func cairo-user-scaled-font-unicode-to-glyph-func-t)) void) (define-function* cairo_user_font_face_get_init_func ((font-face cairo-font-face-t*)) cairo-user-scaled-font-init-func-t) (define-function* cairo_user_font_face_get_render_glyph_func ((font-face cairo-font-face-t*)) cairo-user-scaled-font-render-glyph-func-t) (define-function* cairo_user_font_face_get_text_to_glyphs_func ((font-face cairo-font-face-t*)) cairo-user-scaled-font-text-to-glyphs-func-t) (define-function* cairo_user_font_face_get_unicode_to_glyph_func ((font-face cairo-font-face-t*)) cairo-user-scaled-font-unicode-to-glyph-func-t) (define-function* cairo_get_operator ((cr cairo-t*)) cairo-operator-t) (define-function* cairo_get_source ((cr cairo-t*)) cairo-pattern-t*) (define-function* cairo_get_tolerance ((cr cairo-t*)) double) (define-function* cairo_get_antialias ((cr cairo-t*)) cairo-antialias-t) (define-function* cairo_has_current_point ((cr cairo-t*)) cairo-bool-t) (define-function* cairo_get_current_point ((cr cairo-t*) (x double*) (y double*)) void) (define-function* cairo_get_fill_rule ((cr cairo-t*)) cairo-fill-rule-t) (define-function* cairo_get_line_width ((cr cairo-t*)) double) (define-function* cairo_get_line_cap ((cr cairo-t*)) cairo-line-cap-t) (define-function* cairo_get_line_join ((cr cairo-t*)) cairo-line-join-t) (define-function* cairo_get_miter_limit ((cr cairo-t*)) double) (define-function* cairo_get_dash_count ((cr cairo-t*)) int) (define-function* cairo_get_dash ((cr cairo-t*) (dashes double*) (offset double*)) void) (define-function* cairo_get_matrix ((cr cairo-t*) (matrix cairo-matrix-t*)) void) (define-function* cairo_get_target ((cr cairo-t*)) cairo-surface-t*) (define-function* cairo_get_group_target ((cr cairo-t*)) cairo-surface-t*) (define-function* cairo_copy_path ((cr cairo-t*)) cairo-path-t*) (define-function* cairo_copy_path_flat ((cr cairo-t*)) cairo-path-t*) (define-function* cairo_append_path ((cr cairo-t*) (path const-cairo-path-t*)) void) (define-function* cairo_path_destroy ((path cairo-path-t*)) void) (define-function* cairo_status ((cr cairo-t*)) cairo-status-t) (define-function* cairo_status_to_string ((status cairo-status-t)) const-char*) (define-function* cairo_device_reference ((device cairo-device-t*)) cairo-device-t*) (define-function* cairo_device_get_type ((device cairo-device-t*)) cairo-device-type-t) (define-function* cairo_device_status ((device cairo-device-t*)) cairo-status-t) (define-function* cairo_device_acquire ((device cairo-device-t*)) cairo-status-t) (define-function* cairo_device_release ((device cairo-device-t*)) void) (define-function* cairo_device_flush ((device cairo-device-t*)) void) (define-function* cairo_device_finish ((device cairo-device-t*)) void) (define-function* cairo_device_destroy ((device cairo-device-t*)) void) (define-function* cairo_device_get_reference_count ((device cairo-device-t*)) unsigned-int) (define-function* cairo_device_get_user_data ((device cairo-device-t*) (key const-cairo-user-data-key-t*)) void*) (define-function* cairo_device_set_user_data ((device cairo-device-t*) (key const-cairo-user-data-key-t*) (user-data void*) (destroy cairo-destroy-func-t)) cairo-status-t) (define-function* cairo_surface_create_similar ((other cairo-surface-t*) (content cairo-content-t) (width int) (height int)) cairo-surface-t*) (define-function* cairo_surface_create_similar_image ((other cairo-surface-t*) (format cairo-format-t) (width int) (height int)) cairo-surface-t*) (define-function* cairo_surface_map_to_image ((surface cairo-surface-t*) (extents const-cairo-rectangle-int-t*)) cairo-surface-t*) (define-function* cairo_surface_unmap_image ((surface cairo-surface-t*) (image cairo-surface-t*)) void) (define-function* cairo_surface_create_for_rectangle ((target cairo-surface-t*) (x double) (y double) (width double) (height double)) cairo-surface-t*) (define-function* cairo_surface_create_observer ((target cairo-surface-t*) (mode cairo-surface-observer-mode-t)) cairo-surface-t*) (define-function* cairo_surface_observer_add_paint_callback ((abstract-surface cairo-surface-t*) (func cairo-surface-observer-callback-t) (data void*)) cairo-status-t) (define-function* cairo_surface_observer_add_mask_callback ((abstract-surface cairo-surface-t*) (func cairo-surface-observer-callback-t) (data void*)) cairo-status-t) (define-function* cairo_surface_observer_add_fill_callback ((abstract-surface cairo-surface-t*) (func cairo-surface-observer-callback-t) (data void*)) cairo-status-t) (define-function* cairo_surface_observer_add_stroke_callback ((abstract-surface cairo-surface-t*) (func cairo-surface-observer-callback-t) (data void*)) cairo-status-t) (define-function* cairo_surface_observer_add_glyphs_callback ((abstract-surface cairo-surface-t*) (func cairo-surface-observer-callback-t) (data void*)) cairo-status-t) (define-function* cairo_surface_observer_add_flush_callback ((abstract-surface cairo-surface-t*) (func cairo-surface-observer-callback-t) (data void*)) cairo-status-t) (define-function* cairo_surface_observer_add_finish_callback ((abstract-surface cairo-surface-t*) (func cairo-surface-observer-callback-t) (data void*)) cairo-status-t) (define-function* cairo_surface_observer_print ((surface cairo-surface-t*) (write-func cairo-write-func-t) (closure void*)) cairo-status-t) (define-function* cairo_surface_observer_elapsed ((surface cairo-surface-t*)) double) (define-function* cairo_device_observer_print ((device cairo-device-t*) (write-func cairo-write-func-t) (closure void*)) cairo-status-t) (define-function* cairo_device_observer_elapsed ((device cairo-device-t*)) double) (define-function* cairo_device_observer_paint_elapsed ((device cairo-device-t*)) double) (define-function* cairo_device_observer_mask_elapsed ((device cairo-device-t*)) double) (define-function* cairo_device_observer_fill_elapsed ((device cairo-device-t*)) double) (define-function* cairo_device_observer_stroke_elapsed ((device cairo-device-t*)) double) (define-function* cairo_device_observer_glyphs_elapsed ((device cairo-device-t*)) double) (define-function* cairo_surface_reference ((surface cairo-surface-t*)) cairo-surface-t*) (define-function* cairo_surface_finish ((surface cairo-surface-t*)) void) (define-function* cairo_surface_destroy ((surface cairo-surface-t*)) void) (define-function* cairo_surface_get_device ((surface cairo-surface-t*)) cairo-device-t*) (define-function* cairo_surface_get_reference_count ((surface cairo-surface-t*)) unsigned-int) (define-function* cairo_surface_status ((surface cairo-surface-t*)) cairo-status-t) (define-function* cairo_surface_get_type ((surface cairo-surface-t*)) cairo-surface-type-t) (define-function* cairo_surface_get_content ((surface cairo-surface-t*)) cairo-content-t) (define-function* cairo_surface_write_to_png ((surface cairo-surface-t*) (filename const-char*)) cairo-status-t) (define-function* cairo_surface_write_to_png_stream ((surface cairo-surface-t*) (write-func cairo-write-func-t) (closure void*)) cairo-status-t) (define-function* cairo_surface_get_user_data ((surface cairo-surface-t*) (key const-cairo-user-data-key-t*)) void*) (define-function* cairo_surface_set_user_data ((surface cairo-surface-t*) (key const-cairo-user-data-key-t*) (user-data void*) (destroy cairo-destroy-func-t)) cairo-status-t) (define-function* cairo_surface_get_mime_data ((surface cairo-surface-t*) (mime-type const-char*) (*data const-unsigned-char*) (length unsigned-long*)) void) (define-function* cairo_surface_set_mime_data ((surface cairo-surface-t*) (mime-type const-char*) (data const-unsigned-char*) (length unsigned-long) (destroy cairo-destroy-func-t) (closure void*)) cairo-status-t) (define-function* cairo_surface_supports_mime_type ((surface cairo-surface-t*) (mime-type const-char*)) cairo-bool-t) (define-function* cairo_surface_get_font_options ((surface cairo-surface-t*) (options cairo-font-options-t*)) void) (define-function* cairo_surface_flush ((surface cairo-surface-t*)) void) (define-function* cairo_surface_mark_dirty ((surface cairo-surface-t*)) void) (define-function* cairo_surface_mark_dirty_rectangle ((surface cairo-surface-t*) (x int) (y int) (width int) (height int)) void) (define-function* cairo_surface_set_device_scale ((surface cairo-surface-t*) (x-scale double) (y-scale double)) void) (define-function* cairo_surface_get_device_scale ((surface cairo-surface-t*) (x-scale double*) (y-scale double*)) void) (define-function* cairo_surface_set_device_offset ((surface cairo-surface-t*) (x-offset double) (y-offset double)) void) (define-function* cairo_surface_get_device_offset ((surface cairo-surface-t*) (x-offset double*) (y-offset double*)) void) (define-function* cairo_surface_set_fallback_resolution ((surface cairo-surface-t*) (x-pixels-per-inch double) (y-pixels-per-inch double)) void) (define-function* cairo_surface_get_fallback_resolution ((surface cairo-surface-t*) (x-pixels-per-inch double*) (y-pixels-per-inch double*)) void) (define-function* cairo_surface_copy_page ((surface cairo-surface-t*)) void) (define-function* cairo_surface_show_page ((surface cairo-surface-t*)) void) (define-function* cairo_surface_has_show_text_glyphs ((surface cairo-surface-t*)) cairo-bool-t) (define-function* cairo_image_surface_create ((format cairo-format-t) (width int) (height int)) cairo-surface-t*) (define-function* cairo_format_stride_for_width ((format cairo-format-t) (width int)) int) (define-function* cairo_image_surface_create_for_data ((data unsigned-char*) (format cairo-format-t) (width int) (height int) (stride int)) cairo-surface-t*) (define-function* cairo_image_surface_get_data ((surface cairo-surface-t*)) unsigned-char*) (define-function* cairo_image_surface_get_format ((surface cairo-surface-t*)) cairo-format-t) (define-function* cairo_image_surface_get_width ((surface cairo-surface-t*)) int) (define-function* cairo_image_surface_get_height ((surface cairo-surface-t*)) int) (define-function* cairo_image_surface_get_stride ((surface cairo-surface-t*)) int) (define-function* cairo_image_surface_create_from_png ((filename const-char*)) cairo-surface-t*) (define-function* cairo_image_surface_create_from_png_stream ((read-func cairo-read-func-t) (closure void*)) cairo-surface-t*) (define-function* cairo_recording_surface_create ((content cairo-content-t) (extents const-cairo-rectangle-t*)) cairo-surface-t*) (define-function* cairo_recording_surface_ink_extents ((surface cairo-surface-t*) (x0 double*) (y0 double*) (width double*) (height double*)) void) (define-function* cairo_recording_surface_get_extents ((surface cairo-surface-t*) (extents cairo-rectangle-t*)) cairo-bool-t) (define-function* cairo_pattern_create_raster_source ((user-data void*) (content cairo-content-t) (width int) (height int)) cairo-pattern-t*) (define-function* cairo_raster_source_pattern_set_callback_data ((pattern cairo-pattern-t*) (data void*)) void) (define-function* cairo_raster_source_pattern_get_callback_data ((pattern cairo-pattern-t*)) void*) (define-function* cairo_raster_source_pattern_set_acquire ((pattern cairo-pattern-t*) (acquire cairo-raster-source-acquire-func-t) (release cairo-raster-source-release-func-t)) void) (define-function* cairo_raster_source_pattern_get_acquire ((pattern cairo-pattern-t*) (acquire cairo-raster-source-acquire-func-t*) (release cairo-raster-source-release-func-t*)) void) (define-function* cairo_raster_source_pattern_set_snapshot ((pattern cairo-pattern-t*) (snapshot cairo-raster-source-snapshot-func-t)) void) (define-function* cairo_raster_source_pattern_get_snapshot ((pattern cairo-pattern-t*)) cairo-raster-source-snapshot-func-t) (define-function* cairo_raster_source_pattern_set_copy ((pattern cairo-pattern-t*) (copy cairo-raster-source-copy-func-t)) void) (define-function* cairo_raster_source_pattern_get_copy ((pattern cairo-pattern-t*)) cairo-raster-source-copy-func-t) (define-function* cairo_raster_source_pattern_set_finish ((pattern cairo-pattern-t*) (finish cairo-raster-source-finish-func-t)) void) (define-function* cairo_raster_source_pattern_get_finish ((pattern cairo-pattern-t*)) cairo-raster-source-finish-func-t) (define-function* cairo_pattern_create_rgb ((red double) (green double) (blue double)) cairo-pattern-t*) (define-function* cairo_pattern_create_rgba ((red double) (green double) (blue double) (alpha double)) cairo-pattern-t*) (define-function* cairo_pattern_create_for_surface ((surface cairo-surface-t*)) cairo-pattern-t*) (define-function* cairo_pattern_create_linear ((x0 double) (y0 double) (x1 double) (y1 double)) cairo-pattern-t*) (define-function* cairo_pattern_create_radial ((cx0 double) (cy0 double) (radius0 double) (cx1 double) (cy1 double) (radius1 double)) cairo-pattern-t*) (define-function* cairo_pattern_create_mesh () cairo-pattern-t*) (define-function* cairo_pattern_reference ((pattern cairo-pattern-t*)) cairo-pattern-t*) (define-function* cairo_pattern_destroy ((pattern cairo-pattern-t*)) void) (define-function* cairo_pattern_get_reference_count ((pattern cairo-pattern-t*)) unsigned-int) (define-function* cairo_pattern_status ((pattern cairo-pattern-t*)) cairo-status-t) (define-function* cairo_pattern_get_user_data ((pattern cairo-pattern-t*) (key const-cairo-user-data-key-t*)) void*) (define-function* cairo_pattern_set_user_data ((pattern cairo-pattern-t*) (key const-cairo-user-data-key-t*) (user-data void*) (destroy cairo-destroy-func-t)) cairo-status-t) (define-function* cairo_pattern_get_type ((pattern cairo-pattern-t*)) cairo-pattern-type-t) (define-function* cairo_pattern_add_color_stop_rgb ((pattern cairo-pattern-t*) (offset double) (red double) (green double) (blue double)) void) (define-function* cairo_pattern_add_color_stop_rgba ((pattern cairo-pattern-t*) (offset double) (red double) (green double) (blue double) (alpha double)) void) (define-function* cairo_mesh_pattern_begin_patch ((pattern cairo-pattern-t*)) void) (define-function* cairo_mesh_pattern_end_patch ((pattern cairo-pattern-t*)) void) (define-function* cairo_mesh_pattern_curve_to ((pattern cairo-pattern-t*) (x1 double) (y1 double) (x2 double) (y2 double) (x3 double) (y3 double)) void) (define-function* cairo_mesh_pattern_line_to ((pattern cairo-pattern-t*) (x double) (y double)) void) (define-function* cairo_mesh_pattern_move_to ((pattern cairo-pattern-t*) (x double) (y double)) void) (define-function* cairo_mesh_pattern_set_control_point ((pattern cairo-pattern-t*) (point-num unsigned-int) (x double) (y double)) void) (define-function* cairo_mesh_pattern_set_corner_color_rgb ((pattern cairo-pattern-t*) (corner-num unsigned-int) (red double) (green double) (blue double)) void) (define-function* cairo_mesh_pattern_set_corner_color_rgba ((pattern cairo-pattern-t*) (corner-num unsigned-int) (red double) (green double) (blue double) (alpha double)) void) (define-function* cairo_pattern_set_matrix ((pattern cairo-pattern-t*) (matrix const-cairo-matrix-t*)) void) (define-function* cairo_pattern_get_matrix ((pattern cairo-pattern-t*) (matrix cairo-matrix-t*)) void) (define-function* cairo_pattern_set_extend ((pattern cairo-pattern-t*) (extend cairo-extend-t)) void) (define-function* cairo_pattern_get_extend ((pattern cairo-pattern-t*)) cairo-extend-t) (define-function* cairo_pattern_set_filter ((pattern cairo-pattern-t*) (filter cairo-filter-t)) void) (define-function* cairo_pattern_get_filter ((pattern cairo-pattern-t*)) cairo-filter-t) (define-function* cairo_pattern_get_rgba ((pattern cairo-pattern-t*) (red double*) (green double*) (blue double*) (alpha double*)) cairo-status-t) (define-function* cairo_pattern_get_surface ((pattern cairo-pattern-t*) (*surface cairo-surface-t*)) cairo-status-t) (define-function* cairo_pattern_get_color_stop_rgba ((pattern cairo-pattern-t*) (index int) (offset double*) (red double*) (green double*) (blue double*) (alpha double*)) cairo-status-t) (define-function* cairo_pattern_get_color_stop_count ((pattern cairo-pattern-t*) (count int*)) cairo-status-t) (define-function* cairo_pattern_get_linear_points ((pattern cairo-pattern-t*) (x0 double*) (y0 double*) (x1 double*) (y1 double*)) cairo-status-t) (define-function* cairo_pattern_get_radial_circles ((pattern cairo-pattern-t*) (x0 double*) (y0 double*) (r0 double*) (x1 double*) (y1 double*) (r1 double*)) cairo-status-t) (define-function* cairo_mesh_pattern_get_patch_count ((pattern cairo-pattern-t*) (count unsigned-int*)) cairo-status-t) (define-function* cairo_mesh_pattern_get_path ((pattern cairo-pattern-t*) (patch-num unsigned-int)) cairo-path-t*) (define-function* cairo_mesh_pattern_get_corner_color_rgba ((pattern cairo-pattern-t*) (patch-num unsigned-int) (corner-num unsigned-int) (red double*) (green double*) (blue double*) (alpha double*)) cairo-status-t) (define-function* cairo_mesh_pattern_get_control_point ((pattern cairo-pattern-t*) (patch-num unsigned-int) (point-num unsigned-int) (x double*) (y double*)) cairo-status-t) (define-function* cairo_matrix_init ((matrix cairo-matrix-t*) (xx double) (yx double) (xy double) (yy double) (x0 double) (y0 double)) void) (define-function* cairo_matrix_init_identity ((matrix cairo-matrix-t*)) void) (define-function* cairo_matrix_init_translate ((matrix cairo-matrix-t*) (tx double) (ty double)) void) (define-function* cairo_matrix_init_scale ((matrix cairo-matrix-t*) (sx double) (sy double)) void) (define-function* cairo_matrix_init_rotate ((matrix cairo-matrix-t*) (radians double)) void) (define-function* cairo_matrix_translate ((matrix cairo-matrix-t*) (tx double) (ty double)) void) (define-function* cairo_matrix_scale ((matrix cairo-matrix-t*) (sx double) (sy double)) void) (define-function* cairo_matrix_rotate ((matrix cairo-matrix-t*) (radians double)) void) (define-function* cairo_matrix_invert ((matrix cairo-matrix-t*)) cairo-status-t) (define-function* cairo_matrix_multiply ((result cairo-matrix-t*) (a const-cairo-matrix-t*) (b const-cairo-matrix-t*)) void) (define-function* cairo_matrix_transform_distance ((matrix const-cairo-matrix-t*) (dx double*) (dy double*)) void) (define-function* cairo_matrix_transform_point ((matrix const-cairo-matrix-t*) (x double*) (y double*)) void) (define-function* cairo_region_create () cairo-region-t*) (define-function* cairo_region_create_rectangle ((rectangle const-cairo-rectangle-int-t*)) cairo-region-t*) (define-function* cairo_region_create_rectangles ((rects const-cairo-rectangle-int-t*) (count int)) cairo-region-t*) (define-function* cairo_region_copy ((original const-cairo-region-t*)) cairo-region-t*) (define-function* cairo_region_reference ((region cairo-region-t*)) cairo-region-t*) (define-function* cairo_region_destroy ((region cairo-region-t*)) void) (define-function* cairo_region_equal ((a const-cairo-region-t*) (b const-cairo-region-t*)) cairo-bool-t) (define-function* cairo_region_status ((region const-cairo-region-t*)) cairo-status-t) (define-function* cairo_region_get_extents ((region const-cairo-region-t*) (extents cairo-rectangle-int-t*)) void) (define-function* cairo_region_num_rectangles ((region const-cairo-region-t*)) int) (define-function* cairo_region_get_rectangle ((region const-cairo-region-t*) (nth int) (rectangle cairo-rectangle-int-t*)) void) (define-function* cairo_region_is_empty ((region const-cairo-region-t*)) cairo-bool-t) (define-function* cairo_region_contains_rectangle ((region const-cairo-region-t*) (rectangle const-cairo-rectangle-int-t*)) cairo-region-overlap-t) (define-function* cairo_region_contains_point ((region const-cairo-region-t*) (x int) (y int)) cairo-bool-t) (define-function* cairo_region_translate ((region cairo-region-t*) (dx int) (dy int)) void) (define-function* cairo_region_subtract ((dst cairo-region-t*) (other const-cairo-region-t*)) cairo-status-t) (define-function* cairo_region_subtract_rectangle ((dst cairo-region-t*) (rectangle const-cairo-rectangle-int-t*)) cairo-status-t) (define-function* cairo_region_intersect ((dst cairo-region-t*) (other const-cairo-region-t*)) cairo-status-t) (define-function* cairo_region_intersect_rectangle ((dst cairo-region-t*) (rectangle const-cairo-rectangle-int-t*)) cairo-status-t) (define-function* cairo_region_union ((dst cairo-region-t*) (other const-cairo-region-t*)) cairo-status-t) (define-function* cairo_region_union_rectangle ((dst cairo-region-t*) (rectangle const-cairo-rectangle-int-t*)) cairo-status-t) (define-function* cairo_region_xor ((dst cairo-region-t*) (other const-cairo-region-t*)) cairo-status-t) (define-function* cairo_region_xor_rectangle ((dst cairo-region-t*) (rectangle const-cairo-rectangle-int-t*)) cairo-status-t) (define-function* cairo_debug_reset_static_data () void) (define-function* cairo_pdf_surface_create ((filename const-char*) (width-in-points double) (height-in-points double)) cairo-surface-t*) (define-function* cairo_pdf_surface_create_for_stream ((write-func cairo-write-func-t) (closure void*) (width-in-points double) (height-in-points double)) cairo-surface-t*) (define-function* cairo_pdf_surface_restrict_to_version ((surface cairo-surface-t*) (version cairo-pdf-version-t)) void) (define-function* cairo_pdf_get_versions ((*versions cairo-pdf-version-t-const*) (num-versions int*)) void) (define-function* cairo_pdf_version_to_string ((version cairo-pdf-version-t)) const-char*) (define-function* cairo_pdf_surface_set_size ((surface cairo-surface-t*) (width-in-points double) (height-in-points double)) void) |
Added cairo-test.scm.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
(import (cairo)) (cairo-library-init) (define (test-cairo name proc) (let* ([surface (cairo-image-surface-create (cairo-format 'argb-32) 120 120)] [cr (cairo-create surface)]) (cairo-scale cr 120. 120.) (proc surface cr) (cairo-surface-write-to-png surface (string-append name ".png")))) (test-cairo "stroke" (lambda (surface cr) (cairo-set-line-width cr 0.1) (cairo-set-source-rgb cr 0. 0. 0.) (cairo-rectangle cr 0.25 0.25 0.25 0.25) (cairo-stroke cr))) (test-cairo "showtext" (lambda (surface cr) (cairo-scale cr 120. 120.) (cairo-set-source-rgb cr 0. 0. 0.) (cairo-select-font-face cr "Georgia" (cairo-font-slant 'normal) (cairo-font-weight 'bold)) (cairo-set-font-size cr 1.2) (let ([extents (cairo-text-extents-create)]) (cairo-text-extents cr "a" extents) (cairo-move-to cr (- 0.5 (/ (ftype-ref cairo-text-extents-t (width) extents) 2) (ftype-ref cairo-text-extents-t (x-bearing) extents)) (- 0.5 (/ (ftype-ref cairo-text-extents-t (height) extents) 2) (ftype-ref cairo-text-extents-t (y-bearing) extents))) (cairo-show-text cr "a") (cairo-surface-write-to-png surface ".png")))) (test-cairo "paint" (lambda (surface cr) (cairo-set-source-rgb cr 0.0 0.0 0.0) (cairo-paint-with-alpha cr 0.5))) (test-cairo "mask" (lambda (surface cr) (let* ([linpat (cairo-pattern-create-linear 0. 0. 1. 1.)] [radpat (cairo-pattern-create-radial 0.5 0.5 0.25 0.5 0.5 0.75)]) (cairo-pattern-add-color-stop-rgb linpat 0. 0. 0.3 0.8) (cairo-pattern-add-color-stop-rgb linpat 1. 0. 0.8 0.3) (cairo-pattern-add-color-stop-rgba radpat 0. 0. 0. 0. 1.) (cairo-pattern-add-color-stop-rgba radpat 0.5 0. 0. 0. 0.) (cairo-set-source cr linpat) (cairo-mask cr radpat)))) (test-cairo "setsourcergba" (lambda (surface cr) (cairo-set-source-rgb cr 0. 0. 0.) (cairo-move-to cr 0. 0.) (cairo-line-to cr 1. 1.) (cairo-move-to cr 1. 0.) (cairo-line-to cr 0. 1.) (cairo-set-line-width cr 0.2) (cairo-stroke cr) (cairo-rectangle cr 0. 0. 0.5 0.5) (cairo-set-source-rgba cr 1. 0. 0. 0.80) (cairo-fill cr) (cairo-rectangle cr 0. 0.5 0.5 0.5) (cairo-set-source-rgba cr 0. 1. 0. 0.60) (cairo-fill cr) (cairo-rectangle cr 0.5 0. 0.5 0.5) (cairo-set-source-rgba cr 0. 0. 1. 0.40) (cairo-fill cr))) (test-cairo "setsourcegradient" (lambda (surface cr) (let ([radpat (cairo-pattern-create-radial 0.25 0.25 0.1 0.5 0.5 0.5)] [linpat (cairo-pattern-create-linear 0.25 0.35 0.75 0.65)]) (cairo-pattern-add-color-stop-rgb radpat 0. 1.0 0.8 0.8) (cairo-pattern-add-color-stop-rgb radpat 1. 0.9 0.0 0.0) (for-each (lambda (i) (for-each (lambda (j) (cairo-rectangle cr (- (/ (1+ i) 10.) 0.04) (- (/ (1+ j) 10.) 0.04) 0.08 0.08)) (iota 9))) (iota 9)) (cairo-set-source cr radpat) (cairo-fill cr) (cairo-pattern-add-color-stop-rgba linpat 0.00 1. 1. 1. 0.) (cairo-pattern-add-color-stop-rgba linpat 0.25 0. 1. 0. 0.5) (cairo-pattern-add-color-stop-rgba linpat 0.50 1. 1. 1. 0.) (cairo-pattern-add-color-stop-rgba linpat 0.75 0. 0. 1. 0.5) (cairo-pattern-add-color-stop-rgba linpat 1.00 1. 1. 1. 0.) (cairo-rectangle cr 0.0 0.0 1. 1.) (cairo-set-source cr linpat) (cairo-fill cr)))) (test-cairo "tips-ellipse" (lambda (surface cr) (define pi 3.1415926536) (cairo-set-line-width cr 0.1) (cairo-save cr) (cairo-scale cr 0.5 1.) (cairo-arc cr 0.5 0.5 0.40 0. (* 2. pi)) (cairo-stroke cr) (cairo-translate cr 1. 0.) (cairo-arc cr 0.5 0.5 0.40 0. (* 2. pi)) (cairo-restore cr) (cairo-stroke cr))) (system "eog .") |
Added cairo.sls.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 |
#!chezscheme (library (cairo) (export cairo-library-init cairo-version cairo-version-string cairo-create ;cairo-reference cairo-destroy cairo-get-reference-count cairo-get-user-data cairo-set-user-data cairo-save cairo-restore cairo-push-group cairo-push-group-with-content cairo-pop-group cairo-pop-group-to-source cairo-set-operator cairo-set-source cairo-set-source-rgb cairo-set-source-rgba cairo-set-source-surface cairo-set-tolerance cairo-set-antialias cairo-set-fill-rule cairo-set-line-width cairo-set-line-cap cairo-set-line-join cairo-set-dash cairo-set-miter-limit cairo-translate cairo-scale cairo-rotate cairo-transform cairo-set-matrix cairo-identity-matrix cairo-user-to-device cairo-user-to-device-distance cairo-device-to-user cairo-device-to-user-distance cairo-new-path cairo-move-to cairo-new-sub-path cairo-line-to cairo-curve-to cairo-arc cairo-arc-negative cairo-arc-to cairo-rel-move-to cairo-rel-line-to cairo-rel-curve-to cairo-rectangle cairo-stroke-to-path cairo-close-path cairo-path-extents cairo-paint cairo-paint-with-alpha cairo-mask cairo-mask-surface cairo-stroke cairo-stroke-preserve cairo-fill cairo-fill-preserve cairo-copy-page cairo-show-page cairo-in-stroke cairo-in-fill cairo-in-clip cairo-stroke-extents cairo-fill-extents cairo-reset-clip cairo-clip cairo-clip-preserve cairo-clip-extents cairo-copy-clip-rectangle-list ;cairo-rectangle-list-destroy cairo-glyph-allocate cairo-glyph-free cairo-text-cluster-allocate cairo-text-cluster-free cairo-font-options-create cairo-font-options-copy ;cairo-font-options-destroy cairo-font-options-status cairo-font-options-merge cairo-font-options-equal cairo-font-options-hash cairo-font-options-set-antialias cairo-font-options-get-antialias cairo-font-options-set-subpixel-order cairo-font-options-get-subpixel-order cairo-font-options-set-hint-style cairo-font-options-get-hint-style cairo-font-options-set-hint-metrics cairo-font-options-get-hint-metrics cairo-select-font-face cairo-set-font-size cairo-set-font-matrix cairo-get-font-matrix cairo-set-font-options cairo-get-font-options cairo-set-font-face cairo-get-font-face cairo-set-scaled-font cairo-get-scaled-font cairo-show-text cairo-show-glyphs cairo-show-text-glyphs cairo-text-path cairo-glyph-path cairo-text-extents cairo-glyph-extents cairo-font-extents ;cairo-font-face-reference cairo-font-face-destroy cairo-font-face-get-reference-count cairo-font-face-status cairo-font-face-get-type cairo-font-face-get-user-data cairo-font-face-set-user-data cairo-scaled-font-create ;cairo-scaled-font-reference cairo-scaled-font-destroy cairo-scaled-font-get-reference-count cairo-scaled-font-status cairo-scaled-font-get-type cairo-scaled-font-get-user-data cairo-scaled-font-set-user-data cairo-scaled-font-extents cairo-scaled-font-text-extents cairo-scaled-font-glyph-extents cairo-scaled-font-text-to-glyphs cairo-scaled-font-get-font-face cairo-scaled-font-get-font-matrix cairo-scaled-font-get-ctm cairo-scaled-font-get-scale-matrix cairo-scaled-font-get-font-options cairo-toy-font-face-create cairo-toy-font-face-get-family cairo-toy-font-face-get-slant cairo-toy-font-face-get-weight cairo-user-font-face-create cairo-user-font-face-set-init-func cairo-user-font-face-set-render-glyph-func cairo-user-font-face-set-text-to-glyphs-func cairo-user-font-face-set-unicode-to-glyph-func cairo-user-font-face-get-init-func cairo-user-font-face-get-render-glyph-func cairo-user-font-face-get-text-to-glyphs-func cairo-user-font-face-get-unicode-to-glyph-func cairo-get-operator cairo-get-source cairo-get-tolerance cairo-get-antialias cairo-has-current-point cairo-get-current-point cairo-get-fill-rule cairo-get-line-width cairo-get-line-cap cairo-get-line-join cairo-get-miter-limit cairo-get-dash-count cairo-get-dash cairo-get-matrix cairo-get-target cairo-get-group-target cairo-copy-path cairo-copy-path-flat cairo-append-path ;cairo-path-destroy cairo-status cairo-status-to-string ;cairo-device-reference cairo-device-get-type cairo-device-status cairo-device-acquire cairo-device-release cairo-device-flush cairo-device-finish ;cairo-device-destroy cairo-device-get-reference-count cairo-device-get-user-data cairo-device-set-user-data cairo-surface-create-similar cairo-surface-create-similar-image cairo-surface-map-to-image cairo-surface-unmap-image cairo-surface-create-for-rectangle cairo-surface-create-observer cairo-surface-observer-add-paint-callback cairo-surface-observer-add-mask-callback cairo-surface-observer-add-fill-callback cairo-surface-observer-add-stroke-callback cairo-surface-observer-add-glyphs-callback cairo-surface-observer-add-flush-callback cairo-surface-observer-add-finish-callback cairo-surface-observer-print cairo-surface-observer-elapsed cairo-device-observer-print cairo-device-observer-elapsed cairo-device-observer-paint-elapsed cairo-device-observer-mask-elapsed cairo-device-observer-fill-elapsed cairo-device-observer-stroke-elapsed cairo-device-observer-glyphs-elapsed ;cairo-surface-reference cairo-surface-finish ;cairo-surface-destroy cairo-surface-get-device ;cairo-surface-get-reference-count cairo-surface-status cairo-surface-get-type cairo-surface-get-content cairo-surface-write-to-png cairo-surface-write-to-png-stream cairo-surface-get-user-data cairo-surface-set-user-data cairo-surface-get-mime-data cairo-surface-set-mime-data cairo-surface-supports-mime-type cairo-surface-get-font-options cairo-surface-flush cairo-surface-mark-dirty cairo-surface-mark-dirty-rectangle cairo-surface-set-device-scale cairo-surface-get-device-scale cairo-surface-set-device-offset cairo-surface-get-device-offset cairo-surface-set-fallback-resolution cairo-surface-get-fallback-resolution cairo-surface-copy-page cairo-surface-show-page cairo-surface-has-show-text-glyphs cairo-image-surface-create cairo-format-stride-for-width cairo-image-surface-create-for-data cairo-image-surface-get-data cairo-image-surface-get-format cairo-image-surface-get-width cairo-image-surface-get-height cairo-image-surface-get-stride cairo-image-surface-create-from-png cairo-image-surface-create-from-png-stream cairo-recording-surface-create cairo-recording-surface-ink-extents cairo-recording-surface-get-extents cairo-pattern-create-raster-source cairo-raster-source-pattern-set-callback-data cairo-raster-source-pattern-get-callback-data cairo-raster-source-pattern-set-acquire cairo-raster-source-pattern-get-acquire cairo-raster-source-pattern-set-snapshot cairo-raster-source-pattern-get-snapshot cairo-raster-source-pattern-set-copy cairo-raster-source-pattern-get-copy cairo-raster-source-pattern-set-finish cairo-raster-source-pattern-get-finish cairo-pattern-create-rgb cairo-pattern-create-rgba cairo-pattern-create-for-surface cairo-pattern-create-linear cairo-pattern-create-radial cairo-pattern-create-mesh ;cairo-pattern-reference cairo-pattern-destroy cairo-pattern-get-reference-count cairo-pattern-status cairo-pattern-get-user-data cairo-pattern-set-user-data cairo-pattern-get-type cairo-pattern-add-color-stop-rgb cairo-pattern-add-color-stop-rgba cairo-mesh-pattern-begin-patch cairo-mesh-pattern-end-patch cairo-mesh-pattern-curve-to cairo-mesh-pattern-line-to cairo-mesh-pattern-move-to cairo-mesh-pattern-set-control-point cairo-mesh-pattern-set-corner-color-rgb cairo-mesh-pattern-set-corner-color-rgba cairo-pattern-set-matrix cairo-pattern-get-matrix cairo-pattern-set-extend cairo-pattern-get-extend cairo-pattern-set-filter cairo-pattern-get-filter cairo-pattern-get-rgba cairo-pattern-get-surface cairo-pattern-get-color-stop-rgba cairo-pattern-get-color-stop-count cairo-pattern-get-linear-points cairo-pattern-get-radial-circles cairo-mesh-pattern-get-patch-count cairo-mesh-pattern-get-path cairo-mesh-pattern-get-corner-color-rgba cairo-mesh-pattern-get-control-point cairo-matrix-init cairo-matrix-init-identity cairo-matrix-init-translate cairo-matrix-init-scale cairo-matrix-init-rotate cairo-matrix-translate cairo-matrix-scale cairo-matrix-rotate cairo-matrix-invert cairo-matrix-multiply cairo-matrix-transform-distance cairo-matrix-transform-point cairo-region-create cairo-region-create-rectangle cairo-region-create-rectangles cairo-region-copy ;cairo-region-reference cairo-region-destroy cairo-region-equal cairo-region-status cairo-region-get-extents cairo-region-num-rectangles cairo-region-get-rectangle cairo-region-is-empty cairo-region-contains-rectangle cairo-region-contains-point cairo-region-translate cairo-region-subtract cairo-region-subtract-rectangle cairo-region-intersect cairo-region-intersect-rectangle cairo-region-union cairo-region-union-rectangle cairo-region-xor cairo-region-xor-rectangle cairo-debug-reset-static-data cairo-pdf-surface-create cairo-pdf-surface-create-for-stream cairo-pdf-surface-restrict-to-version cairo-pdf-get-versions cairo-pdf-version-to-string cairo-pdf-surface-set-size cairo-bool-t int* const-char* unsigned-int* cairo-t cairo-t* cairo-surface-t cairo-surface-t* cairo-device-t cairo-device-t* cairo-matrix-t cairo-matrix-t* cairo-pattern-t cairo-destroy-func-t cairo-destroy-func-t* cairo-user-data-key-t cairo-user-data-key-t* cairo-status-t cairo-content-t cairo-format-t cairo-write-func-t cairo-write-func-t* cairo-read-func-t cairo-read-func-t* cairo-rectangle-int-t cairo-rectangle-int-t* cairo-operator-t cairo-antialias-t cairo-fill-rule-t cairo-line-cap-t cairo-line-join-t double* cairo-rectangle-t cairo-rectangle-t* cairo-rectangle-list-t cairo-rectangle-list-t* cairo-scaled-font-t cairo-font-face-t cairo-glyph-t cairo-glyph-t* cairo-text-cluster-t cairo-text-cluster-t* cairo-text-cluster-flags-t cairo-text-cluster-flags-t* cairo-text-extents-t cairo-text-extents-t cairo-text-extents-t* cairo-font-extents-t cairo-font-extents-t cairo-font-extents-t* cairo-font-slant-t cairo-font-weight-t cairo-subpixel-order-t cairo-hint-style-t cairo-hint-metrics-t cairo-font-options-t cairo-font-type-t cairo-user-scaled-font-init-func-t cairo-user-scaled-font-init-func-t* cairo-user-scaled-font-render-glyph-func-t cairo-user-scaled-font-render-glyph-func-t* cairo-user-scaled-font-text-to-glyphs-func-t cairo-user-scaled-font-text-to-glyphs-func-t* unsigned-long* cairo-user-scaled-font-unicode-to-glyph-func-t cairo-user-scaled-font-unicode-to-glyph-func-t* cairo-path-data-type-t cairo-path-data-t cairo-path-t cairo-path-t* cairo-device-type-t cairo-surface-observer-mode-t cairo-surface-observer-callback-t cairo-surface-observer-callback-t* cairo-surface-type-t cairo-raster-source-acquire-func-t cairo-raster-source-acquire-func-t* cairo-raster-source-release-func-t cairo-raster-source-release-func-t* cairo-raster-source-snapshot-func-t cairo-raster-source-snapshot-func-t* cairo-raster-source-copy-func-t cairo-raster-source-copy-func-t* cairo-raster-source-finish-func-t cairo-raster-source-finish-func-t* cairo-pattern-type-t cairo-extend-t cairo-filter-t cairo-region-t cairo-region-t* cairo-region-overlap-t cairo-pdf-version-t cairo-pdf-version-t* ;enums cairo-status-enum cairo-format cairo-operator cairo-antialias cairo-fill-rule cairo-line-cap cairo-line-join cairo-text-cluster-flag cairo-font-slant cairo-font-weight cairo-subpixel-order cairo-hint-style cairo-hint-metrics cairo-font-type cairo-path-data-type cairo-device-type cairo-surface-observer-mode cairo-surface-type cairo-pattern-type cairo-extend cairo-filter cairo-region-overlap ;; ALLOCATORS cairo-rectangle-create cairo-rectangle-list-create cairo-glyph-create cairo-text-cluster-create cairo-text-extents-create cairo-font-extents-create cairo-path-create cairo-guardian cairo-free-garbage cairo-guard-pointer ) (import (chezscheme) (ffi-utils)) (define-syntax define-function* (lambda (x) (define (string-replace s x y) (list->string (let ([cmp (if (list? x) memq eq?)]) (map (lambda (z) (if (cmp z x) y z)) (string->list s))))) (define (rename-scheme->c type) (cond [(case (syntax->datum type) ;[(cairo-t*) 'cairo-t] [(const-char*) 'string] [(const-unsigned-char*) 'u8*] [(unsigned-char*) 'u8*] [(const-double*) 'double*] [(const-cairo-user-data-key-t*) 'cairo-user-data-key-t*] [(cairo-destroy-func-t) 'cairo-destroy-func-t*] [(const-cairo-matrix-t*) 'cairo-matrix-t*] [(cairo-font-options-t*) 'cairo-font-options-t] [(const-cairo-font-options-t*) 'cairo-font-options-t] [(cairo-font-face-t*) 'cairo-font-face-t] [(const-cairo-scaled-font-t*) 'cairo-scaled-font-t] [(cairo-scaled-font-t*) 'cairo-scaled-font-t] [(const-cairo-glyph-t*) 'cairo-glyph-t*] [(const-cairo-text-cluster-t*) 'cairo-text-cluster-t*] [(cairo-user-scaled-font-init-func-t) 'cairo-user-scaled-font-init-func-t*] [(cairo-user-scaled-font-render-glyph-func-t) 'cairo-user-scaled-font-render-glyph-func-t*] [(cairo-user-scaled-font-text-to-glyphs-func-t) 'cairo-user-scaled-font-text-to-glyphs-func-t*] [(cairo-user-scaled-font-unicode-to-glyph-func-t) 'cairo-user-scaled-font-unicode-to-glyph-func-t*] [(const-cairo-path-t*) 'cairo-path-t*] [(const-cairo-rectangle-int-t*) 'cairo-rectangle-int-t*] [(const-cairo-rectangle-t*) 'cairo-rectangle-t*] [(cairo-surface-observer-callback-t) 'cairo-surface-observer-callback-t*] [(cairo-write-func-t) 'cairo-write-func-t*] [(cairo-read-func-t) 'cairo-read-func-t*] [(cairo-raster-source-release-func-t) 'cairo-raster-source-release-func-t*] [(cairo-raster-source-acquire-func-t) 'cairo-raster-source-acquire-func-t*] [(cairo-raster-source-snapshot-func-t) 'cairo-raster-source-snapshot-func-t*] [(cairo-raster-source-copy-func-t) 'cairo-raster-source-copy-func-t*] [(cairo-raster-source-finish-func-t) 'cairo-raster-source-finish-func-t*] [(const-cairo-region-t*) 'cairo-region-t*] [(cairo-pdf-version-t-const*) 'cairo-pdf-version-t*] [else #f]) => (lambda (t) (datum->syntax type t))] [else type])) (define (convert-scheme->c function-name name type) (import (only (srfi s13 strings) string-delete string-suffix? string-prefix?)) (define (remove-* x) (string->symbol (string-delete #\* (symbol->string x)))) (let ([t (syntax->datum (rename-scheme->c type))]) (cond [(and (string-prefix? "cairo-" (symbol->string t)) (string-suffix? "*" (symbol->string t))) #`(if (ftype-pointer? #,(datum->syntax type (remove-* t)) #,name) (ftype-pointer-address #,name) (assertion-violation 'convert-scheme->c "wrong pointer type for argument" (quote #,function-name) (quote #,name) (quote #,type) #,name))] [else name]))) (define (datum->string x) (symbol->string (syntax->datum x))) (define (string->datum t x) (datum->syntax t (string->symbol x))) (syntax-case x () [(_ name ((arg-name arg-type) ...) ret-type) (with-syntax ([name/string (datum->string #'name)] [name (string->datum #'name (string-replace (datum->string #'name) #\_ #\-))] [(renamed-type ...) (map rename-scheme->c #'(arg-type ...))] [renamed-ret (rename-scheme->c #'ret-type)] [function-ftype (datum->syntax #'name (string->symbol (string-append (symbol->string (syntax->datum #'name)) "-ft")))] [((arg-name arg-convert) ...) (map (lambda (n t) (list n (convert-scheme->c #'name n t))) #'(arg-name ...) #'(arg-type ...))]) #`(begin (define (name arg-name ...) (define-ftype function-ftype (function (renamed-type ...) renamed-ret)) (let* ([function-fptr (make-ftype-pointer function-ftype name/string)] [function (ftype-ref function-ftype () function-fptr)] [arg-name arg-convert] ...) (let ([result (function arg-name ...)]) #,(case (syntax->datum #'ret-type) [(cairo-status-t) #'(cairo-status-enum-ref result)] [(cairo-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-t result))] [(cairo-surface-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-surface-t result))] [(cairo-pattern-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-pattern-t result))] [(cairo-region-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-region-t result))] [(cairo-rectangle-list-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-rectangle-list-t result))] [(cairo-font-options-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-font-options-t result))] [(cairo-font-face-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-font-face-t result))] [(cairo-scaled-font-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-scaled-font-t result))] [(cairo-path-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-path-t result))] [(cairo-device-t*) #'(cairo-guard-pointer (make-ftype-pointer cairo-device-t result))] [else #'result]))))))]))) (define-syntax define-ftype-allocator (lambda (x) (syntax-case x () [(_ name type) #'(define (name) (cairo-guard-pointer (make-ftype-pointer type (foreign-alloc (ftype-sizeof type)))))]))) (define (cairo-library-init . t) (load-shared-object (if (null? t) "libcairo.so" (car t)))) (define-ftype cairo-bool-t int) (define-ftype int* void*) (define-ftype const-char* (array 0 unsigned-8)) (define-ftype unsigned-int* void*) (define-ftype cairo-t (struct)) (define-ftype cairo-t* void*) (define-ftype cairo-surface-t (struct)) (define-ftype cairo-surface-t* void*) (define-ftype cairo-device-t void*) (define-ftype cairo-device-t* void*) (define-ftype cairo-matrix-t (struct [xx double] [yx double] [xy double] [yy double] [x0 double] [y0 double])) (define-ftype cairo-matrix-t* void*) (define-ftype cairo-pattern-t (struct)) (define-ftype cairo-pattern-t* void*) (define-ftype cairo-destroy-func-t (function (void*) void)) (define-ftype cairo-destroy-func-t* void*) (define-ftype cairo-user-data-key-t (struct [unused int])) (define-ftype cairo-user-data-key-t* void*) (define-ftype cairo-status-t int) (define-enumeration* cairo-status-enum (success no-memory invalid-restore invalid-pop-group no-current-point invalid-matrix invalid-status null-pointer invalid-string invalid-path-data read-error write-error surface-finished surface-type-mismatch pattern-type-mismatch invalid-content invalid-format invalid-visual file-not-found invalid-dash invalid-dsc-comment invalid-index clip-not-representable temp-file-error invalid-stride font-type-mismatch user-font-immutable user-font-error negative-count invalid-clusters invalid-slant invalid-weight invalid-size user-font-not-implemented device-type-mismatch device-error invalid-mesh-construction device-finished jbig2-global-missing last-status)) (define cairo-content '((color . 4096) (alpha . 8192) (color-alpha . 12288))) (define-ftype cairo-content-t int) (define-enumeration* cairo-format (argb-32 rgb-24 a-8 a-1 rgb-16-565 rgb-30)) (define cairo-format-invalid -1) (define-ftype cairo-format-t int) (define-ftype cairo-write-func-t (function (void* void* unsigned-int) cairo-status-t)) (define-ftype cairo-write-func-t* void*) (define-ftype cairo-read-func-t (function (void* void* unsigned-int) cairo-status-t)) (define-ftype cairo-read-func-t* void*) (define-ftype cairo-rectangle-int-t (struct [x int] [y int] [width int] [height int])) (define-ftype-allocator make-cairo-rectangle-int cairo-rectangle-int-t) (define-ftype cairo-rectangle-int-t* void*) (define-enumeration* cairo-operator (clear source over in out atop dest dest-over dest-in dest-out dest-atop xor add saturate multiply screen overlay darken lighten color-dodge color-burn hard-light soft-light difference exclusion hsl-hue hsl-saturation hsl-color hsl-luminosity)) (define-ftype cairo-operator-t int) (define-enumeration* cairo-antialias (default none gray subpixel fast good best)) (define-ftype cairo-antialias-t int) (define-enumeration* cairo-fill-rule (winding even-odd)) (define-ftype cairo-fill-rule-t int) (define-enumeration* cairo-line-cap (butt round square)) (define-ftype cairo-line-cap-t int) (define-enumeration* cairo-line-join (miter round bevel)) (define-ftype cairo-line-join-t int) (define-ftype double* void*) (define-ftype cairo-rectangle-t (struct [x double] [y double] [width double] [height double])) (define-ftype-allocator cairo-rectangle-create cairo-rectangle-t) (define-ftype cairo-rectangle-t* void*) (define-ftype cairo-rectangle-list-t (struct [status cairo-status-t] [rectangles (* cairo-rectangle-t)] [num-rectangles int])) (define-ftype-allocator cairo-rectangle-list-create cairo-rectangle-list-t) (define-ftype cairo-rectangle-list-t* void*) (define-ftype cairo-scaled-font-t void*) (define-ftype cairo-font-face-t void*) (define-ftype cairo-glyph-t (struct [index unsigned-long] [x double] [y double])) (define-ftype-allocator cairo-glyph-create cairo-glyph-t) (define-ftype cairo-glyph-t* void*) (define-ftype cairo-text-cluster-t (struct [num-bytes int] [num-glyphs int])) (define-ftype-allocator cairo-text-cluster-create cairo-text-cluster-t) (define-ftype cairo-text-cluster-t* void*) (define-enumeration* cairo-text-cluster-flag (none backward)) (define-ftype cairo-text-cluster-flags-t int) (define-ftype cairo-text-cluster-flags-t* void*) (define-ftype cairo-text-extents-t (struct [x-bearing double] [y-bearing double] [width double] [height double] [x-advance double] [y-advance double])) (define-ftype-allocator cairo-text-extents-create cairo-text-extents-t) (define-ftype cairo-text-extents-t* void*) (define-ftype cairo-font-extents-t (struct [ascent double] [descent double] [height double] [max-x-advance double] [max-y-advance double])) (define-ftype-allocator cairo-font-extents-create cairo-font-extents-t) ;(define-ftype cairo-font-extents-t int) (define-ftype cairo-font-extents-t* void*) (define-enumeration* cairo-font-slant (normal italic oblique)) (define-ftype cairo-font-slant-t int) (define-enumeration* cairo-font-weight (normal bold)) (define-ftype cairo-font-weight-t int) (define-enumeration* cairo-subpixel-order (default rgb bgr vrgb vbgr)) (define-ftype cairo-subpixel-order-t int) (define-enumeration* cairo-hint-style (default none slight medium full)) (define-ftype cairo-hint-style-t int) (define-enumeration* cairo-hint-metrics (default off on)) (define-ftype cairo-hint-metrics-t int) (define-ftype cairo-font-options-t void*) (define-enumeration* cairo-font-type (toy ft win32 quartz user)) (define-ftype cairo-font-type-t int) (define-ftype cairo-user-scaled-font-init-func-t (function (cairo-scaled-font-t cairo-t* cairo-font-extents-t*) cairo-status-t)) (define-ftype cairo-user-scaled-font-init-func-t* void*) (define-ftype cairo-user-scaled-font-render-glyph-func-t (function (cairo-scaled-font-t unsigned-long cairo-t* cairo-font-extents-t*) cairo-status-t)) (define-ftype cairo-user-scaled-font-render-glyph-func-t* void*) (define-ftype cairo-user-scaled-font-text-to-glyphs-func-t (function (cairo-scaled-font-t string int cairo-glyph-t* int cairo-text-cluster-t* int cairo-text-cluster-flags-t*) cairo-status-t)) (define-ftype cairo-user-scaled-font-text-to-glyphs-func-t* void*) (define-ftype unsigned-long* void*) (define-ftype cairo-user-scaled-font-unicode-to-glyph-func-t (function (cairo-scaled-font-t unsigned-long unsigned-long*) cairo-status-t)) (define-ftype cairo-user-scaled-font-unicode-to-glyph-func-t* void*) (define-enumeration* cairo-path-data-type (move-to line-to curve-to close-path)) (define-ftype cairo-path-data-type-t int) (define-ftype cairo-path-data-t (union [header (struct [type cairo-path-data-type-t] [length int])] [point (struct [x double] [y double])])) (define-ftype cairo-path-t (struct [status cairo-status-t] [data (* cairo-path-data-t)] [num-data int])) (define-ftype-allocator cairo-path-create cairo-path-t) (define-ftype cairo-path-t* void*) (define-enumeration* cairo-device-type (drm gl script xcb xlib xml cogl win32)) (define-ftype cairo-device-type-t int) (define cairo-device-type-invalid -1) (define-enumeration* cairo-surface-observer-mode (normal record-operations)) (define-ftype cairo-surface-observer-mode-t int) (define-ftype cairo-surface-observer-callback-t (function (cairo-surface-t* cairo-surface-t* void*) void)) (define-ftype cairo-surface-observer-callback-t* void*) (define-enumeration* cairo-surface-type (image pdf ps xlib xcb gliz quartz win32 beos directfb svg os2 win32-printing quartz-image script qt recording vg gl drm tee xml skia subsurface cogl)) (define-ftype cairo-surface-type-t int) (define cairo-mime-types '((jpeg . "image/jpeg") (png . "image/png") (jp2 . "image/jp2") (uri . "text/x-uri") (unique-id . "application/x-cairo.uuid") (jbig2 . "application/x-cairo.jbig2") (jbig2-global . "application/x-cairo.jbig2-global") (jbig2-global-id . "application/x-cairo.jbig2-global-id"))) (define-ftype cairo-raster-source-acquire-func-t (function (cairo-pattern-t* void* cairo-surface-t* cairo-rectangle-int-t*) cairo-status-t)) (define-ftype cairo-raster-source-acquire-func-t* void*) (define-ftype cairo-raster-source-release-func-t (function (cairo-pattern-t* void* cairo-surface-t*) cairo-status-t)) (define-ftype cairo-raster-source-release-func-t* void*) (define-ftype cairo-raster-source-snapshot-func-t (function (cairo-pattern-t* void*) cairo-status-t)) (define-ftype cairo-raster-source-snapshot-func-t* void*) (define-ftype cairo-raster-source-copy-func-t (function (cairo-pattern-t* void* cairo-pattern-t*) cairo-status-t)) (define-ftype cairo-raster-source-copy-func-t* void*) (define-ftype cairo-raster-source-finish-func-t (function (cairo-pattern-t* void*) cairo-status-t)) (define-ftype cairo-raster-source-finish-func-t* void*) (define-enumeration* cairo-pattern-type (solid surface linear radial mesh raster-source)) (define-ftype cairo-pattern-type-t int) (define-enumeration* cairo-extend (none repeat reflect pad)) (define-ftype cairo-extend-t int) (define-enumeration* cairo-filter (fast good best nearest bilinear gaussian)) (define-ftype cairo-filter-t int) (define-ftype cairo-region-t void*) (define-ftype cairo-region-t* void*) (define-enumeration* cairo-region-overlap (in out part)) (define-ftype cairo-region-overlap-t int) (define-ftype cairo-pdf-version-t int) (define-ftype cairo-pdf-version-t* void*) (define cairo-guardian (make-guardian)) (define (cairo-guard-pointer obj) (cairo-free-garbage) (cairo-guardian obj) obj) (define (cairo-free-garbage) (let loop ([p (cairo-guardian)]) (when p (when (ftype-pointer? p) (printf "cairo-free-garbage: freeing memory at ~x\n" p) ;;[(ftype-pointer? usb-device*-array p) (cond [(ftype-pointer? cairo-t p) (cairo-destroy p)] [(ftype-pointer? cairo-surface-t p) (cairo-surface-destroy p)] [(ftype-pointer? cairo-pattern-t p) (cairo-pattern-destroy p)] [(ftype-pointer? cairo-region-t p) (cairo-region-destroy p)] [(ftype-pointer? cairo-rectangle-list-t p) (cairo-rectangle-list-destroy p)] [(ftype-pointer? cairo-font-options-t p) (cairo-font-options-destroy p)] [(ftype-pointer? cairo-font-face-t p) (cairo-font-face-destroy p)] [(ftype-pointer? cairo-scaled-font-t p) (cairo-scaled-font-destroy p)] [(ftype-pointer? cairo-path-t p) (cairo-path-destroy p)] [(ftype-pointer? cairo-device-t p) (cairo-device-destroy p)] [else (foreign-free (ftype-pointer-address p))] )) (loop (cairo-guardian))))) (include "cairo-functions.scm") ) ; library cairo #!eof ;; HERE IS THE CODE TO GENERATE cairo-functions.scm from cairo.h ;; (ugly hack) :D ;; would be nice to write a general parser for c headers (import (srfi s13 strings)) (import (srfi s14 char-sets)) (load "fmt/read-line.scm") (import (oleg util)) ; is this still needed? ;; POSSIBLE THAT NOT EXISTS THIS FUNCTION??? ; s is a string , c is a character-set ; null strings are discarded from result (define (string-split s c) (define res '()) (let loop ([l (string->list s)] [t '()]) (if (null? l) (if (null? t) res (append res (list(list->string t)))) (if (char-set-contains? c (car l)) (begin (unless (null? t) (set! res (append res (list (list->string t))))) (loop (cdr l) '())) (loop (cdr l) (append t (list (car l)))))))) ;; POSSIBLE THAT THIS NOT EXIST? ;; if x is a character: (eq? s[i] x) => s[i] = y ;; if x is a list: (memq s[i] x) => s[i] = y (define (string-replace s x y) (list->string (let ([cmp (if (list? x) memq eq?)]) (map (lambda (z) (if (cmp z x) y z)) (string->list s))))) (define (split-args l) (let* ([s (string-join l " ")] [t (map string-trim (string-split s (char-set #\,)))]) t)) (define (dashize x) (string-replace x #\_ #\-)) (define (decode-arg x) (let* ([s (string-delete (string->char-set "(),;") x)] [i (string-index-right s #\space)]) (if i (let ([type (string-trim (string-take s i))] [name (string-trim (string-drop s i))]) (when (string-prefix? "*" name) (set! type (string-append type "*")) (set! name (string-drop name 1))) (list name (string-replace type #\space #\-))) (list)))) (define (fix-type x) (if (< (length x) 2) (dashize (string-join x)) (if (equal? (last x) "*") (string-append (dashize (string-join (take x (- (length x) 1)) "-")) "*") (dashize (string-join x "-"))))) (define (gen-cairo-bindings filename) (with-input-from-file filename (lambda () (let loop ([s (read-line)] [l '()]) (unless (not s) (let ([start (string-prefix? "cairo_public" s)]) (if (or start (not (null? l))) (let* ([s (string-split s char-set:whitespace)] [l (if start s (append l s))]) (if (string-suffix? ";" (last l)) (let* ([first-arg-index (list-index (lambda (x) (string-prefix? "(" x)) l)] [args (list-tail l first-arg-index)] [name (list-ref l (- first-arg-index 1))] [type (fix-type (take (cdr l) (- first-arg-index 2)))] [args-list (map (lambda (x) (decode-arg (dashize x))) (split-args args))]) (printf "(define-function* ~d ~d ~d)\n" name (if (null? (car args-list)) '() args-list) type) (loop (read-line) '()))) (loop (read-line) l)) (loop (read-line) '())))))))) (with-output-to-file "cairo-functions.scm" (lambda () (printf "; THIS FILE WAS AUTOMATICALLY GENERATED, see at the end of cairo.sls \n") (let ([the '(miracle happen)]) (gen-cairo-bindings "/usr/include/cairo/cairo.h") (gen-cairo-bindings "/usr/include/cairo/cairo-pdf.h") ;;(gen-cairo-bindings "/usr/include/cairo/cairo-xlib.h") ;;(gen-cairo-bindings "/usr/include/cairo/cairo-svg.h") ;;(gen-cairo-bindings "/usr/include/cairo/cairo-ft.h") ))'(truncate)) |
Changes to ffi-utils.sls.
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
(if r r (assertion-violation 'enum-name "symbol not found" x))))) (define ref-name (lambda (index) (list-ref (enum-set->list enum-name) index)))))]))) ;; TODO: WRITE SOME AUTOMATED TYPE CHECKS/CONVERSIONS (define-syntax define-function (lambda (x) (syntax-case x () ; WITH NAME+TYPE ARGUMENTS , this is nice because you can catch the argument name if some error happens ; In any case it is handy to have the argument names also in the scheme declarations for quick reference. ; We could also ignore them in expansion time [(_ name ((arg-name arg-type) ...) ret) #'(define (name arg-name ...) (foreign-procedure (symbol->string name) (arg-type ...) ret))] ; WITH ONLY ARGUMENT TYPES [(_ name (args ...) ret) #'(define name (foreign-procedure (symbol->string 'name) (args ...) ret))]))) ;DEFINE FLAGS: ;USAGE: (define-flags flags-name (name value) ...) ; name will be escaped ; value will be evaluated ; the following functions will be defined: ; <flags-name>-flags -> record describing the flags ................................................................................ [flags-name (gen-id #'name #'name "-flags")] [ref-name (gen-id #'name #'name "-ref")] [decode-name (gen-id #'name #'name "-decode")]) #'(begin (define flags-name (make-flags 'name (list (cons 'k v) ...))) (define base-name (flags-indexer flags-name)) (define ref-name (flags-ref-maker flags-name)) (define decode-name (flags-decode-maker flags-name))))]))) (define-record flags (name alist)) (define (flags-indexer flags) (lambda (name . more-names) (let ([names (append (list name) more-names)]) (let loop ([f names] [result 0]) |
|
>
|
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
(if r r (assertion-violation 'enum-name "symbol not found" x))))) (define ref-name (lambda (index) (list-ref (enum-set->list enum-name) index))) (indirect-export base-name enum-name ref-name)))]))) ;; ;; TODO: WRITE SOME AUTOMATED TYPE CHECKS/CONVERSIONS ;; (define ffi-types-conversion-list (make-parameter '())) ;; (define-record ffi-type (name >scheme >c ffi-name)) ;; (define (find-ffi-type t) ;; (find (lambda (x) (equal? (ffi-type-name x) t)) (ffi-types-conversion-list))) ;; (define-syntax define-function ;; (lambda (x) ;; (define (rename-type t) (datum->syntax t (cond [(find-ffi-type (syntax->datum t)) ;; => (lambda (ft) (ffi-type-ffi-name ft))] ;; [else (syntax->datum t)]))) ;; (define (rename-types ls) ;; (let loop ([ls ls] [collect '()]) ;; (if (null? ls) (reverse collect) ;; (loop (cdr ls) (cons (rename-type (car ls)) collect))))) ;; (define (value->c x) ;; (let ([type (syntax->datum (cadr x))] [name (syntax->datum (car x))]) ;; (let ([t (find-ffi-type type)]) ;; (if t ((ffi-type->c t) name) ;; name)))) ;; (syntax-case x () ;; ; WITH NAME+TYPE ARGUMENTS , this is nice because you can catch the argument name if some error happens ;; ; In any case it is handy to have the argument names also in the scheme declarations for quick reference. ;; ; We could also ignore them in expansion time ;; [(_ name ((arg-name arg-type) ...) ret) ;; (with-syntax ([args/types #'((arg-name arg-type) ...)] ;; [types-list #'(arg-type ...)] ;; [renamed-types (rename-types #'(arg-type ...))] ;; [renamed-ret (rename-type #'ret)] ;; [name/string (symbol->string (syntax->datum #'name))]) ;; (with-syntax ([(values ...) ;; (map (lambda (x) ;; (let ([ft (datum->syntax #'x (value->c x )) ]) ;; ft)) ;; #'args/types)]) ;; #'(define (name arg-name ...) ;; ((foreign-procedure name/string renamed-types renamed-ret) ;; values ...))))]))) ;; ; WITH ONLY ARGUMENT TYPES ;; [(_ name (args ...) ret) ;; #'(define name ;; (foreign-procedure (symbol->string 'name) (args ...) ret))]))) (define-syntax define-function (lambda (x) (syntax-case x () [(_ name ((arg-name arg-type) ...) ret) #'(define name (lambda (arg-name ...) (foreign-procedure (symbol->string name) (arg-type ...) ret)))] ;; WITH ONLY ARGUMENT TYPES [(_ name (args ...) ret) #'(define name (foreign-procedure (symbol->string 'name) (args ...) ret))]))) (define-syntax define-function* (lambda (x) (define (rename-scheme->c type) type) (define (convert-scheme->c name type) name) (syntax-case x () [(_ name ((arg-name arg-type) ...) ret-type) (with-syntax ([name/string (symbol->string (syntax->datum #'name))] [(renamed-type ...) (map rename-scheme->c #'(arg-type ...))] [renamed-ret #'ret-type] [((arg-name arg-convert) ...) (map (lambda (n t) (list n (convert-scheme->c n t))) #'(arg-name ...) #'(arg-type ...))]) #`(begin (define (name arg-name ...) (let ([p (foreign-procedure name/string (renamed-type ...) renamed-ret)] [arg-name arg-convert] ...) (p arg-name ...)))))]))) ;(sc-expand '(define-function memcpy ((dest void*) (from void*) (n int)) void*)) ;DEFINE FLAGS: ;USAGE: (define-flags flags-name (name value) ...) ; name will be escaped ; value will be evaluated ; the following functions will be defined: ; <flags-name>-flags -> record describing the flags ................................................................................ [flags-name (gen-id #'name #'name "-flags")] [ref-name (gen-id #'name #'name "-ref")] [decode-name (gen-id #'name #'name "-decode")]) #'(begin (define flags-name (make-flags 'name (list (cons 'k v) ...))) (define base-name (flags-indexer flags-name)) (define ref-name (flags-ref-maker flags-name)) (define decode-name (flags-decode-maker flags-name)) (indirect-export base-name flags-name ref-name decode-name flags-indexer flags-ref-maker flags-decode-maker)))]))) (define-record flags (name alist)) (define (flags-indexer flags) (lambda (name . more-names) (let ([names (append (list name) more-names)]) (let loop ([f names] [result 0]) |
Changes to fmt/read-line.scm.
1 2 3 4 5 6 7 8 |
(define (read-line . o) (let ((port (if (pair? o) (car o) (current-input-port)))) (let lp ((res '())) (let ((c (read-char port))) (if (or (eof-object? c) (eqv? c #\newline)) (list->string (reverse res)) (lp (cons c res))))))) |
> > | | > | |
1 2 3 4 5 6 7 8 9 10 11 |
(define (read-line . o) (let ((port (if (pair? o) (car o) (current-input-port)))) (let lp ((res '())) (let ((c (read-char port))) (cond [(and (eof-object? c) (null? res)) #f] [(or (eof-object? c) (eqv? c #\newline)) (list->string (reverse res))] [else (lp (cons c res))]))))) |