Esempio n. 1
0
        public distance_interpolator4(int x1, int y1, int x2, int y2,
                                      int sx, int sy, int ex, int ey,
                                      int len, double scale, int x, int y)
        {
            m_dx       = (x2 - x1);
            m_dy       = (y2 - y1);
            m_dx_start = (LineAABasics.line_mr(sx) - LineAABasics.line_mr(x1));
            m_dy_start = (LineAABasics.line_mr(sy) - LineAABasics.line_mr(y1));
            m_dx_end   = (LineAABasics.line_mr(ex) - LineAABasics.line_mr(x2));
            m_dy_end   = (LineAABasics.line_mr(ey) - LineAABasics.line_mr(y2));

            m_dist = (agg_basics.iround((double)(x + LineAABasics.line_subpixel_scale / 2 - x2) * (double)(m_dy) -
                                        (double)(y + LineAABasics.line_subpixel_scale / 2 - y2) * (double)(m_dx)));

            m_dist_start = ((LineAABasics.line_mr(x + LineAABasics.line_subpixel_scale / 2) - LineAABasics.line_mr(sx)) * m_dy_start -
                            (LineAABasics.line_mr(y + LineAABasics.line_subpixel_scale / 2) - LineAABasics.line_mr(sy)) * m_dx_start);

            m_dist_end = ((LineAABasics.line_mr(x + LineAABasics.line_subpixel_scale / 2) - LineAABasics.line_mr(ex)) * m_dy_end -
                          (LineAABasics.line_mr(y + LineAABasics.line_subpixel_scale / 2) - LineAABasics.line_mr(ey)) * m_dx_end);
            m_len = (int)(agg_basics.uround(len / scale));

            double d  = len * scale;
            int    dx = agg_basics.iround(((x2 - x1) << LineAABasics.line_subpixel_shift) / d);
            int    dy = agg_basics.iround(((y2 - y1) << LineAABasics.line_subpixel_shift) / d);

            m_dx_pict   = -dy;
            m_dy_pict   = dx;
            m_dist_pict = ((x + LineAABasics.line_subpixel_scale / 2 - (x1 - dy)) * m_dy_pict -
                           (y + LineAABasics.line_subpixel_scale / 2 - (y1 + dx)) * m_dx_pict) >>
                          LineAABasics.line_subpixel_shift;

            m_dx       <<= LineAABasics.line_subpixel_shift;
            m_dy       <<= LineAABasics.line_subpixel_shift;
            m_dx_start <<= LineAABasics.line_mr_subpixel_shift;
            m_dy_start <<= LineAABasics.line_mr_subpixel_shift;
            m_dx_end   <<= LineAABasics.line_mr_subpixel_shift;
            m_dy_end   <<= LineAABasics.line_mr_subpixel_shift;
        }
Esempio n. 2
0
        /*
         * //-------------------------------------------------------------------------
         * public void semidot(Cmp, int, int, int, int)
         * {
         * }
         *
         * //-------------------------------------------------------------------------
         * public void pie(int, int, int, int, int, int)
         * {
         * }
         *
         * //-------------------------------------------------------------------------
         * public void line0(line_parameters)
         * {
         * }
         *
         * //-------------------------------------------------------------------------
         * public void line1(line_parameters, int, int)
         * {
         * }
         *
         * //-------------------------------------------------------------------------
         * public void line2(line_parameters, int, int)
         * {
         * }
         */

        //-------------------------------------------------------------------------
        public void line3_no_clip(line_parameters lp,
                                  int sx, int sy, int ex, int ey)
        {
            if (lp.len > LineAABasics.line_max_length)
            {
                line_parameters lp1, lp2;
                lp.divide(lp1, lp2);
                int mx = lp1.x2 + (lp1.y2 - lp1.y1);
                int my = lp1.y2 - (lp1.x2 - lp1.x1);
                line3_no_clip(lp1, (lp.x1 + sx) >> 1, (lp.y1 + sy) >> 1, mx, my);
                line3_no_clip(lp2, mx, my, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1);
                return;
            }

            LineAABasics.fix_degenerate_bisectrix_start(lp, ref sx, ref sy);
            LineAABasics.fix_degenerate_bisectrix_end(lp, ref ex, ref ey);
            line_interpolator_image li = new line_interpolator_image(*this, lp,
                                                                     sx, sy,
                                                                     ex, ey,
                                                                     m_start, m_scale_x);

            if (li.vertical())
            {
                while (li.step_ver())
                {
                    ;
                }
            }
            else
            {
                while (li.step_hor())
                {
                    ;
                }
            }
            m_start += uround(lp.len / m_scale_x);
        }