/** \file
* SVG <feImage> implementation.
*
*/
/*
* Authors:
* Felipe CorrĂȘa da Silva Sanches <juca@members.fsf.org>
* hugo Rodrigues <haa.rodrigues@gmail.com>
* Abhishek Sharma
*
* Copyright (C) 2007 Felipe Sanches
* Copyright (C) 2006 Hugo Rodrigues
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "display/nr-filter-image.h"
#include "uri.h"
#include "uri-references.h"
#include "enums.h"
#include "attributes.h"
#include "image.h"
#include <string.h>
#include "display/nr-filter.h"
this->from_element = 0;
this->SVGElemRef = NULL;
}
}
/**
* Reads the Inkscape::XML::Node, and initializes SPFeImage variables. For this to get called,
* our name must be associated with a repr via "sp_object_type_register". Best done through
* sp-object-repr.cpp's repr_name_entries array.
*/
{
/*LOAD ATTRIBUTES FROM REPR HERE*/
this->readAttr( "preserveAspectRatio" );
this->readAttr( "xlink:href" );
}
/**
* Drops any allocated memory.
*/
this->_image_modified_connection.disconnect();
this->_href_modified_connection.disconnect();
if (this->SVGElemRef) {
delete this->SVGElemRef;
}
}
{
}
{
if (new_elem) {
feImage->_image_modified_connection = ((SPObject*) feImage->SVGElem)->connectModified(sigc::bind(sigc::ptr_fun(&sp_feImage_elem_modified), obj));
} else {
}
}
/**
* Sets a specific value in the SPFeImage.
*/
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
case SP_ATTR_XLINK_HREF:
if (this->href) {
}
if (!this->href) return;
delete this->SVGElemRef;
this->SVGElemRef = 0;
this->SVGElem = 0;
this->_image_modified_connection.disconnect();
this->_href_modified_connection.disconnect();
try{
this->from_element = true;
this->_href_modified_connection = this->SVGElemRef->changedSignal().connect(sigc::bind(sigc::ptr_fun(&sp_feImage_href_modified), this));
this->_image_modified_connection = ((SPObject*) this->SVGElem)->connectModified(sigc::bind(sigc::ptr_fun(&sp_feImage_elem_modified), this));
break;
} else {
}
}
// catches either MalformedURIException or UnsupportedURIException
catch(const Inkscape::BadURIException & e)
{
this->from_element = false;
/* This occurs when using external image as the source */
//g_warning("caught Inkscape::BadURIException in sp_feImage_set");
break;
}
break;
/* Copied from sp-image.cpp */
/* Do setup before, so we can use break to escape */
if (value) {
int len;
gchar c[256];
const gchar *p, *e;
p = value;
while (*p && *p == 32) p += 1;
if (!*p) break;
e = p;
while (*e && *e != 32) e += 1;
len = e - p;
if (len > 8) break;
c[len] = 0;
/* Now the actual part */
if (!strcmp (c, "none")) {
} else if (!strcmp (c, "xMinYMin")) {
} else if (!strcmp (c, "xMidYMin")) {
} else if (!strcmp (c, "xMaxYMin")) {
} else if (!strcmp (c, "xMinYMid")) {
} else if (!strcmp (c, "xMidYMid")) {
} else if (!strcmp (c, "xMaxYMid")) {
} else if (!strcmp (c, "xMinYMax")) {
} else if (!strcmp (c, "xMidYMax")) {
} else if (!strcmp (c, "xMaxYMax")) {
} else {
g_warning("Illegal preserveAspectRatio: %s", c);
break;
}
while (*e && *e == 32) e += 1;
if (*e) {
if (!strcmp (e, "meet")) {
} else if (!strcmp (e, "slice")) {
} else {
break;
}
}
this->aspect_align = align;
this->aspect_clip = clip;
}
break;
default:
break;
}
}
/**
* Receives update notifications.
*/
/* do something to trigger redisplay, updates? */
}
}
/**
* Writes its settings to an incoming repr object, if any.
*/
Inkscape::XML::Node* SPFeImage::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
/* TODO: Don't just clone, but create a new repr node and write all
* relevant values into it */
if (!repr) {
}
return repr;
}
Inkscape::Filters::FilterImage *nr_image = dynamic_cast<Inkscape::Filters::FilterImage*>(nr_primitive);
}
/*
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:fileencoding=utf-8:textwidth=99 :