public VideoEffectsViewModel(IImageProvider2 effect, string imageName, string forgroundImageName) { m_propertyName = "Level"; Effect = effect; LoadImageAsync(imageName); LoadForgroundSource(forgroundImageName); }
protected virtual void Dispose(bool disposing) { var disposable = m_imageProvider as IDisposable; if (disposable != null) { disposable.Dispose(); } m_imageProvider = null; }
protected void SetupEffectCategory(object effect) { if (effect == null) return; // if (effect == this) // throw new ArgumentException("Can't use the image processor itself as the DescribingEffect."); DescribingEffect = effect as IImageProvider2; var namspaceParts = effect.GetType().FullName.Split('.'); string categoryName = namspaceParts[namspaceParts.Length - 2]; foreach (var value in Enum.GetValues(typeof(EffectCategoryEnum))) { if (Enum.GetName(typeof(EffectCategoryEnum), value) == categoryName) { EffectCategory = (EffectCategoryEnum)value; break; } } }
protected void SetupEffectCategory(object effect) { if (effect == null) { return; } // if (effect == this) // throw new ArgumentException("Can't use the image processor itself as the DescribingEffect."); DescribingEffect = effect as IImageProvider2; var namspaceParts = effect.GetType().FullName.Split('.'); string categoryName = namspaceParts[namspaceParts.Length - 2]; foreach (var value in Enum.GetValues(typeof(EffectCategoryEnum))) { if (Enum.GetName(typeof(EffectCategoryEnum), value) == categoryName) { EffectCategory = (EffectCategoryEnum)value; break; } } }
/// <summary> /// Constructs a noise image source. /// </summary> /// <param name="renderSize">The dimensions of the target image that this noise will be used for. The actual grain size is proportional to a standardized ~5 MP image with the same aspect ratio.</param> /// <param name="amplitude">Noise amplitude.</param> public NoiseImageSource(Size renderSize, int amplitude) { m_imageProvider = CreateSource(renderSize, amplitude); }