pixbuf-ops.cpp revision 62dad53172661dfa1ef8dd3ed07e06d2ea2523a4
#define __SP_PIXBUF_OPS_C__
/*
* Helpers for SPItem -> gdk_pixbuf related stuff
*
* Authors:
* John Cliff <simarilius@yahoo.com>
*
* 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 <interface.h>
#include <libnr/nr-pixops.h>
#include <glib.h>
#include <glib/gmessages.h>
#include <png.h>
#include "png-write.h"
#include <display/nr-arena-item.h>
#include <display/nr-arena.h>
#include <document.h>
#include <sp-item.h>
#include <sp-root.h>
#include <sp-use.h>
#include <sp-defs.h>
#include "unit-constants.h"
#include "libnr/nr-matrix-translate-ops.h"
#include "libnr/nr-scale-ops.h"
#include "libnr/nr-scale-translate-ops.h"
#include "libnr/nr-translate-matrix-ops.h"
#include "libnr/nr-translate-scale-ops.h"
#include "pixbuf-ops.h"
/**
* Hide all items that are not listed in list, recursively, skipping groups and defs.
*/
static void
{
if ( SP_IS_ITEM(o)
&& !SP_IS_DEFS(o)
&& !SP_IS_ROOT(o)
&& !SP_IS_GROUP(o)
&& !SP_IS_USE(o)
&& !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.
bool
{
gchar c[32];
g_free(c);
if (saved) return true;
else return false;
}
unsigned long bgcolor,
{
/* Create new arena for offscreen rendering*/
double padding = 1.0;
/* Create ArenaItems and set transform */
NRArenaItem *root = sp_item_invoke_show(SP_ITEM(sp_document_root(doc)), arena, dkey, SP_ITEM_SHOW_DISPLAY);
// 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) {
}
final_bbox.x0 = 0;
nr_arena_item_invoke_update(root, &final_bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
// g_try_new is limited to g_size type which is defined as unisgned int. Need to test for very large nubers
}
{
NRPixBlock B;
//g_warning("sp_generate_internal_bitmap: nr_pixblock_setup_extern.");
unsigned char dtc[4];
for (int i = 0; i < 4; i++) {
*p++ = dtc[i];
}
}
}
TRUE,
NULL);
}
else
{
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 pixbuf;
}
/*
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:encoding=utf-8:textwidth=99 :