Пример #1
0
 public VectorMap CopyAndUpdateColors(int newMaxBits, VectorMapProcessor processor)
 {
     var result = new VectorMap(_width, _height);
     var input = GetPixel();
     var output = result.GetPixel();
     for (var y = 0; y < _height; y++)
         for (var x = 0; x < _width; x++)
         {
             processor(x, y, input, output);
             input.MoveNext();
             output.MoveNext();
         }
     return result;
 }
Пример #2
0
 private static VectorMap ApplyCurve(ColorMapUshort map, Vector3[] curve)
 {
     var result = new VectorMap(map.Width, map.Height);
     Parallel.For(0, result.Height, y =>
     {
         var input = map.GetRow(y);
         var output = result.GetRow(y);
         for (var x = 0; x < result.Width; x++)
         {
             output.SetAndMoveNext(curve[input.R].X, curve[input.G].Y, curve[input.B].Z);
             input.MoveNext();
         }
     });
     return result;
 }
Пример #3
0
        public VectorMap CopyAndUpdateColors(int newMaxBits, VectorMapProcessor processor)
        {
            var result = new VectorMap(_width, _height);
            var input  = GetPixel();
            var output = result.GetPixel();

            for (var y = 0; y < _height; y++)
            {
                for (var x = 0; x < _width; x++)
                {
                    processor(x, y, input, output);
                    input.MoveNext();
                    output.MoveNext();
                }
            }
            return(result);
        }
Пример #4
0
        public VectorMap ConvertToVector()
        {
            var result = new VectorMap(Width, Height);
            var mult   = (float)MaxValue;

            Parallel.For(0, Height, y =>
            {
                var input  = GetRow(y);
                var output = result.GetRow(y);
                for (var x = 0; x < Width; x++)
                {
                    output.SetAndMoveNext(input.R / mult, input.G / mult, input.B / mult);
                    input.MoveNext();
                }
            });
            return(result);
        }
Пример #5
0
        public void AutoAdjust(com.azi.Image.VectorMap map)
        {
            double  maxbright  = 0;
            Vector3 whiteColor = Vector3.One;

            map.ForEachPixel(color =>
            {
                var bright = color.Value.LengthSquared();
                if (bright < maxbright || color.Value.MaxComponent() >= 1f)
                {
                    return;
                }

                maxbright  = bright;
                whiteColor = color.Value;
            });
            var maxComp = whiteColor.MaxComponent();

            WhiteColor = whiteColor / maxComp;
        }
Пример #6
0
 public VectorPixel(VectorMap map, int x, int y)
     : this(map, x, y, map.Width * map.Height)
 {
 }
Пример #7
0
 public VectorPixel(VectorMap map)
     : this(map, 0, 0, map.Width * map.Height)
 {
 }
Пример #8
0
 public VectorPixel(VectorMap map, int x, int y, int limit)
 {
     _map = map.Rgb;
     _limit = limit;
     _index = y * map.Width + x;
 }
Пример #9
0
 private static RGB8Map ConvertToRGB(VectorMap map, VectorToColorFilter<byte> filter)
 {
     var result = new RGB8Map(map.Width, map.Height);
     Parallel.For(0, map.Height, y =>
     {
         var input = map.GetRow(y);
         var output = result.GetRow(y);
         for (var x = 0; x < map.Width; x++)
         {
             filter.ProcessColor(input, output);
             input.MoveNext();
             output.MoveNext();
         }
     });
     return result;
 }
Пример #10
0
 private static void ApplySingleFilterInplace(VectorMap map, VectorToVectorFilter filter)
 {
     Parallel.For(0, map.Height, y =>
     {
         var pix = map.GetRow(y);
         for (var x = 0; x < map.Width; x++)
         {
             filter.ProcessColor(pix, pix);
             pix.MoveNext();
         }
     });
 }
Пример #11
0
 public VectorPixel(VectorMap map, int x, int y)
     : this(map, x, y, map.Width *map.Height)
 {
 }
Пример #12
0
 public VectorPixel(VectorMap map)
     : this(map, 0, 0, map.Width *map.Height)
 {
 }
Пример #13
0
 public VectorPixel(VectorMap map, int x, int y, int limit)
 {
     _map   = map.Rgb;
     _limit = limit;
     _index = y * map.Width + x;
 }