Esempio n. 1
0
        public override void SemiDotHLine(CompareFunction cmp,
                                          int xc1, int yc1, int xc2, int yc2,
                                          int x1, int y1, int x2)
        {
            byte[] covers            = new byte[MAX_HALF_WIDTH * 2 + 4];
            int    offset0           = 0;
            int    offset1           = 0;
            int    x                 = x1 << LineAA.SUBPIXEL_SHIFT;
            int    y                 = y1 << LineAA.SUBPIXEL_SHIFT;
            int    w                 = SubPixelWidth;
            DistanceInterpolator0 di = new DistanceInterpolator0(xc1, yc1, xc2, yc2, x, y);

            x += LineAA.SUBPIXEL_SCALE / 2;
            y += LineAA.SUBPIXEL_SCALE / 2;
            int x0 = x1;
            int dx = x - xc1;
            int dy = y - yc1;

            do
            {
                int d = (int)(AggMath.fast_sqrt(dx * dx + dy * dy));
                covers[offset1] = 0;
                if (cmp(di.Distance) && d <= w)
                {
                    covers[offset1] = (byte)GetCover(d);
                }
                ++offset1;
                dx += LineAA.SUBPIXEL_SCALE;
                di.IncX();
            }while (++x1 <= x2);
            destImageSurface.BlendSolidHSpan(x0, y1,
                                             offset1 - offset0,
                                             Color, covers,
                                             offset0);
        }
Esempio n. 2
0
        public void PineHLine(int xc, int yc, int xp1, int yp1, int xp2, int yp2,
                              int xh1, int yh1, int xh2)
        {
            if (doClipping && ClipLiangBarsky.Flags(xc, yc, clippingRectangle) != 0)
            {
                return;
            }
            byte[] covers             = new byte[MAX_HALF_WIDTH * 2 + 4];
            int    index0             = 0;
            int    index1             = 0;
            int    x                  = xh1 << LineAA.SUBPIXEL_SHIFT;
            int    y                  = yh1 << LineAA.SUBPIXEL_SHIFT;
            int    w                  = SubPixelWidth;
            DistanceInterpolator00 di = new DistanceInterpolator00(xc, yc, xp1, yp1, xp2, yp2, x, y);

            x += LineAA.SUBPIXEL_SCALE / 2;
            y += LineAA.SUBPIXEL_SCALE / 2;
            int xh0 = xh1;
            int dx  = x - xc;
            int dy  = y - yc;

            do
            {
                int d = (int)(AggMath.fast_sqrt(dx * dx + dy * dy));
                covers[index1] = 0;
                if (di.Distance1 <= 0 && di.Distance2 > 0 && d <= w)
                {
                    covers[index1] = (byte)GetCover(d);
                }
                ++index1;
                dx += LineAA.SUBPIXEL_SCALE;
                di.IncX();
            }while (++xh1 <= xh2);
            destImageSurface.BlendSolidHSpan(xh0, yh1, index1 - index0, Color, covers, index0);
        }
Esempio n. 3
0
 public int Calculate(int x, int y, int d)
 {
     //return (int)System.Math.Sqrt((int)(System.Math.Abs(x) * System.Math.Abs(y)));
     return((int)AggMath.fast_sqrt((int)(System.Math.Abs(x * y))));
 }