2
* feFlood filter primitive renderer
5
* Felipe Corrêa da Silva Sanches <felipe.sanches@gmail.com>
7
* Copyright (C) 2007 authors
9
* Released under GNU GPL, read the file 'COPYING' for more information
12
#include "display/nr-filter-flood.h"
13
#include "display/nr-filter-utils.h"
17
FilterFlood::FilterFlood()
20
FilterPrimitive * FilterFlood::create() {
21
return new FilterFlood();
24
FilterFlood::~FilterFlood()
27
int FilterFlood::render(FilterSlot &slot, FilterUnits const &/*units*/) {
28
NRPixBlock *in = slot.get(_input);
30
g_warning("Missing source image for feFlood (in=%d)", _input);
35
int in_w = in->area.x1 - in->area.x0;
36
int in_h = in->area.y1 - in->area.y0;
38
NRPixBlock *out = new NRPixBlock;
40
nr_pixblock_setup_fast(out, NR_PIXBLOCK_MODE_R8G8B8A8N,
41
in->area.x0, in->area.y0, in->area.x1, in->area.y1,
44
unsigned char *out_data = NR_PIXBLOCK_PX(out);
46
unsigned char r,g,b,a;
47
r = CLAMP_D_TO_U8((color >> 24) % 256);
48
g = CLAMP_D_TO_U8((color >> 16) % 256);
49
b = CLAMP_D_TO_U8((color >> 8) % 256);
50
a = CLAMP_D_TO_U8(opacity*255);
52
for(i=0; i < 4*in_h*in_w; i+=4){
60
slot.set(_output, out);
64
void FilterFlood::set_color(guint32 c) {
68
void FilterFlood::set_opacity(double o) {
72
void FilterFlood::area_enlarge(NRRectL &/*area*/, Matrix const &/*trans*/)
81
c-file-style:"stroustrup"
82
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
87
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :