Class: Cairo::Matrix
- Inherits:
-
Object
- Object
- Cairo::Matrix
- Defined in:
- lib/cairo.rb,
ext/cairo/rb_cairo_matrix.c
Class Method Summary collapse
Instance Method Summary collapse
- #== ⇒ Object
- #clone ⇒ Object
- #dup ⇒ Object
- #identity! ⇒ Object
- #initialize ⇒ Object constructor
- #invert ⇒ Object
- #invert! ⇒ Object
- #multiply(other) ⇒ Object (also: #*)
- #multiply! ⇒ Object
- #rotate(radians) ⇒ Object
- #rotate! ⇒ Object
- #scale(sx, sy) ⇒ Object
- #scale! ⇒ Object
-
#set ⇒ Object
Utilities.
- #set_x0 ⇒ Object
- #set_xx ⇒ Object
- #set_xy ⇒ Object
- #set_y0 ⇒ Object
- #set_yx ⇒ Object
- #set_yy ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
- #transform_distance ⇒ Object
- #transform_point ⇒ Object
- #translate(tx, ty) ⇒ Object
- #translate! ⇒ Object
- #x0 ⇒ Object
-
#xx ⇒ Object
Accessors.
- #xy ⇒ Object
- #y0 ⇒ Object
- #yx ⇒ Object
- #yy ⇒ Object
Constructor Details
#initialize ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'ext/cairo/rb_cairo_matrix.c', line 72
static VALUE
cr_matrix_initialize (VALUE self,
VALUE xx, VALUE yx,
VALUE xy, VALUE yy,
VALUE x0, VALUE y0)
{
cairo_matrix_t *matrix = ALLOC (cairo_matrix_t);
cairo_matrix_init (matrix,
NUM2DBL (xx), NUM2DBL (yx),
NUM2DBL (xy), NUM2DBL (yy),
NUM2DBL (x0), NUM2DBL (y0));
RTYPEDDATA_DATA (self) = matrix;
return Qnil;
}
|
Class Method Details
.identity ⇒ Object
88 89 90 91 92 93 94 |
# File 'ext/cairo/rb_cairo_matrix.c', line 88
static VALUE
cr_matrix_init_identity (VALUE self)
{
cairo_matrix_t matrix;
cairo_matrix_init_identity (&matrix);
return CRMATRIX2RVAL (&matrix);
}
|
.rotate ⇒ Object
112 113 114 115 116 117 118 |
# File 'ext/cairo/rb_cairo_matrix.c', line 112
static VALUE
cr_matrix_init_rotate (VALUE self, VALUE radius)
{
cairo_matrix_t matrix;
cairo_matrix_init_rotate (&matrix, NUM2DBL (radius));
return CRMATRIX2RVAL (&matrix);
}
|
.scale ⇒ Object
104 105 106 107 108 109 110 |
# File 'ext/cairo/rb_cairo_matrix.c', line 104
static VALUE
cr_matrix_init_scale (VALUE self, VALUE sx, VALUE sy)
{
cairo_matrix_t matrix;
cairo_matrix_init_scale (&matrix, NUM2DBL (sx), NUM2DBL (sy));
return CRMATRIX2RVAL (&matrix);
}
|
.translate ⇒ Object
96 97 98 99 100 101 102 |
# File 'ext/cairo/rb_cairo_matrix.c', line 96
static VALUE
cr_matrix_init_translate (VALUE self, VALUE tx, VALUE ty)
{
cairo_matrix_t matrix;
cairo_matrix_init_translate (&matrix, NUM2DBL (tx), NUM2DBL (ty));
return CRMATRIX2RVAL (&matrix);
}
|
Instance Method Details
#== ⇒ Object
304 305 306 307 308 309 310 311 312 313 |
# File 'ext/cairo/rb_cairo_matrix.c', line 304
static VALUE
cr_matrix_equal (VALUE self, VALUE other)
{
if (!rb_cairo__is_kind_of (other, rb_cCairo_Matrix))
return Qfalse;
return rb_funcall (cr_matrix_to_a (self),
cr_id_equal, 1,
cr_matrix_to_a (other));
}
|
#clone ⇒ Object
97 98 99 100 101 |
# File 'lib/cairo.rb', line 97 def clone copy = dup copy.freeze if self.frozen? copy end |
#identity! ⇒ Object
120 121 122 123 124 125 |
# File 'ext/cairo/rb_cairo_matrix.c', line 120
static VALUE
cr_matrix_identity (VALUE self)
{
cairo_matrix_init_identity (_SELF);
return self;
}
|
#invert ⇒ Object
106 |
# File 'lib/cairo.rb', line 106 def invert; dup.invert!; end |
#invert! ⇒ Object
148 149 150 151 152 153 |
# File 'ext/cairo/rb_cairo_matrix.c', line 148
static VALUE
cr_matrix_invert (VALUE self)
{
rb_cairo_check_status (cairo_matrix_invert (_SELF));
return self;
}
|
#multiply(other) ⇒ Object Also known as: *
107 |
# File 'lib/cairo.rb', line 107 def multiply(other); dup.multiply!(other); end |
#multiply! ⇒ Object
155 156 157 158 159 160 |
# File 'ext/cairo/rb_cairo_matrix.c', line 155
static VALUE
cr_matrix_multiply (VALUE self, VALUE other)
{
cairo_matrix_multiply (_SELF, _SELF, RVAL2CRMATRIX (other));
return self;
}
|
#rotate(radians) ⇒ Object
105 |
# File 'lib/cairo.rb', line 105 def rotate(radians); dup.rotate!(radians); end |
#rotate! ⇒ Object
141 142 143 144 145 146 |
# File 'ext/cairo/rb_cairo_matrix.c', line 141
static VALUE
cr_matrix_rotate (VALUE self, VALUE radians)
{
cairo_matrix_rotate (_SELF, NUM2DBL (radians));
return self;
}
|
#scale(sx, sy) ⇒ Object
104 |
# File 'lib/cairo.rb', line 104 def scale(sx, sy); dup.scale!(sx, sy); end |
#scale! ⇒ Object
134 135 136 137 138 139 |
# File 'ext/cairo/rb_cairo_matrix.c', line 134
static VALUE
cr_matrix_scale (VALUE self, VALUE sx, VALUE sy)
{
cairo_matrix_scale (_SELF, NUM2DBL (sx), NUM2DBL (sy));
return self;
}
|
#set ⇒ Object
Utilities
263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'ext/cairo/rb_cairo_matrix.c', line 263
static VALUE
cr_matrix_set (VALUE self,
VALUE xx, VALUE yx,
VALUE xy, VALUE yy,
VALUE x0, VALUE y0)
{
cairo_matrix_init (_SELF,
NUM2DBL (xx), NUM2DBL (yx),
NUM2DBL (xy), NUM2DBL (yy),
NUM2DBL (x0), NUM2DBL (y0));
return self;
}
|
#set_x0 ⇒ Object
242 243 244 245 246 247 |
# File 'ext/cairo/rb_cairo_matrix.c', line 242
static VALUE
cr_matrix_set_x0 (VALUE self, VALUE x0)
{
_SELF->x0 = NUM2DBL (x0);
return Qnil;
}
|
#set_xx ⇒ Object
190 191 192 193 194 195 |
# File 'ext/cairo/rb_cairo_matrix.c', line 190
static VALUE
cr_matrix_set_xx (VALUE self, VALUE xx)
{
_SELF->xx = NUM2DBL (xx);
return Qnil;
}
|
#set_xy ⇒ Object
216 217 218 219 220 221 |
# File 'ext/cairo/rb_cairo_matrix.c', line 216
static VALUE
cr_matrix_set_xy (VALUE self, VALUE xy)
{
_SELF->xy = NUM2DBL (xy);
return Qnil;
}
|
#set_y0 ⇒ Object
255 256 257 258 259 260 |
# File 'ext/cairo/rb_cairo_matrix.c', line 255
static VALUE
cr_matrix_set_y0 (VALUE self, VALUE y0)
{
_SELF->y0 = NUM2DBL (y0);
return Qnil;
}
|
#set_yx ⇒ Object
203 204 205 206 207 208 |
# File 'ext/cairo/rb_cairo_matrix.c', line 203
static VALUE
cr_matrix_set_yx (VALUE self, VALUE yx)
{
_SELF->yx = NUM2DBL (yx);
return Qnil;
}
|
#set_yy ⇒ Object
229 230 231 232 233 234 |
# File 'ext/cairo/rb_cairo_matrix.c', line 229
static VALUE
cr_matrix_set_yy (VALUE self, VALUE yy)
{
_SELF->yy = NUM2DBL (yy);
return Qnil;
}
|
#to_a ⇒ Object
276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'ext/cairo/rb_cairo_matrix.c', line 276
static VALUE
cr_matrix_to_a (VALUE self)
{
cairo_matrix_t *matrix = _SELF;
double affine[6];
affine[0] = matrix->xx;
affine[1] = matrix->yx;
affine[2] = matrix->xy;
affine[3] = matrix->yy;
affine[4] = matrix->x0;
affine[5] = matrix->y0;
return rb_cairo__float_array (affine, 6);
}
|
#to_s ⇒ Object
290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'ext/cairo/rb_cairo_matrix.c', line 290
static VALUE
cr_matrix_to_s(VALUE self)
{
VALUE ret;
ret = rb_str_new2 ("#<");
rb_str_cat2 (ret, rb_class2name (CLASS_OF (self)));
rb_str_cat2 (ret, ":");
rb_str_concat (ret, rb_inspect (cr_matrix_to_a (self)));
rb_str_cat2 (ret, ">");
return ret;
}
|
#transform_distance ⇒ Object
162 163 164 165 166 167 168 169 170 |
# File 'ext/cairo/rb_cairo_matrix.c', line 162
static VALUE
cr_matrix_transform_distance (VALUE self, VALUE dx, VALUE dy)
{
double pair[2];
pair[0] = NUM2DBL (dx);
pair[1] = NUM2DBL (dy);
cairo_matrix_transform_distance (_SELF, pair, pair + 1);
return rb_cairo__float_array (pair, 2);
}
|
#transform_point ⇒ Object
172 173 174 175 176 177 178 179 180 |
# File 'ext/cairo/rb_cairo_matrix.c', line 172
static VALUE
cr_matrix_transform_point (VALUE self, VALUE x, VALUE y)
{
double pair[2];
pair[0] = NUM2DBL (x);
pair[1] = NUM2DBL (y);
cairo_matrix_transform_point (_SELF, pair, pair + 1);
return rb_cairo__float_array (pair, 2);
}
|
#translate(tx, ty) ⇒ Object
103 |
# File 'lib/cairo.rb', line 103 def translate(tx, ty); dup.translate!(tx, ty); end |
#translate! ⇒ Object
127 128 129 130 131 132 |
# File 'ext/cairo/rb_cairo_matrix.c', line 127
static VALUE
cr_matrix_translate (VALUE self, VALUE tx, VALUE ty)
{
cairo_matrix_translate (_SELF, NUM2DBL (tx), NUM2DBL (ty));
return self;
}
|
#x0 ⇒ Object
236 237 238 239 240 |
# File 'ext/cairo/rb_cairo_matrix.c', line 236
static VALUE
cr_matrix_get_x0 (VALUE self)
{
return rb_float_new (_SELF->x0);
}
|
#xx ⇒ Object
Accessors
184 185 186 187 188 |
# File 'ext/cairo/rb_cairo_matrix.c', line 184
static VALUE
cr_matrix_get_xx (VALUE self)
{
return rb_float_new (_SELF->xx);
}
|
#xy ⇒ Object
210 211 212 213 214 |
# File 'ext/cairo/rb_cairo_matrix.c', line 210
static VALUE
cr_matrix_get_xy (VALUE self)
{
return rb_float_new (_SELF->xy);
}
|
#y0 ⇒ Object
249 250 251 252 253 |
# File 'ext/cairo/rb_cairo_matrix.c', line 249
static VALUE
cr_matrix_get_y0 (VALUE self)
{
return rb_float_new (_SELF->y0);
}
|
#yx ⇒ Object
197 198 199 200 201 |
# File 'ext/cairo/rb_cairo_matrix.c', line 197
static VALUE
cr_matrix_get_yx (VALUE self)
{
return rb_float_new (_SELF->yx);
}
|
#yy ⇒ Object
223 224 225 226 227 |
# File 'ext/cairo/rb_cairo_matrix.c', line 223
static VALUE
cr_matrix_get_yy (VALUE self)
{
return rb_float_new (_SELF->yy);
}
|