Esempio n. 1
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);
        }
 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);
 }