<commit_before>//
//	
//    The Laxkit, a windowing toolkit
//    Please consult http://laxkit.sourceforge.net about where to send any
//    correspondence about this software.
//
//    This library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Library General Public
//    License as published by the Free Software Foundation; either
//    version 2 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Library General Public License for more details.
//
//    You should have received a copy of the GNU Library General Public
//    License along with this library; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
//    Copyright (C) 2004-2007,2010-2014 by <NAME>
//
#ifndef _LAX_PATHINTERFACE_H
#define _LAX_PATHINTERFACE_H


#include <lax/interfaces/viewportwindow.h>
#include <lax/interfaces/coordinate.h>
#include <lax/interfaces/somedata.h>
#include <lax/interfaces/linestyle.h>
#include <lax/interfaces/fillstyle.h>
#include <lax/curveinfo.h>
#include <lax/screencolor.h>
#include <lax/dump.h>



namespace LaxInterfaces {


class PathOperator;

//These are added to Coordinate::flags, and devs should ensure they do not conflict with normal flags
#define BEZ_MASK           (255<<20)
#define BEZ_STIFF_EQUAL    (1<<20)
#define BEZ_STIFF_NEQUAL   (1<<21)
#define BEZ_NSTIFF_EQUAL   (1<<22)
#define BEZ_NSTIFF_NEQUAL  (1<<23)


//-------------------- Path ---------------------------

class PathWeightNode
{
  public:
	int type; //symmetric width, fixed width with offset, width1/2 independent
	double width; //total width of stroke at this node
	double offset; //0 means weight symmetric about path
	double angle; //see Path::absoluteangle, it affects what this value is
	double t; //point along path, the bezier parameter: integer t corresponds to line points
	double center_t; //t position on cached centerline

	enum PathWeightNodeTypes {
		Default=0,
		Width      =(1<<0),
		Offset     =(1<<1),
		DualOffset =(1<<2),
		Angle      =(1<<3),
		AbsAngle   =(1<<4)
	};
	int nodetype;

	PathWeightNode();
	PathWeightNode(double nt,double no,double nw, int ntype=Default);
	double topOffset() { return offset+width/2; }
	double bottomOffset() { return offset-width/2; }
};

class Path : public LaxFiles::DumpUtility, public Laxkit::DoubleBBox
{
 protected:
 public:
	static Laxkit::PtrStack<PathOperator> basepathops; 

	Coordinate *path; // path is not necessarily the first in a chain, but is a vertex
	Laxkit::PtrStack<PathWeightNode> pathweights;

	LineStyle *linestyle; 
	double defaultwidth;
	bool absoluteangle; //1==absolute, or 0==relative to direction to path, wich angle==0 do default

	int needtorecache;
	int cache_samples;
	int cache_types;
	bool save_cache;
	//std::time_t cache_mod_time;<commit_msg>minor doc change<commit_after>//
//	
//    The Laxkit, a windowing toolkit
//    Please consult http://laxkit.sourceforge.net about where to send any
//    correspondence about this software.
//
//    This library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Library General Public
//    License as published by the Free Software Foundation; either
//    version 2 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Library General Public License for more details.
//
//    You should have received a copy of the GNU Library General Public
//    License along with this library; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
//    Copyright (C) 2004-2007,2010-2014 by <NAME>
//
#ifndef _LAX_PATHINTERFACE_H
#define _LAX_PATHINTERFACE_H


#include <lax/interfaces/viewportwindow.h>
#include <lax/interfaces/coordinate.h>
#include <lax/interfaces/somedata.h>
#include <lax/interfaces/linestyle.h>
#include <lax/interfaces/fillstyle.h>
#include <lax/curveinfo.h>
#include <lax/screencolor.h>
#include <lax/dump.h>



namespace LaxInterfaces {


class PathOperator;

//These are added to Coordinate::flags, and devs should ensure they do not conflict with normal flags
#define BEZ_MASK           (255<<20)
#define BEZ_STIFF_EQUAL    (1<<20)
#define BEZ_STIFF_NEQUAL   (1<<21)
#define BEZ_NSTIFF_EQUAL   (1<<22)
#define BEZ_NSTIFF_NEQUAL  (1<<23)


//-------------------- Path ---------------------------

class PathWeightNode
{
  public:
	int type; //symmetric width, fixed width with offset, width1/2 independent
	double width; //total width of stroke at this node
	double offset; //0 means weight symmetric about path
	double angle; //see Path::absoluteangle, it affects what this value is
	double t; //point along path, the bezier parameter: integer t corresponds to line points
	double center_t; //t position on cached centerline

	enum PathWeightNodeTypes {
		Default=0,
		Width      =(1<<0),
		Offset     =(1<<1),
		DualOffset =(1<<2),
		Angle      =(1<<3),
		AbsAngle   =(1<<4)
	};
	int nodetype; //or'd PathWeightNodeTypes

	PathWeightNode();
	PathWeightNode(double nt,double no,double nw, int ntype=Default);
	double topOffset() { return offset+width/2; }
	double bottomOffset() { return offset-width/2; }
};

class Path : public LaxFiles::DumpUtility, public Laxkit::DoubleBBox
{
 protected:
 public:
	static Laxkit::PtrStack<PathOperator> basepathops; 

	Coordinate *path; // path is not necessarily the first in a chain, but is a vertex
	Laxkit::PtrStack<PathWeightNode> pathweights;

	LineStyle *linestyle; 
	double defaultwidth;
	bool absoluteangle; //1==absolute, or 0==relative to direction to path, wich angle==0 do default

	int needtorecache;
	int cache_samples;
	int cache_types;
	bool save_cache;
	//std::time_t cache_mod_time;
{'fraction_non_alphanumeric': 0.11279296875, 'fraction_numerical': 0.021809895833333332, 'mean_word_length': 3.575577066269546, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7462131', 'n_tokens_mistral': 2002, 'n_tokens_neox': 1870, 'n_words': 685}