[squeak-dev] The Inbox: Morphic-ct.1768.mcz
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Fri Apr 30 18:03:28 UTC 2021
> Original snippet to reproduce (provided by Marcel, mt):
>
> morph := Morph new.
> morph
> extent: 500 at 500;
> borderWidth: 50;
> borderColor: Color red;
> cornerStyle: #rounded;
> cornerRadius: 20;
> yourself.
> morph openInHand.
Before:
[cid:500b569a-552b-4c5b-a194-e777c4b6170c]
After:
[cid:befc4681-cf79-4410-beb2-9a94ab9e9c19]
:-)
Best,
Christoph
<http://www.hpi.de/>
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Freitag, 30. April 2021 20:02:32
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Morphic-ct.1768.mcz
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1768.mcz
==================== Summary ====================
Name: Morphic-ct.1768
Author: ct
Time: 30 April 2021, 8:02:20.035293 pm
UUID: 2c143938-6557-0b42-973c-6453d49680cf
Ancestors: Morphic-mt.1767
Fixes a GrafPort bug when drawing round rectangle frames. In the past, the horizontal segments were too wide.
Original snippet to reproduce (provided by Marcel, mt):
morph := Morph new.
morph
extent: 500 at 500;
borderWidth: 50;
borderColor: Color red;
cornerStyle: #rounded;
cornerRadius: 20;
yourself.
morph openInHand.
=============== Diff against Morphic-mt.1767 ===============
Item was changed:
----- Method: GrafPort>>frameRoundRect:radius:borderWidth: (in category 'drawing support') -----
frameRoundRect: aRectangle radius: radius borderWidth: borderWidth
| nextY outer nextOuterX ovalDiameter rectExtent rectOffset rectX rectY rectWidth rectHeight ovalRadius ovalRect innerRadius innerDiameter innerRect inner nextInnerX wp |
aRectangle area <= 0 ifTrue: [^ self].
ovalDiameter := (radius * 2) asPoint min: aRectangle extent.
(ovalDiameter x <= 0 or:[ovalDiameter y <= 0]) ifTrue:[
^self fillRect: aRectangle offset: 0 at 0.
].
"force diameter to be even - this simplifies lots of stuff"
ovalRadius := (ovalDiameter x // 2) @ (ovalDiameter y // 2).
(ovalRadius x <= 0 or:[ovalRadius y <= 0]) ifTrue:[
^self fillRect: aRectangle offset: 0 at 0.
].
wp := borderWidth asPoint.
ovalDiameter := ovalRadius * 2.
innerRadius := ovalRadius - borderWidth max: 0 at 0.
innerDiameter := innerRadius * 2.
rectExtent := aRectangle extent - ovalDiameter.
rectWidth := rectExtent x.
rectHeight := rectExtent y.
rectOffset := aRectangle origin + ovalRadius.
rectX := rectOffset x.
rectY := rectOffset y.
ovalRect := 0 at 0 extent: ovalDiameter.
innerRect := 0 at 0 extent: innerDiameter.
height := 1.
outer := EllipseMidpointTracer new on: ovalRect.
inner := EllipseMidpointTracer new on: innerRect.
nextY := ovalRadius y.
1 to: (wp y min: nextY) do:[:i|
nextOuterX := outer stepInY.
width := nextOuterX * 2 + rectWidth.
destX := rectX - nextOuterX.
destY := rectY - nextY.
self copyBits.
destY := rectY + nextY + rectHeight - 1.
self copyBits.
nextY := nextY - 1.
].
[nextY > 0] whileTrue:[
nextOuterX := outer stepInY.
nextInnerX := inner stepInY.
destX := rectX - nextOuterX.
destY := rectY - nextY.
width := nextOuterX - nextInnerX.
self copyBits.
destX := rectX + nextInnerX + rectWidth.
self copyBits.
destX := rectX - nextOuterX.
destY := rectY + nextY + rectHeight-1.
self copyBits.
destX := rectX + nextInnerX + rectWidth.
self copyBits.
nextY := nextY - 1.
].
destX := aRectangle left.
destY := rectOffset y.
height := rectHeight.
width := wp x.
self copyBits.
destX := aRectangle right - width.
self copyBits.
innerRadius y = 0 ifTrue:[
destX := aRectangle left + wp x.
destY := rectY.
+ width := aRectangle width - (wp x * 2).
- width := rectWidth.
height := wp y - ovalRadius y.
self copyBits.
destY := aRectangle bottom - wp y.
self copyBits.
].!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210430/f9b1ae92/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 32965 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210430/f9b1ae92/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 31298 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210430/f9b1ae92/attachment-0003.png>
More information about the Squeak-dev
mailing list
|