nr-arena-image.cpp revision 1f67c2bae7e121b1ed8cc11a201d6fabdbdd467f
#define __NR_ARENA_IMAGE_C__
/*
* RGBA display list system for inkscape
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <libnr/nr-compose-transform.h>
#include "../preferences.h"
#include "nr-arena-image.h"
#include "style.h"
#include "display/cairo-utils.h"
#include "display/nr-arena.h"
#include "display/nr-filter.h"
#include "display/nr-filter-gaussian.h"
#include "sp-filter.h"
#include "sp-filter-reference.h"
#include "sp-gaussian-blur.h"
#include "display/nr-filter-blend.h"
int nr_arena_image_x_sample = 1;
int nr_arena_image_y_sample = 1;
/*
* NRArenaCanvasImage
*
*/
static unsigned int nr_arena_image_update (NRArenaItem *item, NRRectL *area, NRGC *gc, unsigned int state, unsigned int reset);
static unsigned int nr_arena_image_render (cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags);
static NRArenaItem *nr_arena_image_pick (NRArenaItem *item, Geom::Point p, double delta, unsigned int sticky);
static NRArenaItemClass *parent_class;
nr_arena_image_get_type (void)
{
if (!type) {
"NRArenaImage",
sizeof (NRArenaImageClass),
sizeof (NRArenaImage),
(void (*) (NRObjectClass *)) nr_arena_image_class_init,
(void (*) (NRObject *)) nr_arena_image_init);
}
return type;
}
static void
{
}
static void
{
}
static void
{
}
static unsigned int
nr_arena_image_update( NRArenaItem *item, NRRectL */*area*/, NRGC *gc, unsigned int /*state*/, unsigned int /*reset*/ )
{
// clear old bbox
/* Copy affine */
} else {
hscale = 1.0;
vscale = 1.0;
}
/* Calculate bbox */
item->bbox.x0 = static_cast<NR::ICoord>(floor(bbox.x0)); // Floor gives the coordinate in which the point resides
item->bbox.x1 = static_cast<NR::ICoord>(ceil (bbox.x1)); // Ceil gives the first coordinate beyond the point
} else {
}
return NR_ARENA_ITEM_STATE_ALL;
}
#define FBITS 12
static unsigned int
nr_arena_image_render( cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int /*flags*/ )
{
if (!ct)
#if 0
#endif
if (!outline) {
// FIXME: at the moment gdk_cairo_set_source_pixbuf creates an ARGB copy
cairo_save(ct);
} else { // outline; draw a rect instead
// 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));
// the box
// the diagonals
}
}
/** Calculates the closest distance from p to the segment a1-a2*/
double
{
// calculate sides of the triangle and their squares
double a_2 = a * a;
// if one of the angles at the base is > 90, return the corresponding side
// otherwise calculate the height to the base
}
static NRArenaItem *
{
if (outline) {
// frame
// diagonals
return NULL;
} else {
return NULL;
// is the alpha not transparent?
}
}
/* Utility */
void
{
// when done in this order, it won't break if pb == image->pixbuf and the refcount is 1
g_object_ref (pb);
}
}
}
void
{
image->x = x;
image->y = y;
}
{
//if image has a filter
}
} else {
//no filter set for this image
}
image->background_new = true;
}
}
/*
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 :