/*
* Helpers for SPItem -> gdk_pixbuf related stuff
*
* Authors:
* John Cliff <simarilius@yahoo.com>
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
*
* Copyright (C) 2008 John Cliff
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <png.h>
#include <boost/scoped_ptr.hpp>
#include "ui/interface.h"
#include "helper/png-write.h"
#include "display/cairo-utils.h"
#include "display/drawing-context.h"
#include "display/drawing-item.h"
#include "document.h"
#include "sp-item.h"
#include "sp-root.h"
#include "sp-use.h"
#include "sp-defs.h"
#include "helper/pixbuf-ops.h"
// TODO look for copy-n-paste duplication of this function:
/**
* Hide all items that are not listed in list, recursively, skipping groups and defs.
*/
{
if ( item
&& !g_slist_find(list, o) )
{
}
// recurse
if (!g_slist_find(list, o)) {
}
}
}
// The following is a mutation of the flood fill code, the marker preview, and random other samplings.
// The dpi settings dont do anything yet, but I want them to, and was wanting to keep reasonably close
// to the call for the interface to the png writing.
{
gchar c[32];
gboolean saved = gdk_pixbuf_save(pixbuf->getPixbufRaw(), filename, "jpeg", NULL, "quality", c, NULL);
return saved;
}
/**
generates a bitmap from given items
the bitmap is stored in RAM and not written to file
@param x0
@param y0
@param x1
@param y1
@param width
@param height
@param xdpi
@param ydpi
@return the created GdkPixbuf structure or NULL if no memory is allocable
*/
unsigned long /*bgcolor*/,
{
/* Create new drawing for offscreen rendering*/
doc->ensureUpToDate();
Geom::Scale scale(Inkscape::Util::Quantity::convert(xdpi, "px", "in"), Inkscape::Util::Quantity::convert(ydpi, "px", "in"));
/* Create ArenaItems and set transform */
// We show all and then hide all items we don't want, instead of showing only requested items,
// because that would not work if the shown item references something in defs
if (items_only) {
}
// render items
}
else
{
long long size = (long long) height * (long long) cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width);
g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %lld.", size);
}
// gdk_pixbuf_save (pixbuf, "C:\\temp\\internal.jpg", "jpeg", NULL, "quality","100", NULL);
return inkpb;
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :