diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp
index 6e5e0d171ba3f2e366e486f826a9d0240ed9eee8..95c144e28b18b831023685a779ee699601fb8c18 100644 (file)
--- a/src/trace/trace.cpp
+++ b/src/trace/trace.cpp
#include <sp-item.h>
#include <sp-shape.h>
#include <sp-image.h>
+#include <libnr/nr-matrix-ops.h>
+#include <libnr/nr-scale-translate-ops.h>
#include <display/nr-arena.h>
#include <display/nr-arena-shape.h>
* Informs the observer how much has been completed.
* Return false if the processing should be aborted.
*/
- virtual bool progress(float percentCompleted)
+ virtual bool progress(float /*percentCompleted*/)
{
//Tracer *tracer = (Tracer *)context;
//## Allow the GUI to update
* Send an error string to the Observer. Processing will
* be halted.
*/
- virtual void error(const std::string &msg)
+ virtual void error(const std::string &/*msg*/)
{
//Tracer *tracer = (Tracer *)context;
}
//Get absolute X,Y position
double xpos = ((double)aImg->bbox.x0) + iwscale * (double)col;
NR::Point point(xpos, ypos);
- point *= aImg->transform;
+ point *= *aImg->transform;
//point *= imgMat;
//point = desktop->doc2dt(point);
//g_message("x:%f y:%f\n", point[0], point[1]);
{
//g_message("hit!\n");
//dumpMap->setPixelLong(dumpMap, col, row, 0L);
- simage.setConfidence(col, row,
+ simage.setConfidence(col, row,
Siox::UNKNOWN_REGION_CONFIDENCE);
}
else
return;
}
+ msgStack->flash(Inkscape::NORMAL_MESSAGE, _("Trace: Starting trace..."));
+ desktop->updateCanvasNow();
+
std::vector<TracingEngineResult> results =
engine->trace(pixbuf);
//printf("nrPaths:%d\n", results.size());
if (sp_repr_get_double(imgRepr, "height", &dval))
height = dval;
- NR::Matrix trans(NR::translate(x, y));
-
double iwidth = (double)pixbuf->get_width();
double iheight = (double)pixbuf->get_height();
double iwscale = width / iwidth;
double ihscale = height / iheight;
- NR::Matrix scal(NR::scale(iwscale, ihscale));
+ NR::translate trans(x, y);
+ NR::scale scal(iwscale, ihscale);
//# Convolve scale, translation, and the original transform
- NR::Matrix tf(scal);
- tf *= trans;
+ NR::Matrix tf(scal * trans);
tf *= img->transform;
//#OK. Now let's start making new nodes
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
Inkscape::XML::Node *groupRepr = NULL;
//# if more than 1, make a <g>roup of <path>s
if (nrPaths > 1)
{
- groupRepr = sp_repr_new("svg:g");
+ groupRepr = xml_doc->createElement("svg:g");
par->addChild(groupRepr, imgRepr);
}
TracingEngineResult result = results[i];
totalNodeCount += result.getNodeCount();
- Inkscape::XML::Node *pathRepr = sp_repr_new("svg:path");
+ Inkscape::XML::Node *pathRepr = xml_doc->createElement("svg:path");
pathRepr->setAttribute("style", result.getStyle().c_str());
pathRepr->setAttribute("d", result.getPathData().c_str());
}
//## inform the document, so we can undo
- sp_document_done(doc, SP_VERB_NONE,
- /* TODO: annotate */ "trace.cpp:567");
+ sp_document_done(doc, SP_VERB_SELECTION_TRACE, _("Trace bitmap"));
engine = NULL;