Esempio n. 1
0
        public ColoredTF()
        {
            InitializeComponent();
            DoubleBuffered = true;
            marginLeft = 182;
            marginRight = 182;
            marginTop = 75;
            marginBottom = 74;
            pp.p.X = 0;
            pp.p.Y = 0;

            winWidth = 0;
            winCentre = 0;
            signedImage = false;

            paint_histogram = false;
            first = true;
            knots = new List<Knot>();
            pp = new Knot();
            pp.p = new Point(marginLeft + 1, this.Height - marginBottom - 1);
            pp.c = System.Drawing.Color.Black;
            knots.Add(pp);
            active_number=0;
            is_active_global = false;
        }
Esempio n. 2
0
        private float TransformationPy(Knot k1, Knot k2, int dx)
        {
            float x, x0, x1;
            float y, y0, y1;
            x = dx;
            x0 = k1.p.X - (marginLeft + 1);
            x1 = k2.p.X - (marginLeft + 1);
            y0 = Math.Abs(this.Height - (marginBottom - 1) - k1.p.Y);
            y1 = Math.Abs(this.Height - (marginBottom - 1) - k2.p.Y);

            y = (int)((float)(((dx-x0)*(y1-y0))/(float)(x1-x0))+y0);
            return  ((float)y/ (float)(this.Height - marginTop - marginBottom));
        }
Esempio n. 3
0
        private void presets_TextChanged(object sender, EventArgs e)
        {
            if (form_this != null)
            {
                knots.Clear();
                pp = new Knot();
                pp.p = new Point(marginLeft + 1, this.Height - marginBottom - 1);
                pp.c = System.Drawing.Color.Black;
                knots.Add(pp);

                if (presets.Text == "Кости1")
                {

                    for (int i = 1; i < 6; i++)
                    {
                        switch (i)
                        {
                            case 1: { pp.p.X = 269; pp.p.Y = 270; pp.c = System.Drawing.Color.Black; break; }
                            case 2: { pp.p.X = 281; pp.p.Y = 251; pp.c = System.Drawing.Color.FromArgb(255, 128, 64); break; }
                            case 3: { pp.p.X = 294; pp.p.Y = 239; pp.c = System.Drawing.Color.FromArgb(255, 128, 0); break; }
                            case 4: { pp.p.X = 314; pp.p.Y = 231; pp.c = System.Drawing.Color.FromArgb(255, 0, 0); break; }
                            case 5: { pp.p.X = 429; pp.p.Y = 224; pp.c = System.Drawing.Color.FromArgb(255, 255, 255); break; }

                        }

                        if (pp.p.X > marginLeft && pp.p.X < Width - marginRight && pp.p.Y > marginTop && pp.p.Y < Height - marginBottom && CanDraw() && form_this != null)
                        {
                            knots.Add(pp);

                        }
                    }
                }
                if (presets.Text == "Кости2")
                {
                    for (int i = 1; i < 13; i++)
                    {
                        switch (i)
                        {
                            case 1: { pp.p.X = 188; pp.p.Y = 227; pp.c = System.Drawing.Color.FromArgb(64, 0, 0); ; break; }
                            case 2: { pp.p.X = 196; pp.p.Y = 201; pp.c = System.Drawing.Color.FromArgb(253, 201, 166); break; }
                            case 3: { pp.p.X = 226; pp.p.Y = 187; pp.c = System.Drawing.Color.FromArgb(251, 191, 125); break; }
                            case 4: { pp.p.X = 265; pp.p.Y = 169; pp.c = System.Drawing.Color.FromArgb(255, 0, 0); break; }
                            case 5: { pp.p.X = 280; pp.p.Y = 155; pp.c = System.Drawing.Color.FromArgb(255, 128, 125); break; }
                            case 6: { pp.p.X = 292; pp.p.Y = 147; pp.c = System.Drawing.Color.FromArgb(255, 255, 0); break; }
                            case 7: { pp.p.X = 309; pp.p.Y = 172; pp.c = System.Drawing.Color.FromArgb(255, 128, 0); break; }
                            case 8: { pp.p.X = 317; pp.p.Y = 197; pp.c = System.Drawing.Color.FromArgb(248, 189, 124); break; }
                            case 9: { pp.p.X = 333; pp.p.Y = 223; pp.c = System.Drawing.Color.FromArgb(255, 128, 64); break; }
                            case 10:{ pp.p.X = 375; pp.p.Y = 242; pp.c = System.Drawing.Color.FromArgb(0, 128, 255); break; }
                            case 11:{ pp.p.X = 408; pp.p.Y = 236; pp.c = System.Drawing.Color.FromArgb(0, 128, 192); break; }
                            case 12:{ pp.p.X = 428; pp.p.Y = 225; pp.c = System.Drawing.Color.FromArgb(255, 255, 255); break; }

                        }

                        if (pp.p.X > marginLeft && pp.p.X < Width - marginRight && pp.p.Y > marginTop && pp.p.Y < Height - marginBottom && CanDraw() && form_this != null)
                        {
                            knots.Add(pp);

                        }
                    }
                }

                paint_histogram = true;
                Invalidate();
            }
        }
