nr-arena-glyphs.cpp revision 6864a204fac56a032f9187b482b4de6c64f06cef
#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/n-art-bpath.h>
#include <libnr/nr-matrix-ops.h>
#include <libnr/nr-matrix-fns.h>
#include "../style.h"
#include "nr-arena.h"
#include "nr-arena-glyphs.h"
#include <cairo.h>
#include "inkscape-cairo.h"
#ifdef test_glyph_liv
#include "../display/canvas-bpath.h"
#include <libnrtype/font-instance.h>
#include <libnrtype/raster-glyph.h>
#include <libnrtype/RasterFont.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, NR::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;
return NR_ARENA_ITEM_STATE_ALL;
glyphs->x = t[4];
glyphs->y = t[5];
t[4]=0;
t[5]=0;
if (glyphs->style->stroke.isNone() || fabs(glyphs->style->stroke_width.computed * scale) <= 0.01) { // Optimization: do fill bbox only if there's no stroke
}
}
/* Build state data */
glyphs->x = t[4];
glyphs->y = t[5];
t[4]=0;
t[5]=0;
if ( fabs(glyphs->style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord
if ( glyphs->style->stroke_linecap.computed == SP_STROKE_LINECAP_BUTT ) nstyl.stroke_cap=butt_straight;
if ( glyphs->style->stroke_linecap.computed == SP_STROKE_LINECAP_ROUND ) nstyl.stroke_cap=butt_round;
if ( glyphs->style->stroke_linecap.computed == SP_STROKE_LINECAP_SQUARE ) nstyl.stroke_cap=butt_square;
if ( glyphs->style->stroke_linejoin.computed == SP_STROKE_LINEJOIN_MITER ) nstyl.stroke_join=join_pointy;
if ( glyphs->style->stroke_linejoin.computed == SP_STROKE_LINEJOIN_ROUND ) nstyl.stroke_join=join_round;
if ( glyphs->style->stroke_linejoin.computed == SP_STROKE_LINEJOIN_BEVEL ) nstyl.stroke_join=join_straight;
nstyl.dash_offset = 0;
}
}
}
return NR_ARENA_ITEM_STATE_ALL;
}
static guint
{
/* TODO : render to greyscale pixblock provided for clipping */
}
static NRArenaItem *
{
double const x = p[NR::X];
double const y = p[NR::Y];
/* With text we take a simple approach: pick if the point is in a characher bbox */
if ((x >= item->bbox.x0) && (y >= item->bbox.y0) && (x <= item->bbox.x1) && (y <= 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, NR::Matrix const *transform)
{
if (transform) {
} else {
}
}
void
{
}
static guint
{
/* fixme: area == m->area, so merge these */
}
}
static guint
{
}
}
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, NR::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
{
if (group->fill_painter) {
}
if (group->stroke_painter) {
}
}
}
static guint
{
if (group->fill_painter) {
}
if (group->stroke_painter) {
}
}
}
if ( item->render_opacity == TRUE && !group->style->stroke.isNone() && !group->style->fill.isNone() ) {
}
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*/)
{
if (!ct)
// 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);
}
return ret;
}
/* Fill */
NRPixBlock m;
// if memory allocation failed, abort
nr_pixblock_release (&m);
}
/* Render children fill mask */
if (!(ret & NR_ARENA_ITEM_STATE_RENDER)) {
nr_pixblock_release(&m);
return ret;
}
}
/* Composite into buffer */
if (ggroup->fill_painter) {
nr_arena_render_paintserver_fill(pb, area, ggroup->fill_painter, SP_SCALE24_TO_FLOAT(style->fill_opacity.value), &m);
}
// In outline mode, render fill only, using outlinecolor
} else if ( item->render_opacity ) {
} else {
}
}
nr_pixblock_release(&m);
}
/* Stroke */
NRPixBlock m;
// if memory allocation failed, abort
nr_pixblock_release (&m);
}
/* Render children stroke mask */
if (!(ret & NR_ARENA_ITEM_STATE_RENDER)) {
nr_pixblock_release(&m);
return ret;
}
}
/* Composite into buffer */
if (ggroup->stroke_painter) {
nr_arena_render_paintserver_fill(pb, area, ggroup->stroke_painter, SP_SCALE24_TO_FLOAT(style->stroke_opacity.value), &m);
}
if ( item->render_opacity ) {
} else {
}
} else {
// nothing
}
nr_pixblock_release(&m);
}
return ret;
}
static unsigned int
{
/* Render children fill mask */
}
return ret;
}
static NRArenaItem *
{
return picked;
}
void
{
}
}
void
nr_arena_glyphs_group_add_component(NRArenaGlyphsGroup *sg, font_instance *font, int glyph, NR::Matrix const *transform)
{
: NULL );
}
}
void
{
}
}
void
{
} else {
/* fixme: We kill warning, although not sure what to do here (Lauris) */
}
}
/*
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 :