/// <summary> /// Resize an image with parameters /// </summary> /// Resize an image to a maximum width and maximum height, while preserving /// the image's original aspect ratio /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='maxWidth'> /// Maximum width of the output image - final image will be as large as /// possible while less than or equial to this width /// </param> /// <param name='maxHeight'> /// Maximum height of the output image - final image will be as large as /// possible while less than or equial to this height /// </param> /// <param name='imageFile'> /// Image file to perform the operation on. Common file formats such as PNG, /// JPEG are supported. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> PostAsync(this IResize operations, int maxWidth, int maxHeight, System.IO.Stream imageFile, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PostWithHttpMessagesAsync(maxWidth, maxHeight, imageFile, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
private void MainImage_OnSizeChanged(object sender, SizeChangedEventArgs e) { IResize viewModel = DataContext as IResize; if (viewModel != null) { viewModel.SizeChanged(sender, e); } }
private void MainImage_OnSizeChanged(object sender, SizeChangedEventArgs e) { IResize dataContext = DataContext as IResize; if (dataContext != null) { dataContext.SizeChanged(sender, e); } }
private void MainImage_OnSizeChanged(object sender, SizeChangedEventArgs e) { IResize resize = DataContext as IResize; if (resize != null) { resize.SizeChanged(sender, e); } }
public void resize(Vector3 size) { IResize[] resize = this.gameObject.GetComponentsInChildren <IResize>(true); Array.ForEach <IResize>(resize, delegate(IResize item) { IResize self = this; if (self != item) { item.resize(size); } }); }
/// <summary> /// Grows the collection by a computed factor. /// </summary> /// <param name="collection">This collection.</param> public static void Grow(this IResize collection) { if (collection.Capacity >= 8) { collection.Resize((Int32)(collection.Capacity * φ)); } else { collection.Resize(13); } }
/// <summary> /// Grows the collection by a computed factor, to at least a specified <paramref name="minimum"/>. /// </summary> /// <param name="collection">This collection.</param> /// <param name="minimum">The minimum allowed size.</param> public static void Grow(this IResize collection, nint minimum) { Double size = collection.Capacity; while (size < minimum) { size += 4.0; size *= φ; } collection.Resize((Int32)size); }
public override Image ProcessImage(Image input, ProjectSetting ps) { try { if (ps.ShrinkPixelTo > 0) { IUnityContainer container = new UnityContainer(); //container.RegisterType<IResize, ResizeByLongSide>("LongSide", new PerThreadLifetimeManager()); //container.RegisterType<IResize, ResizeByWidth>("Width", new PerThreadLifetimeManager()); //container.RegisterType<IResize, ResizeByHeight>("Height", new PerThreadLifetimeManager()); container.RegisterType <IResize, ResizeByLongSide>("LongSide", new ContainerControlledLifetimeManager()); container.RegisterType <IResize, ResizeByWidth>("Width", new ContainerControlledLifetimeManager()); container.RegisterType <IResize, ResizeByHeight>("Height", new ContainerControlledLifetimeManager()); IResize resize = null; switch (ps.ShrinkMode) { case ShrinkImageMode.Height: resize = container.Resolve <IResize>("Height"); break; case ShrinkImageMode.Width: resize = container.Resolve <IResize>("Width"); break; case ShrinkImageMode.LongSide: resize = container.Resolve <IResize>("LongSide"); break; } container.Dispose(); if (resize != null) { System.Windows.Size currentSize = new System.Windows.Size((double)input.Width, (double)input.Height); System.Windows.Size newSize = resize.CalculateNewSize(currentSize, (double)ps.ShrinkPixelTo); return(ResizeImageJob(input, newSize, InterpolationMode.HighQualityBicubic)); } else { return(input); } } else { // if no new size is specified, don't do the job. return(input); } } catch (Exception ex) { Trace.TraceError(ex.ToString()); return(input); } }
private void Config() { object o; Guid g = typeof(IBaseFilter).GUID; DsDevice[] devs = DsDevice.GetDevicesOfCat(FilterCategory.LegacyAmFilterCategory); foreach (DsDevice dev in devs) { if (dev.Name == "Stretch Video") { dev.Mon.BindToObject(null, null, ref g, out o); m_rs = o as IResize; break; } } }
protected virtual void Initialize() { Resizer = new Resizer(this); ServiceLookup = new ServiceLookup(); Helper = new UIHelper(); SaveDimension(); SaveClientCenter(); SetupTopPanel(); SetupSidePanel(); MenuItems = new List <string[]>() { new string[] { "Calculator", "Standard", "Scientific" }, new string[] { "Converter", "Currency", "Temperature", "Time", "Power", "Data", "Pressure", "Angle" } }; }
public Operations() { _resize = new Resize(); }
public PictureController(IResize resize, IBoxStorage attic, IApiRequest dropbox) { _resize = resize; _attic = attic; _dropbox = dropbox; }
public BoxPacker(IResize resize) { _resize = resize; }
/// <summary> /// Shrinks the collection by a computed factor. /// </summary> /// <param name="collection">This collection.</param> public static void Shrink(this IResize collection) => collection.Resize((Int32)(collection.Capacity / φ));
public MyClient(IResize listener) { this.listener = listener; }
/// <summary> /// Resize an image with parameters /// </summary> /// Resize an image to a maximum width and maximum height, while preserving /// the image's original aspect ratio /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='maxWidth'> /// Maximum width of the output image - final image will be as large as /// possible while less than or equial to this width /// </param> /// <param name='maxHeight'> /// Maximum height of the output image - final image will be as large as /// possible while less than or equial to this height /// </param> /// <param name='imageFile'> /// Image file to perform the operation on. Common file formats such as PNG, /// JPEG are supported. /// </param> public static object Post(this IResize operations, int maxWidth, int maxHeight, System.IO.Stream imageFile) { return(Task.Factory.StartNew(s => ((IResize)s).PostAsync(maxWidth, maxHeight, imageFile), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }