Color ICustomPointColorizer.GetColor(ColoredPointInfo info) { switch (info.DateTimeArgument.Month) { case 12: case 1: case 2: return(Color.FromHex("#5982db")); case 3: case 4: case 5: return(Color.FromHex("#755dd9")); case 6: case 7: case 8: return(Color.FromHex("#9b57d3")); case 9: case 10: case 11: return(Color.FromHex("#92278f")); default: return(Color.Default); } }
public override ColoredPointInfo <TColor> GetColor(int x, int y, PointInfo info) { ColoredPointInfo <TColor> result = default(ColoredPointInfo <TColor>); result.Color = this.brush[x, y]; if (info.DistanceFromPath < this.halfWidth) { // inside strip result.DistanceFromElement = 0; } else { result.DistanceFromElement = info.DistanceFromPath - this.halfWidth; } return(result); }
public override ColoredPointInfo <TColor> GetColor(int x, int y, PointInfo info) { ColoredPointInfo <TColor> infoResult = default(ColoredPointInfo <TColor>); infoResult.DistanceFromElement = float.MaxValue; // is really outside the element float length = info.DistanceAlongPath % this.totalLength; // we can treat the DistanceAlongPath and DistanceFromPath as x,y coords for the pattern // we need to calcualte the distance from the outside edge of the pattern // and set them on the ColoredPointInfo<TColor> along with the color. infoResult.Color = this.brush[x, y]; float distanceWAway = 0; if (info.DistanceFromPath < this.halfWidth) { // inside strip distanceWAway = 0; } else { distanceWAway = info.DistanceFromPath - this.halfWidth; } for (int i = 0; i < this.pattern.Length - 1; i++) { float start = this.pattern[i]; float end = this.pattern[i + 1]; if (length >= start && length < end) { // in section if (i % 2 == 0) { // solid part return the maxDistance infoResult.DistanceFromElement = distanceWAway; return(infoResult); } else { // this is a none solid part float distanceFromStart = length - start; float distanceFromEnd = end - length; float closestEdge = MathF.Min(distanceFromStart, distanceFromEnd); float distanceAcross = closestEdge; if (distanceWAway > 0) { infoResult.DistanceFromElement = new Vector2(distanceAcross, distanceWAway).Length(); } else { infoResult.DistanceFromElement = closestEdge; } return(infoResult); } } } return(infoResult); }
Color ICustomPointColorizer.GetColor(ColoredPointInfo info) { return(waveLengthToColor(info.NumericArgument)); }
Color ICustomPointColorizer.GetColor(ColoredPointInfo info) { return(Color.FromHex("#9AE4F3")); }