sp-mesh-gradient.cpp revision 1375fe5c9f0af935233ad027bad7e14094a3414e
#include "sp-mesh-gradient.h"
#include "attributes.h"
#include "display/cairo-utils.h"
#include "sp-factory.h"
namespace {
return new SPMeshGradient();
}
bool meshGradientRegistered = SPFactory::instance().registerObject("svg:meshGradient", createMeshGradient);
}
/*
* Mesh Gradient
*/
//#define MESH_DEBUG
// Start coordinate of mesh
}
SPMeshGradient::~SPMeshGradient() {
}
// Start coordinate of mesh
this->readAttr( "x" );
this->readAttr( "y" );
}
switch (key) {
case SP_ATTR_X:
}
break;
case SP_ATTR_Y:
}
break;
default:
break;
}
}
/**
* Write mesh gradient attributes to associated repr.
*/
Inkscape::XML::Node* SPMeshGradient::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
#ifdef MESH_DEBUG
#endif
}
}
}
return repr;
}
void
{
}
double opacity
#else
double /*opacity*/
#endif
)
{
using Geom::X;
using Geom::Y;
#ifdef MESH_DEBUG
std::cout << "sp_meshgradient_create_pattern: (" << bbox->x0 << "," << bbox->y0 << ") (" << bbox->x1 << "," << bbox->y1 << ") " << opacity << std::endl;
#endif
this->ensureArray();
for( unsigned int i = 0; i < array->patch_rows(); ++i ) {
for( unsigned int j = 0; j < array->patch_columns(); ++j ) {
for( unsigned int k = 0; k < 4; ++k ) {
#ifdef DEBUG_MESH
for( int p = 0; p < 4; ++p ) {
}
#endif
switch ( patch.getPathType( k ) ) {
case 'l':
case 'L':
case 'z':
case 'Z':
break;
case 'c':
case 'C':
{
break;
}
default:
// Shouldn't happen
}
if( patch.tensorIsSet(k) ) {
// Tensor point defined relative to corner.
cairo_mesh_pattern_set_control_point( cp, k, t[X], t[Y] );
//std::cout << " sp_meshgradient_create_pattern: tensor " << k
// << " set to " << t << "." << std::endl;
} else {
// Geom::Point t = patch.coonsTensorPoint(k);
//std::cout << " sp_meshgradient_create_pattern: tensor " << k
// << " calculated as " << t << "." <<std::endl;
}
cp, k,
}
}
}
// set pattern matrix
if (this->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
}
#else
static bool shown = false;
if( !shown ) {
shown = true;
}
#endif
/*
cairo_pattern_t *cp = cairo_pattern_create_radial(
sp_gradient_pattern_common_setup(cp, gr, bbox, opacity);
*/
return cp;
}