Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
librsvg
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
174
Issues
174
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
librsvg
Commits
0205e78e
Commit
0205e78e
authored
Oct 04, 2002
by
Dom Lachowicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsvg can now be a gdk-pixbuf loader if your gdk-pixbuf is new enough
parent
687e1d22
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
203 additions
and
1 deletion
+203
-1
ChangeLog
ChangeLog
+8
-0
Makefile.am
Makefile.am
+1
-1
configure.in
configure.in
+23
-0
gdk-pixbuf-loader/Makefile.am
gdk-pixbuf-loader/Makefile.am
+31
-0
gdk-pixbuf-loader/io-svg.c
gdk-pixbuf-loader/io-svg.c
+140
-0
No files found.
ChangeLog
View file @
0205e78e
2002
-
10
-
03
Matthias
Clasen
<
maclas
@
gmx
.
de
>
*
gdk
-
pixbuf
-
loader
:
RSVG
can
now
be
optionally
a
loadable
module
for
GdkPixbuf
,
if
you
have
a
new
enough
version
of
GdkPixbuf
2002
-
10
-
03
Dom
Lachowicz
<
doml
@
appligent
.
com
>
*
rsvg
.
c
(
set_dpi
):
minor
update
to
reset
the
DPI
if
necessary
2002
-
10
-
02
Dom
Lachowicz
<
doml
@
appligent
.
com
>
*
rsvg
-
path
.
c
(*):
Remove
VERBOSE
statements
...
...
Makefile.am
View file @
0205e78e
SUBDIRS
=
gtk-engine
SUBDIRS
=
gtk-engine
gdk-pixbuf-loader
noinst_PROGRAMS
=
test-rsvg test-performance
...
...
configure.in
View file @
0205e78e
...
...
@@ -71,6 +71,12 @@ AC_SUBST(GTK_VERSION)
dnl ===========================================================================
PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0,,)
AC_SUBST(GDK_PIXBUF_CFLAGS)
AC_SUBST(GDK_PIXBUF_LIBS)
dnl ===========================================================================
AC_CHECK_LIB(popt, poptParseArgvString, [POPT_LIBS="-lpopt"],
AC_MSG_ERROR([popt 1.5 or newer is required to build librsvg.
You can download the latest version from ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/]))
...
...
@@ -130,6 +136,22 @@ fi
AM_CONDITIONAL(ENABLE_GTK_ENGINE, test x$enable_gtk_theme = xyes)
AC_PATH_PROG(QUERYLOADERS, gdk-pixbuf-query-loaders, false)
AC_ARG_ENABLE(pixbuf-loader,
[ --enable-pixbuf-loader Enable a RSVG based GdkPixbuf loader [default=auto]],
enable_pixbuf_loader="$enableval", enable_pixbuf_loader=auto)
if test x$enable_pixbuf_loader = xauto ; then
if test x$QUERYLOADERS = xfalse ; then
enable_pixbuf_loader=no
else
enable_pixbuf_loader=yes
fi
fi
AM_CONDITIONAL(ENABLE_PIXBUF_LOADER, test x$enable_pixbuf_loader = xyes)
dnl ===========================================================================
AC_OUTPUT([
...
...
@@ -141,4 +163,5 @@ gtk-engine/Makefile
gtk-engine/examples/Makefile
gtk-engine/examples/bubble/Makefile
gtk-engine/examples/bubble/gtk-2.0/Makefile
gdk-pixbuf-loader/Makefile
])
gdk-pixbuf-loader/Makefile.am
0 → 100644
View file @
0205e78e
loaderdir
=
$(libdir)
/gtk-2.0/
$(GTK_VERSION)
/loaders
INCLUDES
=
@LIBRSVG_CFLAGS@ @GDK_PIXBUF_CFLAGS@
-DGDK_PIXBUF_ENABLE_BACKEND
if
ENABLE_PIXBUF_LOADER
target_pixbuf_loader
=
svg_loader.la
else
target_pixbuf_loader
=
endif
svg_loader_la_SOURCES
=
io-svg.c
svg_loader_la_LDFLAGS
=
-avoid-version
-module
svg_loader_la_LIBADD
=
$(GDK_PIXBUF_LIBS)
$(LIBRSVG_LIBS)
-lrsvg-2
loader_LTLIBRARIES
=
$(target_pixbuf_loader)
install-data-local
:
if
[
-z
"
$(DESTDIR)
"
]
;
then
\
$(mkinstalldirs)
$(DESTDIR)$(sysconfdir)
/gtk-2.0
;
\
$(QUERYLOADERS)
>
$(DESTDIR)$(sysconfdir)
/gtk-2.0/gdk-pixbuf.loaders
;
\
fi
gdk-pixbuf-loader/io-svg.c
0 → 100644
View file @
0205e78e
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/* GdkPixbuf library - SVG image loader
*
* Copyright (C) 2002 Matthias Clasen
*
* Authors: Matthias Clasen <maclas@gmx.de>
*
* 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 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 * 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include "rsvg.h"
#include "gdk-pixbuf/gdk-pixbuf.h"
#include "gdk-pixbuf/gdk-pixbuf-io.h"
#define BUFFER_SIZE (1024 * 8)
typedef
struct
{
RsvgHandle
*
handle
;
GdkPixbuf
*
pixbuf
;
GdkPixbufModuleUpdatedFunc
updated_func
;
GdkPixbufModulePreparedFunc
prepared_func
;
gpointer
user_data
;
}
SvgContext
;
static
gpointer
gdk_pixbuf__svg_image_begin_load
(
GdkPixbufModuleSizeFunc
size_func
,
GdkPixbufModulePreparedFunc
prepared_func
,
GdkPixbufModuleUpdatedFunc
updated_func
,
gpointer
user_data
,
GError
**
error
)
{
SvgContext
*
context
=
g_new0
(
SvgContext
,
1
);
context
->
handle
=
rsvg_handle_new
();
rsvg_handle_set_size_callback
(
context
->
handle
,
size_func
,
user_data
,
NULL
);
context
->
prepared_func
=
prepared_func
;
context
->
updated_func
=
updated_func
;
context
->
user_data
=
user_data
;
return
context
;
}
static
gboolean
gdk_pixbuf__svg_image_load_increment
(
gpointer
data
,
const
guchar
*
buf
,
guint
size
,
GError
**
error
)
{
SvgContext
*
context
=
(
SvgContext
*
)
data
;
gboolean
result
;
result
=
rsvg_handle_write
(
context
->
handle
,
buf
,
size
,
error
);
context
->
pixbuf
=
rsvg_handle_get_pixbuf
(
context
->
handle
);
if
(
context
->
pixbuf
!=
NULL
&&
context
->
prepared_func
!=
NULL
)
{
(
*
context
->
prepared_func
)
(
context
->
pixbuf
,
NULL
,
context
->
user_data
);
}
return
result
;
}
static
gboolean
gdk_pixbuf__svg_image_stop_load
(
gpointer
data
,
GError
**
error
)
{
SvgContext
*
context
=
(
SvgContext
*
)
data
;
rsvg_handle_close
(
context
->
handle
,
error
);
if
(
context
->
pixbuf
==
NULL
)
{
context
->
pixbuf
=
rsvg_handle_get_pixbuf
(
context
->
handle
);
if
(
context
->
pixbuf
!=
NULL
&&
context
->
prepared_func
!=
NULL
)
{
(
*
context
->
prepared_func
)
(
context
->
pixbuf
,
NULL
,
context
->
user_data
);
}
}
if
(
context
->
pixbuf
!=
NULL
&&
context
->
updated_func
!=
NULL
)
{
(
*
context
->
updated_func
)
(
context
->
pixbuf
,
0
,
0
,
gdk_pixbuf_get_width
(
context
->
pixbuf
),
gdk_pixbuf_get_height
(
context
->
pixbuf
),
context
->
user_data
);
}
rsvg_handle_free
(
context
->
handle
);
g_object_unref
(
context
->
pixbuf
);
g_free
(
context
);
return
TRUE
;
}
void
fill_vtable
(
GdkPixbufModule
*
module
)
{
module
->
begin_load
=
gdk_pixbuf__svg_image_begin_load
;
module
->
stop_load
=
gdk_pixbuf__svg_image_stop_load
;
module
->
load_increment
=
gdk_pixbuf__svg_image_load_increment
;
}
void
fill_info
(
GdkPixbufFormat
*
info
)
{
static
GdkPixbufModulePattern
signature
[]
=
{
{
"<?xml"
,
NULL
,
50
},
{
"<svg"
,
NULL
,
100
},
{
"<!DOCTYPE svg"
,
NULL
,
100
},
{
NULL
,
NULL
,
0
}
};
static
gchar
*
mime_types
[]
=
{
"image/svg"
,
"image/svg+xml"
,
NULL
};
static
gchar
*
extensions
[]
=
{
"svg"
,
NULL
};
info
->
name
=
"svg"
;
info
->
signature
=
signature
;
info
->
description
=
"Scalable Vector Graphics"
;
info
->
mime_types
=
mime_types
;
info
->
extensions
=
extensions
;
info
->
flags
=
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment