trace.cpp revision 6b15695578f07a3f72c4c9475c1a261a3021472a
/*
* A generic interface for plugging different
* autotracers into Inkscape.
*
* Authors:
* Bob Jamison <rjamison@titan.com>
*
* Copyright (C) 2004 Bob Jamison
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "trace/potrace/inkscape-potrace.h"
#include <inkscape.h>
#include <desktop-handles.h>
#include <document.h>
#include "message-stack.h"
#include <selection.h>
#include "sp-item.h"
#include "sp-image.h"
namespace Inkscape {
namespace Trace {
/**
*
*/
SPImage *
{
if (!desktop)
{
g_warning("Trace: No active desktop\n");
return NULL;
}
if (!sel)
{
char *msg = _("Select an <b>image</b> to trace");
//g_warning(msg);
return NULL;
}
if (!item)
{
//g_warning(msg);
return NULL;
}
if (!SP_IS_IMAGE(item))
{
char *msg = _("Select an <b>image</b> to trace");
//g_warning(msg);
return NULL;
}
selectedItem = item;
return img;
}
/**
*
*/
{
if (!img)
return NULL;
return pixbuf;
}
//#########################################################################
//# T R A C E
//#########################################################################
/**
* Threaded method that does single bitmap--->path conversion
*/
void Tracer::traceThread()
{
//## Remember. NEVER leave this method without setting
//## engine back to NULL
//## Prepare our kill flag. We will watch this later to
//## see if the main thread wants us to stop
keepGoing = true;
if (!desktop)
{
g_warning("Trace: No active desktop\n");
return;
}
if (!SP_ACTIVE_DOCUMENT)
{
char *msg = _("Trace: No active document");
//g_warning(msg);
return;
}
if (!img || !selectedItem)
{
return;
}
if (!pixbuf)
{
char *msg = _("Trace: Image has no bitmap data");
//g_warning(msg);
return;
}
int nrPaths;
//printf("nrPaths:%d\n", nrPaths);
//### Check if we should stop
{
return;
}
//### Get pointers to the <image> and its parent
//### Get some information for the new transform()
double x = 0.0;
double y = 0.0;
double width = 0.0;
double height = 0.0;
double dval = 0.0;
x = dval;
y = dval;
//# Convolve scale, translation, and the original transform
//#OK. Now let's start making new nodes
//# if more than 1, make a <g>roup of <path>s
if (nrPaths > 1)
{
}
long totalNodeCount = 0L;
{
if (nrPaths > 1)
else
//### Apply the transform from the image to the new shape
if (reprobj)
{
}
if (nrPaths == 1)
{
}
}
delete results;
// If we have a group, then focus on, then forget it
if (nrPaths > 1)
{
}
//## inform the document, so we can undo
}
/**
* Main tracing method
*/
{
//Check if we are already running
if (engine)
return;
#if HAVE_THREADS
//Ensure that thread support is running
if (!Glib::thread_supported())
Glib::thread_init();
//Create our thread and run it
#else
traceThread();
#endif
}
/**
* Abort the thread that is executing trace()
*/
{
//## Inform Trace's working thread
keepGoing = false;
if (engine)
{
}
}
} // namespace Trace
} // namespace Inkscape
//#########################################################################
//# E N D O F F I L E
//#########################################################################