MakeLevelsAuto() public method

public MakeLevelsAuto ( ) : UnaryPixelOps.Level
return UnaryPixelOps.Level
Esempio n. 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);
        }
Esempio n. 2
0
        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 ();
        }