I am having some trouble accurately drawing polygons using Morphic and the various Canvas types. My task is to recreate the Mac OS Platinum style buttons, and do be as pixel-accurate as I can. For the basic button, this involves creating a rectangle whose corners are always fattened by 2px on each side, no matter the extent of the underlying morph: I can achieve this kind of outline when drawing individual lines one at a time with a Canvas: ```smalltalk
``` Which gives me: But using the native Polygon drawing features of Canvas yield a different, and incorrect, result: ```smalltalk
``` Either this is some kind of limitation in BalloonCanvas/BalloonEngine (which "becomes" the canvas for polygon draw operations) or I am doing something terribly wrong. Ideally I can trace this shape as a border, since I'll need to trace yet more additional borders around it (like the "default" button in Platinum, which has a fat complex border). Borders are already kind of complicated, so any help you all can provide would be much appreciated. FYI this same behavior is present in Squeak. -- Eric |
Hi Eric, I don't know exactly how Borders (BorderdMorphs) are drawn, but a simple way to create that kind of 1px border with 2px round edges may be using the a borderd morph:BorderedMorph new fillStyle: Color transparent; borderStyle: (RoundedBorder new cornerRadius: 2; width: 1; baseColor: Color red) 2018-05-16 20:48 GMT+02:00 Eric Gade <[hidden email]>:
|
Free forum by Nabble | Edit this page |