protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { HistogramRgb histogram = new HistogramRgb(); histogram.UpdateHistogram(srcArgs.Surface, this.EnvironmentParameters.GetSelection(dstArgs.Bounds)); this.levels = histogram.MakeLevelsAuto(); base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length) { if (levels == null) { HistogramRgb histogram = new HistogramRgb(); histogram.UpdateHistogram(srcArgs.Surface, this.EnvironmentParameters.GetSelection(dstArgs.Bounds)); levels = histogram.MakeLevelsAuto(); } if (levels.isValid) { levels.Apply(dstArgs.Surface, srcArgs.Surface, rois, startIndex, length); } }