Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Athens does not have a way to set and get the fill rule #2782

Closed
akevalion opened this Issue Mar 10, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@akevalion
Copy link
Contributor

akevalion commented Mar 10, 2019

Steps to reproduce the issue
1 First read this https://www.cairographics.org/manual/cairo-cairo-t.html#cairo-set-fill-rule.
2 Download pharo7 with PharoLauncher
3 execute the next piece of code that creates a donut in athens

| surface |
surface := AthensCairoSurface extent: 300@300.
surface drawDuring: [ :canvas | | path |
	canvas pathTransform
		translateBy: 50@50.
	"donut"
	"canvas setFillRuleEvenOdd."
	path := canvas createPath: [ :builder |  
		builder
			absolute;
			moveTo: 100 @0;
			arcCenterX: 0
				centerY: 0
				radius: 50
				startAngle: 0 
				endAngle: Float pi * 2;
			moveTo: 75@0;
			arcCenterX: 0
				centerY: 0
				radius: 30
				startAngle: 0
				endAngle: Float pi * 2.
			 ].
	canvas setPaint: Color blue.
	canvas drawShape: path.
	 ].
surface asForm asMorph openInWindow.

4 The result is:

Expected Result:

Athens needs new methods and variables for the following classes
1.

AthensCairoPathBuilder >> setFillRuleEvenOdd
	context setFillRuleEvenOdd
AtthensCairoCanvas >> setFillRuleEvenOdd
	self setFillRule: CAIRO_FILL_RULE_EVEN_ODD
AtthensCairoCanvas >> setFillRule: aCairoFillRule
	^ self ffiCall: #( void cairo_set_fill_rule ( self, cairo_fill_rule_t aCairoFillRule ) )
AthensCairoDefinitions class >> initialize_cairo_fill_rule_t
	CAIRO_FILL_RULE_WINDING := 0.
	CAIRO_FILL_RULE_EVEN_ODD := 1.
AthensCairoDefinitions class>> initialize_types
	cairo_status_t := cairo_font_type_t :=  cairo_line_join_t  := cairo_line_cap_t := cairo_status_t := cairo_font_slant_t := cairo_font_weight_t := cairo_operator_t := cairo_fill_rule_t := #int.
	
	cairo_pattern_t := #AthensCairoPatternPaint.
	
	cairo_t := #AthensCairoCanvas.
	
	cairo_surface_t := #AthensCairoSurface .
	cairo_text_extents_t := #CairoTextExtents.

And maybe the methods and test to check this behavior

@Ducasse

This comment has been minimized.

Copy link
Member

Ducasse commented Mar 10, 2019

Hi milton

Send a PR. Now you should consider that Athens will be deprecated and that we plan to use Sparta and a Sparta adaptation to expose the same API than Athens to user so that they can migrate when they want.
I told to alex that it would be super cool if you could check the status of the SpartaAthensBridge and use Sparta for Roassal 3.

akevalion added a commit to akevalion/pharo that referenced this issue Mar 19, 2019

Fix: pharo-project#2782
Added to athens: set fill rule and new example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.