[UI] Rounded corners [was Re: Fwd: Workspace backgrounds - almost there]

Bert Freudenberg bert at freudenbergs.de
Mon Oct 1 19:57:14 UTC 2007


On Oct 1, 2007, at 21:19 , Klaus D. Witzel wrote:

> I referred to #saveBitsUnderCornersOf:on:in:corners: which copies  
> the bits under potential round corner areas, then the client's  
> block is evaluated, then #tweakCornersOf:on:in:borderWidth:corners:  
> puts back some of those bits. Impossible with a one dimensional SVG 
> +html stream :( or similiar media, for that matter.
>
> During rendering the to-be-rounded Morph does not know that, so I  
> signal a RoundedCornersNotification and exchange rounding  
> information between the related methods (the borderWidthForRounding  
> I think) which [the methods and their receivers] may be far away  
> from each other on the stack. I need the "to be rounded" info at  
> the SVG+xhtml element level. Example attached, FireFox/Opera and  
> Inkskape recommended, Morph class names are in the element id.  
> Magnify to 200% and inspect the corners.

Hehe, I had to do a similar hack for the Rome canvas in Tweak ... I  
did away with the whole saveBits mess:

roundCornersOf: aPlayer in: bounds during: aBlock
	aPlayer roundCorners ifFalse: [^aBlock value].
	^aBlock
		on: RomeTweakWantsRoundedCorners
		do: [:ex |
			ex resume: (ex bounds = bounds
				ifTrue: [aPlayer roundCornerFlags]
				ifFalse: [nil])]

roundedCornersFor: aRectangle
	^(RomeTweakWantsRoundedCorners forBounds: aRectangle) signal


frameAndFillRectangle: r fillColor: c borderWidth: borderWidth  
borderColor: borderColor
	
	(self roundedCornersFor: r) ifNotNilDo: [:corners |
		^self frameAndFillRoundRect: r radius: 6 fillStyle: c borderWidth:  
borderWidth borderColor: borderColor corners: corners].

	canvas selectFill: c asRomeFill.
	canvas selectPenWidth: borderWidth color: borderColor.
	canvas drawRectangle: (r insetByRomePenWidth: borderWidth color:  
borderColor).


- Bert -




More information about the UI mailing list