[Cuis-dev] ImageMorph drawing

Bernhard Pieber bernhard at pieber.com
Thu Sep 5 13:19:07 PDT 2024


Greetings,

If I do this I notice that the image is not centered in the border:

imageMorph := ImageMorph new
	borderWidth: 2;
	borderColor: Color red;
	scaleBy: 6;
	openInWorld

I have no idea why but if I add 1 to the point where the image is drawn, it looks symmetrical:

drawOn: aCanvas

	aCanvas image: image at: (borderWidth at borderWidth + 1).
	(borderWidth > 0) ifTrue: [
		aCanvas
			frameRectangle:  (`0 at 0` extent: extent)
			color:  borderColor
			borderWidth:  borderWidth 
			borderStyleSymbol:  #simple ]

It's probably not the correct fix, though.

There is still a small gap between the image and the border where the background shines through. I wonder how this could be avoided?

Bernhard


More information about the Cuis-dev mailing list