PathStroke.cpp revision e1c9ac33d36bca9ca359096c3450303a160a56e3
/*
* nlivarot
*
* Created by fred on Tue Jun 17 2003.
*
*/
#include "Path.h"
#include "Shape.h"
/*
* stroking polylines into a Shape instance
* grunt work.
* if the goal is to raster the stroke, polyline stroke->polygon->uncrossed polygon->raster is grossly
* inefficient (but reuse the intersector, so that's what a lazy programmer like me does). the correct way would be
* to set up a supersampled buffer, raster each polyline stroke's part (one part per segment in the polyline, plus
* each join) because these are all convex polygons, then transform in alpha values
*/
// until i find something better
if ( length < 0.0000001 ) {
} else {
}
}
// faster version if length is known
if ( length < 0.0000001 ) {
} else {
}
}
{
return;
}
if (justAdd == false) {
}
dest->MakeBackData(false);
int lastM = 0;
{
lastP++;
}
// if ( pts[lastP - 1].closed ) { // this is correct, but this bugs text rendering (doesn't close text stroke)...
// ah I see, because close is defined here for
// a whole path and should be defined per subpath.
// debut==fin => ferme (on devrait garder un element pour les close(), mais tant pis)
} else {
}
dir[0] = 1;
dir[1] = 0;
int end[2];
}
}
}
{
if (N <= 1) {
return;
}
int upTo;
int curI = 0;
if (doClose) {
prevI = N - 1;
while (prevI > 0) {
if (dist > 0.001) {
break;
}
prevI--;
}
if (prevI <= 0) {
return;
}
} else {
upTo = N - 1;
}
{
nextI = 1;
break;
}
nextI++;
}
dir[0] = 1;
dir[1] = 0;
int end[2];
}
return;
}
}
if (doClose) {
} else {
}
do {
nextI++;
if (dist > 0.001 || (nextI == upTo && dist > 0.0)) { // more tolerance for the last distance too, for the right cap direction
break;
}
nextI++;
}
break;
}
if (doClose) {
/* prevP=curP;
prevI=curI;
curP=nextP;
curI=nextI;
prevD=nextD;*/
} else {
int end[2];
}
}
{
if (butt == butt_square)
{
}
else if (butt == butt_pointy)
{
}
else if (butt == butt_round)
{
}
else
{
}
}
{
/* FIXED: this special case caused bug 1028953 */
if (angCo > 0.9999) {
// tout droit
} else {
// demi-tour
if (join == join_round) {
} else {
}
}
return;
}
if (angSi < 0) {
if (join == join_pointy) {
}
} else {
}
} else if (join == join_round) {
} else {
}
} else {
if (join == join_pointy) {
}
}
else
{
}
} else if (join == join_round) {
} else {
}
}
}
void
{
{
if (angCo > 0.9999)
{
// tout droit
}
else
{
// demi-tour
if ( dest->hasBackData() ) {
}
}
return;
}
if (angSi < 0)
{
/* Geom::Point biss;
biss.x=next.x-prev.x;
biss.y=next.y-prev.y;
double c2=cross(biss,next);
double projn=l*(dot(biss,next));
double projp=-l*(dot(biss,prev));
if ( projp <= 0.5*prevL && projn <= 0.5*nextL ) {
double x,y;
x=pos.x+l*biss.x;
y=pos.y+l*biss.y;
leftEnNo=leftStNo=dest->AddPoint(x,y);
} else {*/
if ( dest->hasBackData() ) {
}
if ( dest->hasBackData() ) {
}
// }
}
else
{
if (join == join_pointy)
{
if (l <= emiter)
{
if ( dest->hasBackData() ) {
}
if ( dest->hasBackData() ) {
}
}
else
{
if ( dest->hasBackData() ) {
}
if ( dest->hasBackData() ) {
}
if ( dest->hasBackData() ) {
}
}
}
else if (join == join_round)
{
}
else
{
if ( dest->hasBackData() ) {
}
}
}
}
void
{
{
if (angCo > 0.9999)
{
// tout droit
}
else
{
// demi-tour
if ( dest->hasBackData() ) {
}
}
return;
}
if (angSi < 0)
{
if (join == join_pointy)
{
if (l <= emiter)
{
if ( dest->hasBackData() ) {
}
if ( dest->hasBackData() ) {
}
}
else
{
if ( dest->hasBackData() ) {
}
if ( dest->hasBackData() ) {
}
if ( dest->hasBackData() ) {
}
}
}
else if (join == join_round)
{
}
else
{
if ( dest->hasBackData() ) {
}
}
}
else
{
/* Geom::Point biss;
biss=next.x-prev.x;
biss.y=next.y-prev.y;
double c2=cross(next,biss);
double projn=l*(dot(biss,next));
double projp=-l*(dot(biss,prev));
if ( projp <= 0.5*prevL && projn <= 0.5*nextL ) {
double x,y;
x=pos.x+l*biss.x;
y=pos.y+l*biss.y;
rightEnNo=rightStNo=dest->AddPoint(x,y);
} else {*/
if ( dest->hasBackData() ) {
}
if ( dest->hasBackData() ) {
}
// }
}
}
// a very ugly way to produce round joins: doing one (or two, depend on the angle of the join) quadratic bezier curves
// but since most joins are going to be small, nobody will notice -- but somebody noticed and now the ugly stuff is gone! so:
// a very nice way to produce round joins, caps or dots
{
//Geom::Point diff = iS - iE;
//double dist = dot(diff, diff);
return;
}
sia = 1;
} else {
if ( coa >= 1 ) {
ang = 0;
}
if ( coa <= -1 ) {
}
}
// StrokeNormalize(cur);
// cur*=width;
for (int i = 0; i < nbS; i++) {
}
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :