public XbrScaler(XbrScalerType type, bool allowAlphaBlending) { var info = cImage.GetPixelScalerInfo(type); this._type = type; this._allowAlphaBlending = allowAlphaBlending; this._scaleFactorX = info.Item1; this._scaleFactorY = info.Item2; }
/// <summary> /// Applies the XBR pixel scaler. /// </summary> /// <param name="type">The type of scaler to use.</param> /// <param name="allowAlphaBlending">if set to <c>true</c> [allow alpha blending].</param> /// <param name="filterRegion">The filter region, if any.</param> /// <returns> /// The rescaled image. /// </returns> public cImage ApplyScaler(XbrScalerType type, bool allowAlphaBlending, Rectangle? filterRegion = null) { var info = GetPixelScalerInfo(type); var scaleX = info.Item1; var scaleY = info.Item2; var scaler = info.Item3; return (this._RunLoop(filterRegion, scaleX, scaleY, worker => scaler(worker, allowAlphaBlending))); }
/// <summary> /// Applies the XBR pixel scaler. /// </summary> /// <param name="type">The type of scaler to use.</param> /// <param name="allowAlphaBlending">if set to <c>true</c> [allow alpha blending].</param> /// <param name="filterRegion">The filter region, if any.</param> /// <returns> /// The rescaled image. /// </returns> public cImage ApplyScaler(XbrScalerType type, bool allowAlphaBlending, Rectangle?filterRegion = null) { var info = GetPixelScalerInfo(type); var scaleX = info.Item1; var scaleY = info.Item2; var scaler = info.Item3; return(this._RunLoop(filterRegion, scaleX, scaleY, worker => scaler(worker, allowAlphaBlending))); }
public XbrScaler(XbrScalerType type, bool allowAlphaBlending) { var info = cImage.GetPixelScalerInfo(type); this._type = type; this._allowAlphaBlending = allowAlphaBlending; this._scaleFactorX = info.Item1; this._scaleFactorY = info.Item2; }
/// <summary> /// Gets the scaler information. /// </summary> /// <param name="type">The type of XBR scaler.</param> /// <returns></returns> /// <exception cref="System.NotSupportedException"></exception> public static ScalerInformation GetScalerInformation(XbrScalerType type) { Tuple <byte, byte, XbrFilter> info; if (XBR_SCALERS.TryGetValue(type, out info)) { return(new ScalerInformation(ReflectionUtils.GetDisplayNameForEnumValue(type), ReflectionUtils.GetDescriptionForEnumValue(type), info.Item1, info.Item2)); } throw new NotSupportedException(string.Format("XBR scaler '{0}' not supported.", type)); }
/// <summary> /// Gets the pixel scaler info. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> internal static Tuple <byte, byte, XbrFilter> GetPixelScalerInfo(XbrScalerType type) { Tuple <byte, byte, XbrFilter> info; if (XBR_SCALERS.TryGetValue(type, out info)) { return(info); } throw new NotSupportedException(string.Format("XBR scaler '{0}' not supported.", type)); }
/// <summary> /// Gets the scaler information. /// </summary> /// <param name="type">The type of XBR scaler.</param> /// <returns></returns> /// <exception cref="System.NotSupportedException"></exception> public static ScalerInformation GetScalerInformation(XbrScalerType type) { Tuple<byte, byte, XbrFilter> info; if (XBR_SCALERS.TryGetValue(type, out info)) return (new ScalerInformation(ReflectionUtils.GetDisplayNameForEnumValue(type), ReflectionUtils.GetDescriptionForEnumValue(type), info.Item1, info.Item2)); throw new NotSupportedException(string.Format("XBR scaler '{0}' not supported.", type)); }
/// <summary> /// Gets the pixel scaler info. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> internal static Tuple<byte, byte, XbrFilter> GetPixelScalerInfo(XbrScalerType type) { Tuple<byte, byte, XbrFilter> info; if (XBR_SCALERS.TryGetValue(type, out info)) return (info); throw new NotSupportedException(string.Format("XBR scaler '{0}' not supported.", type)); }
/// <summary> /// Gets the pixel scaler info. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public static Tuple <byte, byte, XbrFilter> GetPixelScalerInfo(XbrScalerType type) => XBR_SCALERS.TryGetValue(type, out var info) ? info : throw new NotSupportedException(string.Format("XBR scaler '{0}' not supported.", type)) ;
/// <summary> /// Applies the XBR pixel scaler. /// </summary> /// <param name="type">The type of scaler to use.</param> /// <param name="allowAlphaBlending">if set to <c>true</c> [allow alpha blending].</param> /// <param name="filterRegion">The filter region, if any.</param> /// <returns> /// The rescaled image. /// </returns> public cImage ApplyScaler(XbrScalerType type, bool allowAlphaBlending, Rect?filterRegion = null) => this.ApplyScaler(type, allowAlphaBlending, filterRegion?.ToRectangle()) ;
/// <summary> /// Gets the scaler information. /// </summary> /// <param name="type">The type of XBR scaler.</param> /// <returns></returns> /// <exception cref="System.NotSupportedException"></exception> public static ScalerInformation GetScalerInformation(XbrScalerType type) => XBR_SCALERS.TryGetValue(type, out var info) ? new ScalerInformation(ReflectionUtils.GetDisplayNameForEnumValue(type), ReflectionUtils.GetDescriptionForEnumValue(type), info.Item1, info.Item2) : throw new NotSupportedException(string.Format("XBR scaler '{0}' not supported.", type)) ;