Exemplo n.º 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()
     }
 });
Exemplo n.º 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()
     }
 });
Exemplo n.º 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()
     }
 });
Exemplo n.º 4
0
 public Constraint(ConstraintMode mode, uint?w, uint?h, ResampleHints hints, AnyColor?canvasColor)
 {
     Mode        = mode;
     W           = w;
     H           = h;
     Hints       = hints;
     CanvasColor = canvasColor;
     if (w == null && h == null)
     {
         throw new ArgumentNullException(nameof(w), "Either w or h must be non-null.");
     }
 }
Exemplo n.º 5
0
 public WatermarkOptions WithHints(ResampleHints hints)
 {
     Hints = hints;
     return(this);
 }
Exemplo n.º 6
0
 public Constraint SetHints(ResampleHints hints)
 {
     this.Hints = hints;
     return(this);
 }