void HatchPlaid(CGContext context)
{
var hatchWidth = getHatchWidth (hatchStyle);
var hatchHeight = getHatchHeight (hatchStyle);
var lineWidth = getLineWidth (hatchStyle);
initializeContext(context, hatchHeight, false);
/* draw background */
drawBackground (context, backColor, hatchWidth, hatchHeight);
/* draw lines in the foreground color */
context.SetFillColor(foreColor.ToCGColor());
context.SetStrokeColor(foreColor.ToCGColor());
context.SetLineWidth(lineWidth);
context.SetLineCap(CGLineCap.Square);
float halfMe = hatchWidth / 2.0f;
CGRect rect = new CGRect (0,0,1,1);
// fraw the alternating pattern for half of area
int x = 0;
int y = 0;
for (y = 0; y<halfMe; y+=2)
{
for (x = 1; x < hatchWidth; x+=2)
{
rect.X = x;
rect.Y = y;
setPixels(context, rect);
}
}
for (y = 1; y<halfMe; y+=2)
{
for (x = 0; x < hatchWidth; x+=2)
{
rect.X = x;
rect.Y = y;
setPixels(context, rect);
}
}
// draw a square
rect.X = 0;
rect.Y = halfMe;
rect.Width = halfMe;
rect.Height = halfMe;
setPixels(context, rect);
}