diff options
| author | Neil <nyamatongwe@gmail.com> | 2021-03-19 21:03:17 +1100 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2021-03-19 21:03:17 +1100 | 
| commit | 216fca2d218c3e0dcb5cdb4273cfb609da06cbd2 (patch) | |
| tree | 44e1769b98acee672f4b4cb6cb2f42ce942faec5 /gtk | |
| parent | 20bb1c7c0f6931819745d9756ab14246c20c4e9f (diff) | |
| download | scintilla-mirror-216fca2d218c3e0dcb5cdb4273cfb609da06cbd2.tar.gz | |
Support strokeWidth and float cornerSize in AlphaRectangle. Use FillStroke
instead of separate colour and alpha arguments.
Diffstat (limited to 'gtk')
| -rwxr-xr-x | gtk/PlatGTK.cxx | 26 | 
1 files changed, 26 insertions, 0 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 3debf8fc8..b1079a31a 100755 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -169,6 +169,7 @@ public:  	void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) override;  	void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,  			    ColourDesired outline, int alphaOutline, int flags) override; +	void AlphaRectangle(PRectangle rc, XYPOSITION cornerSize, FillStroke fillStroke) override;  	void GradientRectangle(PRectangle rc, const std::vector<ColourStop> &stops, GradientOptions options) override;  	void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) override;  	void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override; @@ -592,6 +593,31 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fi  	}  } +void SurfaceImpl::AlphaRectangle(PRectangle rc, XYPOSITION cornerSize, FillStroke fillStroke) { +	if (context && rc.Width() > 0) { +		const float halfStroke = fillStroke.stroke.width / 2.0f; +		const float doubleStroke = fillStroke.stroke.width * 2.0f; +		PenColourAlpha(fillStroke.fill.colour); +		if (cornerSize > 0) +			PathRoundRectangle(context, rc.left + fillStroke.stroke.width, rc.top + fillStroke.stroke.width, +				rc.Width() - doubleStroke, rc.Height() - doubleStroke, cornerSize); +		else +			cairo_rectangle(context, rc.left + fillStroke.stroke.width, rc.top + fillStroke.stroke.width, +				rc.Width() - doubleStroke, rc.Height() - doubleStroke); +		cairo_fill(context); + +		PenColourAlpha(fillStroke.stroke.colour); +		if (cornerSize > 0) +			PathRoundRectangle(context, rc.left + halfStroke, rc.top + halfStroke, +				rc.Width() - fillStroke.stroke.width, rc.Height() - fillStroke.stroke.width, cornerSize); +		else +			cairo_rectangle(context, rc.left + halfStroke, rc.top + halfStroke, +				rc.Width() - fillStroke.stroke.width, rc.Height() - fillStroke.stroke.width); +		cairo_set_line_width(context, fillStroke.stroke.width); +		cairo_stroke(context); +	} +} +  void SurfaceImpl::GradientRectangle(PRectangle rc, const std::vector<ColourStop> &stops, GradientOptions options) {  	if (context) {  		cairo_pattern_t *pattern;  | 
