Skip to content

Commit

Permalink
Merge branch 'bezier-cleanup' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils1729 committed Aug 3, 2022
2 parents f6dab22 + c2414f5 commit a6e6ffe
Show file tree
Hide file tree
Showing 26 changed files with 43 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*SVG-Morphic
boundingBox
"Return the bounds containing the receiver"
^super bounds encompass: (self valueAt: 0.5)

^ super bounds encompass: (self valueAt: 0.5)
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*SVG-Morphic
isLineSegment
"Return true if the receiver is a line segment."

^false
^ false
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*SVG-Morphic
primAddToEngine: aBalloonEngine fills: fills lineWidth: lineWidth
"Add the receiver's description to the ballooon engine."

aBalloonEngine
primAddBezierShape: {start. via. end}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*SVG-Morphic
runClass
"Answer the run class for the receiver."

^SVGBezier2SegmentRun
^ SVGBezier2SegmentRun
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"class" : {
},
"instance" : {
"boundingBox" : "gvc 7/30/2005 19:27",
"boundingBox" : "nh 7/26/2022 18:24",
"equals:" : "lha 7/10/2022 13:13",
"equalsBezier2Segment:" : "lha 7/10/2022 13:22",
"equalsLineSegment:" : "lha 7/10/2022 13:13",
"isLineSegment" : "gvc 10/3/2005 09:48",
"isLineSegment" : "nh 7/26/2022 18:27",
"offsetBy:" : "nh 7/2/2022 10:56",
"primAddToEngine:fills:lineWidth:" : "gvc 7/28/2005 17:12",
"runClass" : "nh 7/2/2022 11:57",
"primAddToEngine:fills:lineWidth:" : "nh 7/26/2022 18:27",
"runClass" : "nh 7/26/2022 18:27",
"transformedBy:" : "nh 7/2/2022 11:13" } }
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*SVG-Morphic
isBezier3Segment
"Return true if the receiver is a cubic bezier segment."

^true
^ true
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*SVG-Morphic
isLineSegment
"Return true if the receiver is a line segment."

^false
^ false
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*SVG-Morphic
primAddToEngine: aBalloonEngine fills: fills lineWidth: lineWidth
"Add the receiver's description to the ballooon engine."

|points|
points := self asBezier2Shape: 0.5.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*SVG-Morphic
runClass
"Answer the run class for the receiver."

^SVGBezier2SegmentRun
^ SVGBezier2SegmentRun
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"equals:" : "lha 7/10/2022 13:15",
"equalsBezier3Segment:" : "lha 7/10/2022 13:22",
"equalsLineSegment:" : "lha 7/10/2022 13:15",
"isBezier3Segment" : "gvc 10/3/2005 09:49",
"isLineSegment" : "gvc 10/3/2005 09:48",
"primAddToEngine:fills:lineWidth:" : "gvc 10/10/2005 13:54",
"runClass" : "nh 7/2/2022 11:58" } }
"isBezier3Segment" : "nh 7/26/2022 18:27",
"isLineSegment" : "nh 7/26/2022 18:28",
"primAddToEngine:fills:lineWidth:" : "nh 7/26/2022 18:28",
"runClass" : "nh 7/26/2022 18:28" } }
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*SVG-Morphic
boundingBox
"Return the bounds containing the receiver"

^self bounds
^ self bounds
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*SVG-Morphic
isBezier3Segment
"Return true if the receiver is a cubic bezier segment."

^false
^ false
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*SVG-Morphic
primAddToEngine: aBalloonEngine fills: fills lineWidth: lineWidth
"Add the receiver's description to the ballooon engine."

aBalloonEngine
primAddPolygon: {start. end}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*SVG-Morphic
run
"Answer the run for the receiver."

^self runClass segments: (OrderedCollection with: self)
^ self runClass segments: (OrderedCollection with: self)
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*SVG-Morphic
runClass
"Answer the run class for the receiver."

^SVGLineSegmentRun
^ SVGLineSegmentRun
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"class" : {
},
"instance" : {
"boundingBox" : "gvc 7/30/2005 19:29",
"boundingBox" : "nh 7/26/2022 18:24",
"equals:" : "lha 7/10/2022 13:11",
"equalsBezier2Segment:" : "lha 7/10/2022 13:12",
"equalsBezier3Segment:" : "lha 7/10/2022 13:12",
"equalsClosingLineSegment:" : "lha 7/10/2022 13:13",
"equalsFixupLineSegment:" : "lha 7/10/2022 13:13",
"equalsLineSegment:" : "lha 7/10/2022 13:22",
"isBezier3Segment" : "gvc 10/3/2005 09:47",
"primAddToEngine:fills:lineWidth:" : "gvc 7/28/2005 17:11",
"run" : "gvc 10/25/2005 12:40",
"runClass" : "gvc 10/25/2005 12:39" } }
"isBezier3Segment" : "nh 7/26/2022 18:24",
"primAddToEngine:fills:lineWidth:" : "nh 7/26/2022 18:24",
"run" : "nh 7/26/2022 18:24",
"runClass" : "nh 7/26/2022 18:24" } }
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
rendering
renderBezier2SegmentRun: segments fill: fillStyle stroke: strokeStyle strokeWidth: aNumber transform: aMatrix on: aCanvas
renderBezier2SegmentRun: aSegmentRun fill: aFillStyle stroke: aStrokeStyle strokeWidth: aNumber transform: aMatrix on: aCanvas

