コード例 #1
0
 /// <summary>
 /// Distort the image to exactly the given dimensions.
 /// </summary>
 /// <param name="w"></param>
 /// <param name="h"></param>
 /// <param name="hints"></param>
 /// <returns></returns>
 public BuildNode Distort(uint w, uint h, ResampleHints hints)
 => To(new
 {
     resample_2d = new
     {
         w,
         h,
         hints = hints?.ToImageflowDynamic()
     }
 });
コード例 #2
0
 /// <summary>
 /// Downscale the image to fit within the given dimensions, but do not upscale. See Constrain() for more options.
 /// </summary>
 /// <param name="w"></param>
 /// <param name="h"></param>
 /// <param name="hints"></param>
 /// <returns></returns>
 public BuildNode ConstrainWithin(uint?w, uint?h, ResampleHints hints)
 => To(new
 {
     constrain = new
     {
         mode = "within",
         w,
         h,
         hints = hints?.ToImageflowDynamic()
     }
 });
コード例 #3
0
 /// <summary>
 /// Draws the input image to the given rectangle on the canvas, distorting if the aspect ratios differ.
 ///
 /// </summary>
 /// <param name="canvas"></param>
 /// <param name="to"></param>
 /// <param name="hints"></param>
 /// <param name="blend"></param>
 /// <returns></returns>
 public BuildNode DrawImageExactTo(BuildNode canvas, Rectangle to, ResampleHints hints, CompositingMode?blend) => NodeWithCanvas(canvas, new
 {
     draw_image_exact = new
     {
         w     = to.Width,
         h     = to.Height,
         x     = to.X,
         y     = to.Y,
         blend = blend?.ToString()?.ToLowerInvariant(),
         hints = hints?.ToImageflowDynamic()
     }
 });