Esempio n. 4
0
 /* Отрисовка 1 точки */
 private void DrawPoint(Graphics g, Knot j)
 {
     Pen pn = new Pen(j.c);
     SolidBrush brush = new SolidBrush(j.c);
     pn.DashStyle = DashStyle.DashDot;
     pn.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
     g.DrawEllipse(pn, j.p.X - 4, j.p.Y - 4, 8, 8);
     g.FillEllipse(brush, j.p.X - 4, j.p.Y - 4, 8, 8);
     pn.Dispose();
 }
Esempio n. 5
0
        private void DrawColorInterpolation(Knot p1, Knot p2, Graphics gg)
        {
            byte a, r, g, b;
            float area;
            int overall;
            Pen p;
            SolidBrush br;
            Point put=new Point();
            Point put2 = new Point();
            float j = 0;
            for(int i=p1.p.X; i<=p2.p.X; i++)
            {
                overall = p2.p.X - p1.p.X;
                area = ((j / (float)overall));
                a = (byte)(p1.c.A + (p2.c.A-p1.c.A)*area);
                r=  (byte)(p1.c.R + (p2.c.R-p1.c.R)*area);
                g = (byte)(p1.c.G + (p2.c.G-p1.c.G)*area);
                b = (byte)(p1.c.B + (p2.c.B-p1.c.B)*area);
                br = new SolidBrush(System.Drawing.Color.FromArgb(a, r, g, b));
                p = new Pen(br);
                put.X = i;
                put.Y = this.Height-marginBottom+30;
                put2 = put;
                put2.Y += 20;
                gg.DrawLine(p, put,put2);

                j++;
            }
        }
Esempio n. 6
0
        private bool CheckActivePoint()
        {
            bool shot = false;

            for (int i = 0; i < knots.Count; i++)
            {
                // если мы попали в точку
                if (shot = InKnotArea(i))
                {
                    active_number = i;
                    active_point = knots[i];
                    preactive_color = knots[i].c; // сохраняем старый цвет теперь уже активной точки точки
                    active_point.c = System.Drawing.Color.YellowGreen;
                    return true;
                }
            }
            return false;
        }
Esempio n. 7
0
        private bool CheckActivePoint()
        {
            bool shot = false;

            for (int i = 0; i < knots.Count; i++)
            {
                // when we got to the point
                if (shot = InKnotArea(i))
                {
                    active_number = i;
                    active_point = knots[i];
                    preactive_color = knots[i].c; // keep the old color now hotspot point
                    active_point.c = System.Drawing.Color.YellowGreen;
                    return true;
                }
            }
            return false;
        }