cairo 1.8.3-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cairo might be problematic. Click here for more details.
- data/AUTHORS +4 -0
- data/COPYING +59 -0
- data/GPL +340 -0
- data/NEWS +163 -0
- data/Rakefile +190 -0
- data/doc/doc.css +91 -0
- data/doc/en/cairo-antialias.html +38 -0
- data/doc/en/cairo-clip-not-representable-error.html +47 -0
- data/doc/en/cairo-color-base.html +69 -0
- data/doc/en/cairo-color-cmyk.html +157 -0
- data/doc/en/cairo-color-hsv.html +137 -0
- data/doc/en/cairo-color-rgb.html +142 -0
- data/doc/en/cairo-color-x11.html +173 -0
- data/doc/en/cairo-color.html +238 -0
- data/doc/en/cairo-content.html +37 -0
- data/doc/en/cairo-context-blur.html +39 -0
- data/doc/en/cairo-context-circle.html +39 -0
- data/doc/en/cairo-context-color.html +39 -0
- data/doc/en/cairo-context-path.html +44 -0
- data/doc/en/cairo-context-rectangle.html +39 -0
- data/doc/en/cairo-context-triangle.html +39 -0
- data/doc/en/cairo-context.html +643 -0
- data/doc/en/cairo-error.html +44 -0
- data/doc/en/cairo-extend.html +38 -0
- data/doc/en/cairo-file-not-found.html +47 -0
- data/doc/en/cairo-fill-rule.html +36 -0
- data/doc/en/cairo-filter.html +40 -0
- data/doc/en/cairo-font-extents.html +129 -0
- data/doc/en/cairo-font-face.html +38 -0
- data/doc/en/cairo-font-options.html +139 -0
- data/doc/en/cairo-font-slant.html +37 -0
- data/doc/en/cairo-font-type-mismatch.html +47 -0
- data/doc/en/cairo-font-weight.html +36 -0
- data/doc/en/cairo-format.html +46 -0
- data/doc/en/cairo-glyph.html +99 -0
- data/doc/en/cairo-gradient-pattern.html +74 -0
- data/doc/en/cairo-hint-metrics.html +37 -0
- data/doc/en/cairo-hint-style.html +39 -0
- data/doc/en/cairo-image-surface.html +82 -0
- data/doc/en/cairo-invalid-clusters.html +47 -0
- data/doc/en/cairo-invalid-content-error.html +47 -0
- data/doc/en/cairo-invalid-dash-error.html +47 -0
- data/doc/en/cairo-invalid-dsc-comment-error.html +47 -0
- data/doc/en/cairo-invalid-format-error.html +47 -0
- data/doc/en/cairo-invalid-index-error.html +47 -0
- data/doc/en/cairo-invalid-matrix-error.html +47 -0
- data/doc/en/cairo-invalid-path-data-error.html +47 -0
- data/doc/en/cairo-invalid-pop-group-error.html +47 -0
- data/doc/en/cairo-invalid-restore-error.html +47 -0
- data/doc/en/cairo-invalid-slant.html +47 -0
- data/doc/en/cairo-invalid-status-error.html +47 -0
- data/doc/en/cairo-invalid-stride-error.html +47 -0
- data/doc/en/cairo-invalid-string-error.html +47 -0
- data/doc/en/cairo-invalid-visual-error.html +47 -0
- data/doc/en/cairo-invalid-weight.html +47 -0
- data/doc/en/cairo-line-cap.html +37 -0
- data/doc/en/cairo-line-join.html +37 -0
- data/doc/en/cairo-linear-pattern.html +60 -0
- data/doc/en/cairo-matrix.html +259 -0
- data/doc/en/cairo-negative-count.html +47 -0
- data/doc/en/cairo-no-current-point-error.html +47 -0
- data/doc/en/cairo-null-pointer-error.html +47 -0
- data/doc/en/cairo-operator.html +48 -0
- data/doc/en/cairo-paper-parse-error.html +47 -0
- data/doc/en/cairo-paper-unknown-paper-name.html +66 -0
- data/doc/en/cairo-paper-unknown-unit.html +66 -0
- data/doc/en/cairo-paper-unrecognized-paper-description.html +66 -0
- data/doc/en/cairo-paper.html +184 -0
- data/doc/en/cairo-path-close-path.html +49 -0
- data/doc/en/cairo-path-curve-to.html +49 -0
- data/doc/en/cairo-path-data-type.html +38 -0
- data/doc/en/cairo-path-data.html +98 -0
- data/doc/en/cairo-path-line-to.html +49 -0
- data/doc/en/cairo-path-move-to.html +49 -0
- data/doc/en/cairo-path.html +155 -0
- data/doc/en/cairo-pattern-type-mismatch-error.html +47 -0
- data/doc/en/cairo-pattern.html +99 -0
- data/doc/en/cairo-pdf-surface.html +57 -0
- data/doc/en/cairo-point.html +74 -0
- data/doc/en/cairo-ps-level.html +49 -0
- data/doc/en/cairo-ps-surface.html +92 -0
- data/doc/en/cairo-quartz-image-surface.html +57 -0
- data/doc/en/cairo-quartz-surface.html +57 -0
- data/doc/en/cairo-radial-pattern.html +60 -0
- data/doc/en/cairo-read-error.html +47 -0
- data/doc/en/cairo-rectangle.html +89 -0
- data/doc/en/cairo-scaled-font.html +94 -0
- data/doc/en/cairo-solid-pattern.html +62 -0
- data/doc/en/cairo-subpixel-order.html +39 -0
- data/doc/en/cairo-surface-finished-error.html +47 -0
- data/doc/en/cairo-surface-pattern.html +57 -0
- data/doc/en/cairo-surface-type-mismatch-error.html +47 -0
- data/doc/en/cairo-surface.html +121 -0
- data/doc/en/cairo-svg-surface.html +77 -0
- data/doc/en/cairo-svg-version.html +49 -0
- data/doc/en/cairo-temp-file-error.html +47 -0
- data/doc/en/cairo-text-cluster-flag.html +35 -0
- data/doc/en/cairo-text-cluster.html +84 -0
- data/doc/en/cairo-text-extents.html +144 -0
- data/doc/en/cairo-toy-font-face.html +67 -0
- data/doc/en/cairo-user-font-error.html +47 -0
- data/doc/en/cairo-user-font-face-text-to-glyphs-data.html +94 -0
- data/doc/en/cairo-user-font-face.html +72 -0
- data/doc/en/cairo-user-font-immutable.html +47 -0
- data/doc/en/cairo-win32-printing-surface.html +57 -0
- data/doc/en/cairo-win32-surface.html +62 -0
- data/doc/en/cairo-write-error.html +47 -0
- data/doc/en/cairo.html +131 -0
- data/doc/en/index.html +1154 -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 +1542 -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 +164 -0
- data/doc/ja/cairo-font-face.html +55 -0
- data/doc/ja/cairo-font-options.html +189 -0
- data/doc/ja/cairo-font-slant.html +50 -0
- data/doc/ja/cairo-font-type-mismatch.html +52 -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-clusters.html +55 -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-slant.html +57 -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-invalid-weight.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 +354 -0
- data/doc/ja/cairo-negative-count.html +52 -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 +180 -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 +213 -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-cluster-flag.html +46 -0
- data/doc/ja/cairo-text-cluster.html +102 -0
- data/doc/ja/cairo-text-extents.html +163 -0
- data/doc/ja/cairo-toy-font-face.html +107 -0
- data/doc/ja/cairo-user-font-error.html +55 -0
- data/doc/ja/cairo-user-font-face-text-to-glyphs-data.html +156 -0
- data/doc/ja/cairo-user-font-face.html +268 -0
- data/doc/ja/cairo-user-font-immutable.html +54 -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 +177 -0
- data/doc/ja/index.html +1156 -0
- data/ext/cairo/cairo.def +104 -0
- data/ext/cairo/extconf.rb +80 -0
- data/ext/cairo/rb_cairo.c +104 -0
- data/ext/cairo/rb_cairo.h +275 -0
- data/ext/cairo/rb_cairo_constants.c +478 -0
- data/ext/cairo/rb_cairo_context.c +1693 -0
- data/ext/cairo/rb_cairo_exception.c +354 -0
- data/ext/cairo/rb_cairo_font_extents.c +200 -0
- data/ext/cairo/rb_cairo_font_face.c +713 -0
- data/ext/cairo/rb_cairo_font_options.c +197 -0
- data/ext/cairo/rb_cairo_glyph.c +161 -0
- data/ext/cairo/rb_cairo_matrix.c +366 -0
- data/ext/cairo/rb_cairo_path.c +459 -0
- data/ext/cairo/rb_cairo_pattern.c +540 -0
- data/ext/cairo/rb_cairo_private.c +242 -0
- data/ext/cairo/rb_cairo_private.h +114 -0
- data/ext/cairo/rb_cairo_scaled_font.c +235 -0
- data/ext/cairo/rb_cairo_surface.c +1371 -0
- data/ext/cairo/rb_cairo_text_cluster.c +151 -0
- data/ext/cairo/rb_cairo_text_extents.c +221 -0
- data/extconf.rb +45 -0
- data/lib/1.8/cairo.so +0 -0
- data/lib/1.9/cairo.so +0 -0
- data/lib/cairo.rb +151 -0
- data/lib/cairo/color.rb +267 -0
- data/lib/cairo/colors.rb +656 -0
- data/lib/cairo/constants.rb +24 -0
- data/lib/cairo/context.rb +29 -0
- data/lib/cairo/context/blur.rb +45 -0
- data/lib/cairo/context/circle.rb +9 -0
- data/lib/cairo/context/color.rb +11 -0
- data/lib/cairo/context/path.rb +116 -0
- data/lib/cairo/context/rectangle.rb +33 -0
- data/lib/cairo/context/triangle.rb +12 -0
- data/lib/cairo/paper.rb +183 -0
- data/lib/cairo/papers.rb +41 -0
- data/lib/cairo/path.rb +15 -0
- data/lib/cairo/point.rb +7 -0
- data/misc/update-colors.rb +143 -0
- data/pkg-config.rb +313 -0
- data/samples/agg/README +4 -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/test-unit/Rakefile +30 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/lib/test/unit.rb +280 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +14 -0
- data/test-unit/lib/test/unit/assertions.rb +722 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +254 -0
- data/test-unit/lib/test/unit/collector.rb +43 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +135 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color.rb +61 -0
- data/test-unit/lib/test/unit/diff.rb +524 -0
- data/test-unit/lib/test/unit/error.rb +124 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +110 -0
- data/test-unit/lib/test/unit/fixture.rb +185 -0
- data/test-unit/lib/test/unit/notification.rb +125 -0
- data/test-unit/lib/test/unit/omission.rb +143 -0
- data/test-unit/lib/test/unit/pending.rb +146 -0
- data/test-unit/lib/test/unit/priority.rb +146 -0
- data/test-unit/lib/test/unit/runner/console.rb +46 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +281 -0
- data/test-unit/lib/test/unit/testresult.rb +89 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +195 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +20 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/tc_adder.rb +18 -0
- data/test-unit/sample/tc_subtracter.rb +18 -0
- data/test-unit/sample/ts_examples.rb +7 -0
- data/test-unit/test/collector/test_descendant.rb +135 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_load.rb +333 -0
- data/test-unit/test/collector/test_objectspace.rb +98 -0
- data/test-unit/test/run-test.rb +13 -0
- data/test-unit/test/test_assertions.rb +693 -0
- data/test-unit/test/test_attribute.rb +86 -0
- data/test-unit/test/test_color.rb +37 -0
- data/test-unit/test/test_diff.rb +477 -0
- data/test-unit/test/test_emacs_runner.rb +60 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_fixture.rb +252 -0
- data/test-unit/test/test_notification.rb +33 -0
- data/test-unit/test/test_omission.rb +81 -0
- data/test-unit/test/test_pending.rb +70 -0
- data/test-unit/test/test_priority.rb +89 -0
- data/test-unit/test/test_testcase.rb +430 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit_test_util.rb +14 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/cairo-test-utils.rb +18 -0
- data/test/run-test.rb +28 -0
- data/test/test_color.rb +17 -0
- data/test/test_constants.rb +16 -0
- data/test/test_context.rb +105 -0
- data/test/test_exception.rb +27 -0
- data/test/test_font_extents.rb +36 -0
- data/test/test_font_face.rb +244 -0
- data/test/test_font_options.rb +13 -0
- data/test/test_paper.rb +81 -0
- data/test/test_pkg_config.rb +123 -0
- data/test/test_scaled_font.rb +34 -0
- data/test/test_surface.rb +41 -0
- data/test/test_text_cluster.rb +32 -0
- data/test/test_text_extents.rb +40 -0
- data/test/test_text_to_glyphs_data.rb +51 -0
- data/tmp/x86-mingw32/cairo/1.8.7/fake.rb +6 -0
- data/tmp/x86-mingw32/cairo/1.8.7/mkmf.rb +1836 -0
- data/tmp/x86-mingw32/cairo/1.8.7/rbconfig.rb +183 -0
- data/tmp/x86-mingw32/cairo/1.9.2/fake.rb +6 -0
- data/tmp/x86-mingw32/cairo/1.9.2/mkmf.rb +2079 -0
- data/tmp/x86-mingw32/cairo/1.9.2/rbconfig.rb +226 -0
- metadata +437 -0
@@ -0,0 +1,197 @@
|
|
1
|
+
/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Ruby Cairo Binding
|
4
|
+
*
|
5
|
+
* $Author: kou $
|
6
|
+
* $Date: 2008-09-19 12:56:27 $
|
7
|
+
*
|
8
|
+
* Copyright 2005-2008 Kouhei Sutou <kou@cozmixng.org>
|
9
|
+
*
|
10
|
+
* This file is made available under the same terms as Ruby
|
11
|
+
*
|
12
|
+
*/
|
13
|
+
|
14
|
+
#include "rb_cairo.h"
|
15
|
+
#include "rb_cairo_private.h"
|
16
|
+
|
17
|
+
#define _SELF(self) (RVAL2CRFONTOPTIONS(self))
|
18
|
+
|
19
|
+
VALUE rb_cCairo_FontOptions;
|
20
|
+
|
21
|
+
static inline void
|
22
|
+
cr_options_check_status (cairo_font_options_t *options)
|
23
|
+
{
|
24
|
+
rb_cairo_check_status (cairo_font_options_status (options));
|
25
|
+
}
|
26
|
+
|
27
|
+
cairo_font_options_t *
|
28
|
+
rb_cairo_font_options_from_ruby_object (VALUE obj)
|
29
|
+
{
|
30
|
+
cairo_font_options_t *options;
|
31
|
+
if (!rb_cairo__is_kind_of (obj, rb_cCairo_FontOptions))
|
32
|
+
{
|
33
|
+
rb_raise (rb_eTypeError, "not a cairo font options");
|
34
|
+
}
|
35
|
+
Data_Get_Struct (obj, cairo_font_options_t, options);
|
36
|
+
return options;
|
37
|
+
}
|
38
|
+
|
39
|
+
static void
|
40
|
+
cr_options_free (void *ptr)
|
41
|
+
{
|
42
|
+
if (ptr)
|
43
|
+
{
|
44
|
+
cairo_font_options_destroy ((cairo_font_options_t *) ptr);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
VALUE
|
49
|
+
rb_cairo_font_options_to_ruby_object (cairo_font_options_t *options)
|
50
|
+
{
|
51
|
+
if (options)
|
52
|
+
{
|
53
|
+
return Data_Wrap_Struct (rb_cCairo_FontOptions, NULL,
|
54
|
+
cr_options_free, options);
|
55
|
+
}
|
56
|
+
else
|
57
|
+
{
|
58
|
+
return Qnil;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
static VALUE
|
63
|
+
cr_options_allocate (VALUE klass)
|
64
|
+
{
|
65
|
+
return Data_Wrap_Struct (klass, NULL, cr_options_free, NULL);
|
66
|
+
}
|
67
|
+
|
68
|
+
static VALUE
|
69
|
+
cr_options_create (VALUE self)
|
70
|
+
{
|
71
|
+
cairo_font_options_t *options;
|
72
|
+
|
73
|
+
options = cairo_font_options_create ();
|
74
|
+
cr_options_check_status (options);
|
75
|
+
DATA_PTR (self) = options;
|
76
|
+
return Qnil;
|
77
|
+
}
|
78
|
+
|
79
|
+
static VALUE
|
80
|
+
cr_options_copy (VALUE self)
|
81
|
+
{
|
82
|
+
cairo_font_options_t *options;
|
83
|
+
|
84
|
+
options = cairo_font_options_copy (_SELF (self));
|
85
|
+
cr_options_check_status (options);
|
86
|
+
return CRFONTOPTIONS2RVAL (options);
|
87
|
+
}
|
88
|
+
|
89
|
+
static VALUE
|
90
|
+
cr_options_merge (VALUE self, VALUE other)
|
91
|
+
{
|
92
|
+
cairo_font_options_merge (_SELF (self), _SELF (other));
|
93
|
+
return self;
|
94
|
+
}
|
95
|
+
|
96
|
+
static VALUE
|
97
|
+
cr_options_equal (VALUE self, VALUE other)
|
98
|
+
{
|
99
|
+
return CBOOL2RVAL (cairo_font_options_equal (_SELF (self), _SELF (other)));
|
100
|
+
}
|
101
|
+
|
102
|
+
static VALUE
|
103
|
+
cr_options_hash (VALUE self)
|
104
|
+
{
|
105
|
+
return INT2NUM (cairo_font_options_hash (_SELF (self)));
|
106
|
+
}
|
107
|
+
|
108
|
+
static VALUE
|
109
|
+
cr_options_set_antialias (VALUE self, VALUE antialias)
|
110
|
+
{
|
111
|
+
cairo_font_options_set_antialias (_SELF (self), RVAL2CRANTIALIAS (antialias));
|
112
|
+
return self;
|
113
|
+
}
|
114
|
+
|
115
|
+
static VALUE
|
116
|
+
cr_options_get_antialias (VALUE self)
|
117
|
+
{
|
118
|
+
return INT2NUM (cairo_font_options_get_antialias (_SELF (self)));
|
119
|
+
}
|
120
|
+
|
121
|
+
static VALUE
|
122
|
+
cr_options_set_subpixel_order (VALUE self, VALUE subpixel_order)
|
123
|
+
{
|
124
|
+
cairo_font_options_set_subpixel_order (_SELF (self),
|
125
|
+
RVAL2CRSUBPIXELORDER (subpixel_order));
|
126
|
+
return self;
|
127
|
+
}
|
128
|
+
|
129
|
+
static VALUE
|
130
|
+
cr_options_get_subpixel_order (VALUE self)
|
131
|
+
{
|
132
|
+
return INT2NUM (cairo_font_options_get_subpixel_order (_SELF (self)));
|
133
|
+
}
|
134
|
+
|
135
|
+
static VALUE
|
136
|
+
cr_options_set_hint_style (VALUE self, VALUE hint_style)
|
137
|
+
{
|
138
|
+
cairo_font_options_set_hint_style (_SELF (self),
|
139
|
+
RVAL2CRHINTSTYLE (hint_style));
|
140
|
+
return self;
|
141
|
+
}
|
142
|
+
|
143
|
+
static VALUE
|
144
|
+
cr_options_get_hint_style (VALUE self)
|
145
|
+
{
|
146
|
+
return INT2NUM (cairo_font_options_get_hint_style (_SELF (self)));
|
147
|
+
}
|
148
|
+
|
149
|
+
static VALUE
|
150
|
+
cr_options_set_hint_metrics (VALUE self, VALUE hint_metrics)
|
151
|
+
{
|
152
|
+
cairo_font_options_set_hint_metrics (_SELF (self),
|
153
|
+
RVAL2CRHINTMETRICS (hint_metrics));
|
154
|
+
return self;
|
155
|
+
}
|
156
|
+
|
157
|
+
static VALUE
|
158
|
+
cr_options_get_hint_metrics (VALUE self)
|
159
|
+
{
|
160
|
+
return INT2NUM (cairo_font_options_get_hint_metrics (_SELF (self)));
|
161
|
+
}
|
162
|
+
|
163
|
+
|
164
|
+
void
|
165
|
+
Init_cairo_font_options (void)
|
166
|
+
{
|
167
|
+
rb_cCairo_FontOptions =
|
168
|
+
rb_define_class_under (rb_mCairo, "FontOptions", rb_cObject);
|
169
|
+
|
170
|
+
rb_define_alloc_func (rb_cCairo_FontOptions, cr_options_allocate);
|
171
|
+
|
172
|
+
rb_define_method (rb_cCairo_FontOptions, "initialize", cr_options_create, 0);
|
173
|
+
|
174
|
+
rb_define_method (rb_cCairo_FontOptions, "dup", cr_options_copy, 0);
|
175
|
+
rb_define_method (rb_cCairo_FontOptions, "merge!", cr_options_merge, 1);
|
176
|
+
rb_define_alias (rb_cCairo_FontOptions, "update", "merge!");
|
177
|
+
rb_define_method (rb_cCairo_FontOptions, "eql?", cr_options_equal, 1);
|
178
|
+
rb_define_method (rb_cCairo_FontOptions, "hash", cr_options_hash, 0);
|
179
|
+
rb_define_method (rb_cCairo_FontOptions, "set_antialias",
|
180
|
+
cr_options_set_antialias, 1);
|
181
|
+
rb_define_method (rb_cCairo_FontOptions, "antialias",
|
182
|
+
cr_options_get_antialias, 0);
|
183
|
+
rb_define_method (rb_cCairo_FontOptions, "set_subpixel_order",
|
184
|
+
cr_options_set_subpixel_order, 1);
|
185
|
+
rb_define_method (rb_cCairo_FontOptions, "subpixel_order",
|
186
|
+
cr_options_get_subpixel_order, 0);
|
187
|
+
rb_define_method (rb_cCairo_FontOptions, "set_hint_style",
|
188
|
+
cr_options_set_hint_style, 1);
|
189
|
+
rb_define_method (rb_cCairo_FontOptions, "hint_style",
|
190
|
+
cr_options_get_hint_style, 0);
|
191
|
+
rb_define_method (rb_cCairo_FontOptions, "set_hint_metrics",
|
192
|
+
cr_options_set_hint_metrics, 1);
|
193
|
+
rb_define_method (rb_cCairo_FontOptions, "hint_metrics",
|
194
|
+
cr_options_get_hint_metrics, 0);
|
195
|
+
|
196
|
+
RB_CAIRO_DEF_SETTERS (rb_cCairo_FontOptions);
|
197
|
+
}
|
@@ -0,0 +1,161 @@
|
|
1
|
+
/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Ruby Cairo Binding
|
4
|
+
*
|
5
|
+
* $Author: kou $
|
6
|
+
* $Date: 2008-08-16 08:16:39 $
|
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
|
+
|
16
|
+
#include "rb_cairo.h"
|
17
|
+
#include "rb_cairo_private.h"
|
18
|
+
|
19
|
+
VALUE rb_cCairo_Glyph;
|
20
|
+
|
21
|
+
#define _SELF(self) (RVAL2CRGLYPH(self))
|
22
|
+
|
23
|
+
cairo_glyph_t *
|
24
|
+
rb_cairo_glyph_from_ruby_object (VALUE obj)
|
25
|
+
{
|
26
|
+
cairo_glyph_t *glyph;
|
27
|
+
if (!rb_cairo__is_kind_of (obj, rb_cCairo_Glyph))
|
28
|
+
{
|
29
|
+
rb_raise (rb_eTypeError, "not a cairo glyph");
|
30
|
+
}
|
31
|
+
Data_Get_Struct (obj, cairo_glyph_t, glyph);
|
32
|
+
return glyph;
|
33
|
+
}
|
34
|
+
|
35
|
+
static void
|
36
|
+
cr_glyph_free (void *ptr)
|
37
|
+
{
|
38
|
+
if (ptr)
|
39
|
+
{
|
40
|
+
xfree (ptr);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
VALUE
|
45
|
+
rb_cairo_glyph_to_ruby_object (cairo_glyph_t *glyph)
|
46
|
+
{
|
47
|
+
if (glyph)
|
48
|
+
{
|
49
|
+
cairo_glyph_t *new_glyph;
|
50
|
+
|
51
|
+
new_glyph = ALLOC (cairo_glyph_t);
|
52
|
+
*new_glyph = *glyph;
|
53
|
+
return Data_Wrap_Struct (rb_cCairo_Glyph, NULL, cr_glyph_free, new_glyph);
|
54
|
+
}
|
55
|
+
else
|
56
|
+
{
|
57
|
+
return Qnil;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
static VALUE
|
62
|
+
cr_glyph_allocate (VALUE klass)
|
63
|
+
{
|
64
|
+
return Data_Wrap_Struct (klass, NULL, cr_glyph_free, NULL);
|
65
|
+
}
|
66
|
+
|
67
|
+
static VALUE
|
68
|
+
cr_glyph_initialize (VALUE self, VALUE index, VALUE x, VALUE y)
|
69
|
+
{
|
70
|
+
cairo_glyph_t *glyph;
|
71
|
+
|
72
|
+
glyph = ALLOC (cairo_glyph_t);
|
73
|
+
glyph->index = NUM2ULONG (index);
|
74
|
+
glyph->x = NUM2DBL (x);
|
75
|
+
glyph->y = NUM2DBL (y);
|
76
|
+
|
77
|
+
DATA_PTR (self) = glyph;
|
78
|
+
return Qnil;
|
79
|
+
}
|
80
|
+
|
81
|
+
static VALUE
|
82
|
+
cr_glyph_index (VALUE self)
|
83
|
+
{
|
84
|
+
return ULONG2NUM (_SELF(self)->index);
|
85
|
+
}
|
86
|
+
|
87
|
+
static VALUE
|
88
|
+
cr_glyph_x (VALUE self)
|
89
|
+
{
|
90
|
+
return rb_float_new (_SELF(self)->x);
|
91
|
+
}
|
92
|
+
|
93
|
+
static VALUE
|
94
|
+
cr_glyph_y (VALUE self)
|
95
|
+
{
|
96
|
+
return rb_float_new (_SELF(self)->y);
|
97
|
+
}
|
98
|
+
|
99
|
+
static VALUE
|
100
|
+
cr_glyph_set_index (VALUE self, VALUE index)
|
101
|
+
{
|
102
|
+
_SELF(self)->index = NUM2ULONG (index);
|
103
|
+
return self;
|
104
|
+
}
|
105
|
+
|
106
|
+
static VALUE
|
107
|
+
cr_glyph_set_x (VALUE self, VALUE x)
|
108
|
+
{
|
109
|
+
_SELF(self)->x = NUM2DBL (x);
|
110
|
+
return self;
|
111
|
+
}
|
112
|
+
|
113
|
+
static VALUE
|
114
|
+
cr_glyph_set_y (VALUE self, VALUE y)
|
115
|
+
{
|
116
|
+
_SELF(self)->y = NUM2DBL (y);
|
117
|
+
return self;
|
118
|
+
}
|
119
|
+
|
120
|
+
static VALUE
|
121
|
+
cr_glyph_to_s (VALUE self)
|
122
|
+
{
|
123
|
+
VALUE ret;
|
124
|
+
|
125
|
+
ret = rb_str_new2 ("#<");
|
126
|
+
rb_str_cat2 (ret, rb_class2name (CLASS_OF (self)));
|
127
|
+
rb_str_cat2 (ret, ": ");
|
128
|
+
rb_str_cat2 (ret, "index=");
|
129
|
+
rb_str_concat (ret, rb_inspect (cr_glyph_index (self)));
|
130
|
+
rb_str_cat2 (ret, ", ");
|
131
|
+
rb_str_cat2 (ret, "x=");
|
132
|
+
rb_str_concat (ret, rb_inspect (cr_glyph_x (self)));
|
133
|
+
rb_str_cat2 (ret, ", ");
|
134
|
+
rb_str_cat2 (ret, "y=");
|
135
|
+
rb_str_concat (ret, rb_inspect (cr_glyph_y (self)));
|
136
|
+
rb_str_cat2 (ret, ">");
|
137
|
+
|
138
|
+
return ret;
|
139
|
+
}
|
140
|
+
|
141
|
+
|
142
|
+
void
|
143
|
+
Init_cairo_glyph (void)
|
144
|
+
{
|
145
|
+
rb_cCairo_Glyph = rb_define_class_under (rb_mCairo, "Glyph", rb_cObject);
|
146
|
+
|
147
|
+
rb_define_alloc_func (rb_cCairo_Glyph, cr_glyph_allocate);
|
148
|
+
|
149
|
+
rb_define_method (rb_cCairo_Glyph, "initialize", cr_glyph_initialize, 3);
|
150
|
+
|
151
|
+
rb_define_method (rb_cCairo_Glyph, "index", cr_glyph_index, 0);
|
152
|
+
rb_define_method (rb_cCairo_Glyph, "x", cr_glyph_x, 0);
|
153
|
+
rb_define_method (rb_cCairo_Glyph, "y", cr_glyph_y, 0);
|
154
|
+
rb_define_method (rb_cCairo_Glyph, "set_index", cr_glyph_set_index, 1);
|
155
|
+
rb_define_method (rb_cCairo_Glyph, "set_x", cr_glyph_set_x, 1);
|
156
|
+
rb_define_method (rb_cCairo_Glyph, "set_y", cr_glyph_set_y, 1);
|
157
|
+
|
158
|
+
rb_define_method (rb_cCairo_Glyph, "to_s", cr_glyph_to_s, 0);
|
159
|
+
|
160
|
+
RB_CAIRO_DEF_SETTERS (rb_cCairo_Glyph);
|
161
|
+
}
|
@@ -0,0 +1,366 @@
|
|
1
|
+
/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Ruby Cairo Binding
|
4
|
+
*
|
5
|
+
* $Author: kou $
|
6
|
+
* $Date: 2008-08-14 12:37:50 $
|
7
|
+
*
|
8
|
+
* Copyright 2006-2008 Kouhei Sutou <kou@cozmixng.org>
|
9
|
+
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
10
|
+
* Copyright 2004-2005 MenTaLguY <mental@rydia.com>
|
11
|
+
*
|
12
|
+
* This file is made available under the same terms as Ruby
|
13
|
+
*
|
14
|
+
*/
|
15
|
+
|
16
|
+
|
17
|
+
#include "rb_cairo.h"
|
18
|
+
#include "rb_cairo_private.h"
|
19
|
+
|
20
|
+
VALUE rb_cCairo_Matrix;
|
21
|
+
|
22
|
+
static ID cr_id_equal;
|
23
|
+
|
24
|
+
#define _SELF (RVAL2CRMATRIX(self))
|
25
|
+
|
26
|
+
cairo_matrix_t *
|
27
|
+
rb_cairo_matrix_from_ruby_object (VALUE obj)
|
28
|
+
{
|
29
|
+
cairo_matrix_t *matrix;
|
30
|
+
if (!rb_cairo__is_kind_of (obj, rb_cCairo_Matrix))
|
31
|
+
{
|
32
|
+
rb_raise (rb_eTypeError, "not a cairo matrix");
|
33
|
+
}
|
34
|
+
Data_Get_Struct (obj, cairo_matrix_t, matrix);
|
35
|
+
return matrix;
|
36
|
+
}
|
37
|
+
|
38
|
+
static void
|
39
|
+
cr_matrix_free (void *ptr)
|
40
|
+
{
|
41
|
+
if (ptr)
|
42
|
+
{
|
43
|
+
free ((cairo_matrix_t *) ptr);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
VALUE
|
48
|
+
rb_cairo_matrix_to_ruby_object (cairo_matrix_t *matrix)
|
49
|
+
{
|
50
|
+
if (matrix)
|
51
|
+
{
|
52
|
+
cairo_matrix_t *new_matrix = ALLOC (cairo_matrix_t);
|
53
|
+
*new_matrix = *matrix;
|
54
|
+
return Data_Wrap_Struct (rb_cCairo_Matrix, NULL,
|
55
|
+
cr_matrix_free, new_matrix);
|
56
|
+
}
|
57
|
+
else
|
58
|
+
{
|
59
|
+
return Qnil;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
static VALUE
|
64
|
+
cr_matrix_allocate (VALUE klass)
|
65
|
+
{
|
66
|
+
return Data_Wrap_Struct (klass, NULL, cr_matrix_free, NULL);
|
67
|
+
}
|
68
|
+
|
69
|
+
static VALUE
|
70
|
+
cr_matrix_initialize (VALUE self,
|
71
|
+
VALUE xx, VALUE yx,
|
72
|
+
VALUE xy, VALUE yy,
|
73
|
+
VALUE x0, VALUE y0)
|
74
|
+
{
|
75
|
+
cairo_matrix_t *matrix = ALLOC (cairo_matrix_t);
|
76
|
+
|
77
|
+
cairo_matrix_init (matrix,
|
78
|
+
NUM2DBL (xx), NUM2DBL (yx),
|
79
|
+
NUM2DBL (xy), NUM2DBL (yy),
|
80
|
+
NUM2DBL (x0), NUM2DBL (y0));
|
81
|
+
DATA_PTR (self) = matrix;
|
82
|
+
return Qnil;
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE
|
86
|
+
cr_matrix_init_identity (VALUE self)
|
87
|
+
{
|
88
|
+
cairo_matrix_t matrix;
|
89
|
+
cairo_matrix_init_identity (&matrix);
|
90
|
+
return CRMATRIX2RVAL (&matrix);
|
91
|
+
}
|
92
|
+
|
93
|
+
static VALUE
|
94
|
+
cr_matrix_init_translate (VALUE self, VALUE tx, VALUE ty)
|
95
|
+
{
|
96
|
+
cairo_matrix_t matrix;
|
97
|
+
cairo_matrix_init_translate (&matrix, NUM2DBL (tx), NUM2DBL (ty));
|
98
|
+
return CRMATRIX2RVAL (&matrix);
|
99
|
+
}
|
100
|
+
|
101
|
+
static VALUE
|
102
|
+
cr_matrix_init_scale (VALUE self, VALUE sx, VALUE sy)
|
103
|
+
{
|
104
|
+
cairo_matrix_t matrix;
|
105
|
+
cairo_matrix_init_scale (&matrix, NUM2DBL (sx), NUM2DBL (sy));
|
106
|
+
return CRMATRIX2RVAL (&matrix);
|
107
|
+
}
|
108
|
+
|
109
|
+
static VALUE
|
110
|
+
cr_matrix_init_rotate (VALUE self, VALUE radius)
|
111
|
+
{
|
112
|
+
cairo_matrix_t matrix;
|
113
|
+
cairo_matrix_init_rotate (&matrix, NUM2DBL (radius));
|
114
|
+
return CRMATRIX2RVAL (&matrix);
|
115
|
+
}
|
116
|
+
|
117
|
+
static VALUE
|
118
|
+
cr_matrix_identity (VALUE self)
|
119
|
+
{
|
120
|
+
cairo_matrix_init_identity (_SELF);
|
121
|
+
return self;
|
122
|
+
}
|
123
|
+
|
124
|
+
static VALUE
|
125
|
+
cr_matrix_translate (VALUE self, VALUE tx, VALUE ty)
|
126
|
+
{
|
127
|
+
cairo_matrix_translate (_SELF, NUM2DBL (tx), NUM2DBL (ty));
|
128
|
+
return self;
|
129
|
+
}
|
130
|
+
|
131
|
+
static VALUE
|
132
|
+
cr_matrix_scale (VALUE self, VALUE sx, VALUE sy)
|
133
|
+
{
|
134
|
+
cairo_matrix_scale (_SELF, NUM2DBL (sx), NUM2DBL (sy));
|
135
|
+
return self;
|
136
|
+
}
|
137
|
+
|
138
|
+
static VALUE
|
139
|
+
cr_matrix_rotate (VALUE self, VALUE radians)
|
140
|
+
{
|
141
|
+
cairo_matrix_rotate (_SELF, NUM2DBL (radians));
|
142
|
+
return self;
|
143
|
+
}
|
144
|
+
|
145
|
+
static VALUE
|
146
|
+
cr_matrix_invert (VALUE self)
|
147
|
+
{
|
148
|
+
rb_cairo_check_status (cairo_matrix_invert (_SELF));
|
149
|
+
return self;
|
150
|
+
}
|
151
|
+
|
152
|
+
static VALUE
|
153
|
+
cr_matrix_multiply (VALUE self, VALUE other)
|
154
|
+
{
|
155
|
+
cairo_matrix_multiply (_SELF, _SELF, RVAL2CRMATRIX (other));
|
156
|
+
return self;
|
157
|
+
}
|
158
|
+
|
159
|
+
static VALUE
|
160
|
+
cr_matrix_transform_distance (VALUE self, VALUE dx, VALUE dy)
|
161
|
+
{
|
162
|
+
double pair[2];
|
163
|
+
pair[0] = NUM2DBL (dx);
|
164
|
+
pair[1] = NUM2DBL (dy);
|
165
|
+
cairo_matrix_transform_distance (_SELF, pair, pair + 1);
|
166
|
+
return rb_cairo__float_array (pair, 2);
|
167
|
+
}
|
168
|
+
|
169
|
+
static VALUE
|
170
|
+
cr_matrix_transform_point (VALUE self, VALUE x, VALUE y)
|
171
|
+
{
|
172
|
+
double pair[2];
|
173
|
+
pair[0] = NUM2DBL (x);
|
174
|
+
pair[1] = NUM2DBL (y);
|
175
|
+
cairo_matrix_transform_point (_SELF, pair, pair + 1);
|
176
|
+
return rb_cairo__float_array (pair, 2);
|
177
|
+
}
|
178
|
+
|
179
|
+
|
180
|
+
/* Accessors */
|
181
|
+
static VALUE
|
182
|
+
cr_matrix_get_xx (VALUE self)
|
183
|
+
{
|
184
|
+
return rb_float_new (_SELF->xx);
|
185
|
+
}
|
186
|
+
|
187
|
+
static VALUE
|
188
|
+
cr_matrix_set_xx (VALUE self, VALUE xx)
|
189
|
+
{
|
190
|
+
_SELF->xx = NUM2DBL (xx);
|
191
|
+
return Qnil;
|
192
|
+
}
|
193
|
+
|
194
|
+
static VALUE
|
195
|
+
cr_matrix_get_yx (VALUE self)
|
196
|
+
{
|
197
|
+
return rb_float_new (_SELF->yx);
|
198
|
+
}
|
199
|
+
|
200
|
+
static VALUE
|
201
|
+
cr_matrix_set_yx (VALUE self, VALUE yx)
|
202
|
+
{
|
203
|
+
_SELF->yx = NUM2DBL (yx);
|
204
|
+
return Qnil;
|
205
|
+
}
|
206
|
+
|
207
|
+
static VALUE
|
208
|
+
cr_matrix_get_xy (VALUE self)
|
209
|
+
{
|
210
|
+
return rb_float_new (_SELF->xy);
|
211
|
+
}
|
212
|
+
|
213
|
+
static VALUE
|
214
|
+
cr_matrix_set_xy (VALUE self, VALUE xy)
|
215
|
+
{
|
216
|
+
_SELF->xy = NUM2DBL (xy);
|
217
|
+
return Qnil;
|
218
|
+
}
|
219
|
+
|
220
|
+
static VALUE
|
221
|
+
cr_matrix_get_yy (VALUE self)
|
222
|
+
{
|
223
|
+
return rb_float_new (_SELF->yy);
|
224
|
+
}
|
225
|
+
|
226
|
+
static VALUE
|
227
|
+
cr_matrix_set_yy (VALUE self, VALUE yy)
|
228
|
+
{
|
229
|
+
_SELF->yy = NUM2DBL (yy);
|
230
|
+
return Qnil;
|
231
|
+
}
|
232
|
+
|
233
|
+
static VALUE
|
234
|
+
cr_matrix_get_x0 (VALUE self)
|
235
|
+
{
|
236
|
+
return rb_float_new (_SELF->x0);
|
237
|
+
}
|
238
|
+
|
239
|
+
static VALUE
|
240
|
+
cr_matrix_set_x0 (VALUE self, VALUE x0)
|
241
|
+
{
|
242
|
+
_SELF->x0 = NUM2DBL (x0);
|
243
|
+
return Qnil;
|
244
|
+
}
|
245
|
+
|
246
|
+
static VALUE
|
247
|
+
cr_matrix_get_y0 (VALUE self)
|
248
|
+
{
|
249
|
+
return rb_float_new (_SELF->y0);
|
250
|
+
}
|
251
|
+
|
252
|
+
static VALUE
|
253
|
+
cr_matrix_set_y0 (VALUE self, VALUE y0)
|
254
|
+
{
|
255
|
+
_SELF->y0 = NUM2DBL (y0);
|
256
|
+
return Qnil;
|
257
|
+
}
|
258
|
+
|
259
|
+
/* Utilities */
|
260
|
+
static VALUE
|
261
|
+
cr_matrix_set (VALUE self,
|
262
|
+
VALUE xx, VALUE yx,
|
263
|
+
VALUE xy, VALUE yy,
|
264
|
+
VALUE x0, VALUE y0)
|
265
|
+
{
|
266
|
+
cairo_matrix_init (_SELF,
|
267
|
+
NUM2DBL (xx), NUM2DBL (yx),
|
268
|
+
NUM2DBL (xy), NUM2DBL (yy),
|
269
|
+
NUM2DBL (x0), NUM2DBL (y0));
|
270
|
+
return self;
|
271
|
+
}
|
272
|
+
|
273
|
+
static VALUE
|
274
|
+
cr_matrix_to_a (VALUE self)
|
275
|
+
{
|
276
|
+
cairo_matrix_t *matrix = _SELF;
|
277
|
+
double affine[6];
|
278
|
+
affine[0] = matrix->xx;
|
279
|
+
affine[1] = matrix->yx;
|
280
|
+
affine[2] = matrix->xy;
|
281
|
+
affine[3] = matrix->yy;
|
282
|
+
affine[4] = matrix->x0;
|
283
|
+
affine[5] = matrix->y0;
|
284
|
+
return rb_cairo__float_array (affine, 6);
|
285
|
+
}
|
286
|
+
|
287
|
+
static VALUE
|
288
|
+
cr_matrix_to_s(VALUE self)
|
289
|
+
{
|
290
|
+
VALUE ret;
|
291
|
+
|
292
|
+
ret = rb_str_new2 ("#<");
|
293
|
+
rb_str_cat2 (ret, rb_class2name (CLASS_OF (self)));
|
294
|
+
rb_str_cat2 (ret, ":");
|
295
|
+
rb_str_concat (ret, rb_inspect (cr_matrix_to_a (self)));
|
296
|
+
rb_str_cat2 (ret, ">");
|
297
|
+
|
298
|
+
return ret;
|
299
|
+
}
|
300
|
+
|
301
|
+
static VALUE
|
302
|
+
cr_matrix_equal (VALUE self, VALUE other)
|
303
|
+
{
|
304
|
+
if (!rb_cairo__is_kind_of (other, rb_cCairo_Matrix))
|
305
|
+
return Qfalse;
|
306
|
+
|
307
|
+
return rb_funcall (cr_matrix_to_a (self),
|
308
|
+
cr_id_equal, 1,
|
309
|
+
cr_matrix_to_a (other));
|
310
|
+
}
|
311
|
+
|
312
|
+
void
|
313
|
+
Init_cairo_matrix (void)
|
314
|
+
{
|
315
|
+
cr_id_equal = rb_intern ("==");
|
316
|
+
|
317
|
+
rb_cCairo_Matrix =
|
318
|
+
rb_define_class_under (rb_mCairo, "Matrix", rb_cObject);
|
319
|
+
|
320
|
+
rb_define_alloc_func (rb_cCairo_Matrix, cr_matrix_allocate);
|
321
|
+
|
322
|
+
rb_define_singleton_method (rb_cCairo_Matrix, "identity",
|
323
|
+
cr_matrix_init_identity, 0);
|
324
|
+
rb_define_singleton_method (rb_cCairo_Matrix, "translate",
|
325
|
+
cr_matrix_init_translate, 2);
|
326
|
+
rb_define_singleton_method (rb_cCairo_Matrix, "scale",
|
327
|
+
cr_matrix_init_scale, 2);
|
328
|
+
rb_define_singleton_method (rb_cCairo_Matrix, "rotate",
|
329
|
+
cr_matrix_init_rotate, 1);
|
330
|
+
|
331
|
+
rb_define_method (rb_cCairo_Matrix, "initialize", cr_matrix_initialize, 6);
|
332
|
+
|
333
|
+
rb_define_method (rb_cCairo_Matrix, "identity!", cr_matrix_identity, 0);
|
334
|
+
rb_define_method (rb_cCairo_Matrix, "translate!", cr_matrix_translate, 2);
|
335
|
+
rb_define_method (rb_cCairo_Matrix, "scale!", cr_matrix_scale, 2);
|
336
|
+
rb_define_method (rb_cCairo_Matrix, "rotate!", cr_matrix_rotate, 1);
|
337
|
+
rb_define_method (rb_cCairo_Matrix, "invert!", cr_matrix_invert, 0);
|
338
|
+
rb_define_method (rb_cCairo_Matrix, "multiply!", cr_matrix_multiply, 1);
|
339
|
+
rb_define_method (rb_cCairo_Matrix, "transform_distance",
|
340
|
+
cr_matrix_transform_distance, 2);
|
341
|
+
rb_define_method (rb_cCairo_Matrix, "transform_point",
|
342
|
+
cr_matrix_transform_point, 2);
|
343
|
+
|
344
|
+
/* Accessors */
|
345
|
+
rb_define_method (rb_cCairo_Matrix, "xx", cr_matrix_get_xx, 0);
|
346
|
+
rb_define_method (rb_cCairo_Matrix, "set_xx", cr_matrix_set_xx, 1);
|
347
|
+
rb_define_method (rb_cCairo_Matrix, "yx", cr_matrix_get_yx, 0);
|
348
|
+
rb_define_method (rb_cCairo_Matrix, "set_yx", cr_matrix_set_yx, 1);
|
349
|
+
rb_define_method (rb_cCairo_Matrix, "xy", cr_matrix_get_xy, 0);
|
350
|
+
rb_define_method (rb_cCairo_Matrix, "set_xy", cr_matrix_set_xy, 1);
|
351
|
+
rb_define_method (rb_cCairo_Matrix, "yy", cr_matrix_get_yy, 0);
|
352
|
+
rb_define_method (rb_cCairo_Matrix, "set_yy", cr_matrix_set_yy, 1);
|
353
|
+
rb_define_method (rb_cCairo_Matrix, "x0", cr_matrix_get_x0, 0);
|
354
|
+
rb_define_method (rb_cCairo_Matrix, "set_x0", cr_matrix_set_x0, 1);
|
355
|
+
rb_define_method (rb_cCairo_Matrix, "y0", cr_matrix_get_y0, 0);
|
356
|
+
rb_define_method (rb_cCairo_Matrix, "set_y0", cr_matrix_set_y0, 1);
|
357
|
+
|
358
|
+
/* Utilities */
|
359
|
+
rb_define_method (rb_cCairo_Matrix, "set", cr_matrix_set, 6);
|
360
|
+
rb_define_method (rb_cCairo_Matrix, "to_a", cr_matrix_to_a, 0);
|
361
|
+
rb_define_method (rb_cCairo_Matrix, "to_s", cr_matrix_to_s, 0);
|
362
|
+
rb_define_method (rb_cCairo_Matrix, "==", cr_matrix_equal, 1);
|
363
|
+
|
364
|
+
|
365
|
+
RB_CAIRO_DEF_SETTERS (rb_cCairo_Matrix);
|
366
|
+
}
|