Skip to content

Instantly share code, notes, and snippets.

@luiseduardohd
Forked from mikebluestein/gist:4219563
Created June 26, 2014 16:23
Show Gist options
  • Save luiseduardohd/1b7c8ec6a7143664691e to your computer and use it in GitHub Desktop.
Save luiseduardohd/1b7c8ec6a7143664691e to your computer and use it in GitHub Desktop.
//does the actual coloring
void DrawPoints (CGContext dctx)
{
dctx.BeginPath ();
dctx.MoveTo (Points.First().X, Points.First().Y);
dctx.SetLineWidth(swatchSlider.Value);
dctx.SetBlendMode (CGBlendMode.Normal);
foreach (var crayon in Crayons) {
if(crayon.Selected) {
if (crayon.Name == "Eraser") {
dctx.SetStrokeColor (1.0f, 1.0f, 1.0f, 1.0f);
} else {
dctx.SetStrokeColor (crayon.R / 255f, crayon.G / 255f, crayon.B / 255f, 1f);
}
dctx.SetLineCap (CGLineCap.Round);
}
}
//set fill color with current crayons
foreach (var point in Points) {
dctx.AddLineToPoint(point.X, point.Y);
}
dctx.StrokePath();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment