Skip to content

Commit

Permalink
Cairo: Extract to method part of arc drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed Apr 8, 2024
1 parent 04ddc13 commit 847d26a
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/Alexandrie-Cairo/AeCairoContext.class.st
Expand Up @@ -153,24 +153,34 @@ AeCairoContext >> arcCenter: aPoint radius: aRadius startAngle: aStartAngleInRad
]

{ #category : #'API - path' }
AeCairoContext >> arcCenter: aCenter radius: aRadius startAngle: startAngleInRadians sweep: sweepAngleInRadians [
"Draw and arc that may be positive or negative according to the specified sweep angle."
AeCairoContext >> arcCenter: aCenter radius: aRadius startAngle: startAngleInRadians endAngle: endAngleInRadians cw: isClockwise [
"Draw and arc that may be positive or negative according to isClockwise."

| endAngle |
endAngle := startAngleInRadians + sweepAngleInRadians.
sweepAngleInRadians positive
isClockwise
ifTrue: [
self
arcCenter: aCenter
radius: aRadius
startAngle: startAngleInRadians
endAngle: endAngle ]
endAngle: endAngleInRadians ]
ifFalse: [
self
arcNegativeCenter: aCenter
radius: aRadius
startAngle: startAngleInRadians
endAngle: endAngle ]
endAngle: endAngleInRadians ]
]

{ #category : #'API - path' }
AeCairoContext >> arcCenter: aCenter radius: aRadius startAngle: startAngleInRadians sweep: sweepAngleInRadians [
"Draw an arc that may be positive or negative (clockwise or counter-clockwise) according to the sign of the specified sweep angle."

self
arcCenter: aCenter
radius: aRadius
startAngle: startAngleInRadians
endAngle: startAngleInRadians + sweepAngleInRadians
cw: sweepAngleInRadians positive
]

{ #category : #'API - path' }
Expand Down

0 comments on commit 847d26a

Please sign in to comment.