Class: Cairo::Path
- Inherits:
-
Object
- Object
- Cairo::Path
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/cairo/path.rb,
ext/cairo/rb_cairo_path.c
Instance Method Summary collapse
- #[] ⇒ Object
- #close ⇒ Object
- #each ⇒ Object
- #empty? ⇒ Boolean
- #initialize ⇒ Object constructor
- #size ⇒ Object (also: #length)
Constructor Details
#initialize ⇒ Object
285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'ext/cairo/rb_cairo_path.c', line 285 static VALUE cr_path_initialize (VALUE self) { cairo_path_t *path; path = RB_ALLOC (cairo_path_t); path->status = CAIRO_STATUS_SUCCESS; path->data = NULL; path->num_data = 0; RTYPEDDATA_DATA (self) = path; return Qnil; } |
Instance Method Details
#[] ⇒ Object
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'ext/cairo/rb_cairo_path.c', line 325 static VALUE cr_path_ref (VALUE self, VALUE index) { cairo_path_t *path = _SELF (self); int i, requested_index, real_index; requested_index = NUM2INT (index); if (requested_index < 0) { requested_index += cairo_path_get_size (path); if (requested_index < 0) return Qnil; } for (i = 0, real_index = 0; i < requested_index; i++) { if (real_index >= path->num_data) return Qnil; real_index += path->data[real_index].header.length; } if (real_index < path->num_data) return cr_path_data_to_ruby_object (&path->data[real_index]); else return Qnil; } |
#close ⇒ Object
11 12 13 |
# File 'lib/cairo/path.rb', line 11 def close @context.close_path end |
#each ⇒ Object
353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'ext/cairo/rb_cairo_path.c', line 353 static VALUE cr_path_each (VALUE self) { cairo_path_t *path = _SELF(self); int i; for (i = 0; i < path->num_data; i += path->data[i].header.length) { rb_yield (cr_path_data_to_ruby_object (&(path->data[i]))); } return self; } |
#empty? ⇒ Boolean
299 300 301 302 303 304 305 |
# File 'ext/cairo/rb_cairo_path.c', line 299 static VALUE cr_path_empty_p (VALUE self) { cairo_path_t *path = _SELF (self); return CBOOL2RVAL (path->num_data == 0); } |
#size ⇒ Object Also known as: length
318 319 320 321 322 323 |
# File 'ext/cairo/rb_cairo_path.c', line 318 static VALUE cr_path_size (VALUE self) { cairo_path_t *path = _SELF (self); return INT2NUM (cairo_path_get_size (path)); } |