Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1419.mcz ==================== Summary ==================== Name: Morphic-mt.1419 Author: mt Time: 23 April 2018, 8:52:51.282883 am UUID: 661d960f-f307-fa4f-be9f-ac5f7e818b55 Ancestors: Morphic-dtl.1418 Some API clean-up for drawing border styles via Canvas to improve code readability. =============== Diff against Morphic-dtl.1418 =============== Item was changed: ----- Method: Canvas>>fillRectangle:fillStyle:borderStyle: (in category 'drawing-rectangles') ----- fillRectangle: aRectangle fillStyle: aFillStyle borderStyle: aBorderStyle + "For convenience and historical reasons only. Try to use the more explicit 'frameAndFill..' calls if you want to draw borders." + + self frameAndFillRectangle: aRectangle fillStyle: aFillStyle borderStyle: aBorderStyle.! - "Fill the given rectangle." - aFillStyle isTransparent ifFalse:[ - self fillRectangle: (aRectangle insetBy: aBorderStyle inset) fillStyle: aFillStyle]. - aBorderStyle ifNil:[^self]. - aBorderStyle width <= 0 ifTrue:[^self]. - aBorderStyle frameRectangle: aRectangle on: self.! Item was added: + ----- Method: Canvas>>fillRoundRect:radius:fillStyle:borderStyle: (in category 'drawing-rectangles') ----- + fillRoundRect: aRectangle radius: radius fillStyle: fillStyle borderStyle: borderStyle + "For convenience only. Try to use 'frameAndFill...' messages." + + self + frameAndFillRoundRect: aRectangle + radius: radius + fillStyle: fillStyle + borderStyle: borderStyle.! Item was added: + ----- Method: Canvas>>frameAndFillRectangle:fillStyle:borderStyle: (in category 'drawing-rectangles') ----- + frameAndFillRectangle: aRectangle fillStyle: aFillStyle borderStyle: aBorderStyle + + aFillStyle isTransparent ifFalse: [ + self fillRectangle: (aRectangle insetBy: aBorderStyle inset) fillStyle: aFillStyle]. + + aBorderStyle width > 0 ifTrue: [ + self frameRectangle: aRectangle borderStyle: aBorderStyle].! Item was added: + ----- Method: Canvas>>frameAndFillRoundRect:radius:fillStyle:borderStyle: (in category 'drawing-rectangles') ----- + frameAndFillRoundRect: aRectangle radius: cornerRadius fillStyle: fillStyle borderStyle: borderStyle + + self + frameAndFillRectangle: aRectangle + fillColor: fillStyle asColor + borderWidth: borderStyle width + borderColor: borderStyle color.! Item was added: + ----- Method: Canvas>>frameRectangle:borderStyle: (in category 'drawing-rectangles') ----- + frameRectangle: aRectangle borderStyle: aBorderStyle + "Double dispatch." + + aBorderStyle frameRectangle: aRectangle on: self.! Item was changed: ----- Method: Morph>>drawOn: (in category 'drawing') ----- drawOn: aCanvas self wantsRoundedCorners ifTrue: [aCanvas frameAndFillRoundRect: self bounds radius: self cornerRadius fillStyle: self fillStyle borderWidth: self borderStyle width borderColor: self borderStyle color] + ifFalse: [aCanvas frameAndFillRectangle: self bounds fillStyle: self fillStyle borderStyle: self borderStyle]. - ifFalse: [aCanvas fillRectangle: self bounds fillStyle: self fillStyle borderStyle: self borderStyle]. ! Item was changed: ----- Method: NewBalloonMorph>>drawOn: (in category 'drawing') ----- drawOn: aCanvas self fillStyle isColor ifFalse: [self fillStyle isGradientFill ifTrue: [self fillStyle direction: 0 @ self height]]. "Bubble." self wantsRoundedCorners ifTrue: [aCanvas frameAndFillRoundRect: self bubbleBounds radius: self cornerRadius fillStyle: self fillStyle borderWidth: self borderStyle width borderColor: self borderStyle color] ifFalse: [aCanvas + frameAndFillRectangle: self bubbleBounds + fillStyle: self fillStyle + borderStyle: self borderStyle]. - fillRectangle: self bubbleBounds - fillStyle: self fillStyle borderStyle: self borderStyle]. "Tail." self hasTail ifTrue: [ self verticesForTail in: [:points | | pixelOffset | pixelOffset := points first y < points second y ifFalse: [points first x < points second x ifTrue: [self borderStyle width negated @ self borderStyle width] "bottomLeft" ifFalse: [self borderStyle width @ self borderStyle width]] "bottomRight" ifTrue: [points first x < points second x ifTrue: [self borderStyle width negated @ self borderStyle width negated] "topLeft" ifFalse: [self borderStyle width @ self borderStyle width negated]]. "topRight" aCanvas drawPolygon: points fillStyle: self fillStyle. aCanvas line: points first to: points second + pixelOffset width: self borderStyle width color: self borderStyle color. aCanvas line: points first to: points third + pixelOffset width: self borderStyle width color: self borderStyle color]]! Item was changed: ----- Method: SystemProgressBarMorph>>drawOn: (in category 'drawing') ----- drawOn: aCanvas | area fill | super drawOn: aCanvas. self barSize > 0 ifTrue: [ area := self innerBounds. area := area origin extent: (self barSize min: area extent x)@area extent y. fill := self barColor isColor ifTrue: [SolidFillStyle color: self barColor] ifFalse: [self barColor]. fill isGradientFill ifTrue: [ fill origin: area origin. fill direction: 0@ area height]. aCanvas + frameAndFillRectangle: area - fillRectangle: area fillStyle: fill borderStyle: (SimpleBorder new width: 1; color: fill asColor muchDarker). ]. ! |
Free forum by Nabble | Edit this page |