Commit b64892b5 authored by Dom Lachowicz's avatar Dom Lachowicz

some work toward a cairo rsvg backend

parent 231c0b02
......@@ -4,14 +4,20 @@ else
target_rsvg_view =
endif
if HAVE_ART
SUBDIRS = . gtk-engine gdk-pixbuf-loader moz-plugin doc data
lib_LTLIBRARIES = librsvg-2-base.la librsvg-2-libart.la librsvg-2.la
bin_PROGRAMS = rsvg $(target_rsvg_view)
noinst_PROGRAMS = test-performance
else
SUBDIRS = . doc data
lib_LTLIBRARIES = librsvg-2-base.la
bin_PROGRAMS =
noinst_PROGRAMS =
if HAVE_ART
SUBDIRS += gtk-engine gdk-pixbuf-loader moz-plugin
lib_LTLIBRARIES += librsvg-2-libart.la librsvg-2.la
bin_PROGRAMS += rsvg $(target_rsvg_view)
noinst_PROGRAMS += test-performance
endif
if HAVE_CAIRO
lib_LTLIBRARIES += librsvg-2-cairo.la
endif
man_MANS = rsvg.1
......@@ -28,8 +34,6 @@ enum_sources = \
librsvg-enum-types.h \
librsvg-enum-types.c
librsvg_2_base_la_SOURCES = \
rsvg-affine.c \
librsvg-features.c \
......@@ -79,10 +83,17 @@ librsvg_2_libart_la_SOURCES = \
rsvg-art-paint-server.h \
rsvg-art-render.c \
rsvg-art-render.h
librsvg_2_libart_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined -export-dynamic
librsvg_2_libart_la_LIBADD = librsvg-2-base.la $(LIBGNOME_VFS_LIBS) $(LIBGSF_LIBS) $(LIBCROCO_LIBS) $(LIBRSVG_LIBS) $(FREETYPE_LIBS) $(LIBART_LIBS)
librsvg_2_cairo_la_SOURCES = \
rsvg-cairo-draw.c \
rsvg-cairo-draw.h \
rsvg-cairo-render.c \
rsvg-cairo-render.h
librsvg_2_cairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined -export-dynamic
librsvg_2_cairo_la_LIBADD = librsvg-2-base.la $(LIBGNOME_VFS_LIBS) $(LIBGSF_LIBS) $(LIBCROCO_LIBS) $(LIBRSVG_LIBS) $(FREETYPE_LIBS) $(CAIRO_LIBS)
librsvg_2_la_SOURCES = \
rsvg.c
......@@ -106,7 +117,8 @@ INCLUDES = \
$(GDK_X11_CFLAGS) \
-DG_LOG_DOMAIN=\"librsvg\" \
-DLIBRSVG_DATADIR="\"$(datadir)\""\
$(LIBART_CFLAGS)
$(LIBART_CFLAGS) \
$(CAIRO_CFLAGS)
DEPS = $(top_builddir)/librsvg-2.la $(top_builddir)/librsvg-2-libart.la
LDADDS = \
......
......@@ -7,12 +7,14 @@ GDK_PIXBUF_REQUIRED=1.3.7
GLIB_REQUIRED=2.0.0
LIBART_REQUIRED=2.3.10
LIBXML_REQUIRED=2.4.7
CAIRO_REQUIRED=0.6.0
PANGOFT2_REQUIRED=1.2.0
POPT_REQUIRED=1.5
AC_SUBST(GDK_PIXBUF_REQUIRED)
AC_SUBST(GLIB_REQUIRED)
AC_SUBST(LIBART_REQUIRED)
AC_SUBST(CAIRO_REQUIRED)
AC_SUBST(LIBXML_REQUIRED)
AC_SUBST(PANGOFT2_REQUIRED)
AC_SUBST(POPT_REQUIRED)
......@@ -147,6 +149,31 @@ AM_CONDITIONAL(HAVE_ART, test "x$test_art" = "xtrue")
dnl ===========================================================================
LIBCAIRO_CFLAGS=""
LIBCAIRO_LIBS=""
test_cairo=true
AC_ARG_WITH(cairo,[ --with-cairo Build the cairo backend],[
if test "x$withval" = "xno"; then
test_cairo=false
fi
])
if test "x$test_cairo" = "xtrue"; then
PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_REQUIRED, test_cairo=true, test_cairo=false)
fi
if test "x$test_cairo" = "xtrue"; then
LIBCAIRO_CFLAGS="$LIBCAIRO_CFLAGS"
else
AC_MSG_WARN([cairo backend disabled, as requested (Use --with-cairo to enable)])
fi
AC_SUBST(LIBCAIRO_CFLAGS)
AC_SUBST(LIBCAIRO_LIBS)
AM_CONDITIONAL(HAVE_CAIRO, test "x$test_cairo" = "xtrue")
dnl ===========================================================================
LIBGSF_CFLAGS=""
LIBGSF_LIBS=""
......@@ -474,8 +501,22 @@ librsvg-$LIBRSVG_VERSION
Use Gnome VFS: ${test_gnome_vfs}
Use libcroco for css parsing: ${test_croco}
Build documentation: ${enable_gtk_doc}
Build libart backend: ${test_art}
Build cairo backend: ${test_cairo}
"
AC_MSG_RESULT([$croco_warning]);
AC_MSG_RESULT([$gsf_warning]);
AC_MSG_RESULT([$art_warning]);
\ No newline at end of file
if test "x$croco_warning" != "x"; then
AC_MSG_RESULT([$croco_warning]);
fi
if test "x$gsf_warning" != "x"; then
AC_MSG_RESULT([$gsf_warning]);
fi
if test "x$art_warning" != "x"; then
AC_MSG_RESULT([$art_warning]);
fi
if test "x$cairo_warning" != "x"; then
AC_MSG_RESULT([$cairo_warning]);
fi
......@@ -152,12 +152,14 @@ rsvg_art_mask_render (RsvgMask *self, GdkPixbuf *tos, GdkPixbuf *nos, RsvgDrawin
if (tos == NULL || nos == NULL)
{
/* FIXME: What warning/GError here? */
g_object_unref (G_OBJECT (mask));
return;
}
if (!gdk_pixbuf_get_has_alpha (nos))
{
g_warning (_("push/pop transparency group on non-alpha buffer nyi"));
g_object_unref (G_OBJECT (mask));
return;
}
......
/* vim: set sw=4: -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
rsvg-shapes.c: Draw shapes with libart
Copyright (C) 2000 Eazel, Inc.
Copyright (C) 2002 Dom Lachowicz <cinamod@hotmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Raph Levien <raph@artofcode.com>,
Dom Lachowicz <cinamod@hotmail.com>,
Caleb Moore <c.moore@student.unsw.edu.au>
*/
#include "rsvg-cairo-draw.h"
#include "rsvg-cairo-render.h"
#include "rsvg-styles.h"
#include "rsvg-bpath-util.h"
#include "rsvg-path.h"
#include "rsvg-filter.h"
#include <math.h>
void
rsvg_cairo_render_path(RsvgDrawingCtx *ctx, const RsvgBpathDef *bpath_def)
{
}
void rsvg_cairo_render_image (RsvgDrawingCtx *ctx, const GdkPixbuf * img,
double x, double y, double w, double h)
{
RsvgCairoRender *render = (RsvgCairoRender *)ctx->render;
RsvgState *state = rsvg_state_current(ctx);
cairo_surface_t * surface;
unsigned char * data = gdk_pixbuf_get_pixels(img);
cairo_save (render->cr);
surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_RGB24,
w, h, w * 4);
cairo_translate (render->cr, x, y);
cairo_set_source_surface (render->cr, surface, 0, 0);
if (state->opacity != 1.0)
cairo_paint_with_alpha (render->cr, state->opacity);
else
cairo_paint (render->cr);
cairo_surface_destroy (surface);
cairo_restore (render->cr);
}
/* vim: set sw=4: -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
rsvg-shapes.c: Draw shapes with libart
Copyright (C) 2000 Eazel, Inc.
Copyright (C) 2002 Dom Lachowicz <cinamod@hotmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Raph Levien <raph@artofcode.com>,
Dom Lachowicz <cinamod@hotmail.com>,
Caleb Moore <c.moore@student.unsw.edu.au>
*/
#ifndef RSVG_CAIRO_DRAW_H
#define RSVG_CAIRO_DRAW_H
#include "rsvg-private.h"
G_BEGIN_DECLS
void rsvg_cairo_render_path (RsvgDrawingCtx *ctx, const RsvgBpathDef * path);
void rsvg_cairo_render_image (RsvgDrawingCtx *ctx, const GdkPixbuf * img,
double x, double y, double w, double h);
G_END_DECLS
#endif /*RSVG_CAIRO_DRAW_H*/
/* vim: set sw=4: -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
rsvg-cairo-render.c: The cairo backend plugin
Copyright (C) 2005 Dom Lachowicz <cinamod@hotmail.com>
Caleb Moore <c.moore@student.unsw.edu.au>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Dom Lachowicz <cinamod@hotmail.com>
Caleb Moore <c.moore@student.unsw.edu.au>
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "rsvg-cairo-draw.h"
#include "rsvg-cairo-render.h"
static void
rsvg_cairo_render_free (RsvgRender * self)
{
RsvgCairoRender * me = (RsvgCairoRender *)self;
/* TODO */
g_free (me);
}
RsvgCairoRender *
rsvg_cairo_render_new(cairo_t * cr)
{
RsvgCairoRender * cairo_render = g_new(RsvgCairoRender, 1);
cairo_render->super.free = rsvg_cairo_render_free;
cairo_render->super.render_image = rsvg_cairo_render_image;
#if 0
cairo_render->super.render_path = rsvg_cairo_render_path;
cairo_render->super.pop_discrete_layer = rsvg_cairo_pop_discrete_layer;
cairo_render->super.push_discrete_layer = rsvg_cairo_push_discrete_layer;
cairo_render->super.add_clipping_rect = rsvg_cairo_add_clipping_rect;
cairo_render->super.get_image_of_node = rsvg_cairo_get_image_of_node;
#endif
cairo_render->cr = cr;
return cairo_render;
}
/* vim: set sw=4: -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
rsvg-cairo-render.h: The cairo backend plugin
Copyright (C) 2005 Dom Lachowicz <cinamod@hotmail.com>
Caleb Moore <c.moore@student.unsw.edu.au>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Dom Lachowicz <cinamod@hotmail.com>
Caleb Moore <c.moore@student.unsw.edu.au>
*/
#ifndef RSVG_CAIRO_RENDER_H
#define RSVG_CAIRO_RENDER_H
#include "rsvg-private.h"
#include <cairo.h>
G_BEGIN_DECLS
typedef struct RsvgCairoRender RsvgCairoRender;
struct RsvgCairoRender {
RsvgRender super;
cairo_surface_t *surface;
cairo_t *cr;
};
RsvgCairoRender * rsvg_cairo_render_new(cairo_t * cr);
G_END_DECLS
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment