Module: Rsvg

Defined in:
lib/rsvg2/handle.rb,
lib/rsvg2.rb,
lib/rsvg2/loader.rb,
lib/rsvg2/version.rb,
lib/rsvg2/dimension-data.rb

Overview

Copyright (C) 2017 Ruby-GNOME2 Project Team

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Defined Under Namespace

Modules: Error, HandleFlags, Unit, Version Classes: DimensionData, Handle, Loader

Constant Summary collapse

MAJOR_VERSION =

This is a C macro that expands to a number with the major version of librsvg against which your program is compiled.

For example, for librsvg-2.3.4, the major version is 2.

C programs can use this as a compile-time check for the required version, but note that generally it is a better idea to do compile-time checks by calling pkg-config in your build scripts.

Note: for a run-time check on the version of librsvg that your program is running with (e.g. the version which the linker used for your program), or for programs not written in C, use rsvg_major_version instead.

2
MICRO_VERSION =

This is a C macro that expands to a number with the micro version of librsvg against which your program is compiled.

For example, for librsvg-2.3.4, the micro version is 4.

C programs can use this as a compile-time check for the required version, but note that generally it is a better idea to do compile-time checks by calling pkg-config in your build scripts.

Note: for a run-time check on the version of librsvg that your program is running with (e.g. the version which the linker used for your program), or for programs not written in C, use rsvg_micro_version instead.

0
MINOR_VERSION =

This is a C macro that expands to a number with the minor version of librsvg against which your program is compiled.

For example, for librsvg-2.3.4, the minor version is 3.

C programs can use this as a compile-time check for the required version, but note that generally it is a better idea to do compile-time checks by calling pkg-config in your build scripts.

Note: for a run-time check on the version of librsvg that your program is running with (e.g. the version which the linker used for your program), or for programs not written in C, use rsvg_minor_version instead.

58
VERSION =

This is a C macro that expands to a string with the version of librsvg against which your program is compiled.

For example, for librsvg-2.3.4, this macro expands to "2.3.4".

C programs can use this as a compile-time check for the required version, but note that generally it is a better idea to do compile-time checks by calling pkg-config in your build scripts.

Note: for a run-time check on the version of librsvg that your program is running with (e.g. the version which the linker used for your program), or for programs not written in C, use rsvg_version instead.

2.58.0
LOG_DOMAIN =
"librsvg"

Instance Method Summary collapse

Instance Method Details

#cleanupnil

This function does nothing.

Returns:

  • (nil)

#default_dpi=(dpi) ⇒ nil

Do not use this function. Create an [classRsvg.Handle] and call [methodRsvg.Handle.set_dpi] on it instead.

Parameters:

  • dpi (Float)

    Dots Per Inch (aka Pixels Per Inch)

Returns:

  • (nil)

#error_quarkGLib::Quark

The error domain for RSVG

Returns:

  • (GLib::Quark)

    The error domain

#initnil

This function does nothing.

Returns:

  • (nil)

#pixbuf_from_file(filename) ⇒ GdkPixbuf::Pixbuf

Loads a new GdkPixbuf from filename and returns it. The caller must assume the reference to the reurned pixbuf. If an error occurred, error is set and NULL is returned.

Parameters:

  • filename (String)

    A file name

Returns:

  • (GdkPixbuf::Pixbuf)

    A pixbuf, or nil on error.

#pixbuf_from_file_at_max_size(filename, max_width, max_height) ⇒ GdkPixbuf::Pixbuf

Loads a new GdkPixbuf from filename and returns it. This pixbuf is uniformly scaled so that the it fits into a rectangle of size max_width * max_height. The caller must assume the reference to the returned pixbuf. If an error occurred, error is set and NULL is returned.

Parameters:

  • filename (String)

    A file name

  • max_width (Integer)

    The requested max width

  • max_height (Integer)

    The requested max height

Returns:

  • (GdkPixbuf::Pixbuf)

    A pixbuf, or nil on error.

#pixbuf_from_file_at_size(filename, width, height) ⇒ GdkPixbuf::Pixbuf

Loads a new GdkPixbuf from filename and returns it. This pixbuf is scaled from the size indicated to the new size indicated by width and height. If both of these are -1, then the default size of the image being loaded is used. The caller must assume the reference to the returned pixbuf. If an error occurred, error is set and NULL is returned.

Parameters:

  • filename (String)

    A file name

  • width (Integer)

    The new width, or -1

  • height (Integer)

    The new height, or -1

Returns:

  • (GdkPixbuf::Pixbuf)

    A pixbuf, or nil on error.

#pixbuf_from_file_at_zoom(filename, x_zoom, y_zoom) ⇒ GdkPixbuf::Pixbuf

Loads a new GdkPixbuf from filename and returns it. This pixbuf is scaled from the size indicated by the file by a factor of x_zoom and y_zoom. The caller must assume the reference to the returned pixbuf. If an error occurred, error is set and NULL is returned.

Parameters:

  • filename (String)

    A file name

  • x_zoom (Float)

    The horizontal zoom factor

  • y_zoom (Float)

    The vertical zoom factor

Returns:

  • (GdkPixbuf::Pixbuf)

    A pixbuf, or nil on error.

#pixbuf_from_file_at_zoom_with_max(filename, x_zoom, y_zoom, max_width, max_height) ⇒ GdkPixbuf::Pixbuf

Loads a new GdkPixbuf from filename and returns it. This pixbuf is scaled from the size indicated by the file by a factor of x_zoom and y_zoom. If the resulting pixbuf would be larger than max_width/max_heigh it is uniformly scaled down to fit in that rectangle. The caller must assume the reference to the returned pixbuf. If an error occurred, error is set and NULL is returned.

Parameters:

  • filename (String)

    A file name

  • x_zoom (Float)

    The horizontal zoom factor

  • y_zoom (Float)

    The vertical zoom factor

  • max_width (Integer)

    The requested max width

  • max_height (Integer)

    The requested max height

Returns:

  • (GdkPixbuf::Pixbuf)

    A pixbuf, or nil on error.

#set_default_dpi_x_y(dpi_x, dpi_y) ⇒ nil

Do not use this function. Create an [classRsvg.Handle] and call [methodRsvg.Handle.set_dpi_x_y] on it instead.

Parameters:

  • dpi_x (Float)

    Dots Per Inch (aka Pixels Per Inch)

  • dpi_y (Float)

    Dots Per Inch (aka Pixels Per Inch)

Returns:

  • (nil)

#termnil

This function does nothing.

Returns:

  • (nil)