Beispiel #1
0
        public static (Vector4 Min, Vector4 Max) MinMax(SpanBitmap <Vector4> src)
        {
            var min = new Vector4(float.PositiveInfinity);
            var max = new Vector4(float.NegativeInfinity);

            for (int y = 0; y < src.Height; ++y)
            {
                var srcRow = src.GetScanlinePixels(y);

                for (int x = 0; x < srcRow.Length; ++x)
                {
                    var p = srcRow[x];
                    min = Vector4.Min(min, p);
                    max = Vector4.Max(max, p);
                }
            }

            return(min, max);
        }
Beispiel #2
0
        public static (Single Min, Single Max) MinMax(SpanBitmap <float> src)
        {
            var min = float.PositiveInfinity;
            var max = float.NegativeInfinity;

            for (int y = 0; y < src.Height; ++y)
            {
                var srcRow = src.GetScanlinePixels(y);

                var(rMin, rMax) = Vector4Streaming.MinMax(srcRow);

                if (min > rMin)
                {
                    min = rMin;
                }
                if (max < rMax)
                {
                    max = rMax;
                }
            }

            return(min, max);
        }