Hopefully this isn't double posted, I sent it in yesterday, but I wasn't a list member and it was pending approval. I figured I should join the list anyway, so without further ado here is my question.
---------- Forwarded message ---------- From: Jeff Gonis jgon.in.canada@gmail.com Date: Mon, Dec 21, 2009 at 5:20 PM Subject: Anti-aliasing canvas graphics To: beginners@lists.squeakfoundation.org
Hi everyone,
I am executing the following code in the drawOn: method of a morph I am experimenting with as a canvas for some possible turtle graphics experiments: super drawOn: aCanvas. (aCanvas respondsTo: #asBalloonCanvas) ifTrue: [| bc | bc := aCanvas asBalloonCanvas. bc aaLevel: 4. bc line: (self bounds topLeft translateBy: 3 @ 3) to: (self bounds bottomRight translateBy: -4 @ -4) width: 3 color: Color red]
This gives me the look I want, except for the fact that the line isn't really anti-aliased. I have attached a screen shot of what the line looks like in the morph. I am wondering how I can go about getting a better looking line with less noticeable aliasing when I draw.
Thanks for your help, Jeff G.
Jeff Gonis wrote:
This gives me the look I want, except for the fact that the line isn't really anti-aliased. I have attached a screen shot of what the line looks like in the morph. I am wondering how I can go about getting a better looking line with less noticeable aliasing when I draw.
There is an optimization in BalloonCanvas trying to use the faster FormCanvas and you're running afoul of it. Try this instead:
bc drawPolygon: {startPt. endPt} color: nil borderWidth: 3 borderColor: Color red
Cheers, - Andreas
Andreas,
Thanks for the help. For some reason I was still in non-squeak mode where I was thinking that I would need to rely on getting the help of experts instead of, *duh*, reading the code myself! I read the code for BalloonCanvas and looked at the old WatchMorph in an earlier version of squeak and I found the optimization and work around you mentioned. It takes some time to get used to have all the source available I guess!
Thanks for your help, Jeff G.
beginners@lists.squeakfoundation.org