b1a5b4d7aca4ca0a07954bcdee12bc524d89ede3
1 /*
2 * feImage filter primitive renderer
3 *
4 * Authors:
5 * Felipe CorrĂȘa da Silva Sanches <felipe.sanches@gmail.com>
6 *
7 * Copyright (C) 2007 authors
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
12 #include "display/nr-filter-image.h"
13 // #include <string.h>
14 // #include <gtkmm.h>
16 namespace NR {
18 FilterImage::FilterImage()
19 {
20 g_warning("FilterImage::render not implemented.");
21 /* Testing with hardcoded xlink:href :
22 image = Gdk::Pixbuf::create_from_file("/home/felipe/images/image1.jpg");
23 //TODO: handle errors
24 width = image->get_width()+1;
25 height = image->get_height()+1;
26 image_pixbuf = image->get_pixels();*/
27 }
29 FilterPrimitive * FilterImage::create() {
30 return new FilterImage();
31 }
33 FilterImage::~FilterImage()
34 {}
36 int FilterImage::render(FilterSlot &slot, Matrix const &trans) {
37 return 0;
38 /* TODO: Implement this renderer method.
39 Specification: http://www.w3.org/TR/SVG11/filters.html#feImage
41 It would be good to findout how to reuse sp-image.cpp code
42 */
44 /* int w,x,y;
45 NRPixBlock *in = slot.get(_input);
46 NRPixBlock *out = new NRPixBlock;
48 int x0 = in->area.x0, y0 = in->area.y0;
49 int x1 = in->area.x1, y1 = in->area.y1;
50 if (x0<0) x0 = 0;
51 if (x1>width-1) x1 = width-1;
53 if (y0<0) y0 = 0;
54 if (y1>height-1) y1 = height-1;
56 nr_pixblock_setup_fast(out, in->mode, x0, y0, x1, y1, true);
58 w = x1 - x0;
59 unsigned char *out_data = NR_PIXBLOCK_PX(out);
60 for (x=x0; x < x1; x++){
61 for (y=y0; y < y1; y++){
62 out_data[4*((x - x0)+w*(y - y0))] = (unsigned char) image_pixbuf[3*(x+width*y)]; //Red
63 out_data[4*((x - x0)+w*(y - y0)) + 1] = (unsigned char) image_pixbuf[3*(x+width*y) + 1]; //Green
64 out_data[4*((x - x0)+w*(y - y0)) + 2] = (unsigned char) image_pixbuf[3*(x+width*y) + 2]; //Blue
65 out_data[4*((x - x0)+w*(y - y0)) + 3] = 255; //Alpha
66 }
67 }
69 out->empty = FALSE;
70 slot.set(_output, out);
71 return 0;*/
72 }
74 } /* namespace NR */
76 /*
77 Local Variables:
78 mode:c++
79 c-file-style:"stroustrup"
80 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
81 indent-tabs-mode:nil
82 fill-column:99
83 End:
84 */
85 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :