librsvg source for verification 2026-05-22
This commit is contained in:
0
include/.dirstamp
Normal file
0
include/.dirstamp
Normal file
36
include/librsvg/meson.build
Normal file
36
include/librsvg/meson.build
Normal file
@@ -0,0 +1,36 @@
|
||||
includes = files(
|
||||
'rsvg.h',
|
||||
'rsvg-cairo.h',
|
||||
)
|
||||
|
||||
if pixbuf_dep.found()
|
||||
includes += files('rsvg-pixbuf.h')
|
||||
endif
|
||||
|
||||
features_data = configuration_data()
|
||||
features_data.set10('LIBRSVG_HAVE_PIXBUF', pixbuf_dep.found())
|
||||
|
||||
features_header = configure_file(
|
||||
input: 'rsvg-features.h.in',
|
||||
output: 'rsvg-features.h',
|
||||
configuration: features_data
|
||||
)
|
||||
|
||||
header_version = meson.project_version().split('.')
|
||||
|
||||
version_header = configure_file(
|
||||
input: 'rsvg-version.h.in',
|
||||
output: 'rsvg-version.h',
|
||||
configuration: {
|
||||
'LIBRSVG_MAJOR_VERSION': header_version[0],
|
||||
'LIBRSVG_MINOR_VERSION': header_version[1],
|
||||
'LIBRSVG_MICRO_VERSION': header_version[2],
|
||||
'PACKAGE_VERSION': meson.project_version(),
|
||||
}
|
||||
)
|
||||
|
||||
includes += [features_header, version_header]
|
||||
install_headers(
|
||||
includes,
|
||||
subdir: '@0@/librsvg'.format(librsvg_pc),
|
||||
)
|
||||
395
include/librsvg/rsvg-cairo.h
Normal file
395
include/librsvg/rsvg-cairo.h
Normal file
@@ -0,0 +1,395 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 sts=4 expandtab: */
|
||||
/*
|
||||
rsvg-cairo.h: SAX-based renderer for SVG files using Cairo
|
||||
|
||||
Copyright (C) 2005 Red Hat, Inc.
|
||||
|
||||
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
|
||||
|
||||
Author: Carl Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)
|
||||
#warning "Including <librsvg/rsvg-cairo.h> directly is deprecated."
|
||||
#endif
|
||||
|
||||
#ifndef RSVG_CAIRO_H
|
||||
#define RSVG_CAIRO_H
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* rsvg_handle_render_cairo:
|
||||
* @handle: A [class@Rsvg.Handle]
|
||||
* @cr: A Cairo context
|
||||
*
|
||||
* Draws a loaded SVG handle to a Cairo context. Please try to use
|
||||
* [method@Rsvg.Handle.render_document] instead, which allows you to pick the size
|
||||
* at which the document will be rendered.
|
||||
*
|
||||
* Historically this function has picked a size by itself, based on the following rules:
|
||||
*
|
||||
* * If the SVG document has both `width` and `height`
|
||||
* attributes with physical units (px, in, cm, mm, pt, pc) or font-based units (em,
|
||||
* ex), the function computes the size directly based on the dots-per-inch (DPI) you
|
||||
* have configured with [method@Rsvg.Handle.set_dpi]. This is the same approach as
|
||||
* [method@Rsvg.Handle.get_intrinsic_size_in_pixels].
|
||||
*
|
||||
* * Otherwise, if there is a `viewBox` attribute and both
|
||||
* `width` and `height` are set to
|
||||
* `100%` (or if they don't exist at all and thus default to 100%),
|
||||
* the function uses the width and height of the `viewBox` as a pixel size. This
|
||||
* produces a rendered document with the correct aspect ratio.
|
||||
*
|
||||
* * Otherwise, this function computes the extents of every graphical object in the SVG
|
||||
* document to find the total extents. This is moderately expensive, but no more expensive
|
||||
* than rendering the whole document, for example.
|
||||
*
|
||||
* * This function cannot deal with percentage-based units for `width`
|
||||
* and `height` because there is no viewport against which they could
|
||||
* be resolved; that is why it will compute the extents of objects in that case. This
|
||||
* is why we recommend that you use [method@Rsvg.Handle.render_document] instead, which takes
|
||||
* in a viewport and follows the sizing policy from the web platform.
|
||||
*
|
||||
* Drawing will occur with respect to the @cr's current transformation: for example, if
|
||||
* the @cr has a rotated current transformation matrix, the whole SVG will be rotated in
|
||||
* the rendered version.
|
||||
*
|
||||
* This function depends on the [class@Rsvg.Handle]'s DPI to compute dimensions in
|
||||
* pixels, so you should call [method@Rsvg.Handle.set_dpi] beforehand.
|
||||
*
|
||||
* Note that @cr must be a Cairo context that is not in an error state, that is,
|
||||
* `cairo_status()` must return `CAIRO_STATUS_SUCCESS` for it. Cairo can set a
|
||||
* context to be in an error state in various situations, for example, if it was
|
||||
* passed an invalid matrix or if it was created for an invalid surface.
|
||||
*
|
||||
* Returns: `TRUE` if drawing succeeded; `FALSE` otherwise. This function will emit a g_warning()
|
||||
* if a rendering error occurs.
|
||||
*
|
||||
* Since: 2.14
|
||||
*
|
||||
* Deprecated: 2.52. Please use [method@Rsvg.Handle.render_document] instead; that function lets
|
||||
* you pass a viewport and obtain a good error message.
|
||||
*/
|
||||
RSVG_DEPRECATED_FOR(rsvg_handle_render_document)
|
||||
gboolean rsvg_handle_render_cairo (RsvgHandle *handle, cairo_t *cr);
|
||||
|
||||
/**
|
||||
* rsvg_handle_render_cairo_sub:
|
||||
* @handle: A [class@Rsvg.Handle]
|
||||
* @cr: A Cairo context
|
||||
* @id: (nullable): An element's id within the SVG, starting with "#" (a single
|
||||
* hash character), for example, `#layer1`. This notation corresponds to a
|
||||
* URL's fragment ID. Alternatively, pass `NULL` to render the whole SVG.
|
||||
*
|
||||
* Renders a single SVG element in the same place as for a whole SVG document (a "subset"
|
||||
* of the document). Please try to use [method@Rsvg.Handle.render_layer] instead, which allows
|
||||
* you to pick the size at which the document with the layer will be rendered.
|
||||
*
|
||||
* This is equivalent to [method@Rsvg.Handle.render_cairo], but it renders only a single
|
||||
* element and its children, as if they composed an individual layer in the SVG.
|
||||
*
|
||||
* Historically this function has picked a size for the whole document by itself, based
|
||||
* on the following rules:
|
||||
*
|
||||
* * If the SVG document has both `width` and `height`
|
||||
* attributes with physical units (px, in, cm, mm, pt, pc) or font-based units (em,
|
||||
* ex), the function computes the size directly based on the dots-per-inch (DPI) you
|
||||
* have configured with [method@Rsvg.Handle.set_dpi]. This is the same approach as
|
||||
* [method@Rsvg.Handle.get_intrinsic_size_in_pixels].
|
||||
*
|
||||
* * Otherwise, if there is a `viewBox` attribute and both
|
||||
* `width` and `height` are set to
|
||||
* `100%` (or if they don't exist at all and thus default to 100%),
|
||||
* the function uses the width and height of the `viewBox` as a pixel size. This
|
||||
* produces a rendered document with the correct aspect ratio.
|
||||
*
|
||||
* * Otherwise, this function computes the extents of every graphical object in the SVG
|
||||
* document to find the total extents. This is moderately expensive, but no more expensive
|
||||
* than rendering the whole document, for example.
|
||||
*
|
||||
* * This function cannot deal with percentage-based units for `width`
|
||||
* and `height` because there is no viewport against which they could
|
||||
* be resolved; that is why it will compute the extents of objects in that case. This
|
||||
* is why we recommend that you use [method@Rsvg.Handle.render_layer] instead, which takes
|
||||
* in a viewport and follows the sizing policy from the web platform.
|
||||
*
|
||||
* Drawing will occur with respect to the @cr's current transformation: for example, if
|
||||
* the @cr has a rotated current transformation matrix, the whole SVG will be rotated in
|
||||
* the rendered version.
|
||||
*
|
||||
* This function depends on the [class@Rsvg.Handle]'s DPI to compute dimensions in
|
||||
* pixels, so you should call [method@Rsvg.Handle.set_dpi] beforehand.
|
||||
*
|
||||
* Note that @cr must be a Cairo context that is not in an error state, that is,
|
||||
* `cairo_status()` must return `CAIRO_STATUS_SUCCESS` for it. Cairo can set a
|
||||
* context to be in an error state in various situations, for example, if it was
|
||||
* passed an invalid matrix or if it was created for an invalid surface.
|
||||
*
|
||||
* Element IDs should look like an URL fragment identifier; for example, pass
|
||||
* `#foo` (hash `foo`) to get the geometry of the element that
|
||||
* has an `id="foo"` attribute.
|
||||
*
|
||||
* Returns: `TRUE` if drawing succeeded; `FALSE` otherwise. This function will emit a g_warning()
|
||||
* if a rendering error occurs.
|
||||
*
|
||||
* Since: 2.14
|
||||
*
|
||||
* Deprecated: 2.52. Please use [method@Rsvg.Handle.render_layer] instead; that function lets
|
||||
* you pass a viewport and obtain a good error message.
|
||||
*/
|
||||
RSVG_DEPRECATED_FOR(rsvg_handle_render_layer)
|
||||
gboolean rsvg_handle_render_cairo_sub (RsvgHandle *handle, cairo_t *cr, const char *id);
|
||||
|
||||
/**
|
||||
* rsvg_handle_render_document:
|
||||
* @handle: An [class@Rsvg.Handle]
|
||||
* @cr: A Cairo context
|
||||
* @viewport: Viewport size at which the whole SVG would be fitted.
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* Renders the whole SVG document fitted to a viewport.
|
||||
*
|
||||
* The @viewport gives the position and size at which the whole SVG document will be
|
||||
* rendered. The document is scaled proportionally to fit into this viewport.
|
||||
*
|
||||
* The @cr must be in a `CAIRO_STATUS_SUCCESS` state, or this function will not
|
||||
* render anything, and instead will return an error.
|
||||
*
|
||||
* Returns: `TRUE` on success, `FALSE` on error. Errors are returned
|
||||
* in the @error argument.
|
||||
*
|
||||
* API ordering: This function must be called on a fully-loaded @handle. See
|
||||
* the section "[API ordering](class.Handle.html#api-ordering)" for details.
|
||||
*
|
||||
* Panics: this function will panic if the @handle is not fully-loaded.
|
||||
*
|
||||
* Since: 2.46
|
||||
*/
|
||||
RSVG_API
|
||||
gboolean rsvg_handle_render_document (RsvgHandle *handle,
|
||||
cairo_t *cr,
|
||||
const RsvgRectangle *viewport,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* rsvg_handle_get_geometry_for_layer:
|
||||
* @handle: An [class@Rsvg.Handle]
|
||||
* @id: (nullable): An element's id within the SVG, starting with "#" (a single
|
||||
* hash character), for example, `#layer1`. This notation corresponds to a
|
||||
* URL's fragment ID. Alternatively, pass `NULL` to compute the geometry for the
|
||||
* whole SVG.
|
||||
* @viewport: Viewport size at which the whole SVG would be fitted.
|
||||
* @out_ink_rect: (out)(optional): Place to store the ink rectangle of the element.
|
||||
* @out_logical_rect: (out)(optional): Place to store the logical rectangle of the element.
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* Computes the ink rectangle and logical rectangle of an SVG element, or the
|
||||
* whole SVG, as if the whole SVG were rendered to a specific viewport.
|
||||
*
|
||||
* Element IDs should look like an URL fragment identifier; for example, pass
|
||||
* `#foo` (hash `foo`) to get the geometry of the element that
|
||||
* has an `id="foo"` attribute.
|
||||
*
|
||||
* The "ink rectangle" is the bounding box that would be painted
|
||||
* for fully-stroked and filled elements.
|
||||
*
|
||||
* The "logical rectangle" just takes into account the unstroked
|
||||
* paths and text outlines.
|
||||
*
|
||||
* Note that these bounds are not minimum bounds; for example,
|
||||
* clipping paths are not taken into account.
|
||||
*
|
||||
* You can pass `NULL` for the @id if you want to measure all
|
||||
* the elements in the SVG, i.e. to measure everything from the
|
||||
* root element.
|
||||
*
|
||||
* This operation is not constant-time, as it involves going through all
|
||||
* the child elements.
|
||||
*
|
||||
* Returns: `TRUE` if the geometry could be obtained, or `FALSE` on error. Errors
|
||||
* are returned in the @error argument.
|
||||
*
|
||||
* API ordering: This function must be called on a fully-loaded @handle. See
|
||||
* the section "[API ordering](class.Handle.html#api-ordering)" for details.
|
||||
*
|
||||
* Panics: this function will panic if the @handle is not fully-loaded.
|
||||
*
|
||||
* Since: 2.46
|
||||
*/
|
||||
RSVG_API
|
||||
gboolean rsvg_handle_get_geometry_for_layer (RsvgHandle *handle,
|
||||
const char *id,
|
||||
const RsvgRectangle *viewport,
|
||||
RsvgRectangle *out_ink_rect,
|
||||
RsvgRectangle *out_logical_rect,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* rsvg_handle_render_layer:
|
||||
* @handle: An [class@Rsvg.Handle]
|
||||
* @cr: A Cairo context
|
||||
* @id: (nullable): An element's id within the SVG, starting with "#" (a single
|
||||
* hash character), for example, `#layer1`. This notation corresponds to a
|
||||
* URL's fragment ID. Alternatively, pass `NULL` to render the whole SVG document tree.
|
||||
* @viewport: Viewport size at which the whole SVG would be fitted.
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* Renders a single SVG element in the same place as for a whole SVG document.
|
||||
*
|
||||
* The @viewport gives the position and size at which the whole SVG document would be
|
||||
* rendered. The document is scaled proportionally to fit into this viewport; hence the
|
||||
* individual layer may be smaller than this.
|
||||
*
|
||||
* This is equivalent to [method@Rsvg.Handle.render_document], but it renders only a
|
||||
* single element and its children, as if they composed an individual layer in
|
||||
* the SVG. The element is rendered with the same transformation matrix as it
|
||||
* has within the whole SVG document. Applications can use this to re-render a
|
||||
* single element and repaint it on top of a previously-rendered document, for
|
||||
* example.
|
||||
*
|
||||
* Element IDs should look like an URL fragment identifier; for example, pass
|
||||
* `#foo` (hash `foo`) to get the geometry of the element that
|
||||
* has an `id="foo"` attribute.
|
||||
*
|
||||
* You can pass `NULL` for the @id if you want to render all
|
||||
* the elements in the SVG, i.e. to render everything from the
|
||||
* root element.
|
||||
*
|
||||
* Returns: `TRUE` on success, `FALSE` on error. Errors are returned
|
||||
* in the @error argument.
|
||||
*
|
||||
* API ordering: This function must be called on a fully-loaded @handle. See
|
||||
* the section "[API ordering](class.Handle.html#api-ordering)" for details.
|
||||
*
|
||||
* Panics: this function will panic if the @handle is not fully-loaded.
|
||||
*
|
||||
* Since: 2.46
|
||||
*/
|
||||
RSVG_API
|
||||
gboolean rsvg_handle_render_layer (RsvgHandle *handle,
|
||||
cairo_t *cr,
|
||||
const char *id,
|
||||
const RsvgRectangle *viewport,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* rsvg_handle_get_geometry_for_element:
|
||||
* @handle: An [class@Rsvg.Handle]
|
||||
* @id: (nullable): An element's id within the SVG, starting with "#" (a single
|
||||
* hash character), for example, `#layer1`. This notation corresponds to a
|
||||
* URL's fragment ID. Alternatively, pass `NULL` to compute the geometry for the
|
||||
* whole SVG.
|
||||
* @out_ink_rect: (out)(optional): Place to store the ink rectangle of the element.
|
||||
* @out_logical_rect: (out)(optional): Place to store the logical rectangle of the element.
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* Computes the ink rectangle and logical rectangle of a single SVG element.
|
||||
*
|
||||
* While `rsvg_handle_get_geometry_for_layer` computes the geometry of an SVG element subtree with
|
||||
* its transformation matrix, this other function will compute the element's geometry
|
||||
* as if it were being rendered under an identity transformation by itself. That is,
|
||||
* the resulting geometry is as if the element got extracted by itself from the SVG.
|
||||
*
|
||||
* This function is the counterpart to `rsvg_handle_render_element`.
|
||||
*
|
||||
* Element IDs should look like an URL fragment identifier; for example, pass
|
||||
* `#foo` (hash `foo`) to get the geometry of the element that
|
||||
* has an `id="foo"` attribute.
|
||||
*
|
||||
* The "ink rectangle" is the bounding box that would be painted
|
||||
* for fully- stroked and filled elements.
|
||||
*
|
||||
* The "logical rectangle" just takes into account the unstroked
|
||||
* paths and text outlines.
|
||||
*
|
||||
* Note that these bounds are not minimum bounds; for example,
|
||||
* clipping paths are not taken into account.
|
||||
*
|
||||
* You can pass `NULL` for the @id if you want to measure all
|
||||
* the elements in the SVG, i.e. to measure everything from the
|
||||
* root element.
|
||||
*
|
||||
* This operation is not constant-time, as it involves going through all
|
||||
* the child elements.
|
||||
*
|
||||
* Returns: `TRUE` if the geometry could be obtained, or `FALSE` on error. Errors
|
||||
* are returned in the @error argument.
|
||||
*
|
||||
* API ordering: This function must be called on a fully-loaded @handle. See
|
||||
* the section "[API ordering](class.Handle.html#api-ordering)" for details.
|
||||
*
|
||||
* Panics: this function will panic if the @handle is not fully-loaded.
|
||||
*
|
||||
* Since: 2.46
|
||||
*/
|
||||
RSVG_API
|
||||
gboolean rsvg_handle_get_geometry_for_element (RsvgHandle *handle,
|
||||
const char *id,
|
||||
RsvgRectangle *out_ink_rect,
|
||||
RsvgRectangle *out_logical_rect,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* rsvg_handle_render_element:
|
||||
* @handle: An [class@Rsvg.Handle]
|
||||
* @cr: A Cairo context
|
||||
* @id: (nullable): An element's id within the SVG, starting with "#" (a single
|
||||
* hash character), for example, `#layer1`. This notation corresponds to a
|
||||
* URL's fragment ID. Alternatively, pass `NULL` to render the whole SVG document tree.
|
||||
* @element_viewport: Viewport size in which to fit the element
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* Renders a single SVG element to a given viewport.
|
||||
*
|
||||
* This function can be used to extract individual element subtrees and render them,
|
||||
* scaled to a given @element_viewport. This is useful for applications which have
|
||||
* reusable objects in an SVG and want to render them individually; for example, an
|
||||
* SVG full of icons that are meant to be be rendered independently of each other.
|
||||
*
|
||||
* Element IDs should look like an URL fragment identifier; for example, pass
|
||||
* `#foo` (hash `foo`) to get the geometry of the element that
|
||||
* has an `id="foo"` attribute.
|
||||
*
|
||||
* You can pass `NULL` for the @id if you want to render all
|
||||
* the elements in the SVG, i.e. to render everything from the
|
||||
* root element.
|
||||
*
|
||||
* The `element_viewport` gives the position and size at which the named element will
|
||||
* be rendered. FIXME: mention proportional scaling.
|
||||
*
|
||||
* Returns: `TRUE` on success, `FALSE` on error. Errors are returned
|
||||
* in the @error argument.
|
||||
*
|
||||
* API ordering: This function must be called on a fully-loaded @handle. See
|
||||
* the section "[API ordering](class.Handle.html#api-ordering)" for details.
|
||||
*
|
||||
* Panics: this function will panic if the @handle is not fully-loaded.
|
||||
*
|
||||
* Since: 2.46
|
||||
*/
|
||||
RSVG_API
|
||||
gboolean rsvg_handle_render_element (RsvgHandle *handle,
|
||||
cairo_t *cr,
|
||||
const char *id,
|
||||
const RsvgRectangle *element_viewport,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
183
include/librsvg/rsvg-features.h.in
Normal file
183
include/librsvg/rsvg-features.h.in
Normal file
@@ -0,0 +1,183 @@
|
||||
#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)
|
||||
#warning "Including <librsvg/rsvg-features.h> directly is deprecated."
|
||||
#endif
|
||||
|
||||
#ifndef RSVG_FEATURES_H
|
||||
#define RSVG_FEATURES_H
|
||||
|
||||
/**
|
||||
* rsvg-features:
|
||||
*
|
||||
* Check for the version of librsvg being used.
|
||||
*
|
||||
* Librsvg provides a few C macros that C and C++ programs can use to
|
||||
* check the version being used at compile-time, that is, the API that
|
||||
* the program expects to have. This is useful for programs that need
|
||||
* to conditionally compile code with `#ifdef` blocks
|
||||
* depending on the version of librsvg that may be available during
|
||||
* compilation.
|
||||
*
|
||||
* Librsvg also provides a few global constants that can be used to
|
||||
* check the version of librsvg being used at run-time. This is
|
||||
* useful to know which version of librsvg is actually being used on
|
||||
* the system where the program is running.
|
||||
*/
|
||||
|
||||
/**
|
||||
* LIBRSVG_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](https://www.freedesktop.org/wiki/Software/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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* LIBRSVG_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](https://www.freedesktop.org/wiki/Software/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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* LIBRSVG_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](https://www.freedesktop.org/wiki/Software/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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* LIBRSVG_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](https://www.freedesktop.org/wiki/Software/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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* LIBRSVG_CHECK_VERSION:
|
||||
* @major: component for the major version to check
|
||||
* @minor: component for the minor version to check
|
||||
* @micro: component for the micro version to check
|
||||
*
|
||||
* This C macro returns `TRUE` if the the version of librsvg being
|
||||
* compiled against is the same or newer than the specified version.
|
||||
*
|
||||
* Note that this a compile-time check for C programs. If you want a
|
||||
* run-time check for the version of librsvg being used, or if you are
|
||||
* using another programming language, see the variables
|
||||
* `rsvg_major_version`, `rsvg_minor_version`, `rsvg_micro_version`
|
||||
* instead.
|
||||
*/
|
||||
#define LIBRSVG_CHECK_VERSION(major,minor,micro) \
|
||||
(LIBRSVG_MAJOR_VERSION > (major) || \
|
||||
(LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION > (minor)) || \
|
||||
(LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION == (minor) && LIBRSVG_MICRO_VERSION >= (micro)))
|
||||
|
||||
#define LIBRSVG_HAVE_SVGZ (TRUE)
|
||||
#define LIBRSVG_HAVE_CSS (TRUE)
|
||||
#define LIBRSVG_HAVE_PIXBUF (@LIBRSVG_HAVE_PIXBUF@)
|
||||
|
||||
#define LIBRSVG_CHECK_FEATURE(FEATURE) (LIBRSVG_HAVE_##FEATURE)
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
|
||||
/*
|
||||
* On Windows builds, we need to decorate variables that are exposed in the public API
|
||||
* so that they can be properly exported and linked to, for DLL builds
|
||||
*/
|
||||
#ifndef RSVG_VAR
|
||||
# ifdef G_PLATFORM_WIN32
|
||||
# ifndef RSVG_STATIC
|
||||
# ifdef RSVG_COMPILATION
|
||||
# define RSVG_VAR extern __declspec (dllexport)
|
||||
# else /* RSVG_COMPILATION */
|
||||
# define RSVG_VAR extern __declspec (dllimport)
|
||||
# endif /* !RSVG_COMPILATION */
|
||||
# else /* !RSVG_STATIC */
|
||||
# define RSVG_VAR extern
|
||||
# endif /* RSVG_STATIC */
|
||||
# else /* G_PLATFORM_WIN32 */
|
||||
# define RSVG_VAR extern
|
||||
# endif /* !G_PLATFORM_WIN32 */
|
||||
#endif
|
||||
|
||||
#endif /* __GTK_DOC_IGNORE__ */
|
||||
|
||||
/**
|
||||
* rsvg_major_version:
|
||||
*
|
||||
* Major version of the library. For example, for version 2.3.4, the major
|
||||
* version will be 2.
|
||||
*
|
||||
* Since: 2.52
|
||||
*/
|
||||
RSVG_VAR const guint rsvg_major_version;
|
||||
|
||||
/**
|
||||
* rsvg_minor_version:
|
||||
*
|
||||
* Minor version of the library. For example, for version 2.3.4, the minor
|
||||
* version will be 3.
|
||||
*
|
||||
* Since: 2.52
|
||||
*/
|
||||
RSVG_VAR const guint rsvg_minor_version;
|
||||
|
||||
/**
|
||||
* rsvg_micro_version:
|
||||
*
|
||||
* Micro version of the library. For example, for version 2.3.4, the micro
|
||||
* version will be 4.
|
||||
*
|
||||
* Since: 2.52
|
||||
*/
|
||||
RSVG_VAR const guint rsvg_micro_version;
|
||||
|
||||
#endif
|
||||
235
include/librsvg/rsvg-pixbuf.h
Normal file
235
include/librsvg/rsvg-pixbuf.h
Normal file
@@ -0,0 +1,235 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 sts=4 expandtab: */
|
||||
/*
|
||||
rsvg-pixbuf.h: SAX-based renderer for SVG files using GDK-Pixbuf.
|
||||
|
||||
Copyright (C) 2000 Eazel, Inc.
|
||||
|
||||
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
|
||||
|
||||
Author: Raph Levien <raph@artofcode.com>
|
||||
*/
|
||||
|
||||
#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)
|
||||
#warning "Including <librsvg/rsvg-pixbuf.h> directly is deprecated."
|
||||
#endif
|
||||
|
||||
#ifndef RSVG_PIXBUF_H
|
||||
#define RSVG_PIXBUF_H
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* rsvg_handle_get_pixbuf:
|
||||
* @handle: An [class@Rsvg.Handle]
|
||||
*
|
||||
* Returns the pixbuf loaded by @handle. The pixbuf returned will be reffed, so
|
||||
* the caller of this function must assume that ref.
|
||||
*
|
||||
* API ordering: This function must be called on a fully-loaded @handle. See
|
||||
* the section "[API ordering](class.Handle.html#api-ordering)" for details.
|
||||
*
|
||||
* This function depends on the [class@Rsvg.Handle]'s dots-per-inch value (DPI) to compute the
|
||||
* "natural size" of the document in pixels, so you should call [method@Rsvg.Handle.set_dpi]
|
||||
* beforehand.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A pixbuf, or %NULL on error
|
||||
* during rendering.
|
||||
* Deprecated: 2.58. Use [method@Rsvg.Handle.get_pixbuf_and_error].
|
||||
**/
|
||||
RSVG_DEPRECATED_FOR(rsvg_handle_get_pixbuf_and_error)
|
||||
GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle *handle);
|
||||
|
||||
/**
|
||||
* rsvg_handle_get_pixbuf_and_error:
|
||||
* @handle: An [class@Rsvg.Handle]
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* Returns the pixbuf loaded by @handle. The pixbuf returned will be reffed, so
|
||||
* the caller of this function must assume that ref.
|
||||
*
|
||||
* API ordering: This function must be called on a fully-loaded @handle. See
|
||||
* the section "[API ordering](class.Handle.html#api-ordering)" for details.
|
||||
*
|
||||
* This function depends on the [class@Rsvg.Handle]'s dots-per-inch value (DPI) to compute the
|
||||
* "natural size" of the document in pixels, so you should call [method@Rsvg.Handle.set_dpi]
|
||||
* beforehand.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A pixbuf, or %NULL on error
|
||||
* during rendering.
|
||||
*
|
||||
* Since: 2.59
|
||||
**/
|
||||
RSVG_API
|
||||
GdkPixbuf *rsvg_handle_get_pixbuf_and_error (RsvgHandle *handle, GError **error);
|
||||
|
||||
/**
|
||||
* rsvg_handle_get_pixbuf_sub:
|
||||
* @handle: An #RsvgHandle
|
||||
* @id: (nullable): An element's id within the SVG, starting with "#" (a single
|
||||
* hash character), for example, `#layer1`. This notation corresponds to a
|
||||
* URL's fragment ID. Alternatively, pass `NULL` to use the whole SVG.
|
||||
*
|
||||
* Creates a `GdkPixbuf` the same size as the entire SVG loaded into @handle, but
|
||||
* only renders the sub-element that has the specified @id (and all its
|
||||
* sub-sub-elements recursively). If @id is `NULL`, this function renders the
|
||||
* whole SVG.
|
||||
*
|
||||
* This function depends on the [class@Rsvg.Handle]'s dots-per-inch value (DPI) to compute the
|
||||
* "natural size" of the document in pixels, so you should call [method@Rsvg.Handle.set_dpi]
|
||||
* beforehand.
|
||||
*
|
||||
* If you need to render an image which is only big enough to fit a particular
|
||||
* sub-element of the SVG, consider using [method@Rsvg.Handle.render_element].
|
||||
*
|
||||
* Element IDs should look like an URL fragment identifier; for example, pass
|
||||
* `#foo` (hash `foo`) to get the geometry of the element that
|
||||
* has an `id="foo"` attribute.
|
||||
*
|
||||
* API ordering: This function must be called on a fully-loaded @handle. See
|
||||
* the section "[API ordering](class.Handle.html#api-ordering)" for details.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): a pixbuf, or `NULL` if an error occurs
|
||||
* during rendering.
|
||||
*
|
||||
* Since: 2.14
|
||||
**/
|
||||
RSVG_API
|
||||
GdkPixbuf *rsvg_handle_get_pixbuf_sub (RsvgHandle *handle, const char *id);
|
||||
|
||||
/* BEGIN deprecated APIs. Do not use! */
|
||||
|
||||
/**
|
||||
* rsvg-pixbuf:
|
||||
*
|
||||
* Years ago, GNOME and GTK used the gdk-pixbuf library as a general mechanism to load
|
||||
* raster images into memory (PNG, JPEG, etc.) and pass them around. The general idiom
|
||||
* was, "load this image file and give me a `GdkPixbuf` object", which is basically a pixel
|
||||
* buffer. Librsvg supports this kind of interface to load and render SVG documents, but
|
||||
* it is deprecated in favor of rendering to Cairo contexts.
|
||||
*/
|
||||
|
||||
/**
|
||||
* rsvg_pixbuf_from_file:
|
||||
* @filename: A file name
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A pixbuf, or %NULL on error.
|
||||
* Deprecated: Use [ctor@Rsvg.Handle.new_from_file] and [method@Rsvg.Handle.render_document] instead.
|
||||
**/
|
||||
RSVG_DEPRECATED
|
||||
GdkPixbuf *rsvg_pixbuf_from_file (const gchar *filename,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* rsvg_pixbuf_from_file_at_zoom:
|
||||
* @filename: A file name
|
||||
* @x_zoom: The horizontal zoom factor
|
||||
* @y_zoom: The vertical zoom factor
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A pixbuf, or %NULL on error.
|
||||
* Deprecated: Use [ctor@Rsvg.Handle.new_from_file] and [method@Rsvg.Handle.render_document] instead.
|
||||
**/
|
||||
RSVG_DEPRECATED
|
||||
GdkPixbuf *rsvg_pixbuf_from_file_at_zoom (const gchar *filename,
|
||||
double x_zoom,
|
||||
double y_zoom,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* rsvg_pixbuf_from_file_at_size:
|
||||
* @filename: A file name
|
||||
* @width: The new width, or -1
|
||||
* @height: The new height, or -1
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A pixbuf, or %NULL on error.
|
||||
* Deprecated: Use [ctor@Rsvg.Handle.new_from_file] and [method@Rsvg.Handle.render_document] instead.
|
||||
**/
|
||||
RSVG_DEPRECATED
|
||||
GdkPixbuf *rsvg_pixbuf_from_file_at_size (const gchar *filename,
|
||||
gint width,
|
||||
gint height,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* rsvg_pixbuf_from_file_at_max_size:
|
||||
* @filename: A file name
|
||||
* @max_width: The requested max width
|
||||
* @max_height: The requested max height
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A pixbuf, or %NULL on error.
|
||||
* Deprecated: Use [ctor@Rsvg.Handle.new_from_file] and [method@Rsvg.Handle.render_document] instead.
|
||||
**/
|
||||
RSVG_DEPRECATED
|
||||
GdkPixbuf *rsvg_pixbuf_from_file_at_max_size (const gchar *filename,
|
||||
gint max_width,
|
||||
gint max_height,
|
||||
GError **error);
|
||||
/**
|
||||
* rsvg_pixbuf_from_file_at_zoom_with_max:
|
||||
* @filename: A file name
|
||||
* @x_zoom: The horizontal zoom factor
|
||||
* @y_zoom: The vertical zoom factor
|
||||
* @max_width: The requested max width
|
||||
* @max_height: The requested max height
|
||||
* @error: return location for a `GError`
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A pixbuf, or %NULL on error.
|
||||
* Deprecated: Use [ctor@Rsvg.Handle.new_from_file] and [method@Rsvg.Handle.render_document] instead.
|
||||
**/
|
||||
RSVG_DEPRECATED
|
||||
GdkPixbuf *rsvg_pixbuf_from_file_at_zoom_with_max (const gchar *filename,
|
||||
double x_zoom,
|
||||
double y_zoom,
|
||||
gint max_width,
|
||||
gint max_height,
|
||||
GError **error);
|
||||
|
||||
/* END deprecated APIs. */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
13
include/librsvg/rsvg-version.h.in
Normal file
13
include/librsvg/rsvg-version.h.in
Normal file
@@ -0,0 +1,13 @@
|
||||
#if !defined (__RSVG_RSVG_H_INSIDE__) && !defined (RSVG_COMPILATION)
|
||||
#warning "Including <librsvg/rsvg-version.h> directly is deprecated."
|
||||
#endif
|
||||
|
||||
#ifndef RSVG_VERSION_H
|
||||
#define RSVG_VERSION_H
|
||||
|
||||
#define LIBRSVG_MAJOR_VERSION (@LIBRSVG_MAJOR_VERSION@)
|
||||
#define LIBRSVG_MINOR_VERSION (@LIBRSVG_MINOR_VERSION@)
|
||||
#define LIBRSVG_MICRO_VERSION (@LIBRSVG_MICRO_VERSION@)
|
||||
#define LIBRSVG_VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
#endif
|
||||
1342
include/librsvg/rsvg.h
Normal file
1342
include/librsvg/rsvg.h
Normal file
File diff suppressed because it is too large
Load Diff
1
include/meson.build
Normal file
1
include/meson.build
Normal file
@@ -0,0 +1 @@
|
||||
subdir('librsvg')
|
||||
Reference in New Issue
Block a user