I am drawing some objects on a mac with retina. Specifically, I am trying to draw roundRects with a gradient, so I am using pictures and masks. Here is the code in the canvas paint event:
[code] dim startcolor as Color = &cA1A19900
dim endColor as color = &c6A696900
dim samt,eamt as Double
dim p as new picture(g.Width, g.Height, 32)
//SET MASK
p.mask.Graphics.ForeColor = &cFFFFFF00
p.mask.Graphics.FillRect(0, 0,g.Width, g.Height)
p.mask.Graphics.ForeColor = &c00000000
p.mask.Graphics.FillRoundRect(0, 0,g.Width, g.Height,10,10)
//SET GRADIENT
For i As Integer = 0 to p.Height
samt = 1 - (i / p.Height)
eamt = i / p.Height
p.Graphics.ForeColor = RGB((startColor.Red * samt) + (endColor.Red * eamt), _
(startColor.Green *samt) + (endColor.Green * eamt), _
(startColor.Blue * samt) + (endColor.Blue * eamt))
p.Graphics.DrawLine(0, i, p.Width, i)
Next
g.drawpicture(p, 0, 0)[/code]
I have enable high res using plists, but my question is why when I use a canvas to draw/fill a roundRec the edges are not as clean as a roundRec control?