/// <summary> /// Draw on the specified image. /// </summary> /// <param name="image">The image to draw on.</param> /// <returns>The current instance.</returns> public Drawables Draw(IMagickImage image) { Throw.IfNull("image", image); image.Draw(this); return(this); }
/// <summary> /// Draw on the specified image. /// </summary> /// <param name="image">The image to draw on.</param> /// <returns>The current instance.</returns> public IDrawables <QuantumType> Draw(IMagickImage <QuantumType> image) { Throw.IfNull(nameof(image), image); image.Draw(this); return(this); }
private static void WriteLabelAndBoundingBox(IMagickImage outputImage, int imageHeight, string text, double[] bb, string drawColor) { DrawableStrokeColor strokeColor = new DrawableStrokeColor(new MagickColor(drawColor)); DrawableStrokeWidth strokeWidth = new DrawableStrokeWidth(3); DrawableFillColor fillColor = new DrawableFillColor(new MagickColor(50, 50, 50, 128)); DrawableRectangle dr = new DrawableRectangle(bb[0], bb[1], bb[4], bb[5]); DrawableText dt = new DrawableText(bb[0], bb[1], text); outputImage.Draw(strokeColor, strokeWidth, fillColor, dr, dt); }
private void ExecuteDraw(XmlElement element, IMagickImage image) { Collection <IDrawable> drawables = new Collection <IDrawable>(); foreach (XmlElement elem in element.SelectNodes("*")) { ExecuteIDrawable(elem, drawables); } image.Draw(drawables); }
public void LineNoize() { var rnd = new Random((int)Environment.TickCount); var count = rnd.Next(6 * Math.Max(_current.Width, _current.Height)); for (int i = 0; i < count; i++) { var x1 = rnd.Next(0, _current.Width); var y1 = rnd.Next(0, _current.Height); var x2 = rnd.Next(-25, 25); var y2 = rnd.Next(-25, 25); byte[] rgb = new byte[3]; rnd.NextBytes(rgb); DrawableFillColor fillColor = new DrawableFillColor(MagickColor.FromRgb(rgb[0], rgb[1], rgb[2])); DrawableLine dl = new DrawableLine(x1, y1, x1 + x2, y1 + y2); _current.Draw(fillColor, dl); } }
/// <summary> /// Makes channel null (all black). /// </summary> /// <param name="channel">Channel to be nullified.</param> private static void MakeNull(this IMagickImage <ushort> channel) { channel.ColorFuzz = (Percentage)100; channel.Settings.FillColor = MagickColors.Black; channel.Draw(new DrawableAlpha(0, 0, PaintMethod.Floodfill)); }