Skip to content

Instantly share code, notes, and snippets.

@mikebluestein
Created December 5, 2012 21:16
Show Gist options
  • Save mikebluestein/4219563 to your computer and use it in GitHub Desktop.
Save mikebluestein/4219563 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