/// <summary>
 /// Adds padding of the given color by enlarging the canvas on the sides specified.
 /// </summary>
 /// <param name="left"></param>
 /// <param name="top"></param>
 /// <param name="right"></param>
 /// <param name="bottom"></param>
 /// <param name="color"></param>
 /// <returns></returns>
 public BuildNode ExpandCanvas(int left, int top, int right, int bottom, AnyColor color)
 => To(new
 {
     expand_canvas = new
     {
         left,
         top,
         right,
         bottom,
         color = color.ToImageflowDynamic()
     }
 });
 /// <summary>
 /// Fills the given rectangle with the specified color
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="color"></param>
 /// <returns></returns>
 public BuildNode FillRectangle(int x1, int y1, int x2, int y2, AnyColor color)
 => To(new
 {
     fill_rect = new
     {
         x1,
         y1,
         x2,
         y2,
         color = color.ToImageflowDynamic()
     }
 });
 /// <summary>
 /// Region is like a crop command, but you can specify coordinates outside of the image and
 /// thereby add padding. It's like a window.
 /// You can specify a region as a percentage of the image's width and height.
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="backgroundColor"></param>
 /// <returns></returns>
 public BuildNode RegionPercent(float x1, float y1, float x2, float y2, AnyColor backgroundColor)
 => To(new
 {
     region_percent = new
     {
         x1,
         y1,
         x2,
         y2,
         background_color = backgroundColor.ToImageflowDynamic()
     }
 });
 /// <summary>
 /// Region is like a crop command, but you can specify coordinates outside of the image and
 /// thereby add padding. It's like a window. Coordinates are in pixels.
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="backgroundColor"></param>
 /// <returns></returns>
 public BuildNode Region(int x1, int y1, int x2, int y2, AnyColor backgroundColor)
 => To(new
 {
     region = new
     {
         x1,
         y1,
         x2,
         y2,
         background_color = backgroundColor.ToImageflowDynamic()
     }
 });
Exemple #5
0
 public BuildNode CreateCanvasBgra32(uint w, uint h, AnyColor color) =>
 CreateCanvas(w, h, color, PixelFormat.Bgra_32);
Exemple #6
0
 private BuildNode CreateCanvas(uint w, uint h, AnyColor color, PixelFormat format) =>
 BuildNode.StartNode(this, new { create_canvas = new { w, h, color, format = format.ToString().ToLowerInvariant() } });