diff options
Diffstat (limited to 'cocoa')
| -rw-r--r-- | cocoa/PlatCocoa.h | 2 | ||||
| -rw-r--r-- | cocoa/PlatCocoa.mm | 33 | 
2 files changed, 35 insertions, 0 deletions
| diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h index c14ca1928..29a3626ce 100644 --- a/cocoa/PlatCocoa.h +++ b/cocoa/PlatCocoa.h @@ -96,6 +96,8 @@ public:  	int DeviceHeightFont(int points) override;  	void MoveTo(int x_, int y_) override;  	void LineTo(int x_, int y_) override; +	void LineDraw(Point start, Point end, Stroke stroke) override; +	void PolyLine(const Point *pts, size_t npts, Stroke stroke) override;  	void Polygon(Scintilla::Point *pts, size_t npts, ColourDesired fore, ColourDesired back) override;  	void Polygon(const Scintilla::Point *pts, size_t npts, FillStroke fillStroke) override;  	void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override; diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index 7bec2d73d..275587288 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -657,6 +657,39 @@ void SurfaceImpl::LineTo(int x_, int y_) {  //-------------------------------------------------------------------------------------------------- +void SurfaceImpl::LineDraw(Point start, Point end, Stroke stroke) { +	PenColourAlpha(stroke.colour); +	CGContextSetLineWidth(gc, stroke.width); + +	CGContextBeginPath(gc); +	CGContextMoveToPoint(gc, start.x, start.y); +	CGContextAddLineToPoint(gc, end.x, end.y); +	CGContextStrokePath(gc); + +	CGContextSetLineWidth(gc, 1.0f); +} + +//-------------------------------------------------------------------------------------------------- + +void SurfaceImpl::PolyLine(const Point *pts, size_t npts, Stroke stroke) { +	PLATFORM_ASSERT(gc && (npts > 1)); +	if (!gc || (npts <= 1)) { +		return; +	} +	PenColourAlpha(stroke.colour); +	CGContextSetLineWidth(gc, stroke.width); +	CGContextBeginPath(gc); +	CGContextMoveToPoint(gc, pts[0].x, pts[0].y); +	for (size_t i = 1; i < npts; i++) { +		CGContextAddLineToPoint(gc, pts[i].x, pts[i].y); +	} +	CGContextStrokePath(gc); + +	CGContextSetLineWidth(gc, 1.0f); +} + +//-------------------------------------------------------------------------------------------------- +  void SurfaceImpl::Polygon(Scintilla::Point *pts, size_t npts, ColourDesired fore,  			  ColourDesired back) {  	// Allocate memory for the array of points. | 
