nr-arena-image.cpp revision f727367dddbf050f0a7d33757e9290f571cbd492
#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 "../prefs-utils.h"
#include "nr-arena-image.h"
#include "style.h"
#include "display/nr-arena.h"
#include "display/nr-filter.h"
#include "display/nr-filter-gaussian.h"
#include "sp-filter.h"
#include "sp-gaussian-blur.h"
#include "sp-feblend.h"
#include "display/nr-filter-blend.h"
int nr_arena_image_x_sample = 1;
int nr_arena_image_y_sample = 1;
/*
* NRArenaCanvasImage
*
*/
// defined in nr-arena-shape.cpp
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, NR::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)
{
/* Request render old */
/* Copy affine */
} else {
hscale = 1.0;
vscale = 1.0;
}
/* Calculate bbox */
} 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 (!outline) {
/* fixme: This is not implemented yet (Lauris) */
/* nr_R8G8B8_R8G8B8_R8G8B8A8_N_TRANSFORM (dpx, dw, dh, drs, spx, sw, sh, srs, d2s, Falpha, nr_arena_image_x_sample, nr_arena_image_y_sample); */
nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (dpx, dw, dh, drs, spx, sw, sh, srs, d2s, Falpha, nr_arena_image_x_sample, nr_arena_image_y_sample);
//FIXME: The _N_N_N_ version gives a gray border around images, see bug 906376
// This mode is only used when exporting, screen rendering always has _P_P_P_, so I decided to simply replace it for now
// Feel free to propose a better fix
//nr_R8G8B8A8_N_R8G8B8A8_N_R8G8B8A8_N_TRANSFORM (dpx, dw, dh, drs, spx, sw, sh, srs, d2s, Falpha, nr_arena_image_x_sample, nr_arena_image_y_sample);
nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (dpx, dw, dh, drs, spx, sw, sh, srs, d2s, Falpha, nr_arena_image_x_sample, nr_arena_image_y_sample);
}
} else { // outline; draw a rect instead
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));
// 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
nr_arena_image_set_pixels (NRArenaImage *image, const unsigned char *px, unsigned int pxw, unsigned int pxh, unsigned int pxrs)
{
}
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 :