Exemple #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);
        }
 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);
 }