Ejemplo n.º 1
0
Archivo: Ney.cs Proyecto: pes7/NeyRo
        public Bitmap CreateImage(spector sp)
        {
            Bitmap bt = new Bitmap(size[0], size[1]);

            switch (sp)
            {
            case spector.red:
                for (var x = 0; x < size[0]; x++)
                {
                    for (var y = 0; y < size[1]; y++)
                    {
                        bt.SetPixel(y, x, Color.FromArgb(weight_r[y, x] > 225 ? 225 : weight_r[y, x] < 0 ? 0 : weight_r[y, x], 0, 0));
                    }
                }
                return(bt);

            case spector.blue:
                for (var x = 0; x < size[0]; x++)
                {
                    for (var y = 0; y < size[1]; y++)
                    {
                        bt.SetPixel(y, x, Color.FromArgb(0, weight_b[y, x] > 225 ? 225 : weight_b[y, x] < 0 ? 0 : weight_b[y, x], 0));
                    }
                }
                return(bt);

            case spector.green:
                for (var x = 0; x < size[0]; x++)
                {
                    for (var y = 0; y < size[1]; y++)
                    {
                        bt.SetPixel(y, x, Color.FromArgb(0, 0, weight_g[y, x] > 225 ? 225 : weight_g[y, x] < 0 ? 0 : weight_g[y, x]));
                    }
                }
                return(bt);

            case spector.rgb:
                for (var x = 0; x < size[0]; x++)
                {
                    for (var y = 0; y < size[1]; y++)
                    {
                        bt.SetPixel(y, x, Color.FromArgb(weight_r[y, x] > 225 ? 225 : weight_r[y, x] < 0 ? 0 : weight_r[y, x], weight_b[y, x] > 225 ? 225 : weight_b[y, x] < 0 ? 0 : weight_b[y, x], weight_g[y, x] > 225 ? 225 : weight_g[y, x] < 0 ? 0 : weight_g[y, x]));
                    }
                }
                return(bt);

            default:
                return(bt);
            }
        }
Ejemplo n.º 2
0
Archivo: Form1.cs Proyecto: pes7/NeyRo
            private int getN(spector sp, int x, int y)
            {
                int d = 0;

                try
                {
                    switch (sp)
                    {
                    case spector.blue:
                        d = (Bit.GetPixel(x, y).B);
                        if (d >= 170)
                        {
                            d = 0;
                        }
                        return(d);

                    case spector.red:
                        d = (Bit.GetPixel(x, y).R);
                        if (d >= 170)
                        {
                            d = 0;
                        }
                        return(d);

                    case spector.green:
                        d = (Bit.GetPixel(x, y).G);
                        if (d >= 170)
                        {
                            d = 0;
                        }
                        return(d);

                    default:
                        return(0);
                    }
                }
                catch
                {
                    return(d);
                }
            }