/*
* nlivarot
*
* Created by fred on Mon Nov 03 2003.
*
*/
#include <glib.h>
#include "Path.h"
#include "Shape.h"
#include "livarot/path-description.h"
/*
* path description -> polyline
* and Path -> Shape (the Fill() function at the bottom)
* nathing fancy here: take each command and append an approximation of it to the polyline
*/
{
if ( descr_flags & descr_adding_bezier ) {
CancelBezier();
}
if ( descr_flags & descr_doing_subpath ) {
CloseSubpath();
}
SetBackData(true);
ResetPoints();
return;
}
// The initial moveto.
{
if ( firstTyp == descr_moveto ) {
} else {
curP = 0;
}
}
// And the rest, one by one.
switch (nType) {
case descr_forced: {
curP++;
break;
}
case descr_moveto: {
// et on avance
curP++;
break;
}
case descr_close: {
curP++;
break;
}
case descr_lineto: {
// et on avance
curP++;
break;
}
case descr_cubicto: {
// et on avance
curP++;
break;
}
case descr_arcto: {
DoArc(curX, nextX, nData->rx, nData->ry, nData->angle, nData->large, nData->clockwise, treshhold, curP);
// et on avance
curP++;
break;
}
case descr_bezierto: {
if ( nbInterm >= 1 ) {
ip++;
for (int k = 0; k < nbInterm - 1; k++) {
ip++;
if ( k > 0 ) {
}
{
}
}
{
if ( nbInterm > 1 ) {
}
{
}
}
}
// et on avance
break;
}
}
}
}
{
if ( descr_flags & descr_adding_bezier ) {
CancelBezier();
}
if ( descr_flags & descr_doing_subpath ) {
CloseSubpath();
}
SetBackData(false);
ResetPoints();
return;
}
int lastMoveTo = 0;
// le moveto
{
if ( firstTyp == descr_moveto ) {
} else {
curP = 0;
}
}
// et le reste, 1 par 1
switch (nType) {
case descr_forced: {
curP++;
break;
}
case descr_moveto: {
// et on avance
curP++;
break;
}
case descr_close: {
if ( curP == 0 ) {
} else {
}
}
}
curP++;
break;
}
case descr_lineto: {
if ( curP == 0 ) {
} else {
}
}
// et on avance
curP++;
break;
}
case descr_cubicto: {
if ( curP == 0 ) {
} else {
}
}
// et on avance
curP++;
break;
}
case descr_arcto: {
if ( curP == 0 ) {
} else {
}
}
// et on avance
curP++;
break;
}
case descr_bezierto: {
curP++;
if ( nbInterm == 1 ) {
} else if ( nbInterm > 1 ) {
ip++;
for (int k = 0; k < nbInterm - 1; k++) {
ip++;
if ( k > 0 ) {
if ( curP == 0 ) {
} else {
}
}
}
{
}
}
{
if ( curP == 0 ) {
} else {
}
}
{
}
}
}
if ( curP == 0 ) {
} else {
}
}
// et on avance
break;
}
}
}
}
{
if ( descr_flags & descr_adding_bezier ) {
CancelBezier();
}
if ( descr_flags & descr_doing_subpath ) {
CloseSubpath();
}
SetBackData(false);
ResetPoints();
return;
}
int lastMoveTo = 0;
// le moveto
{
if ( firstTyp == descr_moveto ) {
} else {
curP = 0;
}
}
// et le reste, 1 par 1
switch (nType) {
case descr_forced: {
curP++;
break;
}
case descr_moveto: {
// et on avance
curP++;
break;
}
case descr_close: {
{
}
}
}
if ( curP == 0 ) {
} else {
}
}
}
curP++;
break;
}
case descr_lineto: {
}
}
if ( curP == 0 ) {
} else {
}
}
// et on avance
curP++;
break;
}
case descr_cubicto: {
if ( curP == 0 ) {
} else {
}
}
// et on avance
curP++;
break;
}
case descr_arcto: {
if ( curP == 0 ) {
} else {
}
}
// et on avance
curP++;
break;
}
case descr_bezierto: {
curP++;
if ( nbInterm == 1 ) {
} else if ( nbInterm > 1 ) {
ip++;
for (int k = 0; k < nbInterm - 1; k++) {
ip++;
if ( k > 0 ) {
if ( curP == 0 ) {
} else {
}
}
}
{
}
}
{
if ( curP == 0 ) {
} else {
}
}
{
}
}
}
if ( curP == 0 ) {
} else {
}
}
// et on avance
break;
}
}
}
}
}
{
/* TODO: I suspect this should assert `(unsigned) i < descr_nb'. We can probably change
the argument to unsigned. descr_nb should probably be changed to unsigned too. */
g_assert( i >= 0 );
case descr_moveto: {
return nData->p;
}
case descr_lineto: {
return nData->p;
}
case descr_arcto: {
return nData->p;
}
case descr_cubicto: {
return nData->p;
}
case descr_bezierto: {
return nData->p;
}
case descr_interm_bezier:
case descr_close:
case descr_forced:
return PrevPoint(i - 1);
default:
}
}
// utilitaries: given a quadratic bezier curve (start point, control point, end point, ie that's a clamped curve),
// and an abcissis on it, get the point with that abcissis.
// warning: it's NOT a curvilign abcissis (or whatever you call that in english), so "t" is NOT the length of "start point"->"result point"
{
}
// idem for cubic bezier patch
{
}
// extract interesting info of a SVG arc description
{
}
/* N.B. If iS == iE then sang,eang,dr each become NaN. Probably a bug. */
{
: 0.0 )
if ( ra[0] <= -1 ) {
} else if ( ra[0] >= 1 ) {
sang = 0;
} else {
if ( ra[1] < 0 ) {
}
}
if ( ra[0] <= -1 ) {
} else if ( ra[0] >= 1 ) {
eang = 0;
} else {
if ( ra[1] < 0 ) {
}
}
if ( wise ) {
if (large) {
}
}
}
} else {
if (!large) {
}
}
}
}
}
{
/* TODO: Check that our behaviour is standards-conformant if iS and iE are (much) further
apart than the diameter. Also check that we do the right thing for negative radius.
(Same for the other DoArc functions in this file.) */
return;
// We always add a lineto afterwards, so this is fine.
// [on ajoute toujours un lineto apres, donc c bon]
}
double sang;
double eang;
/* TODO: This isn't as good numerically as treating iS and iE as primary. E.g. consider
the case of low curvature (i.e. very large radius). */
if (wise) {
}
}
} else {
}
}
}
}
{
if ( dC < 0.01 ) {
return;
}
} else {
// presque tt droit -> attention si on nous demande de bien subdiviser les petits segments
if ( lev <= 0 ) {
return;
}
AddPoint(m);
}
return;
}
}
if ( lev <= 0 ) {
return;
}
{
AddPoint(m);
}
}
{
if ( lev <= 0 ) {
return;
}
if ( s < tresh ) {
AddPoint(m);
}
return;
}
{
AddPoint(m);
}
}
{
/* TODO: Check that our behaviour is standards-conformant if iS and iE are (much) further
apart than the diameter. Also check that we do the right thing for negative radius.
(Same for the other DoArc functions in this file.) */
return;
// We always add a lineto afterwards, so this is fine.
// [on ajoute toujours un lineto apres, donc c bon]
}
double sang;
double eang;
/* TODO: This isn't as good numerically as treating iS and iE as primary. E.g. consider
the case of low curvature (i.e. very large radius). */
if (wise) {
}
}
} else {
}
}
}
}
{
if ( dC < 0.01 ) {
return;
}
} else {
return;
}
}
if ( lev <= 0 ) {
return;
}
}
{
if ( lev <= 0 ) {
return;
}
if ( s < tresh ) {
return;
}
{
}
}
{
// Will never arrive here, as offsets are made of cubics.
// [on n'arrivera jamais ici, puisque les offsets sont fait de cubiques]
/* TODO: Check that our behaviour is standards-conformant if iS and iE are (much) further
apart than the diameter. Also check that we do the right thing for negative radius.
(Same for the other DoArc functions in this file.) */
return;
// We always add a lineto afterwards, so this is fine.
// [on ajoute toujours un lineto apres, donc c bon]
}
double sang;
double eang;
/* TODO: This isn't as good numerically as treating iS and iE as primary. E.g. consider
the case of low curvature (i.e. very large radius). */
if (wise) {
}
}
} else {
}
}
}
}
{
bool doneSub = false;
if ( dC < 0.01 ) {
return;
}
} else {
doneSub = true;
}
}
if ( lev <= 0 ) {
doneSub = true;
}
// test des inversions
bool stInv = false;
bool enInv = false;
{
if ( si < 0 ) {
stInv = true;
}
if ( si < 0 ) {
enInv = true;
}
return;
return;
}
}
return;
}
{
}
}
{
bool doneSub = false;
if ( lev <= 0 ) {
return;
}
if ( s < tresh ) {
doneSub = true ;
}
// test des inversions
bool stInv = false;
bool enInv = false;
{
double n_len;
double n_rad;
if ( si < 0 ) {
stInv = true;
}
if ( si < 0 ) {
enInv = true;
}
return;
}
}
return;
}
{
}
}
/*
* put a polyline in a Shape instance, for further fun
* pathID is the ID you want this Path instance to be associated with, for when you're going to recompose the polyline
* in a path description ( you need to have prepared the back data for that, of course)
*/
{
return;
}
if ( justAdd == false ) {
}
return;
}
if ( back ) {
dest->MakeBackData(true);
}
if ( invert ) {
if ( back ) {
{
// invert && back && !weighted
}
int lastM = 0;
int pathEnd = 0;
bool closed = false;
if ( closeIfNeeded ) {
} else {
if ( lEdge >= 0 ) {
}
}
}
closed = false;
lEdge = -1;
} else {
if ( lEdge >= 0 ) {
} else {
}
}
closed = true;
} else {
closed = false;
}
}
}
curP++;
}
if ( closeIfNeeded ) {
} else {
if ( lEdge >= 0 ) {
}
}
}
}
} else {
{
// invert && !back && !weighted
}
int lastM = 0;
int pathEnd = 0;
bool closed = false;
if ( closeIfNeeded ) {
} else {
}
}
closed = false;
lEdge = -1;
} else {
closed = true;
} else {
closed = false;
}
}
}
curP++;
}
if ( closeIfNeeded ) {
} else {
}
}
}
}
} else {
if ( back ) {
{
// !invert && back && !weighted
}
int lastM = 0;
int pathEnd = 0;
bool closed = false;
if ( closeIfNeeded ) {
} else {
if ( lEdge >= 0 ) {
}
}
}
closed = false;
lEdge = -1;
} else {
} else {
}
closed = true;
} else {
closed = false;
}
}
}
curP++;
}
if ( closeIfNeeded ) {
} else {
if ( lEdge >= 0 ) {
}
}
}
}
} else {
{
// !invert && !back && !weighted
}
int lastM = 0;
int pathEnd = 0;
bool closed = false;
if ( closeIfNeeded ) {
} else {
}
}
closed = false;
lEdge = -1;
} else {
closed = true;
} else {
closed = false;
}
}
}
curP++;
}
if ( closeIfNeeded ) {
} else {
}
}
}
}
}
}
/*
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 :