ColorGlove.Filter.CopyDepth C# (CSharp) Method

CopyDepth() public static method

public static CopyDepth ( ProcessorState state ) : void
state ProcessorState
return void
        public static void CopyDepth(ProcessorState state)
        {
            for (int x = state.crop.Value.X; x <= state.crop.Value.Width + state.crop.Value.X; x++)
            {
                for (int y = state.crop.Value.Y; y <= state.crop.Value.Height + state.crop.Value.Y; y++)
                {
                    int idx = Util.toID(x, y, width, height, kDepthStride);
                    
                    state.bitmap_bits[4 * idx] =
                    state.bitmap_bits[4 * idx + 1] =
                    state.bitmap_bits[4 * idx + 2] =
                    state.bitmap_bits[4 * idx + 3] = (byte)(255 * (short.MaxValue - state.depth[idx]) / short.MaxValue);
                }
            }
        }