path.h

来自「这是VCF框架的代码」· C头文件 代码 · 共 324 行

H
324
字号
#ifndef _VCF_PATH_H__#define _VCF_PATH_H__//Path.h/*Copyright 2000-2004 The VCF Project.Please see License.txt in the top level directorywhere you installed the VCF.*/#if _MSC_VER > 1000#   pragma once#endif/* Generated by Together */namespace VCF{class Matrix2D;/**\class PathPoint Path.h "vcf/GraphicsKit/Path.h"*utility to make working with path points easier*/class GRAPHICSKIT_API PathPoint {public:	enum PointType{		ptUnknown = 0,		ptMoveTo,		ptLineTo,		ptQuadTo,		ptCubicTo,		ptClose	};	PathPoint() :type_(ptUnknown) {	}	PathPoint( double x, double y, PointType type ){		type_ = type;		point_.x_ = x;		point_.y_ = y;	}	PathPoint( Point* pt, PointType type ){		type_ = type;		point_.x_ = pt->x_;		point_.y_ = pt->y_;	}	PathPoint( const Point& pt, PointType type ){		type_ = type;		point_.x_ = pt.x_;		point_.y_ = pt.y_;	}	PathPoint( const PathPoint& pt ){		point_.x_ = pt.point_.x_;		point_.y_ = pt.point_.y_;		type_ = pt.type_;	};	virtual ~PathPoint(){};	PathPoint& operator=( const PathPoint& pt ){		if (this != &pt) {			point_.x_ = pt.point_.x_;			point_.y_ = pt.point_.y_;			type_ = pt.type_;		}		return *this;	};	bool operator==( const PathPoint& pt )const {		return (point_.x_ == pt.point_.x_) &&				(point_.y_ == pt.point_.y_) &&				(type_ == pt.type_);	};	/**	The x,y coordinate of the point. 	*/	Point point_;	/**	The path type - the type may be one of 		\li ptMoveTo		\li ptLineTo		\li ptQuadTo		\li ptCubicTo		\li ptClose	*/	PointType type_;};/**\class Path Path.h "vcf/GraphicsKit/Path.h"A Path is an abstract class that represents a series of points used to draw one or more shapes. The path instance is used in conjuntion with a fill and/or a stroke instance to actually render the shape on the graphics context.@see GraphicsContext@see Fill@see Stroke*/class GRAPHICSKIT_API Path : public Interface{public:	enum WindingRule {		wrEvenOdd=0,		wrNonZero	};	virtual ~Path(){};	/**	Applies the transform to the path	*/	virtual void applyTransform( const Matrix2D& transform ) = 0;	/**	Returns true or false, depending on whether or not the path	includes, or contains, the specified rectangle. 	@return bool Returns true if the rect is within the bounds of the	shape, otherwise false.	*/    virtual bool contains(const Rect& rect ) = 0;	/**	Returns true or false, depending on whether or not the path	includes, or contains, the specified point. 	@return bool Returns true if the point is within the bounds of the	shape, otherwise false.	*/    virtual bool contains( const Point& pt ) = 0;	/**	Returns true or false, depending on whether or not the 	specified point intersects any part of the path. 	@return bool Returns true if the point intersects 	the shape, otherwise false.	*/    virtual bool intersects( const Point& pt ) = 0;	/**	Returns true or false, depending on whether or not the 	specified rectangle intersects any part of the path. 	@return bool Returns true if the rectangle intersects 	the shape, otherwise false.	*/    virtual bool intersects( const Rect& rect ) = 0;	/**	returns the smallest rectangular bounds that fully enclose this path	*/    virtual Rect getBounds() = 0;	/**	Returns the winding rule for the path. This affects how the path get rendered.	*/	virtual WindingRule getWindingRule() = 0;	virtual void setWindingRule( WindingRule rule ) = 0;	/**	This fills in the points vector with a series of all the points that make 	up the path. If the path were to describe a rectangle, then more than 	likely the points parameter would be filled with 4 points for the 4 corners 	of the rectangle.	@param std::vector<PathPoint>	@param Matrix2D a pointer to an affine matrix. This matrix is used to apply a 	transformation to the returned points. It does \em not modify the path. The 	matrix instance is optional, and may be NULL.	@return bool returns true if the points vector is non empty 	(i.e. points.emtpy() == false).	*/	virtual bool getPoints( std::vector<PathPoint>& points, Matrix2D* transform ) = 0;	/**	This does the same thing as getPoints(), only it "flattens" the path if 	neccessary.	For example, if you had a path that was a bezier curve, it might 	be made of 4 points, the start point, 1st control point, 2nd control point, 	and end point. Calling getPoints would returns these 4 points, where as 	calling flattenPoints() would "flatten" the curve, and return a series of 	points that approximate the curve. How closely the flattened points approximate	the curve is entirely up to the implementor of the Path class.	*/	virtual void flattenPoints( std::vector<Point>& flattenedPoints ) = 0;};};/***CVS Log info*$Log$*Revision 1.5  2006/04/07 02:35:41  ddiego*initial checkin of merge from 0.6.9 dev branch.**Revision 1.4.4.1  2006/03/12 22:42:08  ddiego*more doc updates - specific to graphicskit.**Revision 1.4  2004/12/02 04:11:10  ddiego*removed some old, extraneous files from graphics kit dir.**Revision 1.3  2004/12/02 02:26:24  ddiego*removed some old, extraneous files from graphics kit dir.**Revision 1.2  2004/08/07 02:49:18  ddiego*merged in the devmain-0-6-5 branch to stable**Revision 1.1.2.3  2004/07/09 03:39:30  ddiego*merged in changes from the OSX branch for new theming API. Added*support for controlling the use of locale translated strings in components.**Revision 1.1.2.2.2.1  2004/07/06 03:27:13  ddiego*more osx updates that add proper support*for lightweight controls, some fixes to text layout, and some window painting issues. Also a fix*so that controls and windows paint either their default theme background or their background*color.**Revision 1.1.2.2  2004/04/29 04:10:27  marcelloptr*reformatting of source files: macros and csvlog and copyright sections**Revision 1.1.2.1  2004/04/28 03:40:31  ddiego*migration towards new directory structure**Revision 1.9.4.1  2004/04/26 21:58:40  marcelloptr*changes for dir reorganization: _VCF_MACRO_H__**Revision 1.9  2003/12/18 05:15:58  ddiego*merge from devmain-0-6-2 branch into the stable branch**Revision 1.8.2.1  2003/10/28 04:06:11  ddiego*updated the GraphicsContext and ContextPeer classes to support*slider control drawing. adjusted the Slider control accordingly.*Also changed some of the GraphicsKit headers to conform to the*current header style.**Revision 1.8  2003/08/09 02:56:43  ddiego*merge over from the devmain-0-6-1 branch*Changes*Features:*-Added additional implementation to better support the MVC architecture in*the VCF**-Added a Document/View architecure that is similar to MFC's or NextSteps's*Doc/View architectures**-Integrated the Anti Grain Graphics library into the GraphicsKit. There is*now basic support for it in terms of drawing vector shapes*(fills and strokes). Image support will come in the next release**-Added several documented graphics tutorials**Bugfixes:**[ 775744 ] wrong buttons on a dialog*[ 585239 ] Painting weirdness in a modal dialog ?*[ 585238 ] Modal dialog which makes a modal Dialog*[ 509004 ] Opening a modal Dialog causes flicker*[ 524878 ] onDropped not called for MLTcontrol**Plus an issue with some focus and getting the right popup window to activate*has also been fixed**Revision 1.7.2.2  2003/07/03 03:14:50  ddiego*made some changes to the Path interface, and got rid of the PathEnumerator*class**Revision 1.7.2.1  2003/06/20 04:41:04  ddiego*more AGG integration**Revision 1.7  2003/05/17 20:37:10  ddiego*this is the checkin for the 0.6.1 release - represents the merge over from*the devmain-0-6-0 branch plus a few minor bug fixes**Revision 1.6.10.2  2003/03/23 03:23:48  marcelloptr*3 empty lines at the end of the files**Revision 1.6.10.1  2003/03/12 03:10:31  ddiego*switched all member variable that used the "m_"<name> prefix to* <name>"_" suffix nameing standard.*Also changed all vcf builder files to accomadate this.*Changes were made to the Stream classes to NOT multiple inheritance and to*be a little more correct. Changes include breaking the FileStream into two*distinct classes, one for input and one for output.**Revision 1.6  2002/09/12 03:26:04  ddiego*merged over the changes from the devmain-0-5-5b branch**Revision 1.5.12.2  2002/08/06 02:57:35  ddiego*added base X11 files for GraphicsKit and made sure that the GraphicsKit compiles*under linux (GCC). There is now a new dir under build/xmake called GraphicsKit*where the xmake build script lives. This checkin also includes the base X11*include (as part of GraphicsKitPrivate.h), as well as linking to the X11 libs**Revision 1.5.12.1  2002/07/02 05:35:10  marcelloptr*fixes for vc6, vc7, separated builds, automatic library selection, stlport**Revision 1.5  2002/01/24 01:46:48  ddiego*added a cvs "log" comment to the top of all files in vcf/src and vcf/include*to facilitate change tracking**/#endif // _VCF_PATH_H__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?