//----------------------------------------------------------------
        public void Begin(double x, double y, uint len)
        {
            // Calculate transformed Coordinates At x1,y1
            double xt = x;
            double yt = y;

            m_trans_dir.Transform(ref xt, ref yt);
            int x1 = Basics.Round(xt * subpixel_scale);
            int y1 = Basics.Round(yt * subpixel_scale);

            double dx;
            double dy;
            double delta = 1 / (double)subpixel_scale;

            // Calculate Scale by X At x1,y1
            dx = xt + delta;
            dy = yt;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= x;
            dy -= y;
            int sx1 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Calculate Scale by Y At x1,y1
            dx = xt;
            dy = yt + delta;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= x;
            dy -= y;
            int sy1 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Calculate transformed Coordinates At x2,y2
            x += len;
            xt = x;
            yt = y;
            m_trans_dir.Transform(ref xt, ref yt);
            int x2 = Basics.Round(xt * subpixel_scale);
            int y2 = Basics.Round(yt * subpixel_scale);

            // Calculate Scale by X At x2,y2
            dx = xt + delta;
            dy = yt;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= x;
            dy -= y;
            int sx2 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Calculate Scale by Y At x2,y2
            dx = xt;
            dy = yt + delta;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= x;
            dy -= y;
            int sy2 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Initialize the interpolators
            m_coord_x = new Dda2LineInterpolator(x1, x2, (int)len);
            m_coord_y = new Dda2LineInterpolator(y1, y2, (int)len);
            m_scale_x = new Dda2LineInterpolator(sx1, sx2, (int)len);
            m_scale_y = new Dda2LineInterpolator(sy1, sy2, (int)len);
        }
Пример #2
0
 public RGBA_Bytes(RGBA_Doubles c)
 {
     m_R = ((byte)Basics.UnsignedRound(c.m_r * (double)base_mask));
     m_G = ((byte)Basics.UnsignedRound(c.m_g * (double)base_mask));
     m_B = ((byte)Basics.UnsignedRound(c.m_b * (double)base_mask));
     m_A = ((byte)Basics.UnsignedRound(c.m_a * (double)base_mask));
 }
Пример #3
0
 //--------------------------------------------------------------------
 public RGBA_Bytes(double r_, double g_, double b_)
 {
     m_R = ((byte)Basics.UnsignedRound(r_ * (double)base_mask));
     m_G = ((byte)Basics.UnsignedRound(g_ * (double)base_mask));
     m_B = ((byte)Basics.UnsignedRound(b_ * (double)base_mask));
     m_A = (byte)base_mask;
 }
Пример #4
0
 public override void ToPixel(ref RGBA_Bytes c)
 {
     c.m_R = (Byte)Basics.UnsignedRound(r);
     c.m_G = (Byte)Basics.UnsignedRound(g);
     c.m_B = (Byte)Basics.UnsignedRound(b);
     c.m_A = (Byte)Basics.UnsignedRound(a);
 }
Пример #5
0
 //--------------------------------------------------------------------
 private RGBA_Bytes(RGBA_Doubles c, double a_)
 {
     m_R = ((byte)Basics.UnsignedRound(c.m_r * (double)base_mask));
     m_G = ((byte)Basics.UnsignedRound(c.m_g * (double)base_mask));
     m_B = ((byte)Basics.UnsignedRound(c.m_b * (double)base_mask));
     m_A = ((byte)Basics.UnsignedRound(a_ * (double)base_mask));
 }
 void MasterAlpha(int style, double alpha)
 {
     if (style >= 0)
     {
         while ((int)_masterAlpha.Size() <= style)
         {
             _masterAlpha.Add(AntiAliasingMask);
         }
         _masterAlpha.Array[style] = Basics.UnsignedRound(alpha * AntiAliasingMask);
     }
 }
Пример #7
0
        //--------------------------------------------------------------------
        public RGBA_Bytes Gradient(RGBA_Bytes c, double k)
        {
            RGBA_Bytes ret = new RGBA_Bytes();
            uint       ik  = Basics.UnsignedRound(k * base_scale);

            ret.R_Byte = (byte)((uint)(R_Byte) + ((((uint)(c.R_Byte) - R_Byte) * ik) >> BaseShift));
            ret.G_Byte = (byte)((uint)(G_Byte) + ((((uint)(c.G_Byte) - G_Byte) * ik) >> BaseShift));
            ret.B_Byte = (byte)((uint)(B_Byte) + ((((uint)(c.B_Byte) - B_Byte) * ik) >> BaseShift));
            ret.A_Byte = (byte)((uint)(A_Byte) + ((((uint)(c.A_Byte) - A_Byte) * ik) >> BaseShift));
            return(ret);
        }
        //----------------------------------------------------------------
        public void ReSynchronize(double xe, double ye, uint len)
        {
            // Assume x1,y1 are equal to the ones At the previous End point
            int x1  = m_coord_x.y();
            int y1  = m_coord_y.y();
            int sx1 = m_scale_x.y();
            int sy1 = m_scale_y.y();

            // Calculate transformed Coordinates At x2,y2
            double xt = xe;
            double yt = ye;

            m_trans_dir.Transform(ref xt, ref yt);
            int x2 = Basics.Round(xt * subpixel_scale);
            int y2 = Basics.Round(yt * subpixel_scale);

            double delta = 1 / (double)subpixel_scale;
            double dx;
            double dy;

            // Calculate Scale by X At x2,y2
            dx = xt + delta;
            dy = yt;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= xe;
            dy -= ye;
            int sx2 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Calculate Scale by Y At x2,y2
            dx = xt;
            dy = yt + delta;
            m_trans_inv.Transform(ref dx, ref dy);
            dx -= xe;
            dy -= ye;
            int sy2 = (int)Basics.UnsignedRound(subpixel_scale / Math.Sqrt(dx * dx + dy * dy)) >> subpixel_shift;

            // Initialize the interpolators
            m_coord_x = new Dda2LineInterpolator(x1, x2, (int)len);
            m_coord_y = new Dda2LineInterpolator(y1, y2, (int)len);
            m_scale_x = new Dda2LineInterpolator(sx1, sx2, (int)len);
            m_scale_y = new Dda2LineInterpolator(sy1, sy2, (int)len);
        }
Пример #9
0
 public override void ToPixel(ref RGBA_Bytes c)
 {
     c.m_R = (Byte)Basics.UnsignedRound(r);
 }