graphicscontext.h

来自「这是VCF框架的代码」· C头文件 代码 · 共 1,066 行 · 第 1/3 页

H
1,066
字号
	double getShearY( );	double getScaleX( );	double getScaleY( );	/**	returns whether or not the XOR Mode is turned on.	@return bool if the return is true then the	XOR mode is on, which means that colors are alternated	at the pixel level. Thus a line drawn once, and then	a second time at the same coordinates will erase itself	*/	bool isXORModeOn( );	/**	Turns the XOR mode on or off.	@param bool XORModeOn, if true then turns the XORMode on	otherwise if it's false it turns it off.	*/	void setXORModeOn( const bool& XORModeOn );	/**	draws a path. See Path for more info. Basically this simple enumerates all the	path points and uses the current stroke and fill to render the shape	*/	void draw(Path * path );	/**	draws an image at the x,y, coordinates	*/	void drawImage( const double& x, const double& y, Image * image );	void drawImage( const Point & pt, Image * image );	/**	draws an image at the x,y, coordinates, with	state	@param double x coordinate	@param double y coordinate	@param Image the image to draw	@param bool the state of the image, if true then draws the	image normally, if false draws a grayed out and embossed	version	Note: as of 8/4/2001 not implemented yet	*/	void drawImageWithState( const double& x, const double& y, Image * image, const bool& enabled );	void drawImageWithState( const Point & pt, Image * image, const bool& enabled );	/**	draws a portion of the image.	@param Rect boudns - the left_, top_ members of the bounds rect describe	where on the GraphicsContext the image will be drawn, while the height	and width of the bounds tells how much of the image to draw. A height or width	greater than the Image is ignored, and the whole image is draw. A height	or width less than the image results in only a portion of the image getting	drawn, or the top, left of the image to the specified height and width.	@param Image the image to draw	*/	void drawImageWithinBounds( Rect* bounds, Image* image );	/**	draws a partial image at the x,y, coordinates specified	@param double x - the x coordinate on the GraphicsContext	@param double y - the y coordinate on the GraphicsContext	@param Rect* imageBounds - a rectangle in the coordinate space	of the image that specifies which rectangular portion of the	image to draw	@param Image image - the image to draw	*/	void drawPartialImage( const double& x, const double& y, Rect* imageBounds, Image* image );	void drawPartialImage( const Point & pt, Rect* imageBounds, Image* image );	void setCurrentTransform( const Matrix2D& transform );	Matrix2D* getCurrentTransform( );	/**	End of high level gaphics functions. The funtions below are lower level	See ContextPeer for more information on the functions below	*/	void setStrokeWidth( const double& width );	double getStrokeWidth( );	void textAt( const double & x, const double & y, const String & text );	void textAt( const Point & pt, const String & text );	void textAt( const double & x, const double & y, const String& text, const long drawOptions );	void textAt( const Point & pt, const String& text, const long drawOptions );	void textWithStateAt( const double& x, const double& y, const String& text, const bool& enabled );	void textWithStateAt( const Point & pt, const String& text, const bool& enabled );	/**	draws text within the bounds specified. If specified the	text will be word wrapped within the bounds.	@param Rect bounds - the left, top, right, and bottom of the	rectangle to draw the text within	@param String the text to draw	@param bool wordWrap whether or not wrap the text to	bounds specified. If wordWrap is false, then the text is	treated as a single line, and any text extending past the	right coordinate value will be clipped using an ellipsis.	So if "Hello World" is passed in and the bounds only fits	*"Hello W", then the string will be drawn as "Hello..."	*/	void textBoundedBy( Rect* bounds, const String& text, const bool& wordWrap=true );	void textBoundedBy( Rect* bounds, const String& text, const long drawOptions );	double getTextWidth( const String& text );	double getTextHeight( const String& text );	void rectangle( const double & x1, const double & y1, const double & x2, const double & y2 );	void rectangle( const Rect & rc );	void rectangle( const Point & pt1, const Point & pt2 );	void rectangle( Rect* r ){		if ( NULL != r ) {			this->rectangle( r->left_, r->top_, r->right_, r->bottom_ );		}	};	void lineTo( const double& x, const double& y );	void lineTo( const Point & pt );	void moveTo( const double& x, const double& y );	void moveTo( const Point & pt );	void roundRect( const double & x1, const double & y1, const double & x2, const double & y2, const double & xc, const double & yc );	void roundRect( const Rect & rc, const Point & ptc );	void roundRect( const Point & pt1, const Point & pt2, const Point & ptc );	void roundRect( Rect* r, Point * p ){		if ( NULL != r && NULL != p ) {			this->roundRect( r->left_, r->top_, r->right_, r->bottom_, p->x_, p->y_ );		}	};	void circle( const double & x, const double & y, const double & radius );	void circle( const Point & pt, const double & radius );	void ellipse( const double & x1, const double & y1, const double & x2, const double & y2 );	void ellipse( const Point & pt1, const Point & pt2 );	void arc( const double& centerX,  const double& centerY,	          const double& radiusWidth, const double& radiusHeight,	          const double& startAngle, const double& endAngle );	void arc( const Point & centerPt, const Size& radius,	          const double& startAngle, const double& endAngle );	void pie( const double & x1, const double & y1, const double & x2, const double & y2, const double & x3, const double & y3, const double & x4, const double & y4 );	void pie( const Point & pt1, const Point & pt2, const Point & pt3, const Point & pt4 );	void chord( const double & x1, const double & y1, const double & x2, const double & y2, const double & x3, const double & y3, const double & x4, const double & y4 );	void chord( const Point & pt1, const Point & pt2, const Point & pt3, const Point & pt4 );	void polyline( const std::vector<Point> & pts );	void curve( const double& x1, const double& y1, const double& x2, const double& y2,	            const double& x3, const double& y3, const double& x4, const double& y4 );	void curve( const Point & pt1, const Point & pt2, const Point & pt3, const Point & pt4 );	/**	The following functions are related to theme compliant drawing.	These allow the VCF to properly draw various "parts" of the	windowing system that are compliant with the windowing system's	"theme" or visual style.	*/	void drawThemeSelectionRect( Rect* rect, DrawUIState& state );	void drawThemeFocusRect( Rect* rect, DrawUIState& state );	void drawThemeButtonRect( Rect* rect, ButtonState& state, Rect* captionRect=NULL );	void drawThemeButtonFocusRect( Rect* rect );	void drawThemeCheckboxRect( Rect* rect, ButtonState& state );	void drawThemeRadioButtonRect( Rect* rect, ButtonState& state );	void drawThemeComboboxRect( Rect* rect, ButtonState& state );	void drawThemeScrollButtonRect( Rect* rect, ScrollBarState& state );	/**	Draws a button that is used to open up more details, for example	the button that opens up a tree node to reveal it's children, that is compliant	with the native windowing systems default look and feel.	On Win32 this is usually represented by the "+" and "-" look as found on	the tree controls, while on OSX it is the little triangles	*/	void drawThemeDisclosureButton( Rect* rect, DisclosureButtonState& state );	/**	Draws a tab, the part of the TabbedPages control that acts like a	little button to activate a page, that is compliant	with the native windowing systems default look and feel	*/	void drawThemeTab( Rect* rect, TabState& state );	/**	Draws a tab page - the page on which other controls for the page are	parented to, that is compliant	with the native windowing systems default look and feel	*/	void drawThemeTabPage( Rect* rect, DrawUIState& state );	void drawThemeTabContent( Rect* rect, DrawUIState& state );	void drawThemeTabs( Rect* rect, DrawUIState& paneState, TabState& selectedTabState, TabState& otherTabs, const std::vector<String>& tabNames, int selectedTabIndex );	/**	Draws tick marks, like that used for a slider control, that is compliant	with the native windowing systems default look and feel	*/	void drawThemeTickMarks( Rect* rect, SliderState& state );	/**	Draws a slider control, like that used for a slider control, that is compliant	with the native windowing systems default look and feel	*/	void drawThemeSlider( Rect* rect, SliderState& state );	/**	Draws a progress bar control, that is compliant	with the native windowing systems default look and feel	*/	void drawThemeProgress( Rect* rect, ProgressState& state );	void drawThemeImage( Rect* rect, Image* image, DrawUIState& state );	/**	Draws a header control that is compliant	with the native windowing systems default look and feel	*/	void drawThemeHeader( Rect* rect, ButtonState& state );	/**	draws edges, useful for separators, that is compliant	with the native windowing systems default look and feel.	use a mask or 1 or more values of type ContextPeer::EdgeType	to indicate which sides of the rect to draw an edge on	*/	void drawThemeEdge( Rect* rect, DrawUIState& state, const long& edgeSides, const long& edgeStyle );	/**	Draws a size gripper for resizing a control/window that is compliant	with the native windowing systems default look and feel	*/	void drawThemeSizeGripper( Rect* rect, DrawUIState& state );	/**	Draws a them compliant background	*/	void drawThemeBackground( Rect* rect, BackgroundState& state );	/**	Draws the background appropriate for a menu item that is compliant	with the native windowing systems default look and feel.	This is typically called first by a menu item to give it a standard	look and feel in it's background before drawing any thing else	*/	void drawThemeMenuItem( Rect* rect, MenuState& state );	/**	Draws the menu items text such that it's compliant with the	native windowing platform look and feel. This will take into	consideration the accelerator values if present.	*/	void drawThemeMenuItemText( Rect* rect, MenuState& state );	void drawThemeText( Rect* rect, TextState& state );protected:	void buildArc( double centerX,  double centerY,	               double radiusWidth, double radiusHeight,	               double startAngle, double endAngle,	               std::vector<Point>& pts, const Matrix2D& transform );	void buildRoundRect( double x1, double y1, double x2, double y2,	                     double cornerArcWidth, double cornerArcHeight,	                     std::vector<Point>& pts, const Matrix2D& transform );	void buildEllipse( double x1, double y1, double x2, double y2,	                   std::vector<Point>& pts, const Matrix2D& transform );	void checkPathOperations( );	void execPathOperations( );protected:	/**	*	*	*/	struct PointOperation {		enum PrimitiveType{			ptMoveTo=0,			ptLineTo,			ptPolyLine,			ptBezier,			ptRect,			ptRoundRect,			ptEllipse,			ptArc,			ptClose		};		PointOperation( const double& ax=0.0, const double& ay=0.0, PrimitiveType op=ptMoveTo ):			x(ax), y(ay),primitive(op) {		}		double x;		double y;		PrimitiveType primitive;	};	ContextPeer* contextPeer_;	GraphicsDrawingState currentDrawingState_;	std::vector<PointOperation> pathOperations_;	Image* drawingArea_;	Point drawingAreaTopLeft_;	agg::rendering_buffer* renderBuffer_;	bool renderAreaDirty_;	Rect viewableBounds_;	/**	the collection of all the saved Graphics states.	@see GraphicsContext::saveState()	*/	GraphicsStateCollection stateCollection_;	/**	the index of the current state in the collection of	all the saved Graphics states.	@see GraphicsContext::saveState()

⌨️ 快捷键说明

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