cairo 1.6.1-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of cairo might be problematic. Click here for more details.
- data/AUTHORS +4 -0
- data/COPYING +59 -0
- data/ChangeLog +1320 -0
- data/GPL +340 -0
- data/NEWS +98 -0
- data/README +70 -0
- data/Rakefile +215 -0
- data/cairo/bin/libcairo-2.dll +0 -0
- data/cairo/bin/libpng13.dll +0 -0
- data/cairo/bin/zlib1.dll +0 -0
- data/cairo/include/cairo/cairo-deprecated.h +142 -0
- data/cairo/include/cairo/cairo-features.h +35 -0
- data/cairo/include/cairo/cairo-pdf.h +68 -0
- data/cairo/include/cairo/cairo-ps.h +114 -0
- data/cairo/include/cairo/cairo-svg.h +82 -0
- data/cairo/include/cairo/cairo-win32.h +104 -0
- data/cairo/include/cairo/cairo.h +1945 -0
- data/cairo/include/libpng13/png.h +3419 -0
- data/cairo/include/libpng13/pngconf.h +1437 -0
- data/cairo/lib/cairo.def +251 -0
- data/cairo/lib/cairo.lib +0 -0
- data/cairo/lib/libcairo.dll.a +0 -0
- data/cairo/lib/libpng.def +372 -0
- data/cairo/lib/libpng13.dll.a +0 -0
- data/cairo/lib/pkgconfig/cairo-pdf.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-png.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-ps.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-svg.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-win32-font.pc +12 -0
- data/cairo/lib/pkgconfig/cairo-win32.pc +12 -0
- data/cairo/lib/pkgconfig/cairo.pc +13 -0
- data/cairo/lib/pkgconfig/libpng.pc +14 -0
- data/cairo/lib/pkgconfig/libpng13.pc +14 -0
- data/cairo/make/cairo-1.6.4-1.sh +55 -0
- data/cairo/manifest/cairo-1.6.4-1.mft +6 -0
- data/cairo/manifest/cairo-dev-1.6.4-1.mft +72 -0
- data/cairo/manifest/libpng-dev-1.2.8.mft +7 -0
- data/cairo/share/doc/cairo-1.6.4-1/COPYING +32 -0
- data/cairo/share/doc/cairo-1.6.4-1/COPYING-LGPL-2.1 +510 -0
- data/cairo/share/doc/cairo-1.6.4-1/COPYING-MPL-1.1 +470 -0
- data/cairo/share/gtk-doc/html/cairo/Drawing.html +53 -0
- data/cairo/share/gtk-doc/html/cairo/Fonts.html +56 -0
- data/cairo/share/gtk-doc/html/cairo/Support.html +50 -0
- data/cairo/share/gtk-doc/html/cairo/Surfaces.html +65 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-errors.html +128 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-fonts.html +59 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-memory.html +129 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-overloading.html +127 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-path.html +123 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-patterns.html +63 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-return-values.html +126 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-streams.html +98 -0
- data/cairo/share/gtk-doc/html/cairo/bindings-surfaces.html +99 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Error-Handling.html +328 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Font-Options.html +720 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-FreeType-Fonts.html +297 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html +484 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-PDF-Surfaces.html +246 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-PNG-Support.html +345 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Paths.html +1336 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Patterns.html +1560 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-PostScript-Surfaces.html +656 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Quartz-Fonts.html +161 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Quartz-Surfaces.html +232 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-SVG-Surfaces.html +337 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Scaled-Fonts.html +823 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Text.html +836 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Transformations.html +462 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Types.html +143 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Version-Information.html +325 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Win32-Fonts.html +381 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-Win32-Surfaces.html +331 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-XLib-Surfaces.html +525 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-cairo-font-face-t.html +427 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-cairo-matrix-t.html +626 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html +995 -0
- data/cairo/share/gtk-doc/html/cairo/cairo-cairo-t.html +2795 -0
- data/cairo/share/gtk-doc/html/cairo/cairo.devhelp +432 -0
- data/cairo/share/gtk-doc/html/cairo/cairo.devhelp2 +432 -0
- data/cairo/share/gtk-doc/html/cairo/home.png +0 -0
- data/cairo/share/gtk-doc/html/cairo/index-1.2.html +137 -0
- data/cairo/share/gtk-doc/html/cairo/index-1.4.html +105 -0
- data/cairo/share/gtk-doc/html/cairo/index-1.6.html +65 -0
- data/cairo/share/gtk-doc/html/cairo/index.html +134 -0
- data/cairo/share/gtk-doc/html/cairo/index.sgml +466 -0
- data/cairo/share/gtk-doc/html/cairo/ix01.html +693 -0
- data/cairo/share/gtk-doc/html/cairo/language-bindings.html +79 -0
- data/cairo/share/gtk-doc/html/cairo/left.png +0 -0
- data/cairo/share/gtk-doc/html/cairo/right.png +0 -0
- data/cairo/share/gtk-doc/html/cairo/style.css +148 -0
- data/cairo/share/gtk-doc/html/cairo/up.png +0 -0
- data/doc/doc.css +91 -0
- data/doc/en/cairo-antialias.html +41 -0
- data/doc/en/cairo-antialias.rd +16 -0
- data/doc/en/cairo-clip-not-representable-error.html +50 -0
- data/doc/en/cairo-clip-not-representable-error.rd +17 -0
- data/doc/en/cairo-color-base.html +72 -0
- data/doc/en/cairo-color-base.rd +38 -0
- data/doc/en/cairo-color-cmyk.html +160 -0
- data/doc/en/cairo-color-cmyk.rd +107 -0
- data/doc/en/cairo-color-hsv.html +140 -0
- data/doc/en/cairo-color-hsv.rd +91 -0
- data/doc/en/cairo-color-rgb.html +145 -0
- data/doc/en/cairo-color-rgb.rd +95 -0
- data/doc/en/cairo-color-x11.html +176 -0
- data/doc/en/cairo-color-x11.rd +151 -0
- data/doc/en/cairo-color.html +241 -0
- data/doc/en/cairo-color.rd +213 -0
- data/doc/en/cairo-content.html +40 -0
- data/doc/en/cairo-content.rd +15 -0
- data/doc/en/cairo-context-blur.html +42 -0
- data/doc/en/cairo-context-blur.rd +15 -0
- data/doc/en/cairo-context-circle.html +42 -0
- data/doc/en/cairo-context-circle.rd +15 -0
- data/doc/en/cairo-context-color.html +42 -0
- data/doc/en/cairo-context-color.rd +15 -0
- data/doc/en/cairo-context-path.html +47 -0
- data/doc/en/cairo-context-path.rd +19 -0
- data/doc/en/cairo-context-rectangle.html +42 -0
- data/doc/en/cairo-context-rectangle.rd +15 -0
- data/doc/en/cairo-context-triangle.html +42 -0
- data/doc/en/cairo-context-triangle.rd +15 -0
- data/doc/en/cairo-context.html +636 -0
- data/doc/en/cairo-context.rd +491 -0
- data/doc/en/cairo-error.html +47 -0
- data/doc/en/cairo-error.rd +16 -0
- data/doc/en/cairo-extend.html +41 -0
- data/doc/en/cairo-extend.rd +16 -0
- data/doc/en/cairo-file-not-found.html +50 -0
- data/doc/en/cairo-file-not-found.rd +17 -0
- data/doc/en/cairo-fill-rule.html +39 -0
- data/doc/en/cairo-fill-rule.rd +14 -0
- data/doc/en/cairo-filter.html +43 -0
- data/doc/en/cairo-filter.rd +18 -0
- data/doc/en/cairo-font-extents.html +74 -0
- data/doc/en/cairo-font-extents.rd +40 -0
- data/doc/en/cairo-font-face.html +41 -0
- data/doc/en/cairo-font-face.rd +14 -0
- data/doc/en/cairo-font-options.html +142 -0
- data/doc/en/cairo-font-options.rd +94 -0
- data/doc/en/cairo-font-slant.html +40 -0
- data/doc/en/cairo-font-slant.rd +15 -0
- data/doc/en/cairo-font-weight.html +39 -0
- data/doc/en/cairo-font-weight.rd +14 -0
- data/doc/en/cairo-format.html +49 -0
- data/doc/en/cairo-format.rd +22 -0
- data/doc/en/cairo-glyph.html +102 -0
- data/doc/en/cairo-glyph.rd +62 -0
- data/doc/en/cairo-gradient-pattern.html +77 -0
- data/doc/en/cairo-gradient-pattern.rd +41 -0
- data/doc/en/cairo-hint-metrics.html +40 -0
- data/doc/en/cairo-hint-metrics.rd +15 -0
- data/doc/en/cairo-hint-style.html +42 -0
- data/doc/en/cairo-hint-style.rd +17 -0
- data/doc/en/cairo-image-surface.html +85 -0
- data/doc/en/cairo-image-surface.rd +47 -0
- data/doc/en/cairo-invalid-content-error.html +50 -0
- data/doc/en/cairo-invalid-content-error.rd +17 -0
- data/doc/en/cairo-invalid-dash-error.html +50 -0
- data/doc/en/cairo-invalid-dash-error.rd +17 -0
- data/doc/en/cairo-invalid-dsc-comment-error.html +50 -0
- data/doc/en/cairo-invalid-dsc-comment-error.rd +17 -0
- data/doc/en/cairo-invalid-format-error.html +50 -0
- data/doc/en/cairo-invalid-format-error.rd +17 -0
- data/doc/en/cairo-invalid-index-error.html +50 -0
- data/doc/en/cairo-invalid-index-error.rd +17 -0
- data/doc/en/cairo-invalid-matrix-error.html +50 -0
- data/doc/en/cairo-invalid-matrix-error.rd +17 -0
- data/doc/en/cairo-invalid-path-data-error.html +50 -0
- data/doc/en/cairo-invalid-path-data-error.rd +17 -0
- data/doc/en/cairo-invalid-pop-group-error.html +50 -0
- data/doc/en/cairo-invalid-pop-group-error.rd +17 -0
- data/doc/en/cairo-invalid-restore-error.html +50 -0
- data/doc/en/cairo-invalid-restore-error.rd +17 -0
- data/doc/en/cairo-invalid-status-error.html +50 -0
- data/doc/en/cairo-invalid-status-error.rd +17 -0
- data/doc/en/cairo-invalid-stride-error.html +50 -0
- data/doc/en/cairo-invalid-stride-error.rd +17 -0
- data/doc/en/cairo-invalid-string-error.html +50 -0
- data/doc/en/cairo-invalid-string-error.rd +17 -0
- data/doc/en/cairo-invalid-visual-error.html +50 -0
- data/doc/en/cairo-invalid-visual-error.rd +17 -0
- data/doc/en/cairo-line-cap.html +40 -0
- data/doc/en/cairo-line-cap.rd +15 -0
- data/doc/en/cairo-line-join.html +40 -0
- data/doc/en/cairo-line-join.rd +15 -0
- data/doc/en/cairo-linear-pattern.html +63 -0
- data/doc/en/cairo-linear-pattern.rd +28 -0
- data/doc/en/cairo-matrix.html +257 -0
- data/doc/en/cairo-matrix.rd +186 -0
- data/doc/en/cairo-no-current-point-error.html +50 -0
- data/doc/en/cairo-no-current-point-error.rd +17 -0
- data/doc/en/cairo-null-pointer-error.html +50 -0
- data/doc/en/cairo-null-pointer-error.rd +17 -0
- data/doc/en/cairo-operator.html +51 -0
- data/doc/en/cairo-operator.rd +26 -0
- data/doc/en/cairo-paper-parse-error.html +50 -0
- data/doc/en/cairo-paper-parse-error.rd +17 -0
- data/doc/en/cairo-paper-unknown-paper-name.html +69 -0
- data/doc/en/cairo-paper-unknown-paper-name.rd +30 -0
- data/doc/en/cairo-paper-unknown-unit.html +69 -0
- data/doc/en/cairo-paper-unknown-unit.rd +30 -0
- data/doc/en/cairo-paper-unrecognized-paper-description.html +69 -0
- data/doc/en/cairo-paper-unrecognized-paper-description.rd +30 -0
- data/doc/en/cairo-paper.html +187 -0
- data/doc/en/cairo-paper.rd +141 -0
- data/doc/en/cairo-path-close-path.html +52 -0
- data/doc/en/cairo-path-close-path.rd +21 -0
- data/doc/en/cairo-path-curve-to.html +52 -0
- data/doc/en/cairo-path-curve-to.rd +21 -0
- data/doc/en/cairo-path-data-type.html +41 -0
- data/doc/en/cairo-path-data-type.rd +16 -0
- data/doc/en/cairo-path-data.html +101 -0
- data/doc/en/cairo-path-data.rd +62 -0
- data/doc/en/cairo-path-line-to.html +52 -0
- data/doc/en/cairo-path-line-to.rd +21 -0
- data/doc/en/cairo-path-move-to.html +52 -0
- data/doc/en/cairo-path-move-to.rd +21 -0
- data/doc/en/cairo-path.html +158 -0
- data/doc/en/cairo-path.rd +109 -0
- data/doc/en/cairo-pattern-type-mismatch-error.html +50 -0
- data/doc/en/cairo-pattern-type-mismatch-error.rd +17 -0
- data/doc/en/cairo-pattern.html +102 -0
- data/doc/en/cairo-pattern.rd +62 -0
- data/doc/en/cairo-pdf-surface.html +60 -0
- data/doc/en/cairo-pdf-surface.rd +27 -0
- data/doc/en/cairo-point.html +77 -0
- data/doc/en/cairo-point.rd +42 -0
- data/doc/en/cairo-ps-level.html +52 -0
- data/doc/en/cairo-ps-level.rd +24 -0
- data/doc/en/cairo-ps-surface.html +95 -0
- data/doc/en/cairo-ps-surface.rd +55 -0
- data/doc/en/cairo-quartz-image-surface.html +60 -0
- data/doc/en/cairo-quartz-image-surface.rd +27 -0
- data/doc/en/cairo-quartz-surface.html +60 -0
- data/doc/en/cairo-quartz-surface.rd +27 -0
- data/doc/en/cairo-radial-pattern.html +63 -0
- data/doc/en/cairo-radial-pattern.rd +28 -0
- data/doc/en/cairo-read-error.html +50 -0
- data/doc/en/cairo-read-error.rd +17 -0
- data/doc/en/cairo-rectangle.html +92 -0
- data/doc/en/cairo-rectangle.rd +54 -0
- data/doc/en/cairo-scaled-font.html +87 -0
- data/doc/en/cairo-scaled-font.rd +50 -0
- data/doc/en/cairo-solid-pattern.html +65 -0
- data/doc/en/cairo-solid-pattern.rd +31 -0
- data/doc/en/cairo-subpixel-order.html +42 -0
- data/doc/en/cairo-subpixel-order.rd +17 -0
- data/doc/en/cairo-surface-finished-error.html +50 -0
- data/doc/en/cairo-surface-finished-error.rd +17 -0
- data/doc/en/cairo-surface-pattern.html +60 -0
- data/doc/en/cairo-surface-pattern.rd +27 -0
- data/doc/en/cairo-surface-type-mismatch-error.html +50 -0
- data/doc/en/cairo-surface-type-mismatch-error.rd +17 -0
- data/doc/en/cairo-surface.html +114 -0
- data/doc/en/cairo-surface.rd +72 -0
- data/doc/en/cairo-svg-surface.html +80 -0
- data/doc/en/cairo-svg-surface.rd +44 -0
- data/doc/en/cairo-svg-version.html +52 -0
- data/doc/en/cairo-svg-version.rd +24 -0
- data/doc/en/cairo-temp-file-error.html +50 -0
- data/doc/en/cairo-temp-file-error.rd +17 -0
- data/doc/en/cairo-text-extents.html +79 -0
- data/doc/en/cairo-text-extents.rd +44 -0
- data/doc/en/cairo-win32-printing-surface.html +60 -0
- data/doc/en/cairo-win32-printing-surface.rd +27 -0
- data/doc/en/cairo-win32-surface.html +65 -0
- data/doc/en/cairo-win32-surface.rd +31 -0
- data/doc/en/cairo-write-error.html +50 -0
- data/doc/en/cairo-write-error.rd +17 -0
- data/doc/en/cairo.html +123 -0
- data/doc/en/cairo.rd +95 -0
- data/doc/en/index.html +1080 -0
- data/doc/en/index.rd +1051 -0
- data/doc/index.html +18 -0
- data/doc/ja/cairo-antialias.html +57 -0
- data/doc/ja/cairo-clip-not-representable-error.html +56 -0
- data/doc/ja/cairo-color-base.html +75 -0
- data/doc/ja/cairo-color-cmyk.html +152 -0
- data/doc/ja/cairo-color-hsv.html +135 -0
- data/doc/ja/cairo-color-rgb.html +145 -0
- data/doc/ja/cairo-color-x11.html +183 -0
- data/doc/ja/cairo-color.html +317 -0
- data/doc/ja/cairo-content.html +51 -0
- data/doc/ja/cairo-context-blur.html +53 -0
- data/doc/ja/cairo-context-circle.html +54 -0
- data/doc/ja/cairo-context-color.html +52 -0
- data/doc/ja/cairo-context-path.html +77 -0
- data/doc/ja/cairo-context-rectangle.html +60 -0
- data/doc/ja/cairo-context-triangle.html +47 -0
- data/doc/ja/cairo-context.html +1449 -0
- data/doc/ja/cairo-error.html +56 -0
- data/doc/ja/cairo-extend.html +56 -0
- data/doc/ja/cairo-file-not-found.html +51 -0
- data/doc/ja/cairo-fill-rule.html +58 -0
- data/doc/ja/cairo-filter.html +43 -0
- data/doc/ja/cairo-font-extents.html +110 -0
- data/doc/ja/cairo-font-face.html +55 -0
- data/doc/ja/cairo-font-options.html +186 -0
- data/doc/ja/cairo-font-slant.html +50 -0
- data/doc/ja/cairo-font-weight.html +47 -0
- data/doc/ja/cairo-format.html +81 -0
- data/doc/ja/cairo-glyph.html +115 -0
- data/doc/ja/cairo-gradient-pattern.html +119 -0
- data/doc/ja/cairo-hint-metrics.html +57 -0
- data/doc/ja/cairo-hint-style.html +64 -0
- data/doc/ja/cairo-image-surface.html +131 -0
- data/doc/ja/cairo-invalid-content-error.html +54 -0
- data/doc/ja/cairo-invalid-dash-error.html +54 -0
- data/doc/ja/cairo-invalid-dsc-comment-error.html +54 -0
- data/doc/ja/cairo-invalid-format-error.html +54 -0
- data/doc/ja/cairo-invalid-index-error.html +54 -0
- data/doc/ja/cairo-invalid-matrix-error.html +54 -0
- data/doc/ja/cairo-invalid-path-data-error.html +54 -0
- data/doc/ja/cairo-invalid-pop-group-error.html +54 -0
- data/doc/ja/cairo-invalid-restore-error.html +55 -0
- data/doc/ja/cairo-invalid-status-error.html +55 -0
- data/doc/ja/cairo-invalid-stride-error.html +55 -0
- data/doc/ja/cairo-invalid-string-error.html +54 -0
- data/doc/ja/cairo-invalid-visual-error.html +57 -0
- data/doc/ja/cairo-line-cap.html +50 -0
- data/doc/ja/cairo-line-join.html +53 -0
- data/doc/ja/cairo-linear-pattern.html +87 -0
- data/doc/ja/cairo-matrix.html +343 -0
- data/doc/ja/cairo-no-current-point-error.html +54 -0
- data/doc/ja/cairo-null-pointer-error.html +54 -0
- data/doc/ja/cairo-operator.html +51 -0
- data/doc/ja/cairo-paper-parse-error.html +55 -0
- data/doc/ja/cairo-paper-unknown-paper-name.html +76 -0
- data/doc/ja/cairo-paper-unknown-unit.html +75 -0
- data/doc/ja/cairo-paper-unrecognized-paper-description.html +76 -0
- data/doc/ja/cairo-paper.html +357 -0
- data/doc/ja/cairo-path-close-path.html +57 -0
- data/doc/ja/cairo-path-curve-to.html +70 -0
- data/doc/ja/cairo-path-data-type.html +53 -0
- data/doc/ja/cairo-path-data.html +127 -0
- data/doc/ja/cairo-path-line-to.html +62 -0
- data/doc/ja/cairo-path-move-to.html +62 -0
- data/doc/ja/cairo-path.html +144 -0
- data/doc/ja/cairo-pattern-type-mismatch-error.html +56 -0
- data/doc/ja/cairo-pattern.html +128 -0
- data/doc/ja/cairo-pdf-surface.html +86 -0
- data/doc/ja/cairo-point.html +90 -0
- data/doc/ja/cairo-ps-level.html +62 -0
- data/doc/ja/cairo-ps-surface.html +214 -0
- data/doc/ja/cairo-quartz-image-surface.html +75 -0
- data/doc/ja/cairo-quartz-surface.html +93 -0
- data/doc/ja/cairo-radial-pattern.html +93 -0
- data/doc/ja/cairo-read-error.html +55 -0
- data/doc/ja/cairo-rectangle.html +109 -0
- data/doc/ja/cairo-scaled-font.html +144 -0
- data/doc/ja/cairo-solid-pattern.html +87 -0
- data/doc/ja/cairo-subpixel-order.html +57 -0
- data/doc/ja/cairo-surface-finished-error.html +54 -0
- data/doc/ja/cairo-surface-pattern.html +68 -0
- data/doc/ja/cairo-surface-type-mismatch-error.html +56 -0
- data/doc/ja/cairo-surface.html +191 -0
- data/doc/ja/cairo-svg-surface.html +114 -0
- data/doc/ja/cairo-svg-version.html +66 -0
- data/doc/ja/cairo-temp-file-error.html +50 -0
- data/doc/ja/cairo-text-extents.html +101 -0
- data/doc/ja/cairo-win32-printing-surface.html +80 -0
- data/doc/ja/cairo-win32-surface.html +100 -0
- data/doc/ja/cairo-write-error.html +55 -0
- data/doc/ja/cairo.html +148 -0
- data/doc/ja/index.html +1080 -0
- data/extconf.rb +153 -0
- data/misc/update-colors.rb +143 -0
- data/pkg-config.rb +278 -0
- data/samples/agg/README +4 -0
- data/samples/agg/aa_demo.rb +47 -0
- data/samples/agg/aa_test.rb +304 -0
- data/samples/blur.rb +47 -0
- data/samples/pac.rb +99 -0
- data/samples/pac2.rb +171 -0
- data/samples/png.rb +45 -0
- data/samples/scalable.rb +56 -0
- data/samples/text-on-path.rb +60 -0
- data/samples/text2.rb +131 -0
- data/src/cairo.def +96 -0
- data/src/cairo.so +0 -0
- data/src/lib/cairo.rb +141 -0
- data/src/lib/cairo/color.rb +255 -0
- data/src/lib/cairo/colors.rb +656 -0
- data/src/lib/cairo/constants.rb +21 -0
- data/src/lib/cairo/context.rb +29 -0
- data/src/lib/cairo/context/blur.rb +45 -0
- data/src/lib/cairo/context/circle.rb +9 -0
- data/src/lib/cairo/context/color.rb +11 -0
- data/src/lib/cairo/context/path.rb +116 -0
- data/src/lib/cairo/context/rectangle.rb +33 -0
- data/src/lib/cairo/context/triangle.rb +12 -0
- data/src/lib/cairo/paper.rb +183 -0
- data/src/lib/cairo/papers.rb +41 -0
- data/src/lib/cairo/path.rb +15 -0
- data/src/lib/cairo/point.rb +7 -0
- data/src/libruby-cairo.a +0 -0
- data/src/rb_cairo.c +82 -0
- data/src/rb_cairo.h +264 -0
- data/src/rb_cairo_constants.c +456 -0
- data/src/rb_cairo_context.c +1548 -0
- data/src/rb_cairo_exception.c +214 -0
- data/src/rb_cairo_font_extents.c +125 -0
- data/src/rb_cairo_font_face.c +56 -0
- data/src/rb_cairo_font_options.c +197 -0
- data/src/rb_cairo_glyph.c +159 -0
- data/src/rb_cairo_matrix.c +350 -0
- data/src/rb_cairo_path.c +459 -0
- data/src/rb_cairo_pattern.c +540 -0
- data/src/rb_cairo_private.c +78 -0
- data/src/rb_cairo_private.h +72 -0
- data/src/rb_cairo_scaled_font.c +177 -0
- data/src/rb_cairo_surface.c +1252 -0
- data/src/rb_cairo_text_extents.c +138 -0
- data/test/run-test.rb +15 -0
- data/test/test_paper.rb +81 -0
- data/test/test_pkg_config.rb +122 -0
- metadata +490 -0
@@ -0,0 +1,1548 @@
|
|
1
|
+
/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Ruby Cairo Binding
|
4
|
+
*
|
5
|
+
* $Author: kou $
|
6
|
+
* $Date: 2008-03-25 13:43:50 $
|
7
|
+
*
|
8
|
+
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
9
|
+
* Copyright 2004-2005 MenTaLguY <mental@rydia.com>
|
10
|
+
*
|
11
|
+
* This file is made available under the same terms as Ruby
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#include "rb_cairo.h"
|
16
|
+
#include "rb_cairo_private.h"
|
17
|
+
|
18
|
+
VALUE rb_cCairo_Context;
|
19
|
+
|
20
|
+
static ID cr_id_surface, cr_id_source;
|
21
|
+
static ID cr_id_plus, cr_id_minus, cr_id_multi, cr_id_div;
|
22
|
+
|
23
|
+
#define _SELF (RVAL2CRCONTEXT(self))
|
24
|
+
|
25
|
+
static VALUE cr_get_current_point (VALUE self);
|
26
|
+
|
27
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
28
|
+
static VALUE rb_cCairo_Rectangle;
|
29
|
+
static ID at_x, at_y, at_width, at_height;
|
30
|
+
|
31
|
+
static VALUE
|
32
|
+
cr_rectangle_initialize (VALUE self, VALUE x, VALUE y,
|
33
|
+
VALUE width, VALUE height)
|
34
|
+
{
|
35
|
+
rb_ivar_set (self, at_x, x);
|
36
|
+
rb_ivar_set (self, at_y, y);
|
37
|
+
rb_ivar_set (self, at_width, width);
|
38
|
+
rb_ivar_set (self, at_height, height);
|
39
|
+
|
40
|
+
return Qnil;
|
41
|
+
}
|
42
|
+
#endif
|
43
|
+
|
44
|
+
static inline void
|
45
|
+
cr_check_status (cairo_t *context)
|
46
|
+
{
|
47
|
+
rb_cairo_check_status (cairo_status (context));
|
48
|
+
}
|
49
|
+
|
50
|
+
/* Functions for manipulating state objects */
|
51
|
+
cairo_t *
|
52
|
+
rb_cairo_context_from_ruby_object (VALUE obj)
|
53
|
+
{
|
54
|
+
cairo_t *context;
|
55
|
+
if (!rb_cairo__is_kind_of (obj, rb_cCairo_Context))
|
56
|
+
{
|
57
|
+
rb_raise (rb_eTypeError, "not a cairo graphics context");
|
58
|
+
}
|
59
|
+
Data_Get_Struct (obj, cairo_t, context);
|
60
|
+
return context;
|
61
|
+
}
|
62
|
+
|
63
|
+
static void
|
64
|
+
cr_context_free (void *ptr)
|
65
|
+
{
|
66
|
+
if (ptr)
|
67
|
+
{
|
68
|
+
cairo_destroy ((cairo_t *) ptr);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
VALUE
|
73
|
+
rb_cairo_context_to_ruby_object (cairo_t *cr)
|
74
|
+
{
|
75
|
+
if (cr)
|
76
|
+
{
|
77
|
+
cairo_reference (cr);
|
78
|
+
return Data_Wrap_Struct (rb_cCairo_Context, NULL, cr_context_free, cr);
|
79
|
+
}
|
80
|
+
else
|
81
|
+
{
|
82
|
+
return Qnil;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
static VALUE
|
87
|
+
cr_allocate (VALUE klass)
|
88
|
+
{
|
89
|
+
return Data_Wrap_Struct (klass, NULL, cr_context_free, NULL);
|
90
|
+
}
|
91
|
+
|
92
|
+
static VALUE
|
93
|
+
cr_initialize (VALUE self, VALUE target)
|
94
|
+
{
|
95
|
+
cairo_t *cr;
|
96
|
+
|
97
|
+
cr = cairo_create (RVAL2CRSURFACE (target));
|
98
|
+
cr_check_status (cr);
|
99
|
+
rb_ivar_set (self, cr_id_surface, target);
|
100
|
+
DATA_PTR (self) = cr;
|
101
|
+
return Qnil;
|
102
|
+
}
|
103
|
+
|
104
|
+
static VALUE
|
105
|
+
cr_restore (VALUE self)
|
106
|
+
{
|
107
|
+
cairo_restore (_SELF);
|
108
|
+
cr_check_status (_SELF);
|
109
|
+
return Qnil;
|
110
|
+
}
|
111
|
+
|
112
|
+
static VALUE
|
113
|
+
cr_save (VALUE self)
|
114
|
+
{
|
115
|
+
VALUE result = Qnil;
|
116
|
+
cairo_save (_SELF);
|
117
|
+
cr_check_status (_SELF);
|
118
|
+
if (rb_block_given_p ())
|
119
|
+
{
|
120
|
+
result = rb_ensure (rb_yield, self, cr_restore, self);
|
121
|
+
}
|
122
|
+
return result;
|
123
|
+
}
|
124
|
+
|
125
|
+
static VALUE
|
126
|
+
cr_pop_group (VALUE self)
|
127
|
+
{
|
128
|
+
VALUE rb_pattern;
|
129
|
+
cairo_pattern_t *pattern;
|
130
|
+
|
131
|
+
pattern = cairo_pop_group (_SELF);
|
132
|
+
cr_check_status (_SELF);
|
133
|
+
rb_pattern = CRPATTERN2RVAL (pattern);
|
134
|
+
cairo_pattern_destroy (pattern);
|
135
|
+
return rb_pattern;
|
136
|
+
}
|
137
|
+
|
138
|
+
static VALUE
|
139
|
+
cr_pop_group_to_source (VALUE self)
|
140
|
+
{
|
141
|
+
cairo_pop_group_to_source (_SELF);
|
142
|
+
cr_check_status (_SELF);
|
143
|
+
return Qnil;
|
144
|
+
}
|
145
|
+
|
146
|
+
static VALUE
|
147
|
+
cr_pop_group_generic (int argc, VALUE *argv, VALUE self)
|
148
|
+
{
|
149
|
+
VALUE to_source;
|
150
|
+
rb_scan_args (argc, argv, "01", &to_source);
|
151
|
+
if (RVAL2CBOOL (to_source))
|
152
|
+
return cr_pop_group_to_source (self);
|
153
|
+
else
|
154
|
+
return cr_pop_group (self);
|
155
|
+
}
|
156
|
+
|
157
|
+
static VALUE
|
158
|
+
cr_push_group (int argc, VALUE *argv, VALUE self)
|
159
|
+
{
|
160
|
+
VALUE result = Qnil;
|
161
|
+
VALUE content, pop_to_source;
|
162
|
+
rb_scan_args (argc, argv, "02", &content, &pop_to_source);
|
163
|
+
|
164
|
+
if (NIL_P(content))
|
165
|
+
cairo_push_group (_SELF);
|
166
|
+
else
|
167
|
+
cairo_push_group_with_content (_SELF, RVAL2CRCONTENT(content));
|
168
|
+
cr_check_status (_SELF);
|
169
|
+
|
170
|
+
if (rb_block_given_p ())
|
171
|
+
{
|
172
|
+
int state = 0;
|
173
|
+
|
174
|
+
if (NIL_P (pop_to_source))
|
175
|
+
pop_to_source = Qtrue;
|
176
|
+
|
177
|
+
result = rb_protect (rb_yield, self, &state);
|
178
|
+
if (cairo_status(_SELF) == CAIRO_STATUS_SUCCESS)
|
179
|
+
{
|
180
|
+
if (RVAL2CBOOL (pop_to_source))
|
181
|
+
cr_pop_group_to_source (self);
|
182
|
+
else
|
183
|
+
result = cr_pop_group (self);
|
184
|
+
}
|
185
|
+
|
186
|
+
if (state)
|
187
|
+
rb_jump_tag (state);
|
188
|
+
}
|
189
|
+
|
190
|
+
return result;
|
191
|
+
}
|
192
|
+
|
193
|
+
|
194
|
+
/* Modify state */
|
195
|
+
static VALUE
|
196
|
+
cr_set_operator (VALUE self, VALUE operator)
|
197
|
+
{
|
198
|
+
cairo_set_operator (_SELF, RVAL2CROPERATOR (operator));
|
199
|
+
cr_check_status (_SELF);
|
200
|
+
return self;
|
201
|
+
}
|
202
|
+
|
203
|
+
static VALUE
|
204
|
+
cr_set_source_rgb (int argc, VALUE *argv, VALUE self)
|
205
|
+
{
|
206
|
+
VALUE red, green, blue;
|
207
|
+
int n;
|
208
|
+
|
209
|
+
n = rb_scan_args (argc, argv, "12", &red, &green, &blue);
|
210
|
+
|
211
|
+
if (n == 1 && rb_cairo__is_kind_of (red, rb_cArray))
|
212
|
+
{
|
213
|
+
VALUE ary = red;
|
214
|
+
n = RARRAY (ary)->len;
|
215
|
+
red = rb_ary_entry (ary, 0);
|
216
|
+
green = rb_ary_entry (ary, 1);
|
217
|
+
blue = rb_ary_entry (ary, 2);
|
218
|
+
}
|
219
|
+
|
220
|
+
if (n == 3)
|
221
|
+
{
|
222
|
+
cairo_set_source_rgb (_SELF,
|
223
|
+
NUM2DBL (red),
|
224
|
+
NUM2DBL (green),
|
225
|
+
NUM2DBL (blue));
|
226
|
+
}
|
227
|
+
else
|
228
|
+
{
|
229
|
+
VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv));
|
230
|
+
rb_raise (rb_eArgError,
|
231
|
+
"invalid RGB: %s (expect "
|
232
|
+
"(red, green, blue) or ([red, green, blue]))",
|
233
|
+
StringValuePtr (inspected_arg));
|
234
|
+
}
|
235
|
+
cr_check_status (_SELF);
|
236
|
+
rb_ivar_set (self, cr_id_source, Qnil);
|
237
|
+
return self;
|
238
|
+
}
|
239
|
+
|
240
|
+
static VALUE
|
241
|
+
cr_set_source_rgba (int argc, VALUE *argv, VALUE self)
|
242
|
+
{
|
243
|
+
VALUE red, green, blue, alpha;
|
244
|
+
int n;
|
245
|
+
|
246
|
+
n = rb_scan_args (argc, argv, "13", &red, &green, &blue, &alpha);
|
247
|
+
|
248
|
+
if (n == 1 && rb_cairo__is_kind_of (red, rb_cArray))
|
249
|
+
{
|
250
|
+
VALUE ary = red;
|
251
|
+
n = RARRAY (ary)->len;
|
252
|
+
red = rb_ary_entry (ary, 0);
|
253
|
+
green = rb_ary_entry (ary, 1);
|
254
|
+
blue = rb_ary_entry (ary, 2);
|
255
|
+
alpha = rb_ary_entry (ary, 3);
|
256
|
+
}
|
257
|
+
|
258
|
+
if (n == 3)
|
259
|
+
{
|
260
|
+
cairo_set_source_rgb (_SELF,
|
261
|
+
NUM2DBL (red),
|
262
|
+
NUM2DBL (green),
|
263
|
+
NUM2DBL (blue));
|
264
|
+
}
|
265
|
+
else if (n == 4)
|
266
|
+
{
|
267
|
+
cairo_set_source_rgba (_SELF,
|
268
|
+
NUM2DBL (red),
|
269
|
+
NUM2DBL (green),
|
270
|
+
NUM2DBL (blue),
|
271
|
+
NUM2DBL (alpha));
|
272
|
+
}
|
273
|
+
else
|
274
|
+
{
|
275
|
+
VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv));
|
276
|
+
rb_raise (rb_eArgError,
|
277
|
+
"invalid RGB%s: %s (expect "
|
278
|
+
"(red, green, blue), (red, green, blue, alpha), "
|
279
|
+
"([red, green, blue]) or ([red, green, blue, alpha]))",
|
280
|
+
n == 4 ? "A" : "",
|
281
|
+
StringValuePtr (inspected_arg));
|
282
|
+
}
|
283
|
+
cr_check_status (_SELF);
|
284
|
+
rb_ivar_set (self, cr_id_source, Qnil);
|
285
|
+
return self;
|
286
|
+
}
|
287
|
+
|
288
|
+
static VALUE
|
289
|
+
cr_set_source_surface (VALUE self, VALUE surface, VALUE width, VALUE height)
|
290
|
+
{
|
291
|
+
cairo_set_source_surface (_SELF,
|
292
|
+
RVAL2CRSURFACE (surface),
|
293
|
+
NUM2DBL (width),
|
294
|
+
NUM2DBL (height));
|
295
|
+
cr_check_status (_SELF);
|
296
|
+
rb_ivar_set (self, cr_id_source, Qnil);
|
297
|
+
return self;
|
298
|
+
}
|
299
|
+
|
300
|
+
static VALUE
|
301
|
+
cr_set_source (VALUE self, VALUE pattern)
|
302
|
+
{
|
303
|
+
cairo_set_source (_SELF, RVAL2CRPATTERN (pattern));
|
304
|
+
cr_check_status (_SELF);
|
305
|
+
rb_ivar_set (self, cr_id_source, pattern);
|
306
|
+
return self;
|
307
|
+
}
|
308
|
+
|
309
|
+
static VALUE
|
310
|
+
cr_set_source_generic (int argc, VALUE *argv, VALUE self)
|
311
|
+
{
|
312
|
+
VALUE arg1, arg2, arg3, arg4;
|
313
|
+
int n;
|
314
|
+
|
315
|
+
n = rb_scan_args (argc, argv, "13", &arg1, &arg2, &arg3, &arg4);
|
316
|
+
|
317
|
+
if (n == 1 && rb_cairo__is_kind_of (arg1, rb_cArray))
|
318
|
+
{
|
319
|
+
return cr_set_source_rgba (argc, argv, self);
|
320
|
+
}
|
321
|
+
else if (n == 1)
|
322
|
+
{
|
323
|
+
return cr_set_source (self, arg1);
|
324
|
+
}
|
325
|
+
else if (n == 3 && rb_cairo__is_kind_of (arg1, rb_cCairo_Surface))
|
326
|
+
{
|
327
|
+
return cr_set_source_surface (self, arg1, arg2, arg3);
|
328
|
+
}
|
329
|
+
else if (n == 3 || n == 4)
|
330
|
+
{
|
331
|
+
return cr_set_source_rgba (argc, argv, self);
|
332
|
+
}
|
333
|
+
else
|
334
|
+
{
|
335
|
+
rb_raise (rb_eArgError,
|
336
|
+
"invalid argument (expect "
|
337
|
+
"(red, green, blue), (red, green, blue, alpha), "
|
338
|
+
"([red, green, blue]), ([red, green, blue, alpha]), "
|
339
|
+
"(pattern) or (surface, x, y))");
|
340
|
+
}
|
341
|
+
}
|
342
|
+
|
343
|
+
static VALUE
|
344
|
+
cr_set_tolerance (VALUE self, VALUE tolerance)
|
345
|
+
{
|
346
|
+
cairo_set_tolerance (_SELF, NUM2DBL (tolerance));
|
347
|
+
cr_check_status (_SELF);
|
348
|
+
return self;
|
349
|
+
}
|
350
|
+
|
351
|
+
static VALUE
|
352
|
+
cr_set_antialias(VALUE self, VALUE antialias)
|
353
|
+
{
|
354
|
+
cairo_set_antialias(_SELF, RVAL2CRANTIALIAS (antialias));
|
355
|
+
cr_check_status(_SELF);
|
356
|
+
return self;
|
357
|
+
}
|
358
|
+
|
359
|
+
static VALUE
|
360
|
+
cr_set_fill_rule (VALUE self, VALUE rule)
|
361
|
+
{
|
362
|
+
cairo_set_fill_rule (_SELF, RVAL2CRFILLRULE (rule));
|
363
|
+
cr_check_status (_SELF);
|
364
|
+
return self;
|
365
|
+
}
|
366
|
+
|
367
|
+
static VALUE
|
368
|
+
cr_set_line_width (VALUE self, VALUE width)
|
369
|
+
{
|
370
|
+
cairo_set_line_width (_SELF, NUM2DBL (width));
|
371
|
+
return self;
|
372
|
+
}
|
373
|
+
|
374
|
+
static VALUE
|
375
|
+
cr_set_line_cap (VALUE self, VALUE cap)
|
376
|
+
{
|
377
|
+
cairo_set_line_cap (_SELF, RVAL2CRLINECAP (cap));
|
378
|
+
cr_check_status (_SELF);
|
379
|
+
return self;
|
380
|
+
}
|
381
|
+
|
382
|
+
static VALUE
|
383
|
+
cr_set_line_join (VALUE self, VALUE join)
|
384
|
+
{
|
385
|
+
cairo_set_line_join (_SELF, RVAL2CRLINEJOIN (join));
|
386
|
+
cr_check_status (_SELF);
|
387
|
+
return self;
|
388
|
+
}
|
389
|
+
|
390
|
+
static VALUE
|
391
|
+
cr_set_dash (int argc, VALUE *argv, VALUE self)
|
392
|
+
{
|
393
|
+
VALUE dash_array, rb_offset;
|
394
|
+
double offset;
|
395
|
+
cairo_bool_t is_num;
|
396
|
+
|
397
|
+
rb_scan_args(argc, argv, "11", &dash_array, &rb_offset);
|
398
|
+
|
399
|
+
is_num = rb_cairo__is_kind_of (dash_array, rb_cNumeric);
|
400
|
+
if (!(NIL_P (dash_array) || is_num))
|
401
|
+
{
|
402
|
+
Check_Type (dash_array, T_ARRAY);
|
403
|
+
}
|
404
|
+
|
405
|
+
if (NIL_P (rb_offset))
|
406
|
+
offset = 0.0;
|
407
|
+
else
|
408
|
+
offset = NUM2DBL (rb_offset);
|
409
|
+
|
410
|
+
if (is_num)
|
411
|
+
{
|
412
|
+
double values[1];
|
413
|
+
values[0] = NUM2DBL (dash_array);
|
414
|
+
cairo_set_dash (_SELF, values, 1, offset);
|
415
|
+
}
|
416
|
+
else if (NIL_P (dash_array) || RARRAY (dash_array)->len == 0)
|
417
|
+
{
|
418
|
+
cairo_set_dash (_SELF, NULL, 0, offset);
|
419
|
+
}
|
420
|
+
else
|
421
|
+
{
|
422
|
+
int i, length;
|
423
|
+
double *values;
|
424
|
+
length = RARRAY (dash_array)->len;
|
425
|
+
values = ALLOCA_N (double, length);
|
426
|
+
if (!values)
|
427
|
+
{
|
428
|
+
rb_cairo_check_status (CAIRO_STATUS_NO_MEMORY);
|
429
|
+
}
|
430
|
+
for (i = 0; i < length; i++)
|
431
|
+
{
|
432
|
+
values[i] = NUM2DBL (RARRAY (dash_array)->ptr[i]);
|
433
|
+
}
|
434
|
+
cairo_set_dash (_SELF, values, length, offset);
|
435
|
+
}
|
436
|
+
|
437
|
+
cr_check_status (_SELF);
|
438
|
+
return self;
|
439
|
+
}
|
440
|
+
|
441
|
+
static VALUE
|
442
|
+
cr_set_miter_limit (VALUE self, VALUE limit)
|
443
|
+
{
|
444
|
+
cairo_set_miter_limit (_SELF, NUM2DBL (limit));
|
445
|
+
cr_check_status (_SELF);
|
446
|
+
return self;
|
447
|
+
}
|
448
|
+
|
449
|
+
static VALUE
|
450
|
+
cr_translate (VALUE self, VALUE tx, VALUE ty)
|
451
|
+
{
|
452
|
+
cairo_translate (_SELF, NUM2DBL (tx), NUM2DBL (ty));
|
453
|
+
cr_check_status (_SELF);
|
454
|
+
return self;
|
455
|
+
}
|
456
|
+
|
457
|
+
static VALUE
|
458
|
+
cr_scale (VALUE self, VALUE sx, VALUE sy)
|
459
|
+
{
|
460
|
+
cairo_scale (_SELF, NUM2DBL (sx), NUM2DBL (sy));
|
461
|
+
cr_check_status (_SELF);
|
462
|
+
return self;
|
463
|
+
}
|
464
|
+
|
465
|
+
static VALUE
|
466
|
+
cr_rotate (VALUE self, VALUE radians)
|
467
|
+
{
|
468
|
+
cairo_rotate (_SELF, NUM2DBL (radians));
|
469
|
+
cr_check_status (_SELF);
|
470
|
+
return self;
|
471
|
+
}
|
472
|
+
|
473
|
+
static VALUE
|
474
|
+
cr_transform (VALUE self, VALUE matrix)
|
475
|
+
{
|
476
|
+
cairo_transform (_SELF, RVAL2CRMATRIX (matrix));
|
477
|
+
cr_check_status (_SELF);
|
478
|
+
return self;
|
479
|
+
}
|
480
|
+
|
481
|
+
static VALUE
|
482
|
+
cr_set_matrix (VALUE self, VALUE matrix)
|
483
|
+
{
|
484
|
+
cairo_set_matrix (_SELF, RVAL2CRMATRIX (matrix));
|
485
|
+
cr_check_status (_SELF);
|
486
|
+
return self;
|
487
|
+
}
|
488
|
+
|
489
|
+
static VALUE
|
490
|
+
cr_identity_matrix (VALUE self)
|
491
|
+
{
|
492
|
+
cairo_identity_matrix (_SELF);
|
493
|
+
cr_check_status (_SELF);
|
494
|
+
return self;
|
495
|
+
}
|
496
|
+
|
497
|
+
static VALUE
|
498
|
+
cr_user_to_device (VALUE self, VALUE x, VALUE y)
|
499
|
+
{
|
500
|
+
double pair[2];
|
501
|
+
pair[0] = NUM2DBL (x);
|
502
|
+
pair[1] = NUM2DBL (y);
|
503
|
+
cairo_user_to_device (_SELF, pair, pair + 1);
|
504
|
+
cr_check_status (_SELF);
|
505
|
+
return rb_cairo__float_array (pair, 2);
|
506
|
+
}
|
507
|
+
|
508
|
+
static VALUE
|
509
|
+
cr_user_to_device_distance (VALUE self, VALUE dx, VALUE dy)
|
510
|
+
{
|
511
|
+
double pair[2];
|
512
|
+
pair[0] = NUM2DBL (dx);
|
513
|
+
pair[1] = NUM2DBL (dy);
|
514
|
+
cairo_user_to_device_distance (_SELF, pair, pair + 1);
|
515
|
+
cr_check_status (_SELF);
|
516
|
+
return rb_cairo__float_array (pair, 2);
|
517
|
+
}
|
518
|
+
|
519
|
+
static VALUE
|
520
|
+
cr_device_to_user (VALUE self, VALUE x, VALUE y)
|
521
|
+
{
|
522
|
+
double pair[2];
|
523
|
+
pair[0] = NUM2DBL (x);
|
524
|
+
pair[1] = NUM2DBL (y);
|
525
|
+
cairo_device_to_user (_SELF, pair, pair + 1);
|
526
|
+
cr_check_status (_SELF);
|
527
|
+
return rb_cairo__float_array (pair, 2);
|
528
|
+
}
|
529
|
+
|
530
|
+
static VALUE
|
531
|
+
cr_device_to_user_distance (VALUE self, VALUE dx, VALUE dy)
|
532
|
+
{
|
533
|
+
double pair[2];
|
534
|
+
pair[0] = NUM2DBL (dx);
|
535
|
+
pair[1] = NUM2DBL (dy);
|
536
|
+
cairo_device_to_user_distance (_SELF, pair, pair + 1);
|
537
|
+
cr_check_status (_SELF);
|
538
|
+
return rb_cairo__float_array (pair, 2);
|
539
|
+
}
|
540
|
+
|
541
|
+
|
542
|
+
/* Path creation functions */
|
543
|
+
static VALUE
|
544
|
+
cr_new_path (VALUE self)
|
545
|
+
{
|
546
|
+
cairo_new_path (_SELF);
|
547
|
+
cr_check_status (_SELF);
|
548
|
+
return self;
|
549
|
+
}
|
550
|
+
|
551
|
+
static VALUE
|
552
|
+
cr_move_to (VALUE self, VALUE x, VALUE y)
|
553
|
+
{
|
554
|
+
cairo_move_to (_SELF, NUM2DBL (x), NUM2DBL (y));
|
555
|
+
cr_check_status (_SELF);
|
556
|
+
return self;
|
557
|
+
}
|
558
|
+
|
559
|
+
static VALUE
|
560
|
+
cr_new_sub_path (VALUE self)
|
561
|
+
{
|
562
|
+
cairo_new_sub_path (_SELF);
|
563
|
+
cr_check_status (_SELF);
|
564
|
+
return self;
|
565
|
+
}
|
566
|
+
|
567
|
+
static VALUE
|
568
|
+
cr_line_to (VALUE self, VALUE x, VALUE y)
|
569
|
+
{
|
570
|
+
cairo_line_to (_SELF, NUM2DBL (x), NUM2DBL (y));
|
571
|
+
cr_check_status (_SELF);
|
572
|
+
return self;
|
573
|
+
}
|
574
|
+
|
575
|
+
static VALUE
|
576
|
+
cr_curve_to (VALUE self, VALUE x1, VALUE y1,
|
577
|
+
VALUE x2, VALUE y2, VALUE x3, VALUE y3)
|
578
|
+
{
|
579
|
+
cairo_curve_to (_SELF, NUM2DBL (x1), NUM2DBL (y1),
|
580
|
+
NUM2DBL (x2), NUM2DBL (y2), NUM2DBL (x3), NUM2DBL (y3));
|
581
|
+
cr_check_status (_SELF);
|
582
|
+
return self;
|
583
|
+
}
|
584
|
+
|
585
|
+
static VALUE
|
586
|
+
cr_quadratic_curve_to (VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2)
|
587
|
+
{
|
588
|
+
VALUE current_point, x0, y0, cx1, cy1, cx2, cy2;
|
589
|
+
|
590
|
+
current_point = cr_get_current_point (self);
|
591
|
+
x0 = RARRAY (current_point)->ptr[0];
|
592
|
+
y0 = RARRAY (current_point)->ptr[1];
|
593
|
+
|
594
|
+
/* cx1 = x0 + 2 * ((x1 - x0) / 3.0) */
|
595
|
+
cx1 = rb_funcall (x0, cr_id_plus, 1,
|
596
|
+
rb_funcall (INT2NUM(2), cr_id_multi, 1,
|
597
|
+
rb_funcall (rb_funcall (x1, cr_id_minus, 1, x0),
|
598
|
+
cr_id_div, 1, rb_float_new (3.0))));
|
599
|
+
/* cy1 = y0 + 2 * ((y1 - y0) / 3.0) */
|
600
|
+
cy1 = rb_funcall (y0, cr_id_plus, 1,
|
601
|
+
rb_funcall (INT2NUM(2), cr_id_multi, 1,
|
602
|
+
rb_funcall (rb_funcall (y1, cr_id_minus, 1, y0),
|
603
|
+
cr_id_div, 1, rb_float_new (3.0))));
|
604
|
+
/* cx2 = cx1 + (x2 - x0) / 3.0 */
|
605
|
+
cx2 = rb_funcall (cx1, cr_id_plus, 1,
|
606
|
+
rb_funcall (rb_funcall (x2, cr_id_minus, 1, x0),
|
607
|
+
cr_id_div, 1, rb_float_new (3.0)));
|
608
|
+
/* cy2 = cy1 + (y2 - y0) / 3.0 */
|
609
|
+
cy2 = rb_funcall (cy1, cr_id_plus, 1,
|
610
|
+
rb_funcall (rb_funcall (y2, cr_id_minus, 1, y0),
|
611
|
+
cr_id_div, 1, rb_float_new (3.0)));
|
612
|
+
return cr_curve_to (self, cx1, cy1, cx2, cy2, x2, y2);
|
613
|
+
}
|
614
|
+
|
615
|
+
static VALUE
|
616
|
+
cr_curve_to_generic (int argc, VALUE *argv, VALUE self)
|
617
|
+
{
|
618
|
+
VALUE x1, y1, x2, y2, x3, y3;
|
619
|
+
|
620
|
+
rb_scan_args (argc, argv, "42", &x1, &y1, &x2, &y2, &x3, &y3);
|
621
|
+
|
622
|
+
if (!(argc == 4 || argc == 6))
|
623
|
+
{
|
624
|
+
VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv));
|
625
|
+
rb_raise (rb_eArgError,
|
626
|
+
"invalid argument: %s (expect "
|
627
|
+
"(x1, y1, x2, y2) (quadratic) or "
|
628
|
+
"(x1, y1, x2, y2, x3, y3) (cubic))",
|
629
|
+
StringValuePtr (inspected_arg));
|
630
|
+
}
|
631
|
+
|
632
|
+
if (argc == 4)
|
633
|
+
return cr_quadratic_curve_to (self, x1, y1, x2, y2);
|
634
|
+
else
|
635
|
+
return cr_curve_to (self, x1, y1, x2, y2, x3, y3);
|
636
|
+
}
|
637
|
+
|
638
|
+
static VALUE
|
639
|
+
cr_arc (VALUE self, VALUE xc, VALUE yc, VALUE radius,
|
640
|
+
VALUE angle1, VALUE angle2)
|
641
|
+
{
|
642
|
+
cairo_arc (_SELF, NUM2DBL (xc), NUM2DBL (yc), NUM2DBL (radius),
|
643
|
+
NUM2DBL (angle1), NUM2DBL (angle2));
|
644
|
+
cr_check_status (_SELF);
|
645
|
+
return self;
|
646
|
+
}
|
647
|
+
|
648
|
+
static VALUE
|
649
|
+
cr_arc_negative (VALUE self, VALUE xc, VALUE yc, VALUE radius,
|
650
|
+
VALUE angle1, VALUE angle2)
|
651
|
+
{
|
652
|
+
cairo_arc_negative (_SELF, NUM2DBL (xc), NUM2DBL (yc), NUM2DBL (radius),
|
653
|
+
NUM2DBL (angle1), NUM2DBL (angle2));
|
654
|
+
cr_check_status (_SELF);
|
655
|
+
return self;
|
656
|
+
}
|
657
|
+
|
658
|
+
static VALUE
|
659
|
+
cr_rel_move_to (VALUE self, VALUE x, VALUE y)
|
660
|
+
{
|
661
|
+
cairo_rel_move_to (_SELF, NUM2DBL (x), NUM2DBL (y));
|
662
|
+
cr_check_status (_SELF);
|
663
|
+
return self;
|
664
|
+
}
|
665
|
+
|
666
|
+
static VALUE
|
667
|
+
cr_rel_line_to (VALUE self, VALUE x, VALUE y)
|
668
|
+
{
|
669
|
+
cairo_rel_line_to (_SELF, NUM2DBL (x), NUM2DBL (y));
|
670
|
+
cr_check_status (_SELF);
|
671
|
+
return self;
|
672
|
+
}
|
673
|
+
|
674
|
+
static VALUE
|
675
|
+
cr_rel_curve_to (VALUE self, VALUE dx1, VALUE dy1,
|
676
|
+
VALUE dx2, VALUE dy2, VALUE dx3, VALUE dy3)
|
677
|
+
{
|
678
|
+
cairo_rel_curve_to (_SELF, NUM2DBL (dx1), NUM2DBL (dy1),
|
679
|
+
NUM2DBL (dx2), NUM2DBL (dy2),
|
680
|
+
NUM2DBL (dx3), NUM2DBL (dy3));
|
681
|
+
cr_check_status (_SELF);
|
682
|
+
return self;
|
683
|
+
}
|
684
|
+
|
685
|
+
static VALUE
|
686
|
+
cr_rel_quadratic_curve_to (VALUE self, VALUE dx1, VALUE dy1,
|
687
|
+
VALUE dx2, VALUE dy2)
|
688
|
+
{
|
689
|
+
VALUE current_point, x0, y0;
|
690
|
+
|
691
|
+
current_point = cr_get_current_point (self);
|
692
|
+
x0 = RARRAY (current_point)->ptr[0];
|
693
|
+
y0 = RARRAY (current_point)->ptr[1];
|
694
|
+
return cr_quadratic_curve_to (self,
|
695
|
+
rb_funcall (dx1, cr_id_plus, 1, x0),
|
696
|
+
rb_funcall (dy1, cr_id_plus, 1, y0),
|
697
|
+
rb_funcall (dx2, cr_id_plus, 1, x0),
|
698
|
+
rb_funcall (dy2, cr_id_plus, 1, y0));
|
699
|
+
}
|
700
|
+
|
701
|
+
static VALUE
|
702
|
+
cr_rel_curve_to_generic (int argc, VALUE *argv, VALUE self)
|
703
|
+
{
|
704
|
+
VALUE dx1, dy1, dx2, dy2, dx3, dy3;
|
705
|
+
|
706
|
+
rb_scan_args (argc, argv, "42", &dx1, &dy1, &dx2, &dy2, &dx3, &dy3);
|
707
|
+
|
708
|
+
if (!(argc == 4 || argc == 6))
|
709
|
+
{
|
710
|
+
VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv));
|
711
|
+
rb_raise (rb_eArgError,
|
712
|
+
"invalid argument: %s (expect "
|
713
|
+
"(dx1, dy1, dx2, dy2) (quadratic) or "
|
714
|
+
"(dx1, dy1, dx2, dy2, dx3, dy3) (cubic))",
|
715
|
+
StringValuePtr (inspected_arg));
|
716
|
+
}
|
717
|
+
|
718
|
+
if (argc == 4)
|
719
|
+
return cr_rel_quadratic_curve_to (self, dx1, dy1, dx2, dy2);
|
720
|
+
else
|
721
|
+
return cr_rel_curve_to (self, dx1, dy1, dx2, dy2, dx3, dy3);
|
722
|
+
}
|
723
|
+
|
724
|
+
static VALUE
|
725
|
+
cr_rectangle (VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
|
726
|
+
{
|
727
|
+
cairo_rectangle (_SELF, NUM2DBL (x), NUM2DBL (y),
|
728
|
+
NUM2DBL (width), NUM2DBL (height));
|
729
|
+
cr_check_status (_SELF);
|
730
|
+
return self;
|
731
|
+
}
|
732
|
+
|
733
|
+
static VALUE
|
734
|
+
cr_close_path (VALUE self)
|
735
|
+
{
|
736
|
+
cairo_close_path (_SELF);
|
737
|
+
cr_check_status (_SELF);
|
738
|
+
return self;
|
739
|
+
}
|
740
|
+
|
741
|
+
#if CAIRO_CHECK_VERSION(1, 5, 8)
|
742
|
+
static VALUE
|
743
|
+
cr_path_extents (VALUE self)
|
744
|
+
{
|
745
|
+
double x1, y1, x2, y2;
|
746
|
+
cairo_path_extents (_SELF, &x1, &y1, &x2, &y2);
|
747
|
+
cr_check_status (_SELF);
|
748
|
+
return rb_ary_new3 (4,
|
749
|
+
rb_float_new(x1), rb_float_new(y1),
|
750
|
+
rb_float_new(x2), rb_float_new(y2));
|
751
|
+
}
|
752
|
+
#endif
|
753
|
+
|
754
|
+
/* Painting functions */
|
755
|
+
static VALUE
|
756
|
+
cr_paint (VALUE self)
|
757
|
+
{
|
758
|
+
cairo_paint (_SELF);
|
759
|
+
cr_check_status (_SELF);
|
760
|
+
return self;
|
761
|
+
}
|
762
|
+
|
763
|
+
static VALUE
|
764
|
+
cr_paint_with_alpha (VALUE self, VALUE alpha)
|
765
|
+
{
|
766
|
+
cairo_paint_with_alpha (_SELF, NUM2DBL (alpha));
|
767
|
+
cr_check_status (_SELF);
|
768
|
+
return self;
|
769
|
+
}
|
770
|
+
|
771
|
+
static VALUE
|
772
|
+
cr_paint_generic(int argc, VALUE *argv, VALUE self)
|
773
|
+
{
|
774
|
+
VALUE alpha;
|
775
|
+
int n;
|
776
|
+
|
777
|
+
n = rb_scan_args (argc, argv, "01", &alpha);
|
778
|
+
|
779
|
+
if (n == 0 || (n == 1 && NIL_P (alpha)))
|
780
|
+
{
|
781
|
+
return cr_paint (self);
|
782
|
+
}
|
783
|
+
if (n == 1)
|
784
|
+
{
|
785
|
+
return cr_paint_with_alpha (self, alpha);
|
786
|
+
}
|
787
|
+
else
|
788
|
+
{
|
789
|
+
rb_raise (rb_eArgError,
|
790
|
+
"invalid argument (expect () or (alpha))");
|
791
|
+
}
|
792
|
+
}
|
793
|
+
|
794
|
+
static VALUE
|
795
|
+
cr_mask(VALUE self, VALUE pattern)
|
796
|
+
{
|
797
|
+
cairo_mask (_SELF, RVAL2CRPATTERN (pattern));
|
798
|
+
cr_check_status (_SELF);
|
799
|
+
return self;
|
800
|
+
}
|
801
|
+
|
802
|
+
static VALUE
|
803
|
+
cr_mask_surface (VALUE self, VALUE surface, VALUE x, VALUE y)
|
804
|
+
{
|
805
|
+
cairo_mask_surface (_SELF, RVAL2CRSURFACE (surface),
|
806
|
+
NUM2DBL (x), NUM2DBL (y));
|
807
|
+
cr_check_status (_SELF);
|
808
|
+
return self;
|
809
|
+
}
|
810
|
+
|
811
|
+
static VALUE
|
812
|
+
cr_mask_generic (int argc, VALUE *argv, VALUE self)
|
813
|
+
{
|
814
|
+
VALUE arg1, arg2, arg3;
|
815
|
+
int n;
|
816
|
+
|
817
|
+
n = rb_scan_args (argc, argv, "12", &arg1, &arg2, &arg3);
|
818
|
+
|
819
|
+
if (n == 1)
|
820
|
+
{
|
821
|
+
return cr_mask (self, arg1);
|
822
|
+
}
|
823
|
+
else if (n == 3)
|
824
|
+
{
|
825
|
+
return cr_mask_surface (self, arg1, arg2, arg3);
|
826
|
+
}
|
827
|
+
else
|
828
|
+
{
|
829
|
+
rb_raise (rb_eArgError,
|
830
|
+
"invalid argument (expect (pattern) or (surface, x, y))");
|
831
|
+
}
|
832
|
+
}
|
833
|
+
|
834
|
+
static VALUE
|
835
|
+
cr_stroke (int argc, VALUE *argv, VALUE self)
|
836
|
+
{
|
837
|
+
VALUE preserve;
|
838
|
+
|
839
|
+
rb_scan_args (argc, argv, "01", &preserve);
|
840
|
+
|
841
|
+
if (rb_block_given_p ())
|
842
|
+
{
|
843
|
+
cr_new_path (self);
|
844
|
+
rb_yield (self);
|
845
|
+
}
|
846
|
+
|
847
|
+
if (RVAL2CBOOL (preserve))
|
848
|
+
cairo_stroke_preserve (_SELF);
|
849
|
+
else
|
850
|
+
cairo_stroke (_SELF);
|
851
|
+
|
852
|
+
cr_check_status (_SELF);
|
853
|
+
return self;
|
854
|
+
}
|
855
|
+
|
856
|
+
static VALUE
|
857
|
+
cr_fill (int argc, VALUE *argv, VALUE self)
|
858
|
+
{
|
859
|
+
VALUE preserve;
|
860
|
+
|
861
|
+
rb_scan_args (argc, argv, "01", &preserve);
|
862
|
+
|
863
|
+
if (rb_block_given_p ())
|
864
|
+
{
|
865
|
+
cr_new_path (self);
|
866
|
+
rb_yield (self);
|
867
|
+
}
|
868
|
+
|
869
|
+
if (RVAL2CBOOL (preserve))
|
870
|
+
cairo_fill_preserve (_SELF);
|
871
|
+
else
|
872
|
+
cairo_fill (_SELF);
|
873
|
+
|
874
|
+
cr_check_status (_SELF);
|
875
|
+
return self;
|
876
|
+
}
|
877
|
+
|
878
|
+
|
879
|
+
static VALUE
|
880
|
+
cr_copy_page (VALUE self)
|
881
|
+
{
|
882
|
+
cairo_copy_page (_SELF);
|
883
|
+
cr_check_status (_SELF);
|
884
|
+
return self;
|
885
|
+
}
|
886
|
+
|
887
|
+
static VALUE
|
888
|
+
cr_show_page (VALUE self)
|
889
|
+
{
|
890
|
+
cairo_show_page (_SELF);
|
891
|
+
cr_check_status (_SELF);
|
892
|
+
return self;
|
893
|
+
}
|
894
|
+
|
895
|
+
/* Insideness testing */
|
896
|
+
static VALUE
|
897
|
+
cr_in_stroke (VALUE self, VALUE x, VALUE y)
|
898
|
+
{
|
899
|
+
if (rb_block_given_p ())
|
900
|
+
{
|
901
|
+
cr_new_path (self);
|
902
|
+
rb_yield (self);
|
903
|
+
}
|
904
|
+
return CBOOL2RVAL (cairo_in_stroke (_SELF, NUM2DBL (x), NUM2DBL (y)));
|
905
|
+
}
|
906
|
+
|
907
|
+
static VALUE
|
908
|
+
cr_in_fill (VALUE self, VALUE x, VALUE y)
|
909
|
+
{
|
910
|
+
if (rb_block_given_p ())
|
911
|
+
{
|
912
|
+
cr_new_path (self);
|
913
|
+
rb_yield (self);
|
914
|
+
}
|
915
|
+
return CBOOL2RVAL (cairo_in_fill (_SELF, NUM2DBL (x), NUM2DBL (y)));
|
916
|
+
}
|
917
|
+
|
918
|
+
/* Rectangular extents */
|
919
|
+
static VALUE
|
920
|
+
cr_stroke_extents (VALUE self)
|
921
|
+
{
|
922
|
+
double extents[4];
|
923
|
+
if (rb_block_given_p ())
|
924
|
+
{
|
925
|
+
cr_new_path (self);
|
926
|
+
rb_yield (self);
|
927
|
+
}
|
928
|
+
cairo_stroke_extents (_SELF, extents, extents + 1, extents + 2, extents + 3);
|
929
|
+
return rb_cairo__float_array (extents, 4);
|
930
|
+
}
|
931
|
+
|
932
|
+
static VALUE
|
933
|
+
cr_fill_extents (VALUE self)
|
934
|
+
{
|
935
|
+
double extents[4];
|
936
|
+
if (rb_block_given_p ())
|
937
|
+
{
|
938
|
+
cr_new_path (self);
|
939
|
+
rb_yield (self);
|
940
|
+
}
|
941
|
+
cairo_fill_extents (_SELF, extents, extents + 1, extents + 2, extents + 3);
|
942
|
+
return rb_cairo__float_array (extents, 4);
|
943
|
+
}
|
944
|
+
|
945
|
+
/* Clipping */
|
946
|
+
static VALUE
|
947
|
+
cr_reset_clip (VALUE self)
|
948
|
+
{
|
949
|
+
cairo_reset_clip (_SELF);
|
950
|
+
cr_check_status (_SELF);
|
951
|
+
return self;
|
952
|
+
}
|
953
|
+
|
954
|
+
static VALUE
|
955
|
+
cr_clip (int argc, VALUE *argv, VALUE self)
|
956
|
+
{
|
957
|
+
VALUE preserve;
|
958
|
+
|
959
|
+
rb_scan_args(argc, argv, "01", &preserve);
|
960
|
+
|
961
|
+
if (rb_block_given_p ())
|
962
|
+
{
|
963
|
+
cr_new_path (self);
|
964
|
+
rb_yield (self);
|
965
|
+
}
|
966
|
+
|
967
|
+
if (RVAL2CBOOL (preserve))
|
968
|
+
cairo_clip_preserve(_SELF);
|
969
|
+
else
|
970
|
+
cairo_clip (_SELF);
|
971
|
+
|
972
|
+
cr_check_status (_SELF);
|
973
|
+
return self;
|
974
|
+
}
|
975
|
+
|
976
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
977
|
+
static VALUE
|
978
|
+
cr_clip_extents (VALUE self)
|
979
|
+
{
|
980
|
+
double x1, y1, x2, y2;
|
981
|
+
cairo_clip_extents (_SELF, &x1, &y1, &x2, &y2);
|
982
|
+
cr_check_status (_SELF);
|
983
|
+
return rb_ary_new3 (4,
|
984
|
+
rb_float_new (x1), rb_float_new (y1),
|
985
|
+
rb_float_new (x2), rb_float_new (y2));
|
986
|
+
}
|
987
|
+
|
988
|
+
static VALUE
|
989
|
+
cr_clip_rectangle_list (VALUE self)
|
990
|
+
{
|
991
|
+
VALUE rb_rectangles;
|
992
|
+
cairo_rectangle_list_t *rectangles;
|
993
|
+
int i;
|
994
|
+
|
995
|
+
rectangles = cairo_copy_clip_rectangle_list (_SELF);
|
996
|
+
rb_cairo_check_status (rectangles->status);
|
997
|
+
|
998
|
+
rb_rectangles = rb_ary_new2 (rectangles->num_rectangles);
|
999
|
+
for (i = 0; i < rectangles->num_rectangles; i++) {
|
1000
|
+
VALUE argv[4];
|
1001
|
+
cairo_rectangle_t rectangle = rectangles->rectangles[i];
|
1002
|
+
|
1003
|
+
argv[0] = rb_float_new (rectangle.x);
|
1004
|
+
argv[1] = rb_float_new (rectangle.y);
|
1005
|
+
argv[2] = rb_float_new (rectangle.width);
|
1006
|
+
argv[3] = rb_float_new (rectangle.height);
|
1007
|
+
rb_ary_push (rb_rectangles,
|
1008
|
+
rb_class_new_instance (4, argv, rb_cCairo_Rectangle));
|
1009
|
+
}
|
1010
|
+
cairo_rectangle_list_destroy (rectangles);
|
1011
|
+
|
1012
|
+
return rb_rectangles;
|
1013
|
+
}
|
1014
|
+
#endif
|
1015
|
+
|
1016
|
+
/* Font/Text functions */
|
1017
|
+
static VALUE
|
1018
|
+
cr_select_font_face (int argc, VALUE *argv, VALUE self)
|
1019
|
+
{
|
1020
|
+
VALUE family, rb_slant, rb_weight;
|
1021
|
+
cairo_font_slant_t slant;
|
1022
|
+
cairo_font_weight_t weight;
|
1023
|
+
|
1024
|
+
rb_scan_args(argc, argv, "12", &family, &rb_slant, &rb_weight);
|
1025
|
+
|
1026
|
+
if (NIL_P (rb_slant))
|
1027
|
+
slant = CAIRO_FONT_SLANT_NORMAL;
|
1028
|
+
else
|
1029
|
+
slant = RVAL2CRFONTSLANT (rb_slant);
|
1030
|
+
|
1031
|
+
if (NIL_P (rb_weight))
|
1032
|
+
weight = CAIRO_FONT_WEIGHT_NORMAL;
|
1033
|
+
else
|
1034
|
+
weight = RVAL2CRFONTWEIGHT (rb_weight);
|
1035
|
+
|
1036
|
+
cairo_select_font_face (_SELF, RVAL2CSTR (family), slant, weight);
|
1037
|
+
cr_check_status (_SELF);
|
1038
|
+
return self;
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
static VALUE
|
1042
|
+
cr_set_font_size (VALUE self, VALUE scale)
|
1043
|
+
{
|
1044
|
+
cairo_set_font_size (_SELF, NUM2DBL (scale));
|
1045
|
+
cr_check_status (_SELF);
|
1046
|
+
return self;
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
static VALUE
|
1050
|
+
cr_set_font_matrix (VALUE self, VALUE matrix)
|
1051
|
+
{
|
1052
|
+
cairo_set_font_matrix (_SELF, RVAL2CRMATRIX (matrix));
|
1053
|
+
cr_check_status (_SELF);
|
1054
|
+
return self;
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
static VALUE
|
1058
|
+
cr_get_font_matrix (VALUE self)
|
1059
|
+
{
|
1060
|
+
cairo_matrix_t matrix;
|
1061
|
+
cairo_get_font_matrix (_SELF, &matrix);
|
1062
|
+
cr_check_status (_SELF);
|
1063
|
+
return CRMATRIX2RVAL (&matrix);
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
static VALUE
|
1067
|
+
cr_set_font_options (VALUE self, VALUE options)
|
1068
|
+
{
|
1069
|
+
cairo_set_font_options (_SELF, RVAL2CRFONTOPTIONS (options));
|
1070
|
+
cr_check_status (_SELF);
|
1071
|
+
return self;
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
static VALUE
|
1075
|
+
cr_get_font_options (VALUE self)
|
1076
|
+
{
|
1077
|
+
cairo_font_options_t *options = cairo_font_options_create ();
|
1078
|
+
rb_cairo_check_status (cairo_font_options_status (options));
|
1079
|
+
cairo_get_font_options (_SELF, options);
|
1080
|
+
rb_cairo_check_status (cairo_font_options_status (options));
|
1081
|
+
return CRFONTOPTIONS2RVAL (options);
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
static VALUE
|
1085
|
+
cr_set_scaled_font (VALUE self, VALUE scaled_font)
|
1086
|
+
{
|
1087
|
+
cairo_set_scaled_font (_SELF, RVAL2CRSCALEDFONT (scaled_font));
|
1088
|
+
cr_check_status (_SELF);
|
1089
|
+
return self;
|
1090
|
+
}
|
1091
|
+
|
1092
|
+
#if CAIRO_CHECK_VERSION(1, 3, 16)
|
1093
|
+
static VALUE
|
1094
|
+
cr_get_scaled_font (VALUE self)
|
1095
|
+
{
|
1096
|
+
return CRSCALEDFONT2RVAL (cairo_get_scaled_font (_SELF));
|
1097
|
+
}
|
1098
|
+
#endif
|
1099
|
+
|
1100
|
+
static VALUE
|
1101
|
+
cr_show_text (VALUE self, VALUE utf8)
|
1102
|
+
{
|
1103
|
+
cairo_show_text (_SELF, RVAL2CSTR (utf8));
|
1104
|
+
cr_check_status (_SELF);
|
1105
|
+
return self;
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
static VALUE
|
1109
|
+
cr_show_glyphs (VALUE self, VALUE rb_glyphs)
|
1110
|
+
{
|
1111
|
+
int count;
|
1112
|
+
cairo_glyph_t *glyphs;
|
1113
|
+
|
1114
|
+
RB_CAIRO__GLYPHS_TO_ARRAY (rb_glyphs, glyphs, count);
|
1115
|
+
cairo_show_glyphs (_SELF, glyphs, count);
|
1116
|
+
cr_check_status (_SELF);
|
1117
|
+
return self;
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
static VALUE
|
1121
|
+
cr_get_font_face (VALUE self)
|
1122
|
+
{
|
1123
|
+
cairo_font_face_t *face;
|
1124
|
+
|
1125
|
+
face = cairo_get_font_face (_SELF);
|
1126
|
+
rb_cairo_check_status (cairo_font_face_status (face));
|
1127
|
+
return CRFONTFACE2RVAL (face);
|
1128
|
+
}
|
1129
|
+
|
1130
|
+
static VALUE
|
1131
|
+
cr_font_extents (VALUE self)
|
1132
|
+
{
|
1133
|
+
cairo_font_extents_t extents;
|
1134
|
+
cairo_font_extents (_SELF, &extents);
|
1135
|
+
cr_check_status (_SELF);
|
1136
|
+
return CRFONTEXTENTS2RVAL (&extents);
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
static VALUE
|
1140
|
+
cr_set_font_face (VALUE self, VALUE face)
|
1141
|
+
{
|
1142
|
+
cairo_set_font_face (_SELF, NIL_P (face) ? NULL : RVAL2CRFONTFACE (face));
|
1143
|
+
cr_check_status (_SELF);
|
1144
|
+
return self;
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
static VALUE
|
1148
|
+
cr_text_extents (VALUE self, VALUE utf8)
|
1149
|
+
{
|
1150
|
+
cairo_text_extents_t extents;
|
1151
|
+
cairo_text_extents (_SELF, StringValuePtr (utf8), &extents);
|
1152
|
+
cr_check_status (_SELF);
|
1153
|
+
return CRTEXTEXTENTS2RVAL (&extents);
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
static VALUE
|
1157
|
+
cr_glyph_extents (VALUE self, VALUE rb_glyphs)
|
1158
|
+
{
|
1159
|
+
cairo_text_extents_t extents;
|
1160
|
+
cairo_glyph_t *glyphs;
|
1161
|
+
int length;
|
1162
|
+
|
1163
|
+
RB_CAIRO__GLYPHS_TO_ARRAY (rb_glyphs, glyphs, length);
|
1164
|
+
cairo_glyph_extents (_SELF, glyphs, length, &extents);
|
1165
|
+
cr_check_status (_SELF);
|
1166
|
+
return CRTEXTEXTENTS2RVAL (&extents);
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
static VALUE
|
1170
|
+
cr_text_path (VALUE self, VALUE utf8)
|
1171
|
+
{
|
1172
|
+
cairo_text_path (_SELF, StringValuePtr (utf8));
|
1173
|
+
cr_check_status (_SELF);
|
1174
|
+
return self;
|
1175
|
+
}
|
1176
|
+
|
1177
|
+
static VALUE
|
1178
|
+
cr_glyph_path (VALUE self, VALUE rb_glyphs)
|
1179
|
+
{
|
1180
|
+
int count;
|
1181
|
+
cairo_glyph_t *glyphs;
|
1182
|
+
|
1183
|
+
RB_CAIRO__GLYPHS_TO_ARRAY (rb_glyphs, glyphs, count);
|
1184
|
+
cairo_glyph_path (_SELF, glyphs, count);
|
1185
|
+
cr_check_status (_SELF);
|
1186
|
+
|
1187
|
+
return self;
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
/* Query functions */
|
1191
|
+
static VALUE
|
1192
|
+
cr_get_operator (VALUE self)
|
1193
|
+
{
|
1194
|
+
return INT2FIX (cairo_get_operator (_SELF));
|
1195
|
+
}
|
1196
|
+
|
1197
|
+
static VALUE
|
1198
|
+
cr_get_source (VALUE self)
|
1199
|
+
{
|
1200
|
+
VALUE rb_source = Qnil;
|
1201
|
+
cairo_pattern_t *source;
|
1202
|
+
source = cairo_get_source (_SELF);
|
1203
|
+
|
1204
|
+
if (source)
|
1205
|
+
{
|
1206
|
+
rb_cairo_check_status (cairo_pattern_status (source));
|
1207
|
+
rb_source = rb_ivar_get (self, cr_id_source);
|
1208
|
+
if (NIL_P (rb_source) || RVAL2CRPATTERN (rb_source) != source)
|
1209
|
+
{
|
1210
|
+
rb_source = CRPATTERN2RVAL (source);
|
1211
|
+
rb_ivar_set (self, cr_id_source, rb_source);
|
1212
|
+
}
|
1213
|
+
}
|
1214
|
+
else
|
1215
|
+
{
|
1216
|
+
rb_source = Qnil;
|
1217
|
+
rb_ivar_set (self, cr_id_source, rb_source);
|
1218
|
+
}
|
1219
|
+
|
1220
|
+
return rb_source;
|
1221
|
+
}
|
1222
|
+
|
1223
|
+
static VALUE
|
1224
|
+
cr_get_tolerance (VALUE self)
|
1225
|
+
{
|
1226
|
+
return rb_float_new (cairo_get_tolerance (_SELF));
|
1227
|
+
}
|
1228
|
+
|
1229
|
+
static VALUE
|
1230
|
+
cr_get_antialias(VALUE self)
|
1231
|
+
{
|
1232
|
+
return INT2NUM (cairo_get_antialias (_SELF));
|
1233
|
+
}
|
1234
|
+
|
1235
|
+
#if CAIRO_CHECK_VERSION(1, 5, 10)
|
1236
|
+
static VALUE
|
1237
|
+
cr_has_current_point(VALUE self)
|
1238
|
+
{
|
1239
|
+
return RTEST (cairo_has_current_point (_SELF));
|
1240
|
+
}
|
1241
|
+
#endif
|
1242
|
+
|
1243
|
+
static VALUE
|
1244
|
+
cr_get_current_point (VALUE self)
|
1245
|
+
{
|
1246
|
+
double point[2];
|
1247
|
+
cairo_get_current_point (_SELF, point, point + 1);
|
1248
|
+
return rb_cairo__float_array (point, 2);
|
1249
|
+
}
|
1250
|
+
|
1251
|
+
static VALUE
|
1252
|
+
cr_get_fill_rule (VALUE self)
|
1253
|
+
{
|
1254
|
+
return INT2FIX (cairo_get_fill_rule (_SELF));
|
1255
|
+
}
|
1256
|
+
|
1257
|
+
static VALUE
|
1258
|
+
cr_get_line_width (VALUE self)
|
1259
|
+
{
|
1260
|
+
return rb_float_new (cairo_get_line_width (_SELF));
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
static VALUE
|
1264
|
+
cr_get_line_cap (VALUE self)
|
1265
|
+
{
|
1266
|
+
return INT2FIX (cairo_get_line_cap (_SELF));
|
1267
|
+
}
|
1268
|
+
|
1269
|
+
static VALUE
|
1270
|
+
cr_get_line_join (VALUE self)
|
1271
|
+
{
|
1272
|
+
return INT2FIX (cairo_get_line_join (_SELF));
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
static VALUE
|
1276
|
+
cr_get_miter_limit (VALUE self)
|
1277
|
+
{
|
1278
|
+
return rb_float_new (cairo_get_miter_limit (_SELF));
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
1282
|
+
static VALUE
|
1283
|
+
cr_get_dash_count (VALUE self)
|
1284
|
+
{
|
1285
|
+
return INT2NUM (cairo_get_dash_count (_SELF));
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
static VALUE
|
1289
|
+
cr_get_dash (VALUE self)
|
1290
|
+
{
|
1291
|
+
int count;
|
1292
|
+
double *dashes, offset;
|
1293
|
+
|
1294
|
+
count = cairo_get_dash_count (_SELF);
|
1295
|
+
dashes = ALLOCA_N (double, count);
|
1296
|
+
cairo_get_dash (_SELF, dashes, &offset);
|
1297
|
+
|
1298
|
+
return rb_ary_new3 (2,
|
1299
|
+
rb_cairo__float_array (dashes, count),
|
1300
|
+
rb_float_new (offset));
|
1301
|
+
}
|
1302
|
+
#endif
|
1303
|
+
|
1304
|
+
static VALUE
|
1305
|
+
cr_get_matrix (VALUE self)
|
1306
|
+
{
|
1307
|
+
cairo_matrix_t matrix;
|
1308
|
+
cairo_get_matrix (_SELF, &matrix);
|
1309
|
+
cr_check_status (_SELF);
|
1310
|
+
return CRMATRIX2RVAL (&matrix);
|
1311
|
+
}
|
1312
|
+
|
1313
|
+
static VALUE
|
1314
|
+
cr_get_target (VALUE self)
|
1315
|
+
{
|
1316
|
+
cairo_surface_t *surface;
|
1317
|
+
VALUE rb_surface;
|
1318
|
+
|
1319
|
+
surface = cairo_get_target (_SELF);
|
1320
|
+
rb_cairo_check_status (cairo_surface_status (surface));
|
1321
|
+
|
1322
|
+
rb_surface = rb_ivar_get (self, cr_id_surface);
|
1323
|
+
if (NIL_P (rb_surface) || RVAL2CRSURFACE (rb_surface) != surface)
|
1324
|
+
{
|
1325
|
+
rb_surface = CRSURFACE2RVAL (surface);
|
1326
|
+
rb_ivar_set (self, cr_id_surface, rb_surface);
|
1327
|
+
}
|
1328
|
+
|
1329
|
+
return rb_surface;
|
1330
|
+
}
|
1331
|
+
|
1332
|
+
static VALUE
|
1333
|
+
cr_get_group_target (VALUE self)
|
1334
|
+
{
|
1335
|
+
cairo_surface_t *surface;
|
1336
|
+
|
1337
|
+
surface = cairo_get_group_target (_SELF);
|
1338
|
+
if (!surface)
|
1339
|
+
return Qnil;
|
1340
|
+
rb_cairo_check_status (cairo_surface_status (surface));
|
1341
|
+
return CRSURFACE2RVAL (surface);
|
1342
|
+
}
|
1343
|
+
|
1344
|
+
/* Paths */
|
1345
|
+
static VALUE
|
1346
|
+
cr_copy_path (VALUE self)
|
1347
|
+
{
|
1348
|
+
cairo_path_t *path;
|
1349
|
+
|
1350
|
+
path = cairo_copy_path (_SELF);
|
1351
|
+
rb_cairo_check_status (path->status);
|
1352
|
+
return CRPATH2RVAL (path);
|
1353
|
+
}
|
1354
|
+
|
1355
|
+
static VALUE
|
1356
|
+
cr_copy_path_flat (VALUE self)
|
1357
|
+
{
|
1358
|
+
cairo_path_t *path;
|
1359
|
+
|
1360
|
+
path = cairo_copy_path_flat (_SELF);
|
1361
|
+
rb_cairo_check_status (path->status);
|
1362
|
+
return CRPATH2RVAL (path);
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
static VALUE
|
1366
|
+
cr_copy_append_path (VALUE self, VALUE path)
|
1367
|
+
{
|
1368
|
+
cairo_append_path (_SELF, RVAL2CRPATH (path));
|
1369
|
+
cr_check_status (_SELF);
|
1370
|
+
return self;
|
1371
|
+
}
|
1372
|
+
|
1373
|
+
void
|
1374
|
+
Init_cairo_context (void)
|
1375
|
+
{
|
1376
|
+
cr_id_surface = rb_intern ("surface");
|
1377
|
+
cr_id_source = rb_intern ("source");
|
1378
|
+
|
1379
|
+
cr_id_plus = rb_intern ("+");
|
1380
|
+
cr_id_minus = rb_intern ("-");
|
1381
|
+
cr_id_multi = rb_intern ("*");
|
1382
|
+
cr_id_div = rb_intern ("/");
|
1383
|
+
|
1384
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
1385
|
+
rb_cCairo_Rectangle =
|
1386
|
+
rb_define_class_under (rb_mCairo, "Rectangle", rb_cObject);
|
1387
|
+
at_x = rb_intern ("@x");
|
1388
|
+
at_y = rb_intern ("@y");
|
1389
|
+
at_width = rb_intern ("@width");
|
1390
|
+
at_height = rb_intern ("@height");
|
1391
|
+
|
1392
|
+
rb_define_attr (rb_cCairo_Rectangle, "x", CR_TRUE, CR_TRUE);
|
1393
|
+
rb_define_attr (rb_cCairo_Rectangle, "y", CR_TRUE, CR_TRUE);
|
1394
|
+
rb_define_attr (rb_cCairo_Rectangle, "width", CR_TRUE, CR_TRUE);
|
1395
|
+
rb_define_attr (rb_cCairo_Rectangle, "height", CR_TRUE, CR_TRUE);
|
1396
|
+
|
1397
|
+
rb_define_method (rb_cCairo_Rectangle, "initialize",
|
1398
|
+
cr_rectangle_initialize, 4);
|
1399
|
+
#endif
|
1400
|
+
|
1401
|
+
rb_cCairo_Context =
|
1402
|
+
rb_define_class_under (rb_mCairo, "Context", rb_cObject);
|
1403
|
+
|
1404
|
+
rb_define_alloc_func (rb_cCairo_Context, cr_allocate);
|
1405
|
+
|
1406
|
+
/* Functions for manipulating state objects */
|
1407
|
+
rb_define_method (rb_cCairo_Context, "initialize", cr_initialize, 1);
|
1408
|
+
|
1409
|
+
rb_define_method (rb_cCairo_Context, "save", cr_save, 0);
|
1410
|
+
rb_define_method (rb_cCairo_Context, "restore", cr_restore, 0);
|
1411
|
+
rb_define_method (rb_cCairo_Context, "push_group", cr_push_group, -1);
|
1412
|
+
rb_define_method (rb_cCairo_Context, "pop_group", cr_pop_group_generic, -1);
|
1413
|
+
rb_define_method (rb_cCairo_Context, "pop_group_to_source",
|
1414
|
+
cr_pop_group_to_source, 0);
|
1415
|
+
|
1416
|
+
/* Modify state */
|
1417
|
+
rb_define_method (rb_cCairo_Context, "set_operator", cr_set_operator, 1);
|
1418
|
+
rb_define_method (rb_cCairo_Context, "set_source", cr_set_source_generic, -1);
|
1419
|
+
rb_define_method (rb_cCairo_Context, "set_source_rgb",
|
1420
|
+
cr_set_source_rgb, -1);
|
1421
|
+
rb_define_method (rb_cCairo_Context, "set_source_rgba",
|
1422
|
+
cr_set_source_rgba, -1);
|
1423
|
+
rb_define_method (rb_cCairo_Context, "set_tolerance", cr_set_tolerance, 1);
|
1424
|
+
rb_define_method (rb_cCairo_Context, "set_antialias", cr_set_antialias, 1);
|
1425
|
+
rb_define_method (rb_cCairo_Context, "set_fill_rule", cr_set_fill_rule, 1);
|
1426
|
+
rb_define_method (rb_cCairo_Context, "set_line_width", cr_set_line_width, 1);
|
1427
|
+
rb_define_method (rb_cCairo_Context, "set_line_cap", cr_set_line_cap, 1);
|
1428
|
+
rb_define_method (rb_cCairo_Context, "set_line_join", cr_set_line_join, 1);
|
1429
|
+
rb_define_method (rb_cCairo_Context, "set_dash", cr_set_dash, -1);
|
1430
|
+
rb_define_method (rb_cCairo_Context, "set_miter_limit",
|
1431
|
+
cr_set_miter_limit, 1);
|
1432
|
+
|
1433
|
+
rb_define_method (rb_cCairo_Context, "translate", cr_translate, 2);
|
1434
|
+
rb_define_method (rb_cCairo_Context, "scale", cr_scale, 2);
|
1435
|
+
rb_define_method (rb_cCairo_Context, "rotate", cr_rotate, 1);
|
1436
|
+
rb_define_method (rb_cCairo_Context, "transform", cr_transform, 1);
|
1437
|
+
|
1438
|
+
rb_define_method (rb_cCairo_Context, "set_matrix", cr_set_matrix, 1);
|
1439
|
+
rb_define_method (rb_cCairo_Context, "identity_matrix",
|
1440
|
+
cr_identity_matrix, 0);
|
1441
|
+
rb_define_method (rb_cCairo_Context, "user_to_device", cr_user_to_device, 2);
|
1442
|
+
rb_define_method (rb_cCairo_Context, "user_to_device_distance",
|
1443
|
+
cr_user_to_device_distance, 2);
|
1444
|
+
rb_define_method (rb_cCairo_Context, "device_to_user", cr_device_to_user, 2);
|
1445
|
+
rb_define_method (rb_cCairo_Context, "device_to_user_distance",
|
1446
|
+
cr_device_to_user_distance, 2);
|
1447
|
+
|
1448
|
+
/* Path creation functions */
|
1449
|
+
rb_define_method (rb_cCairo_Context, "new_path", cr_new_path, 0);
|
1450
|
+
rb_define_method (rb_cCairo_Context, "move_to", cr_move_to, 2);
|
1451
|
+
rb_define_method (rb_cCairo_Context, "new_sub_path", cr_new_sub_path, 0);
|
1452
|
+
rb_define_method (rb_cCairo_Context, "line_to", cr_line_to, 2);
|
1453
|
+
rb_define_method (rb_cCairo_Context, "curve_to", cr_curve_to_generic, -1);
|
1454
|
+
rb_define_method (rb_cCairo_Context, "arc", cr_arc, 5);
|
1455
|
+
rb_define_method (rb_cCairo_Context, "arc_negative", cr_arc_negative, 5);
|
1456
|
+
rb_define_method (rb_cCairo_Context, "rel_move_to", cr_rel_move_to, 2);
|
1457
|
+
rb_define_method (rb_cCairo_Context, "rel_line_to", cr_rel_line_to, 2);
|
1458
|
+
rb_define_method (rb_cCairo_Context, "rel_curve_to",
|
1459
|
+
cr_rel_curve_to_generic, -1);
|
1460
|
+
rb_define_method (rb_cCairo_Context, "rectangle", cr_rectangle, 4);
|
1461
|
+
rb_define_method (rb_cCairo_Context, "close_path", cr_close_path, 0);
|
1462
|
+
#if CAIRO_CHECK_VERSION(1, 5, 8)
|
1463
|
+
rb_define_method (rb_cCairo_Context, "path_extents", cr_path_extents, 0);
|
1464
|
+
#endif
|
1465
|
+
|
1466
|
+
/* Painting functions */
|
1467
|
+
rb_define_method (rb_cCairo_Context, "paint", cr_paint_generic, -1);
|
1468
|
+
rb_define_method (rb_cCairo_Context, "mask", cr_mask_generic, -1);
|
1469
|
+
rb_define_method (rb_cCairo_Context, "stroke", cr_stroke, -1);
|
1470
|
+
rb_define_method (rb_cCairo_Context, "fill", cr_fill, -1);
|
1471
|
+
rb_define_method (rb_cCairo_Context, "copy_page", cr_copy_page, 0);
|
1472
|
+
rb_define_method (rb_cCairo_Context, "show_page", cr_show_page, 0);
|
1473
|
+
|
1474
|
+
/* Insideness testing */
|
1475
|
+
rb_define_method (rb_cCairo_Context, "in_stroke?", cr_in_stroke, 2);
|
1476
|
+
rb_define_method (rb_cCairo_Context, "in_fill?", cr_in_fill, 2);
|
1477
|
+
|
1478
|
+
/* Rectangular extents */
|
1479
|
+
rb_define_method (rb_cCairo_Context, "stroke_extents", cr_stroke_extents, 0);
|
1480
|
+
rb_define_method (rb_cCairo_Context, "fill_extents", cr_fill_extents, 0);
|
1481
|
+
|
1482
|
+
/* Clipping */
|
1483
|
+
rb_define_method (rb_cCairo_Context, "reset_clip", cr_reset_clip, 0);
|
1484
|
+
rb_define_method (rb_cCairo_Context, "clip", cr_clip, -1);
|
1485
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
1486
|
+
rb_define_method (rb_cCairo_Context, "clip_extents", cr_clip_extents, 0);
|
1487
|
+
rb_define_method (rb_cCairo_Context, "clip_rectangle_list",
|
1488
|
+
cr_clip_rectangle_list, 0);
|
1489
|
+
#endif
|
1490
|
+
|
1491
|
+
/* Font/Text functions */
|
1492
|
+
rb_define_method (rb_cCairo_Context, "select_font_face",
|
1493
|
+
cr_select_font_face, -1);
|
1494
|
+
rb_define_method (rb_cCairo_Context, "set_font_size", cr_set_font_size, 1);
|
1495
|
+
rb_define_method (rb_cCairo_Context, "set_font_matrix",
|
1496
|
+
cr_set_font_matrix, 1);
|
1497
|
+
rb_define_method (rb_cCairo_Context, "font_matrix", cr_get_font_matrix, 0);
|
1498
|
+
rb_define_method (rb_cCairo_Context, "set_font_options",
|
1499
|
+
cr_set_font_options, 1);
|
1500
|
+
rb_define_method (rb_cCairo_Context, "font_options", cr_get_font_options, 0);
|
1501
|
+
rb_define_method (rb_cCairo_Context, "set_font_face", cr_set_font_face, 1);
|
1502
|
+
rb_define_method (rb_cCairo_Context, "font_face", cr_get_font_face, 0);
|
1503
|
+
rb_define_method (rb_cCairo_Context, "set_scaled_font",
|
1504
|
+
cr_set_scaled_font, 1);
|
1505
|
+
#if CAIRO_CHECK_VERSION(1, 3, 16)
|
1506
|
+
rb_define_method (rb_cCairo_Context, "scaled_font", cr_get_scaled_font, 0);
|
1507
|
+
#endif
|
1508
|
+
rb_define_method (rb_cCairo_Context, "show_text", cr_show_text, 1);
|
1509
|
+
rb_define_method (rb_cCairo_Context, "show_glyphs", cr_show_glyphs, 1);
|
1510
|
+
rb_define_method (rb_cCairo_Context, "text_path", cr_text_path, 1);
|
1511
|
+
rb_define_method (rb_cCairo_Context, "glyph_path", cr_glyph_path, 1);
|
1512
|
+
rb_define_method (rb_cCairo_Context, "text_extents", cr_text_extents, 1);
|
1513
|
+
rb_define_method (rb_cCairo_Context, "glyph_extents", cr_glyph_extents, 1);
|
1514
|
+
rb_define_method (rb_cCairo_Context, "font_extents", cr_font_extents, 0);
|
1515
|
+
|
1516
|
+
/* Query functions */
|
1517
|
+
rb_define_method (rb_cCairo_Context, "operator", cr_get_operator, 0);
|
1518
|
+
rb_define_method (rb_cCairo_Context, "source", cr_get_source, 0);
|
1519
|
+
rb_define_method (rb_cCairo_Context, "tolerance", cr_get_tolerance, 0);
|
1520
|
+
rb_define_method (rb_cCairo_Context, "antialias", cr_get_antialias, 0);
|
1521
|
+
#if CAIRO_CHECK_VERSION(1, 5, 10)
|
1522
|
+
rb_define_method (rb_cCairo_Context, "have_current_point?",
|
1523
|
+
cr_has_current_point, 0);
|
1524
|
+
rb_define_alias (rb_cCairo_Context,
|
1525
|
+
"has_current_point?", "have_current_point?");
|
1526
|
+
#endif
|
1527
|
+
rb_define_method (rb_cCairo_Context, "current_point",
|
1528
|
+
cr_get_current_point, 0);
|
1529
|
+
rb_define_method (rb_cCairo_Context, "fill_rule", cr_get_fill_rule, 0);
|
1530
|
+
rb_define_method (rb_cCairo_Context, "line_width", cr_get_line_width, 0);
|
1531
|
+
rb_define_method (rb_cCairo_Context, "line_cap", cr_get_line_cap, 0);
|
1532
|
+
rb_define_method (rb_cCairo_Context, "line_join", cr_get_line_join, 0);
|
1533
|
+
rb_define_method (rb_cCairo_Context, "miter_limit", cr_get_miter_limit, 0);
|
1534
|
+
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
1535
|
+
rb_define_method (rb_cCairo_Context, "dash_count", cr_get_dash_count, 0);
|
1536
|
+
rb_define_method (rb_cCairo_Context, "dash", cr_get_dash, 0);
|
1537
|
+
#endif
|
1538
|
+
rb_define_method (rb_cCairo_Context, "matrix", cr_get_matrix, 0);
|
1539
|
+
rb_define_method (rb_cCairo_Context, "target", cr_get_target, 0);
|
1540
|
+
rb_define_method (rb_cCairo_Context, "group_target", cr_get_group_target, 0);
|
1541
|
+
|
1542
|
+
/* Paths */
|
1543
|
+
rb_define_method (rb_cCairo_Context, "copy_path", cr_copy_path, 0);
|
1544
|
+
rb_define_method (rb_cCairo_Context, "copy_path_flat", cr_copy_path_flat, 0);
|
1545
|
+
rb_define_method (rb_cCairo_Context, "append_path", cr_copy_append_path, 1);
|
1546
|
+
|
1547
|
+
RB_CAIRO_DEF_SETTERS (rb_cCairo_Context);
|
1548
|
+
}
|