コード例 #1
0
ファイル: AutoLevelEffect.cs プロジェクト: herbqiao/paint.net
        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);
        }
コード例 #2
0
        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);
            }
        }