예제 #1
0
 public override void  MoveTo(PointFP point)
 {
     transformedPoint = new PointFP(point);
     if (transformMatrix != null)
     {
         transformedPoint.Transform(transformMatrix);
     }
     base.MoveTo(point);
 }
예제 #2
0
        public override int GetColorAt(int x, int y, bool singlePoint)
        {
            int     pos;
            PointFP p  = new PointFP(x << SingleFP.DecimalBits, y << SingleFP.DecimalBits);
            PointFP p1 = null;

            if (!singlePoint)
            {
                p1 = new PointFP(p.X + SingleFP.One, p.Y);
            }
            if (finalMatrix != null)
            {
                p.Transform(finalMatrix);
                if (!singlePoint)
                {
                    p1.Transform(finalMatrix);
                }
            }
            int width  = bounds.Width;
            int height = bounds.Height;

            if (type == LINEAR_GRADIENT)
            {
                int v = p.X + ff_length / 2;
                if (v < 0)
                {
                    v = 0;
                }
                else if (v > ff_length - 1)
                {
                    v = ff_length - 1;
                }
                ff_currpos = (int)(((long)v << RATIO_BITS + SingleFP.DecimalBits) / ff_length);
                if (!singlePoint)
                {
                    ff_deltapos = (int)(((long)(p1.X - p.X) << RATIO_BITS + SingleFP.DecimalBits) / ff_length);
                }
                pos = ff_currpos >> SingleFP.DecimalBits;
            }
            else
            {
                ff_currpos = PointFP.Distance(p.X, p.Y);
                if (!singlePoint)
                {
                    ff_deltapos = PointFP.Distance(p1.X, p1.Y) - ff_currpos;
                }
                //if (ff_currpos > SingleFP.One - 1) pos = SingleFP.One - 1;
                pos = ff_currpos >> SingleFP.DecimalBits - RATIO_BITS;
            }
            //pos >>= BrushFP.XY_MAX_BITS - RATIO_BITS;
            pos = pos < 0?0:(pos > RATIO_MAX?RATIO_MAX:pos);
            return(gradientColors[pos]);
        }
예제 #3
0
        public override void  LineTo(PointFP point)
        {
            //PointFP a = new PointFP(CurrentPoint);
            PointFP pntTemp = new PointFP(point);

            ff_xmin = MathFP.Min(ff_xmin, CurrentPoint.X);
            ff_xmax = MathFP.Max(ff_xmax, point.X);
            ff_ymin = MathFP.Min(ff_ymin, CurrentPoint.Y);
            ff_ymax = MathFP.Max(ff_ymax, point.Y);

            if (transformMatrix != null)
            {
                pntTemp.Transform(transformMatrix);
                //b.Transform(transformMatrix);
            }

            Scanline(transformedPoint.X, transformedPoint.Y, pntTemp.X, pntTemp.Y);
            transformedPoint = pntTemp;
            base.LineTo(point);
        }