Class: RSVG::Handle
- Inherits:
-
Object
- Object
- RSVG::Handle
- Defined in:
- ext/rsvg2/rbrsvg.c
Class Method Summary collapse
Instance Method Summary collapse
- #base_uri ⇒ Object
- #close ⇒ Object
- #closed? ⇒ Boolean
- #desc ⇒ Object
- #dimensions ⇒ Object
- #initialize(*args) ⇒ Object constructor
- #metadata ⇒ Object
- #pixbuf(*args) ⇒ Object
- #pixbuf_from_file(file_name) ⇒ Object
- #pixbuf_from_file_at_max_size(file_name, max_width, max_height) ⇒ Object
-
#pixbuf_from_file_at_size(file_name, width, height) ⇒ Object
Extended Convenience API.
- #pixbuf_from_file_at_zoom(file_name, x_zoom, y_zoom) ⇒ Object
- #pixbuf_from_file_at_zoom_with_max(file_name, x_zoom, y_zoom, max_width, max_height) ⇒ Object
- #render_cairo(*args) ⇒ Object
- #set_base_uri(base_uri) ⇒ Object
- #set_dpi(dpi) ⇒ Object
- #set_dpi_x_y(dpi_x, dpi_y) ⇒ Object
- #set_size_callback ⇒ Object
-
#title ⇒ Object
Accessibility API.
- #write(buf) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Object
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'ext/rsvg2/rbrsvg.c', line 310 static VALUE rb_rsvg_handle_initialize(int argc, VALUE *argv, VALUE self) { RsvgHandle *handle; VALUE gz; rb_scan_args(argc, argv, "01", &gz); #if LIBRSVG_CHECK_VERSION(2, 11, 0) handle = rsvg_handle_new(); #else if (RVAL2CBOOL(gz)) { # ifdef HAVE_LIBRSVG_RSVG_GZ_H handle = rsvg_handle_new_gz(); # else rb_warning("gz handling is not supported in your librsvg"); handle = rsvg_handle_new(); # endif } else { handle = rsvg_handle_new(); } #endif #ifdef RSVG_TYPE_HANDLE G_INITIALIZE(self, handle); #else DATA_PTR(self) = handle; #endif rb_ivar_set(self, id_closed, Qfalse); return Qnil; } |
Class Method Details
.new_from_data(data) ⇒ Object
279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'ext/rsvg2/rbrsvg.c', line 279 static VALUE rb_rsvg_handle_new_from_data(VALUE self, VALUE data) { GError *error = NULL; RsvgHandle *handle; handle = rsvg_handle_new_from_data((const guint8 *)RVAL2CSTR(data), RSTRING_LEN(data), &error); if (error) RAISE_GERROR(error); return GOBJ2RVAL(handle); } |
.new_from_file(file) ⇒ Object
294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'ext/rsvg2/rbrsvg.c', line 294 static VALUE rb_rsvg_handle_new_from_file(VALUE self, VALUE file) { GError *error = NULL; RsvgHandle *handle; handle = rsvg_handle_new_from_file((const gchar *)RVAL2CSTR(file), &error); if (error) RAISE_GERROR(error); return GOBJ2RVAL(handle); } |
Instance Method Details
#base_uri ⇒ Object
419 420 421 422 423 |
# File 'ext/rsvg2/rbrsvg.c', line 419 static VALUE rb_rsvg_handle_get_base_uri(VALUE self) { return CSTR2RVAL(rsvg_handle_get_base_uri(_SELF(self))); } |
#close ⇒ Object
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'ext/rsvg2/rbrsvg.c', line 365 static VALUE rb_rsvg_handle_close(VALUE self) { gboolean result; GError *error = NULL; if (RVAL2CBOOL(rb_ivar_get(self, id_closed))) { return Qnil; } result = rsvg_handle_close(_SELF(self), &error); if (result) { rb_ivar_set(self, id_closed, Qtrue); } else { RAISE_GERROR(error); } return CBOOL2RVAL(result); } |
#closed? ⇒ Boolean
386 387 388 389 390 |
# File 'ext/rsvg2/rbrsvg.c', line 386 static VALUE rb_rsvg_handle_closed(VALUE self) { return rb_ivar_get(self, id_closed); } |
#desc ⇒ Object
560 561 562 563 564 |
# File 'ext/rsvg2/rbrsvg.c', line 560 static VALUE rb_rsvg_handle_get_desc(VALUE self) { return CSTR2RVAL(rsvg_handle_get_desc(_SELF(self))); } |
#dimensions ⇒ Object
537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
# File 'ext/rsvg2/rbrsvg.c', line 537 static VALUE rb_rsvg_handle_get_dim(VALUE self) { RsvgDimensionData dim; VALUE args[4]; rsvg_handle_get_dimensions(_SELF(self), &dim); args[0] = INT2NUM(dim.width); args[1] = INT2NUM(dim.height); args[2] = rb_float_new(dim.em); args[3] = rb_float_new(dim.ex); return rb_class_new_instance(sizeof(args) / sizeof(VALUE), args, cDim); } |
#metadata ⇒ Object
567 568 569 570 571 |
# File 'ext/rsvg2/rbrsvg.c', line 567 static VALUE (VALUE self) { return CSTR2RVAL((_SELF(self))); } |
#pixbuf(*args) ⇒ Object
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'ext/rsvg2/rbrsvg.c', line 392 static VALUE rb_rsvg_handle_get_pixbuf(int argc, VALUE *argv, VALUE self) { VALUE id; VALUE rb_pixbuf; GdkPixbuf *pixbuf = NULL; rb_scan_args(argc, argv, "01", &id); if (NIL_P(id)) { pixbuf = rsvg_handle_get_pixbuf(_SELF(self)); } else { #ifdef HAVE_RSVG_HANDLE_GET_PIXBUF_SUB pixbuf = rsvg_handle_get_pixbuf_sub(_SELF(self), (const char *)RVAL2CSTR(id)); #else rb_warning("rsvg_handle_get_pixbuf_sub isn't " "supported in your librsvg"); #endif } rb_pixbuf = GOBJ2RVAL(pixbuf); if (pixbuf) g_object_unref(pixbuf); return rb_pixbuf; } |
#pixbuf_from_file(file_name) ⇒ Object
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
# File 'ext/rsvg2/rbrsvg.c', line 598 static VALUE rb_rsvg_pixbuf_from_file_ex(VALUE self, VALUE file_name) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_ex(_SELF(self), RVAL2CSTR(file_name), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } |
#pixbuf_from_file_at_max_size(file_name, max_width, max_height) ⇒ Object
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 |
# File 'ext/rsvg2/rbrsvg.c', line 637 static VALUE rb_rsvg_pixbuf_from_file_at_max_size_ex(VALUE self, VALUE file_name, VALUE max_width, VALUE max_height) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_max_size_ex(_SELF(self), RVAL2CSTR(file_name), NUM2INT(max_width), NUM2INT(max_height), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } |
#pixbuf_from_file_at_size(file_name, width, height) ⇒ Object
Extended Convenience API
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
# File 'ext/rsvg2/rbrsvg.c', line 577 static VALUE rb_rsvg_pixbuf_from_file_at_size_ex(VALUE self, VALUE file_name, VALUE width, VALUE height) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_size_ex(_SELF(self), RVAL2CSTR(file_name), NUM2INT(width), NUM2INT(height), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } |
#pixbuf_from_file_at_zoom(file_name, x_zoom, y_zoom) ⇒ Object
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 |
# File 'ext/rsvg2/rbrsvg.c', line 616 static VALUE rb_rsvg_pixbuf_from_file_at_zoom_ex(VALUE self, VALUE file_name, VALUE x_zoom, VALUE y_zoom) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_zoom_ex(_SELF(self), RVAL2CSTR(file_name), NUM2DBL(x_zoom), NUM2DBL(y_zoom), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } |
#pixbuf_from_file_at_zoom_with_max(file_name, x_zoom, y_zoom, max_width, max_height) ⇒ Object
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 |
# File 'ext/rsvg2/rbrsvg.c', line 658 static VALUE rb_rsvg_pixbuf_from_file_at_zoom_with_max_ex(VALUE self, VALUE file_name, VALUE x_zoom, VALUE y_zoom, VALUE max_width, VALUE max_height) { VALUE rb_pixbuf; GdkPixbuf *pixbuf; GError *error = NULL; pixbuf = rsvg_pixbuf_from_file_at_zoom_with_max_ex(_SELF(self), RVAL2CSTR(file_name), NUM2DBL(x_zoom), NUM2DBL(y_zoom), NUM2INT(max_width), NUM2INT(max_height), &error); if (error) RAISE_GERROR(error); rb_pixbuf = GOBJ2RVAL(pixbuf); g_object_unref(pixbuf); return rb_pixbuf; } |
#render_cairo(*args) ⇒ Object
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 |
# File 'ext/rsvg2/rbrsvg.c', line 697 static VALUE rb_rsvg_handle_render_cairo(int argc, VALUE *argv, VALUE self) { VALUE cr, id; rb_scan_args(argc, argv, "11", &cr, &id); if (NIL_P(id)) { rsvg_handle_render_cairo( _SELF(self), RVAL2CRCONTEXT(cr)); } else { rsvg_handle_render_cairo_sub( _SELF(self), RVAL2CRCONTEXT(cr), (const char *)RVAL2CSTR(id)); } return Qnil; } |
#set_base_uri(base_uri) ⇒ Object
425 426 427 428 429 430 |
# File 'ext/rsvg2/rbrsvg.c', line 425 static VALUE rb_rsvg_handle_set_base_uri(VALUE self, VALUE base_uri) { rsvg_handle_set_base_uri(_SELF(self), RVAL2CSTR(base_uri)); return self; } |
#set_dpi(dpi) ⇒ Object
240 241 242 243 244 245 246 247 248 249 |
# File 'ext/rsvg2/rbrsvg.c', line 240 static VALUE rb_rsvg_handle_set_dpi(VALUE self, VALUE dpi) { #ifdef HAVE_RSVG_HANDLE_SET_DPI rsvg_handle_set_dpi(_SELF(self), NUM2DBL(dpi)); #else rb_warning("rsvg_handle_set_dpi isn't supported in your librsvg"); #endif return self; } |
#set_dpi_x_y(dpi_x, dpi_y) ⇒ Object
251 252 253 254 255 256 257 258 259 260 |
# File 'ext/rsvg2/rbrsvg.c', line 251 static VALUE rb_rsvg_handle_set_dpi_x_y(VALUE self, VALUE dpi_x, VALUE dpi_y) { #ifdef HAVE_RSVG_HANDLE_SET_DPI_X_Y rsvg_handle_set_dpi_x_y(_SELF(self), NUM2DBL(dpi_x), NUM2DBL(dpi_y)); #else rb_warning("rsvg_handle_set_dpi_x_y isn't supported in your librsvg"); #endif return self; } |
#set_size_callback ⇒ Object
342 343 344 345 346 347 348 349 |
# File 'ext/rsvg2/rbrsvg.c', line 342 static VALUE rb_rsvg_handle_set_size_callback(VALUE self) { rb_ivar_set(self, id_callback, rb_block_proc()); rsvg_handle_set_size_callback(_SELF(self), exec_callback, (gpointer)self, NULL); return self; } |
#title ⇒ Object
Accessibility API
554 555 556 557 558 |
# File 'ext/rsvg2/rbrsvg.c', line 554 static VALUE rb_rsvg_handle_get_title(VALUE self) { return CSTR2RVAL(rsvg_handle_get_title(_SELF(self))); } |
#write(buf) ⇒ Object
351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'ext/rsvg2/rbrsvg.c', line 351 static VALUE rb_rsvg_handle_write(VALUE self, VALUE buf) { gboolean result; GError *error = NULL; result = rsvg_handle_write(_SELF(self), (const guchar*)RVAL2CSTR(buf), RSTRING_LEN(buf), &error); if (!result) RAISE_GERROR(error); return CBOOL2RVAL(result); } |