sp-mesh-gradient.cpp revision 16b1e8c74378da09ee84d73987be64cd6322fff7
#include <glibmm.h>
#include "attributes.h"
#include "display/cairo-utils.h"
#include "sp-mesh-gradient.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" );
this->readAttr( "smooth" );
}
switch (key) {
case SP_ATTR_X:
}
break;
case SP_ATTR_Y:
}
break;
case SP_ATTR_SMOOTH:
if (value) {
this->smooth = SP_MESH_SMOOTH_NONE;
this->smooth = SP_MESH_SMOOTH_SMOOTH;
this->smooth = SP_MESH_SMOOTH_SMOOTH1;
this->smooth = SP_MESH_SMOOTH_SMOOTH2;
this->smooth = SP_MESH_SMOOTH_SMOOTH3;
this->smooth = SP_MESH_SMOOTH_SMOOTH4;
this->smooth = SP_MESH_SMOOTH_SMOOTH5;
this->smooth = SP_MESH_SMOOTH_SMOOTH6;
this->smooth = SP_MESH_SMOOTH_SMOOTH7;
} else {
}
this->smooth_set = TRUE;
} else {
// std::cout << "SPMeshGradient::set() No value " << std::endl;
this->smooth = SP_MESH_SMOOTH_NONE;
this->smooth_set = FALSE;
}
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
}
}
}
switch (this->smooth) {
case SP_MESH_SMOOTH_SMOOTH:
break;
case SP_MESH_SMOOTH_SMOOTH1:
break;
case SP_MESH_SMOOTH_SMOOTH2:
break;
case SP_MESH_SMOOTH_SMOOTH3:
break;
case SP_MESH_SMOOTH_SMOOTH4:
break;
case SP_MESH_SMOOTH_SMOOTH5:
break;
case SP_MESH_SMOOTH_SMOOTH6:
break;
case SP_MESH_SMOOTH_SMOOTH7:
break;
case SP_MESH_SMOOTH_NONE:
break;
default:
// Do nothing
break;
}
}
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();
if( smooth_set ) {
switch (smooth) {
case SP_MESH_SMOOTH_NONE:
// std::cout << "SPMeshGradient::pattern_new: no smoothing" << std::endl;
break;
case SP_MESH_SMOOTH_SMOOTH1:
case SP_MESH_SMOOTH_SMOOTH2:
case SP_MESH_SMOOTH_SMOOTH3:
case SP_MESH_SMOOTH_SMOOTH4:
case SP_MESH_SMOOTH_SMOOTH5:
// std::cout << "SPMeshGradient::pattern_new: calling array.smooth" << std::endl;
break;
case SP_MESH_SMOOTH_SMOOTH:
case SP_MESH_SMOOTH_SMOOTH6:
case SP_MESH_SMOOTH_SMOOTH7:
// std::cout << "SPMeshGradient::pattern_new: calling array.smooth2" << std::endl;
break;
}
}
for( unsigned int i = 0; i < my_array->patch_rows(); ++i ) {
for( unsigned int j = 0; j < my_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;
}