MakeLevelsAuto() public method

public MakeLevelsAuto ( ) : UnaryPixelOps.Level
return UnaryPixelOps.Level
示例#1
0
        public override void RenderEffect(ImageSurface src, ImageSurface dest, Gdk.Rectangle[] rois)
        {
            HistogramRgb histogram = new HistogramRgb ();
            histogram.UpdateHistogram (src, new Gdk.Rectangle (0, 0, src.Width, src.Height));

            op = histogram.MakeLevelsAuto ();

            if (op.isValid)
                op.Apply (dest, src, rois);
        }
示例#2
0
文件: Layer.cs 项目: asbjornu/Pinta
        public unsafe void AutoLevel()
        {
            ImageSurface dest = Surface.Clone ();
            ColorBgra* dstPtr = (ColorBgra*)dest.DataPtr;
            ColorBgra* srcPtr = (ColorBgra*)Surface.DataPtr;

            int len = Surface.Data.Length / 4;

            UnaryPixelOps.Level levels = null;

            HistogramRgb histogram = new HistogramRgb();
            histogram.UpdateHistogram (Surface, new Rectangle (0, 0, Surface.Width, Surface.Height));
            levels = histogram.MakeLevelsAuto();

            if (levels.isValid)
                levels.Apply (dstPtr, srcPtr, len);

            using (Context g = new Context (Surface)) {
                g.AppendPath (PintaCore.Layers.SelectionPath);
                g.FillRule = FillRule.EvenOdd;
                g.Clip ();

                g.SetSource (dest);
                g.Paint ();
            }

            (dest as IDisposable).Dispose ();
        }