aCanvas preserveStateDuring: [:bc |
bc
aaLevel: 4;
drawBezierShape: (segments stitchedClosed points collect: [:p | aMatrix transformPoint: p])
color: fillStyle
drawBezierShape: (aSegmentRun stitchedClosed points collect: [:p | aMatrix transformPoint: p])
color: aFillStyle
borderWidth: 0
borderColor: Color transparent;
drawGeneralBezierShape: (segments stroke: aNumber transform: aMatrix)
color: strokeStyle
drawGeneralBezierShape: (aSegmentRun stroke: aNumber transform: aMatrix)
color: aStrokeStyle
borderWidth: 0
borderColor: Color transparent]
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
rendering
renderBezier3Segments: segments fill: fillStyle stroke: strokeStyle strokeWidth: aNumber transform: aMatrix on: aCanvas
renderBezier3Segments: aCollection fill: aFillStyle stroke: aStrokeStyle strokeWidth: aNumber transform: aMatrix on: aCanvas

|bezier2Run|

bezier2Run := SVGBezier2SegmentRun
fromBezier3Segments: segments
fromBezier3Segments: aCollection
precision: aMatrix compositeScale r reciprocal.

self
renderBezier2SegmentRun: bezier2Run
fill: fillStyle
stroke: strokeStyle
fill: aFillStyle
stroke: aStrokeStyle
strokeWidth: aNumber
transform: aMatrix
on: aCanvas
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
rendering
renderEllipse: anSVGEllipse on: aCanvas
"Render the given object on the canvas."


self
renderBezier3Segments: (Bezier3Segment
makeEllipseSegments: anSVGEllipse rectangle)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
rendering
renderLine: anSVGLine on: aCanvas
"Render the given object on the canvas."

|lineWidth lineColor transform scale rectangle|
lineWidth := (anSVGLine composedStyle at: 'stroke-width') rounded max: 1.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
rendering
renderPath: anSVGPath on: aCanvas
"Render the given object on the canvas."

|fill lineWidth lineColor|
anSVGPath segments isEmpty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
rendering
renderPolygon: anSVGPolygon on: aCanvas
"Render the given object on the canvas."

|fill lineWidth lineColor|
anSVGPolygon points isEmpty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
rendering
renderPolyline: anSVGPolyine on: aCanvas
"Render the given object on the canvas."

| lineWidth lineColor|
anSVGPolyine points isEmpty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
rendering
renderRect: anSVGRect on: aCanvas
"Render the given object on the canvas."

|fill lineWidth lineColor transform scale rectangle|
fill := anSVGRect composedFillStyle.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
rendering
renderText: anSVGText on: aCanvas
"Render the given object on the canvas."

|fill textFont anchor offset trans|
trans := anSVGText transformFrom: anSVGText world.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
},
"instance" : {
"defaultSVGTextSize" : "tw 6/2/2022 21:29",
"renderBezier2SegmentRun:fill:stroke:strokeWidth:transform:on:" : "nh 7/4/2022 09:27",
"renderBezier3Segments:fill:stroke:strokeWidth:transform:on:" : "nh 7/2/2022 11:58",
"renderEllipse:on:" : "nh 7/4/2022 10:12",
"renderLine:on:" : "AS 6/19/2022 11:39",
"renderPath:on:" : "lra 6/12/2022 18:44",
"renderPolygon:on:" : "lra 6/12/2022 18:44",
"renderPolyline:on:" : "lra 6/12/2022 18:44",
"renderRect:on:" : "AS 6/19/2022 11:36",
"renderText:on:" : "lra 6/12/2022 16:38",
"renderBezier2SegmentRun:fill:stroke:strokeWidth:transform:on:" : "nh 8/3/2022 15:26",
"renderBezier3Segments:fill:stroke:strokeWidth:transform:on:" : "nh 8/3/2022 15:18",
"renderEllipse:on:" : "nh 7/26/2022 18:30",
"renderLine:on:" : "nh 7/26/2022 18:30",
"renderPath:on:" : "nh 7/26/2022 18:30",
"renderPolygon:on:" : "nh 7/26/2022 18:30",
"renderPolyline:on:" : "nh 7/26/2022 18:30",
"renderRect:on:" : "nh 7/26/2022 18:30",
"renderText:on:" : "nh 7/26/2022 18:31",
"styleIn:fromSVGStyle:" : "lra 7/6/2022 18:27" } }

0 comments on commit a6e6ffe

Please sign in to comment.