Ejemplo n.º 1
0
            public void Piirra(MainWindow parent)
            {
                switch (Muoto)
                {
                    case 1:
                        Line viiva = new Line();
                        viiva.StrokeThickness = StrokeThickness;
                        viiva.Stroke = new SolidColorBrush(Color.FromArgg(A, R, G, B));
                        viiva.X1 = X;
                        viiva.Y1 = Y;
                        viiva.X2 = X2;
                        viiva.Y2 = Y2;
                        parent.GridPiirto.Children.Add(viiva);
                        break;
                    case 2:
                    case 4:
                        Ellipse ellipsi = new Ellipse();
                        ellipsi.StroketThickness = StrokeThickness;
                        ellipsi.Stroke = new SolidColorBrush(Color.FromArgb(A, R, G, B));
                        ellipsi.HorizontalAlignment = HorizontalAlignment.Left;
                        ellipsi.VerticalAlignment = VerticalAlignment.Top;
                        ellipsi.Margin = new Thckness(X, Y, 0, 0);
                        ellipsi.Width = Width;
                        ellipsi.Height = Height;
                        parent.GridPiirto.Children.Add(ellipsi);
                        break;
                    case 3:
                        Rectangle rect = new Rectangle();
                        rect.StrokeThickness = StrokeThickness;
                        rect.Stroke = new SolidColorBrush(Color.FromArgb(A, R, G, B));
                        rect.HorizontalAlignment = HorizontalAlignment.Left;
                        rect.VerticalAlignment = VerticalAlignment.Top;
                        rect.Margin = new Thickness(X, Y, 0, 0);
                        rect.Width = Width;
                        rect.Height = Height;
                        parent.GridPiirto.Children.Add(rect);
                        break;
                    case 5:
                        ellipsi P = new Ellipse();
                        ellipsi.StrokeThickness = StrokeThickness;
                        ellipsi.Stroke = new SolidColorBrush(ConsoleColor.FromArgb(A, R, G, B));
                        ellipsi.HorizontalAlignment = HorizontalAlignment.Left;
                        ellipsi.VerticalAlignment = VerticalAlignment.Top;
                        ellipsi.Margin = new Thickness(X, Y, 0, 0);
                        ellipsi.Width = Width;
                        ellipsi.Height = Height;
                        ellipsi.Fill = new SolidColorBrush(ConsoleColor.FromArgb(A, R, G, B));
                        parent.GridPiirto.Children.Add(ellipsi);
                        break;
                    default:
                        break;

                }
            }
Ejemplo n.º 2
0
 public static bool keBrightness(Bitmap b)
 {
     for (int i = 0; i < b.Width; i++)
     {
         for (int j = 0; j < b.Height; j++)
         {
             Color c1 = b.GetPixel(i, j);
             int   r1 = c1.R + 255;
             int   g1 = c1.G + 255;
             int   b1 = c1.B + 255;
             b.SetPixel(i, j, ConsoleColor.FromArgb(r1, g1, b1));
         }
     }
     return(true);
 }
    public static Color DrawingColor(ConsoleColor color)
    {
        switch (color)
        {
        case ConsoleColor.Black:

            return(color.Black);

        case ConsoleColor.Blue:

            return(color.Blue);

        case ConsoleColor.Cyan:

            return(color.Cyan);

        case ConsoleColor.DarkBlue:

            return(color.DarkBlue);

        case ConsoleColor.DarkGray:

            return(color.DarkGray);

        case ConsoleColor.DarkGreen:

            return(color.DarkGreen);

        case ConsoleColor.DarkMagenta:

            return(color.DarkMagenta);

        case ConsoleColor.DarkRed:

            return(color.DarkRed);

        case ConsoleColor.DarkYellow:

            return(color.FromArgb(255, 128, 128, 0));

        case ConsoleColor.Gray:

            return(color.Gray);

        case ConsoleColor.Green:

            return(color.Green);

        case ConsoleColor.Magenta:

            return(color.Magenta);

        case ConsoleColor.Red:

            return(color.Red);

        case ConsoleColor.White:

            return(color.White);

        default:
            return(color.Yellow);
        }
    }