nr-arena-glyphs.cpp revision 1f67c2bae7e121b1ed8cc11a201d6fabdbdd467f
#define __NR_ARENA_GLYPHS_C__
/*
* RGBA display list system for inkscape
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 2002 Lauris Kaplinski
*
* Released under GNU GPL
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "libnr/nr-convert2geom.h"
#include "style.h"
#include "display/nr-arena.h"
#include "display/nr-arena-glyphs.h"
#include <cairo.h>
#include "display/cairo-utils.h"
#ifdef test_glyph_liv
#include "../display/canvas-bpath.h"
#include "libnrtype/font-instance.h"
// defined in nr-arena-shape.cpp
#endif
#ifdef ENABLE_SVG_FONTS
#include "nr-svgfonts.h"
#endif //#ifdef ENABLE_SVG_FONTS
static guint nr_arena_glyphs_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset);
static NRArenaItem *nr_arena_glyphs_pick(NRArenaItem *item, Geom::Point p, double delta, unsigned int sticky);
static NRArenaItemClass *glyphs_parent_class;
nr_arena_glyphs_get_type(void)
{
if (!type) {
"NRArenaGlyphs",
sizeof(NRArenaGlyphsClass),
sizeof(NRArenaGlyphs),
(void (*)(NRObjectClass *)) nr_arena_glyphs_class_init,
(void (*)(NRObject *)) nr_arena_glyphs_init);
}
return type;
}
static void
{
}
static void
{
}
static void
{
}
}
static guint
nr_arena_glyphs_update(NRArenaItem *item, NRRectL */*area*/, NRGC *gc, guint /*state*/, guint /*reset*/)
{
return NR_ARENA_ITEM_STATE_ALL;
if (ggroup->nrstyle.fill.type == NRStyle::PAINT_NONE && ggroup->nrstyle.stroke.type == NRStyle::PAINT_NONE)
return NR_ARENA_ITEM_STATE_ALL;
glyphs->x = t[4];
glyphs->y = t[5];
}
// those pesky miters, now
if ( miterMax > 0.01 ) {
// grunt mode. we should compute the various miters instead
// (one for each point on the curve)
}
}
if (b) {
} else {
}
return NR_ARENA_ITEM_STATE_ALL;
}
static guint
{
/* TODO : render to greyscale pixblock provided for clipping */
}
static NRArenaItem *
{
double const x = p[Geom::X];
double const y = p[Geom::Y];
/* With text we take a simple approach: pick if the point is in a characher bbox */
if ((x + delta >= item->bbox.x0) && (y + delta >= item->bbox.y0) && (x - delta <= item->bbox.x1) && (y - delta <= item->bbox.y1)) return item;
return NULL;
}
void
nr_arena_glyphs_set_path(NRArenaGlyphs *glyphs, SPCurve */*curve*/, unsigned int /*lieutenant*/, font_instance *font, gint glyph, Geom::Matrix const *transform)
{
if (transform) {
} else {
}
}
static guint nr_arena_glyphs_group_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset);
static unsigned int nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags);
static NRArenaItem *nr_arena_glyphs_group_pick(NRArenaItem *item, Geom::Point p, gdouble delta, unsigned int sticky);
static NRArenaGroupClass *group_parent_class;
{
if (!type) {
"NRArenaGlyphsGroup",
sizeof(NRArenaGlyphsGroupClass),
sizeof(NRArenaGlyphsGroup),
(void (*)(NRObjectClass *)) nr_arena_glyphs_group_class_init,
(void (*)(NRObject *)) nr_arena_glyphs_group_init);
}
return type;
}
static void
{
}
static void
{
}
static void
{
}
}
static guint
{
return NR_ARENA_ITEM_STATE_ALL;
}
static unsigned int
nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int /*flags*/)
{
// FIXME: we use RGBA buffers but cairo writes BGRA (on i386), so we must cheat
// by setting color channels in the "wrong" order
cairo_set_source_rgba(ct, SP_RGBA32_B_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_R_F(rgba), SP_RGBA32_A_F(rgba));
cairo_fill(ct);
}
}
// NOTE: this is very similar to nr-arena-shape.cpp; the only difference is path feeding
bool has_stroke, has_fill;
cairo_save(ct);
if (has_fill || has_stroke) {
if (needs_opacity) {
}
cairo_save(ct);
}
if (has_fill) {
}
if (has_stroke) {
}
if (needs_opacity) {
}
} // has fill or stroke pattern
}
static unsigned int
{
//NRArenaGroup *group = NR_ARENA_GROUP(item);
/* Render children fill mask */
/*
for (NRArenaItem *child = group->children; child != NULL; child = child->next) {
ret = nr_arena_glyphs_fill_mask(NR_ARENA_GLYPHS(child), area, pb);
if (!(ret & NR_ARENA_ITEM_STATE_RENDER)) return ret;
}*/
return ret;
}
static NRArenaItem *
{
return picked;
}
void
{
}
}
void
nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font, int glyph, Geom::Matrix const &transform)
{
: NULL );
if ( pathv ) {
}
}
void
{
}
void
{
} else {
}
}
/*
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 :