cairo 1.4.1 → 1.5.0
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/ChangeLog +259 -0
- data/NEWS +32 -0
- data/README +5 -0
- data/Rakefile +88 -4
- data/misc/update-colors.rb +143 -0
- data/samples/.#blur.rb.1.1 +36 -0
- data/samples/blur.rb +47 -0
- data/samples/pac.rb +22 -28
- data/samples/pac2.rb +26 -32
- data/samples/png.rb +34 -31
- data/samples/scalable.rb +24 -26
- data/samples/text-on-path.rb +6 -7
- data/samples/text2.rb +16 -18
- data/src/cairo.def +31 -0
- data/src/lib/cairo.rb +25 -7
- 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 +16 -2
- data/src/lib/cairo/context/blur.rb +45 -0
- data/src/lib/cairo/context/circle.rb +2 -2
- data/src/lib/cairo/context/color.rb +11 -0
- data/src/lib/cairo/context/path.rb +17 -28
- data/src/lib/cairo/path.rb +15 -0
- data/src/lib/cairo/point.rb +7 -0
- data/src/rb_cairo.c +8 -17
- data/src/rb_cairo.h +44 -3
- data/src/rb_cairo_constants.c +129 -137
- data/src/rb_cairo_context.c +224 -112
- data/src/rb_cairo_font_extents.c +4 -3
- data/src/rb_cairo_font_face.c +3 -10
- data/src/rb_cairo_font_options.c +6 -4
- data/src/rb_cairo_glyph.c +4 -3
- data/src/rb_cairo_matrix.c +97 -4
- data/src/rb_cairo_path.c +408 -24
- data/src/rb_cairo_pattern.c +130 -70
- data/src/rb_cairo_private.c +40 -13
- data/src/rb_cairo_private.h +40 -2
- data/src/rb_cairo_scaled_font.c +3 -10
- data/src/rb_cairo_surface.c +172 -50
- data/src/rb_cairo_text_extents.c +3 -2
- metadata +15 -5
- data/src/lib/cairo/context/quad.rb +0 -19
@@ -0,0 +1,21 @@
|
|
1
|
+
module Cairo
|
2
|
+
define_constants = Proc.new do |const_module, prefix, target|
|
3
|
+
target ||= self
|
4
|
+
const_module.constants.each do |const_name|
|
5
|
+
target.const_set([prefix, const_name].compact.join("_"),
|
6
|
+
const_module.const_get(const_name))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
%w(operator antialias fill_rule line_cap line_join font_slant
|
11
|
+
font_weight subpixel_order hint_style hint_metrics content
|
12
|
+
format extend filter).each do |name|
|
13
|
+
module_name = name.split(/_/).collect {|component| component.capitalize}.join
|
14
|
+
define_constants.call(const_get(module_name), name.upcase)
|
15
|
+
end
|
16
|
+
|
17
|
+
define_constants.call(PathDataType, "PATH")
|
18
|
+
define_constants.call(PathDataType, nil, Path)
|
19
|
+
define_constants.call(SVGVersion, nil, SVGSurface)
|
20
|
+
define_constants.call(SVGVersion, "SVG")
|
21
|
+
end
|
data/src/lib/cairo/context.rb
CHANGED
@@ -1,13 +1,27 @@
|
|
1
|
-
require 'cairo/context/quad'
|
2
1
|
require 'cairo/context/rectangle'
|
3
2
|
require 'cairo/context/circle'
|
4
3
|
require 'cairo/context/path'
|
4
|
+
require 'cairo/context/blur'
|
5
|
+
require 'cairo/context/color'
|
5
6
|
|
6
7
|
module Cairo
|
7
8
|
class Context
|
8
|
-
include Quad
|
9
9
|
include Rectangle
|
10
10
|
include Circle
|
11
11
|
include Path
|
12
|
+
include Blur
|
13
|
+
include Color
|
14
|
+
|
15
|
+
def stroke_preserve(&block)
|
16
|
+
stroke(true, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def fill_preserve(&block)
|
20
|
+
fill(true, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def clip_preserve(&block)
|
24
|
+
clip(true, &block)
|
25
|
+
end
|
12
26
|
end
|
13
27
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Cairo
|
2
|
+
class Context
|
3
|
+
module Blur
|
4
|
+
def pseudo_blur(radius=3, &block)
|
5
|
+
raise ArgumentError, "should specify block" if block.nil?
|
6
|
+
pattern = push_group(Cairo::CONTENT_COLOR_ALPHA, false, &block)
|
7
|
+
|
8
|
+
save do
|
9
|
+
set_source(pattern)
|
10
|
+
paint(0.5)
|
11
|
+
end
|
12
|
+
|
13
|
+
1.step(radius, 1) do |i|
|
14
|
+
opacity = 0.075 - 0.005 * i
|
15
|
+
next if opacity <= 0
|
16
|
+
5.downto(1) do |ratio|
|
17
|
+
r = i / ratio.to_f
|
18
|
+
r_13 = r / 3.0
|
19
|
+
r_23 = 2 * r_13
|
20
|
+
[
|
21
|
+
[-r, 0],
|
22
|
+
[-r_23, r_23],
|
23
|
+
[-r_23, r_13],
|
24
|
+
[0, r],
|
25
|
+
[r_13, r_23],
|
26
|
+
[r_23, r_23],
|
27
|
+
[r, 0],
|
28
|
+
[r_23, -r_13],
|
29
|
+
[r_23, -r_23],
|
30
|
+
[0, -r],
|
31
|
+
[-r_13, -r_23],
|
32
|
+
[-r_23, -r_23],
|
33
|
+
].each do |x, y|
|
34
|
+
save do
|
35
|
+
translate(x, y)
|
36
|
+
set_source(pattern)
|
37
|
+
paint(opacity)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -1,32 +1,21 @@
|
|
1
1
|
module Cairo
|
2
2
|
class Context
|
3
3
|
module Path
|
4
|
-
module Point
|
5
|
-
module_function
|
6
|
-
def distance(a, b)
|
7
|
-
ax, ay = a
|
8
|
-
bx, by = b
|
9
|
-
Math.sqrt((bx - ax) ** 2 + (by - ay) ** 2)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
4
|
def transform_path(path, &block)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
close_path
|
26
|
-
end
|
5
|
+
transformed_path = Cairo::Path.new
|
6
|
+
path.each do |type, points|
|
7
|
+
case type
|
8
|
+
when PATH_MOVE_TO
|
9
|
+
transformed_path.move_to(*points.collect(&block).flatten)
|
10
|
+
when PATH_LINE_TO
|
11
|
+
transformed_path.line_to(*points.collect(&block).flatten)
|
12
|
+
when PATH_CURVE_TO
|
13
|
+
transformed_path.curve_to(*points.collect(&block).flatten)
|
14
|
+
when PATH_CLOSE_PATH
|
15
|
+
transformed_path.close
|
27
16
|
end
|
28
|
-
copy_path
|
29
17
|
end
|
18
|
+
transformed_path
|
30
19
|
end
|
31
20
|
|
32
21
|
def map_path_onto(path)
|
@@ -38,7 +27,7 @@ module Cairo
|
|
38
27
|
type = points = nil
|
39
28
|
path.each do |type, points|
|
40
29
|
i += 1
|
41
|
-
break if d
|
30
|
+
break if d < parameterized_path[i]
|
42
31
|
d -= parameterized_path[i]
|
43
32
|
case type
|
44
33
|
when PATH_MOVE_TO
|
@@ -110,12 +99,12 @@ module Cairo
|
|
110
99
|
when PATH_MOVE_TO
|
111
100
|
current_point = points[0]
|
112
101
|
when PATH_LINE_TO
|
113
|
-
result =
|
102
|
+
result = current_point.distance(points[0])
|
114
103
|
current_point = points[0]
|
115
104
|
when PATH_CURVE_TO
|
116
|
-
result =
|
117
|
-
result +=
|
118
|
-
result +=
|
105
|
+
result = current_point.distance(points[0])
|
106
|
+
result += points[0].distance(points[1])
|
107
|
+
result += points[1].distance(points[2])
|
119
108
|
current_point = points[2]
|
120
109
|
when PATH_CLOSE_PATH
|
121
110
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
|
3
|
+
module Cairo
|
4
|
+
class Path
|
5
|
+
extend Forwardable
|
6
|
+
methods = %w(new_path new_sub_path move_to line_to curve_to
|
7
|
+
arc arc_negative rel_move_to rel_line_to rel_curve_to
|
8
|
+
rectangle rounded_rectangle circle)
|
9
|
+
def_delegators :@context, *methods
|
10
|
+
|
11
|
+
def close
|
12
|
+
@context.close_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/src/rb_cairo.c
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
* Ruby Cairo Binding
|
4
4
|
*
|
5
5
|
* $Author: kou $
|
6
|
-
* $Date: 2007/
|
6
|
+
* $Date: 2007/05/23 02:26:24 $
|
7
7
|
*
|
8
8
|
* Copyright 2006-2007 Kouhei Sutou <kou@cozmixng.org>
|
9
9
|
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
@@ -15,22 +15,9 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
#include "rb_cairo.h"
|
18
|
+
#include "rb_cairo_private.h"
|
18
19
|
|
19
|
-
VALUE rb_mCairo;
|
20
|
-
|
21
|
-
extern void Init_cairo_context (void);
|
22
|
-
extern void Init_cairo_path (void);
|
23
|
-
extern void Init_cairo_matrix (void);
|
24
|
-
extern void Init_cairo_surface (void);
|
25
|
-
extern void Init_cairo_constants (void);
|
26
|
-
extern void Init_cairo_exception (void);
|
27
|
-
extern void Init_cairo_font (void);
|
28
|
-
extern void Init_cairo_font_extents (void);
|
29
|
-
extern void Init_cairo_font_options (void);
|
30
|
-
extern void Init_cairo_scaled_font (void);
|
31
|
-
extern void Init_cairo_text_extents (void);
|
32
|
-
extern void Init_cairo_pattern (void);
|
33
|
-
extern void Init_cairo_glyph (void);
|
20
|
+
VALUE rb_mCairo, rb_mCairo_Color, rb_cCairo_Color_Base;
|
34
21
|
|
35
22
|
static ID id__add_one_arg_setter;
|
36
23
|
|
@@ -71,8 +58,12 @@ Init_cairo ()
|
|
71
58
|
|
72
59
|
rb_define_const (rb_mCairo, "BINDINGS_VERSION",
|
73
60
|
rb_ary_new3 (4,
|
74
|
-
INT2FIX (1), INT2FIX (
|
61
|
+
INT2FIX (1), INT2FIX (5), INT2FIX (0), Qnil));
|
75
62
|
|
63
|
+
rb_mCairo_Color = rb_const_get (rb_mCairo, rb_intern ("Color"));
|
64
|
+
rb_cCairo_Color_Base = rb_const_get (rb_mCairo_Color, rb_intern ("Base"));
|
65
|
+
|
66
|
+
Init_cairo_private ();
|
76
67
|
Init_cairo_constants ();
|
77
68
|
|
78
69
|
Init_cairo_context ();
|
data/src/rb_cairo.h
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
* Ruby Cairo Binding
|
4
4
|
*
|
5
5
|
* $Author: kou $
|
6
|
-
* $Date: 2007/
|
6
|
+
* $Date: 2007/05/22 11:25:39 $
|
7
7
|
*
|
8
8
|
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
9
9
|
* Copyright 2004-2005 MenTaLguY <mental@rydia.com>
|
@@ -30,6 +30,12 @@
|
|
30
30
|
# include <cairo-svg.h>
|
31
31
|
#endif
|
32
32
|
|
33
|
+
#if CAIRO_HAS_WIN32_SURFACE
|
34
|
+
# define OpenFile OpenFile_win32
|
35
|
+
# include <cairo-win32.h>
|
36
|
+
# undef OpenFile
|
37
|
+
#endif
|
38
|
+
|
33
39
|
#define CAIRO_CHECK_VERSION(major, minor, micro) \
|
34
40
|
(CAIRO_VERSION_MAJOR > (major) || \
|
35
41
|
(CAIRO_VERSION_MAJOR == (major) && CAIRO_VERSION_MINOR > (minor)) || \
|
@@ -50,7 +56,13 @@
|
|
50
56
|
|
51
57
|
RUBY_CAIRO_VAR VALUE rb_mCairo;
|
52
58
|
RUBY_CAIRO_VAR VALUE rb_cCairo_Context;
|
59
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_Point;
|
53
60
|
RUBY_CAIRO_VAR VALUE rb_cCairo_Path;
|
61
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_PathData;
|
62
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_PathMoveTo;
|
63
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_PathLineTo;
|
64
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_PathCurveTo;
|
65
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_PathClosePath;
|
54
66
|
RUBY_CAIRO_VAR VALUE rb_cCairo_Matrix;
|
55
67
|
RUBY_CAIRO_VAR VALUE rb_cCairo_Pattern;
|
56
68
|
RUBY_CAIRO_VAR VALUE rb_cCairo_SolidPattern;
|
@@ -65,6 +77,35 @@ RUBY_CAIRO_VAR VALUE rb_cCairo_ScaledFont;
|
|
65
77
|
RUBY_CAIRO_VAR VALUE rb_cCairo_TextExtents;
|
66
78
|
RUBY_CAIRO_VAR VALUE rb_cCairo_Glyph;
|
67
79
|
RUBY_CAIRO_VAR VALUE rb_cCairo_Surface;
|
80
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_ImageSurface;
|
81
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_PDFSurface;
|
82
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_PSSurface;
|
83
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_SVGSurface;
|
84
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_WIN32Surface;
|
85
|
+
|
86
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_Operator;
|
87
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_Antialias;
|
88
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_FillRule;
|
89
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_LineCap;
|
90
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_LineJoin;
|
91
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_FontSlant;
|
92
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_FontWeight;
|
93
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_SubpixelOrder;
|
94
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_HintStyle;
|
95
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_HintMetrics;
|
96
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_FontType;
|
97
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_PathDataType;
|
98
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_Content;
|
99
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_SurfaceType;
|
100
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_Format;
|
101
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_PatternType;
|
102
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_Extend;
|
103
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_Filter;
|
104
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_SVGVersion;
|
105
|
+
|
106
|
+
RUBY_CAIRO_VAR VALUE rb_mCairo_Color;
|
107
|
+
RUBY_CAIRO_VAR VALUE rb_cCairo_Color_Base;
|
108
|
+
|
68
109
|
|
69
110
|
#define RVAL2CRCONTEXT(obj) (rb_cairo_context_from_ruby_object(obj))
|
70
111
|
#define CRCONTEXT2RVAL(cr) (rb_cairo_context_to_ruby_object(cr))
|
@@ -76,7 +117,7 @@ RUBY_CAIRO_VAR VALUE rb_cCairo_Surface;
|
|
76
117
|
#define CRMATRIX2RVAL(matrix) (rb_cairo_matrix_to_ruby_object(matrix))
|
77
118
|
|
78
119
|
#define RVAL2CRPATTERN(obj) (rb_cairo_pattern_from_ruby_object(obj))
|
79
|
-
#define CRPATTERN2RVAL(pattern
|
120
|
+
#define CRPATTERN2RVAL(pattern) (rb_cairo_pattern_to_ruby_object(pattern))
|
80
121
|
|
81
122
|
#define RVAL2CRFONTFACE(obj) (rb_cairo_font_face_from_ruby_object(obj))
|
82
123
|
#define CRFONTFACE2RVAL(face) (rb_cairo_font_face_to_ruby_object(face))
|
@@ -109,7 +150,7 @@ cairo_matrix_t *rb_cairo_matrix_from_ruby_object (VALUE obj);
|
|
109
150
|
VALUE rb_cairo_matrix_to_ruby_object (cairo_matrix_t *matrix);
|
110
151
|
|
111
152
|
cairo_pattern_t *rb_cairo_pattern_from_ruby_object (VALUE obj);
|
112
|
-
VALUE rb_cairo_pattern_to_ruby_object (cairo_pattern_t *pat
|
153
|
+
VALUE rb_cairo_pattern_to_ruby_object (cairo_pattern_t *pat);
|
113
154
|
|
114
155
|
cairo_font_face_t *rb_cairo_font_face_from_ruby_object (VALUE obj);
|
115
156
|
VALUE rb_cairo_font_face_to_ruby_object (cairo_font_face_t *face);
|
data/src/rb_cairo_constants.c
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
* Ruby Cairo Binding
|
4
4
|
*
|
5
5
|
* $Author: kou $
|
6
|
-
* $Date: 2007/
|
6
|
+
* $Date: 2007/05/20 09:18:49 $
|
7
7
|
*
|
8
8
|
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
9
9
|
* Copyright 2004-2005 MenTaLguY <mental@rydia.com>
|
@@ -14,6 +14,24 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
#include "rb_cairo.h"
|
17
|
+
#include "rb_cairo_private.h"
|
18
|
+
|
19
|
+
VALUE rb_mCairo_Operator;
|
20
|
+
VALUE rb_mCairo_Antialias;
|
21
|
+
VALUE rb_mCairo_FillRule;
|
22
|
+
VALUE rb_mCairo_LineCap;
|
23
|
+
VALUE rb_mCairo_LineJoin;
|
24
|
+
VALUE rb_mCairo_FontSlant;
|
25
|
+
VALUE rb_mCairo_FontWeight;
|
26
|
+
VALUE rb_mCairo_SubpixelOrder;
|
27
|
+
VALUE rb_mCairo_HintStyle;
|
28
|
+
VALUE rb_mCairo_HintMetrics;
|
29
|
+
VALUE rb_mCairo_PathDataType;
|
30
|
+
VALUE rb_mCairo_Content;
|
31
|
+
VALUE rb_mCairo_Format;
|
32
|
+
VALUE rb_mCairo_Extend;
|
33
|
+
VALUE rb_mCairo_Filter;
|
34
|
+
VALUE rb_mCairo_SVGVersion;
|
17
35
|
|
18
36
|
#define CAIRO_OPERATOR_MIN CAIRO_OPERATOR_CLEAR
|
19
37
|
#define CAIRO_OPERATOR_MAX CAIRO_OPERATOR_SATURATE
|
@@ -63,23 +81,28 @@
|
|
63
81
|
#define CAIRO_SVG_VERSION_MIN CAIRO_SVG_VERSION_1_1
|
64
82
|
#define CAIRO_SVG_VERSION_MAX CAIRO_SVG_VERSION_1_2
|
65
83
|
|
66
|
-
#define DEFINE_RVAL2ENUM(name, const_name)
|
67
|
-
cairo_ ## name ## _t
|
68
|
-
rb_cairo_ ## name ## _from_ruby_object (VALUE rb_ ## name)
|
69
|
-
{
|
70
|
-
cairo_ ## name ## _t name;
|
71
|
-
|
72
|
-
if (
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
84
|
+
#define DEFINE_RVAL2ENUM(name, const_name) \
|
85
|
+
cairo_ ## name ## _t \
|
86
|
+
rb_cairo_ ## name ## _from_ruby_object (VALUE rb_ ## name) \
|
87
|
+
{ \
|
88
|
+
cairo_ ## name ## _t name; \
|
89
|
+
\
|
90
|
+
if (!rb_cairo__is_kind_of (rb_ ## name, rb_cNumeric)) \
|
91
|
+
rb_ ## name = rb_cairo__const_get (rb_ ## name, \
|
92
|
+
# const_name "_"); \
|
93
|
+
\
|
94
|
+
name = FIX2INT (rb_ ## name); \
|
95
|
+
if (name < CAIRO_ ## const_name ## _MIN || \
|
96
|
+
name > CAIRO_ ## const_name ## _MAX) \
|
97
|
+
{ \
|
98
|
+
rb_raise (rb_eArgError, \
|
99
|
+
"invalid %s: %d (expect %d <= %s <= %d)", \
|
100
|
+
#name, name, \
|
101
|
+
CAIRO_ ## const_name ## _MIN, \
|
102
|
+
#name, \
|
103
|
+
CAIRO_ ## const_name ## _MAX); \
|
104
|
+
} \
|
105
|
+
return name; \
|
83
106
|
}
|
84
107
|
|
85
108
|
DEFINE_RVAL2ENUM(operator, OPERATOR)
|
@@ -105,238 +128,207 @@ void
|
|
105
128
|
Init_cairo_constants (void)
|
106
129
|
{
|
107
130
|
/* cairo_operator_t */
|
108
|
-
|
131
|
+
rb_mCairo_Operator = rb_define_module_under (rb_mCairo, "Operator");
|
132
|
+
rb_define_const (rb_mCairo_Operator, "CLEAR",
|
109
133
|
INT2FIX (CAIRO_OPERATOR_CLEAR));
|
110
134
|
|
111
|
-
rb_define_const (
|
135
|
+
rb_define_const (rb_mCairo_Operator, "SOURCE",
|
112
136
|
INT2FIX (CAIRO_OPERATOR_SOURCE));
|
113
|
-
rb_define_const (
|
137
|
+
rb_define_const (rb_mCairo_Operator, "OVER",
|
114
138
|
INT2FIX (CAIRO_OPERATOR_OVER));
|
115
|
-
rb_define_const (
|
139
|
+
rb_define_const (rb_mCairo_Operator, "IN",
|
116
140
|
INT2FIX (CAIRO_OPERATOR_IN));
|
117
|
-
rb_define_const (
|
141
|
+
rb_define_const (rb_mCairo_Operator, "OUT",
|
118
142
|
INT2FIX (CAIRO_OPERATOR_OUT));
|
119
|
-
rb_define_const (
|
143
|
+
rb_define_const (rb_mCairo_Operator, "ATOP",
|
120
144
|
INT2FIX (CAIRO_OPERATOR_ATOP));
|
121
|
-
|
122
|
-
rb_define_const (
|
145
|
+
|
146
|
+
rb_define_const (rb_mCairo_Operator, "DEST",
|
123
147
|
INT2FIX (CAIRO_OPERATOR_DEST));
|
124
|
-
rb_define_const (
|
148
|
+
rb_define_const (rb_mCairo_Operator, "DEST_OVER",
|
125
149
|
INT2FIX (CAIRO_OPERATOR_DEST_OVER));
|
126
|
-
rb_define_const (
|
150
|
+
rb_define_const (rb_mCairo_Operator, "DEST_IN",
|
127
151
|
INT2FIX (CAIRO_OPERATOR_DEST_IN));
|
128
|
-
rb_define_const (
|
152
|
+
rb_define_const (rb_mCairo_Operator, "DEST_OUT",
|
129
153
|
INT2FIX (CAIRO_OPERATOR_DEST_OUT));
|
130
|
-
rb_define_const (
|
154
|
+
rb_define_const (rb_mCairo_Operator, "DEST_ATOP",
|
131
155
|
INT2FIX (CAIRO_OPERATOR_DEST_ATOP));
|
132
156
|
|
133
|
-
rb_define_const (
|
157
|
+
rb_define_const (rb_mCairo_Operator, "XOR",
|
134
158
|
INT2FIX (CAIRO_OPERATOR_XOR));
|
135
|
-
rb_define_const (
|
159
|
+
rb_define_const (rb_mCairo_Operator, "ADD",
|
136
160
|
INT2FIX (CAIRO_OPERATOR_ADD));
|
137
|
-
rb_define_const (
|
161
|
+
rb_define_const (rb_mCairo_Operator, "SATURATE",
|
138
162
|
INT2FIX (CAIRO_OPERATOR_SATURATE));
|
139
163
|
|
140
|
-
|
164
|
+
|
141
165
|
/* cairo_antialias_t */
|
142
|
-
|
166
|
+
rb_mCairo_Antialias = rb_define_module_under (rb_mCairo, "Antialias");
|
167
|
+
rb_define_const (rb_mCairo_Antialias, "DEFAULT",
|
143
168
|
INT2FIX (CAIRO_ANTIALIAS_DEFAULT));
|
144
|
-
rb_define_const (
|
169
|
+
rb_define_const (rb_mCairo_Antialias, "NONE",
|
145
170
|
INT2FIX (CAIRO_ANTIALIAS_NONE));
|
146
|
-
rb_define_const (
|
171
|
+
rb_define_const (rb_mCairo_Antialias, "GRAY",
|
147
172
|
INT2FIX (CAIRO_ANTIALIAS_GRAY));
|
148
|
-
rb_define_const (
|
173
|
+
rb_define_const (rb_mCairo_Antialias, "SUBPIXEL",
|
149
174
|
INT2FIX (CAIRO_ANTIALIAS_SUBPIXEL));
|
150
175
|
|
151
176
|
|
152
177
|
/* cairo_fill_rule_t */
|
153
|
-
|
178
|
+
rb_mCairo_FillRule = rb_define_module_under (rb_mCairo, "FillRule");
|
179
|
+
rb_define_const (rb_mCairo_FillRule, "WINDING",
|
154
180
|
INT2FIX (CAIRO_FILL_RULE_WINDING));
|
155
|
-
rb_define_const (
|
181
|
+
rb_define_const (rb_mCairo_FillRule, "EVEN_ODD",
|
156
182
|
INT2FIX (CAIRO_FILL_RULE_EVEN_ODD));
|
157
183
|
|
158
184
|
|
159
185
|
/* cairo_line_cap_t */
|
160
|
-
|
186
|
+
rb_mCairo_LineCap = rb_define_module_under (rb_mCairo, "LineCap");
|
187
|
+
rb_define_const (rb_mCairo_LineCap, "BUTT",
|
161
188
|
INT2FIX (CAIRO_LINE_CAP_BUTT));
|
162
|
-
rb_define_const (
|
189
|
+
rb_define_const (rb_mCairo_LineCap, "ROUND",
|
163
190
|
INT2FIX (CAIRO_LINE_CAP_ROUND));
|
164
|
-
rb_define_const (
|
191
|
+
rb_define_const (rb_mCairo_LineCap, "SQUARE",
|
165
192
|
INT2FIX (CAIRO_LINE_CAP_SQUARE));
|
166
193
|
|
167
194
|
|
168
195
|
/* cairo_line_join_t */
|
169
|
-
|
196
|
+
rb_mCairo_LineJoin = rb_define_module_under (rb_mCairo, "LineJoin");
|
197
|
+
rb_define_const (rb_mCairo_LineJoin, "MITER",
|
170
198
|
INT2FIX (CAIRO_LINE_JOIN_MITER));
|
171
|
-
rb_define_const (
|
199
|
+
rb_define_const (rb_mCairo_LineJoin, "ROUND",
|
172
200
|
INT2FIX (CAIRO_LINE_JOIN_ROUND));
|
173
|
-
rb_define_const (
|
201
|
+
rb_define_const (rb_mCairo_LineJoin, "BEVEL",
|
174
202
|
INT2FIX (CAIRO_LINE_JOIN_BEVEL));
|
175
203
|
|
176
204
|
|
177
205
|
/* cairo_font_slant_t */
|
178
|
-
|
206
|
+
rb_mCairo_FontSlant = rb_define_module_under (rb_mCairo, "FontSlant");
|
207
|
+
rb_define_const (rb_mCairo_FontSlant, "NORMAL",
|
179
208
|
INT2FIX (CAIRO_FONT_SLANT_NORMAL));
|
180
|
-
rb_define_const (
|
209
|
+
rb_define_const (rb_mCairo_FontSlant, "ITALIC",
|
181
210
|
INT2FIX (CAIRO_FONT_SLANT_ITALIC));
|
182
|
-
rb_define_const (
|
211
|
+
rb_define_const (rb_mCairo_FontSlant, "OBLIQUE",
|
183
212
|
INT2FIX (CAIRO_FONT_SLANT_OBLIQUE));
|
184
213
|
|
185
214
|
|
186
215
|
/* cairo_font_weight_t */
|
187
|
-
|
216
|
+
rb_mCairo_FontWeight = rb_define_module_under (rb_mCairo, "FontWeight");
|
217
|
+
rb_define_const (rb_mCairo_FontWeight, "NORMAL",
|
188
218
|
INT2FIX (CAIRO_FONT_WEIGHT_NORMAL));
|
189
|
-
rb_define_const (
|
219
|
+
rb_define_const (rb_mCairo_FontWeight, "BOLD",
|
190
220
|
INT2FIX (CAIRO_FONT_WEIGHT_BOLD));
|
191
|
-
|
221
|
+
|
192
222
|
|
193
223
|
/* cairo_subpixel_order_t */
|
194
|
-
|
224
|
+
rb_mCairo_SubpixelOrder = rb_define_module_under (rb_mCairo, "SubpixelOrder");
|
225
|
+
rb_define_const (rb_mCairo_SubpixelOrder, "DEFAULT",
|
195
226
|
INT2FIX (CAIRO_SUBPIXEL_ORDER_DEFAULT));
|
196
|
-
rb_define_const (
|
227
|
+
rb_define_const (rb_mCairo_SubpixelOrder, "RGB",
|
197
228
|
INT2FIX (CAIRO_SUBPIXEL_ORDER_RGB));
|
198
|
-
rb_define_const (
|
229
|
+
rb_define_const (rb_mCairo_SubpixelOrder, "BGR",
|
199
230
|
INT2FIX (CAIRO_SUBPIXEL_ORDER_BGR));
|
200
|
-
rb_define_const (
|
231
|
+
rb_define_const (rb_mCairo_SubpixelOrder, "VRGB",
|
201
232
|
INT2FIX (CAIRO_SUBPIXEL_ORDER_VRGB));
|
202
|
-
rb_define_const (
|
233
|
+
rb_define_const (rb_mCairo_SubpixelOrder, "VBGR",
|
203
234
|
INT2FIX (CAIRO_SUBPIXEL_ORDER_VBGR));
|
204
|
-
|
235
|
+
|
205
236
|
|
206
237
|
/* cairo_hint_style_t */
|
207
|
-
|
238
|
+
rb_mCairo_HintStyle = rb_define_module_under (rb_mCairo, "HintStyle");
|
239
|
+
rb_define_const (rb_mCairo_HintStyle, "DEFAULT",
|
208
240
|
INT2FIX (CAIRO_HINT_STYLE_DEFAULT));
|
209
|
-
rb_define_const (
|
241
|
+
rb_define_const (rb_mCairo_HintStyle, "NONE",
|
210
242
|
INT2FIX (CAIRO_HINT_STYLE_NONE));
|
211
|
-
rb_define_const (
|
243
|
+
rb_define_const (rb_mCairo_HintStyle, "SLIGHT",
|
212
244
|
INT2FIX (CAIRO_HINT_STYLE_SLIGHT));
|
213
|
-
rb_define_const (
|
245
|
+
rb_define_const (rb_mCairo_HintStyle, "MEDIUM",
|
214
246
|
INT2FIX (CAIRO_HINT_STYLE_MEDIUM));
|
215
|
-
rb_define_const (
|
247
|
+
rb_define_const (rb_mCairo_HintStyle, "FULL",
|
216
248
|
INT2FIX (CAIRO_HINT_STYLE_FULL));
|
217
249
|
|
218
250
|
|
219
251
|
/* cairo_hint_metrics_t */
|
220
|
-
|
252
|
+
rb_mCairo_HintMetrics = rb_define_module_under (rb_mCairo, "HintMetrics");
|
253
|
+
rb_define_const (rb_mCairo_HintMetrics, "DEFAULT",
|
221
254
|
INT2FIX (CAIRO_HINT_METRICS_DEFAULT));
|
222
|
-
rb_define_const (
|
255
|
+
rb_define_const (rb_mCairo_HintMetrics, "ON",
|
223
256
|
INT2FIX (CAIRO_HINT_METRICS_ON));
|
224
|
-
rb_define_const (
|
257
|
+
rb_define_const (rb_mCairo_HintMetrics, "OFF",
|
225
258
|
INT2FIX (CAIRO_HINT_METRICS_OFF));
|
226
259
|
|
227
260
|
|
228
|
-
/* cairo_font_type_t */
|
229
|
-
rb_define_const (rb_mCairo, "FONT_TYPE_TOY", INT2FIX(CAIRO_FONT_TYPE_TOY));
|
230
|
-
rb_define_const (rb_mCairo, "FONT_TYPE_FT", INT2FIX(CAIRO_FONT_TYPE_FT));
|
231
|
-
rb_define_const (rb_mCairo, "FONT_TYPE_WIN32",
|
232
|
-
INT2FIX(CAIRO_FONT_TYPE_WIN32));
|
233
|
-
rb_define_const (rb_mCairo, "FONT_TYPE_ATSUI",
|
234
|
-
INT2FIX(CAIRO_FONT_TYPE_ATSUI));
|
235
|
-
|
236
|
-
|
237
261
|
/* cairo_path_data_type_t */
|
238
|
-
|
262
|
+
rb_mCairo_PathDataType = rb_define_module_under (rb_mCairo, "PathDataType");
|
263
|
+
rb_define_const (rb_mCairo_PathDataType, "MOVE_TO",
|
239
264
|
INT2FIX (CAIRO_PATH_MOVE_TO));
|
240
|
-
rb_define_const (
|
265
|
+
rb_define_const (rb_mCairo_PathDataType, "LINE_TO",
|
241
266
|
INT2FIX (CAIRO_PATH_LINE_TO));
|
242
|
-
rb_define_const (
|
267
|
+
rb_define_const (rb_mCairo_PathDataType, "CURVE_TO",
|
243
268
|
INT2FIX (CAIRO_PATH_CURVE_TO));
|
244
|
-
rb_define_const (
|
269
|
+
rb_define_const (rb_mCairo_PathDataType, "CLOSE_PATH",
|
245
270
|
INT2FIX (CAIRO_PATH_CLOSE_PATH));
|
246
271
|
|
247
272
|
|
248
273
|
/* cairo_content_t */
|
249
|
-
|
274
|
+
rb_mCairo_Content = rb_define_module_under (rb_mCairo, "Content");
|
275
|
+
rb_define_const (rb_mCairo_Content, "COLOR",
|
250
276
|
INT2FIX (CAIRO_CONTENT_COLOR));
|
251
|
-
rb_define_const (
|
277
|
+
rb_define_const (rb_mCairo_Content, "ALPHA",
|
252
278
|
INT2FIX (CAIRO_CONTENT_ALPHA));
|
253
|
-
rb_define_const (
|
279
|
+
rb_define_const (rb_mCairo_Content, "COLOR_ALPHA",
|
254
280
|
INT2FIX (CAIRO_CONTENT_COLOR_ALPHA));
|
255
281
|
|
256
282
|
|
257
|
-
/* cairo_surface_type_t */
|
258
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_IMAGE",
|
259
|
-
INT2FIX (CAIRO_SURFACE_TYPE_IMAGE));
|
260
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_PDF",
|
261
|
-
INT2FIX (CAIRO_SURFACE_TYPE_PDF));
|
262
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_PS",
|
263
|
-
INT2FIX (CAIRO_SURFACE_TYPE_PS));
|
264
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_XLIB",
|
265
|
-
INT2FIX (CAIRO_SURFACE_TYPE_XLIB));
|
266
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_XCB",
|
267
|
-
INT2FIX (CAIRO_SURFACE_TYPE_XCB));
|
268
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_GLITZ",
|
269
|
-
INT2FIX (CAIRO_SURFACE_TYPE_GLITZ));
|
270
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_QUARTZ",
|
271
|
-
INT2FIX (CAIRO_SURFACE_TYPE_QUARTZ));
|
272
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_WIN32",
|
273
|
-
INT2FIX (CAIRO_SURFACE_TYPE_WIN32));
|
274
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_BEOS",
|
275
|
-
INT2FIX (CAIRO_SURFACE_TYPE_BEOS));
|
276
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_DIRECTFB",
|
277
|
-
INT2FIX (CAIRO_SURFACE_TYPE_DIRECTFB));
|
278
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_SVG",
|
279
|
-
INT2FIX (CAIRO_SURFACE_TYPE_SVG));
|
280
|
-
#if CAIRO_CHECK_VERSION(1, 3, 0)
|
281
|
-
rb_define_const (rb_mCairo, "SURFACE_TYPE_OS2",
|
282
|
-
INT2FIX (CAIRO_SURFACE_TYPE_OS2));
|
283
|
-
#endif
|
284
|
-
|
285
283
|
/* cairo_format_t */
|
286
|
-
|
284
|
+
rb_mCairo_Format = rb_define_module_under (rb_mCairo, "Format");
|
285
|
+
rb_define_const (rb_mCairo_Format, "ARGB32",
|
287
286
|
INT2FIX (CAIRO_FORMAT_ARGB32));
|
288
|
-
rb_define_const (
|
287
|
+
rb_define_const (rb_mCairo_Format, "RGB24",
|
289
288
|
INT2FIX (CAIRO_FORMAT_RGB24));
|
290
|
-
rb_define_const (
|
289
|
+
rb_define_const (rb_mCairo_Format, "A8",
|
291
290
|
INT2FIX (CAIRO_FORMAT_A8));
|
292
|
-
rb_define_const (
|
291
|
+
rb_define_const (rb_mCairo_Format, "A1",
|
293
292
|
INT2FIX (CAIRO_FORMAT_A1));
|
294
293
|
#if !CAIRO_CHECK_VERSION(1, 3, 0)
|
295
|
-
rb_define_const (
|
294
|
+
rb_define_const (rb_mCairo_Format, "RGB16_565",
|
296
295
|
INT2FIX (CAIRO_FORMAT_RGB16_565));
|
297
296
|
#endif
|
298
297
|
|
299
298
|
|
300
|
-
/* cairo_pattern_type_t */
|
301
|
-
rb_define_const (rb_mCairo, "PATTERN_TYPE_SOLID",
|
302
|
-
INT2FIX (CAIRO_PATTERN_TYPE_SOLID));
|
303
|
-
rb_define_const (rb_mCairo, "PATTERN_TYPE_SURFACE",
|
304
|
-
INT2FIX (CAIRO_PATTERN_TYPE_SURFACE));
|
305
|
-
rb_define_const (rb_mCairo, "PATTERN_TYPE_LINEAR",
|
306
|
-
INT2FIX (CAIRO_PATTERN_TYPE_LINEAR));
|
307
|
-
rb_define_const (rb_mCairo, "PATTERN_TYPE_RADIAL",
|
308
|
-
INT2FIX (CAIRO_PATTERN_TYPE_RADIAL));
|
309
|
-
|
310
299
|
/* cairo_extend_t */
|
311
|
-
|
300
|
+
rb_mCairo_Extend = rb_define_module_under (rb_mCairo, "Extend");
|
301
|
+
rb_define_const (rb_mCairo_Extend, "NONE",
|
312
302
|
INT2FIX (CAIRO_EXTEND_NONE));
|
313
|
-
rb_define_const (
|
303
|
+
rb_define_const (rb_mCairo_Extend, "REPEAT",
|
314
304
|
INT2FIX (CAIRO_EXTEND_REPEAT));
|
315
|
-
rb_define_const (
|
305
|
+
rb_define_const (rb_mCairo_Extend, "REFLECT",
|
316
306
|
INT2FIX (CAIRO_EXTEND_REFLECT));
|
317
|
-
rb_define_const (
|
307
|
+
rb_define_const (rb_mCairo_Extend, "PAD",
|
318
308
|
INT2FIX (CAIRO_EXTEND_PAD));
|
319
309
|
|
320
310
|
|
321
311
|
/* cairo_filter_t */
|
322
|
-
|
312
|
+
rb_mCairo_Filter = rb_define_module_under (rb_mCairo, "Filter");
|
313
|
+
rb_define_const (rb_mCairo_Filter, "FAST",
|
323
314
|
INT2FIX (CAIRO_FILTER_FAST));
|
324
|
-
rb_define_const (
|
315
|
+
rb_define_const (rb_mCairo_Filter, "GOOD",
|
325
316
|
INT2FIX (CAIRO_FILTER_GOOD));
|
326
|
-
rb_define_const (
|
317
|
+
rb_define_const (rb_mCairo_Filter, "BEST",
|
327
318
|
INT2FIX (CAIRO_FILTER_BEST));
|
328
|
-
rb_define_const (
|
319
|
+
rb_define_const (rb_mCairo_Filter, "NEAREST",
|
329
320
|
INT2FIX (CAIRO_FILTER_NEAREST));
|
330
|
-
rb_define_const (
|
321
|
+
rb_define_const (rb_mCairo_Filter, "BILINEAR",
|
331
322
|
INT2FIX (CAIRO_FILTER_BILINEAR));
|
332
|
-
rb_define_const (
|
323
|
+
rb_define_const (rb_mCairo_Filter, "GAUSSIAN",
|
333
324
|
INT2FIX (CAIRO_FILTER_GAUSSIAN));
|
334
325
|
|
335
326
|
#if CAIRO_HAS_SVG_SURFACE
|
336
327
|
/* cairo_svg_version_t */
|
337
|
-
|
328
|
+
rb_mCairo_SVGVersion = rb_define_module_under (rb_mCairo, "SVGVersion");
|
329
|
+
rb_define_const (rb_mCairo_SVGVersion, "VERSION_1_1",
|
338
330
|
INT2FIX (CAIRO_SVG_VERSION_1_1));
|
339
|
-
rb_define_const (
|
331
|
+
rb_define_const (rb_mCairo_SVGVersion, "VERSION_1_2",
|
340
332
|
INT2FIX (CAIRO_SVG_VERSION_1_2));
|
341
333
|
#endif
|
342
334
|
}
|