Пример #1
0
        /// <summary>
        /// Compute vector coordinates from a length and angle.
        /// </summary>
        /// <param name="length">The vector length.</param>
        /// <param name="angle">The vector angle.</param>
        /// <returns>The address of source vector.</returns>
        public static FTVector FromPolar(Fixed16Dot16 length, Fixed16Dot16 angle)
        {
            FTVector vec;

            FT.FT_Vector_From_Polar(out vec, (IntPtr)length.Value, (IntPtr)angle.Value);

            return(vec);
        }
Пример #2
0
        /// <summary><para>
        /// Return the unit vector corresponding to a given angle. After the call, the value of ‘vec.x’ will be
        /// ‘sin(angle)’, and the value of ‘vec.y’ will be ‘cos(angle)’.
        /// </para><para>
        /// This function is useful to retrieve both the sinus and cosinus of a given angle quickly.
        /// </para></summary>
        /// <param name="angle">The address of angle.</param>
        /// <returns>The address of target vector.</returns>
        public static FTVector Unit(Fixed16Dot16 angle)
        {
            FTVector vec;

            FT.FT_Vector_Unit(out vec, (IntPtr)angle.Value);

            return(vec);
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FTMatrix"/> struct.
 /// </summary>
 /// <param name="xx">Matrix coefficient XX.</param>
 /// <param name="xy">Matrix coefficient XY.</param>
 /// <param name="yx">Matrix coefficient YX.</param>
 /// <param name="yy">Matrix coefficient YY.</param>
 public FTMatrix(Fixed16Dot16 xx, Fixed16Dot16 xy, Fixed16Dot16 yx, Fixed16Dot16 yy)
     : this()
 {
     this.XX = xx;
     this.XY = xy;
     this.YX = yx;
     this.YY = yy;
 }
Пример #4
0
        /// <summary>
        /// Compute both the length and angle of a given vector.
        /// </summary>
        /// <param name="length">The vector length.</param>
        /// <param name="angle">The vector angle.</param>
        public void Polarize(out Fixed16Dot16 length, out Fixed16Dot16 angle)
        {
            IntPtr tmpLength, tmpAngle;

            FT.FT_Vector_Polarize(ref this, out tmpLength, out tmpAngle);

            length = Fixed16Dot16.FromRawValue((int)tmpLength);
            angle  = Fixed16Dot16.FromRawValue((int)tmpAngle);
        }
Пример #5
0
 public static Fixed16Dot16 DivFix(int a, Fixed16Dot16 b)
 {
     return(Fixed16Dot16.FromRawValue((int)FT.FT_DivFix((IntPtr)a, (IntPtr)b.Value)));
 }
Пример #6
0
 public static Fixed16Dot16 MulDiv(Fixed16Dot16 a, Fixed16Dot16 b, Fixed16Dot16 c)
 {
     return(Fixed16Dot16.FromRawValue((int)FT.FT_MulDiv((IntPtr)a.Value, (IntPtr)b.Value, (IntPtr)c.Value)));
 }
Пример #7
0
 public static Fixed16Dot16 AngleDiff(Fixed16Dot16 angle1, Fixed16Dot16 angle2)
 {
     return(Fixed16Dot16.FromRawValue((int)FT.FT_Angle_Diff((IntPtr)angle1.Value, (IntPtr)angle2.Value)));
 }
Пример #8
0
 public static Fixed16Dot16 Atan2(Fixed16Dot16 x, Fixed16Dot16 y)
 {
     return(Fixed16Dot16.FromRawValue((int)FT.FT_Atan2((IntPtr)x.Value, (IntPtr)y.Value)));
 }
Пример #9
0
 public static Fixed16Dot16 Tan(Fixed16Dot16 angle)
 {
     return(Fixed16Dot16.FromRawValue((int)FT.FT_Tan((IntPtr)angle.Value)));
 }
Пример #10
0
 public static Fixed16Dot16 FloorFix(Fixed16Dot16 a)
 {
     return(Fixed16Dot16.FromRawValue((int)FT.FT_FloorFix((IntPtr)a.Value)));
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FTVector"/> struct.
 /// </summary>
 /// <param name="x">The horizontal coordinate.</param>
 /// <param name="y">The vertical coordinate.</param>
 public FTVector(Fixed16Dot16 x, Fixed16Dot16 y)
     : this()
 {
     this.x = (IntPtr)x.Value;
     this.y = (IntPtr)y.Value;
 }
Пример #12
0
 /// <summary>
 /// Return the length of a given vector.
 /// </summary>
 /// <returns>The vector length, expressed in the same units that the original vector coordinates.</returns>
 public Fixed16Dot16 Length()
 {
     return(Fixed16Dot16.FromRawValue((int)FT.FT_Vector_Length(ref this)));
 }
Пример #13
0
 /// <summary>
 /// Rotate a vector by a given angle.
 /// </summary>
 /// <param name="angle">The address of angle.</param>
 public void Rotate(Fixed16Dot16 angle)
 {
     FT.FT_Vector_Rotate(ref this, (IntPtr)angle.Value);
 }
Пример #14
0
        /// <summary>
        /// Reset a stroker object's attributes.
        /// </summary>
        /// <remarks>
        /// The radius is expressed in the same units as the outline coordinates.
        /// </remarks>
        /// <param name="radius">The border radius.</param>
        /// <param name="lineCap">The line cap style.</param>
        /// <param name="lineJoin">The line join style.</param>
        /// <param name="miterLimit">
        /// The miter limit for the <see cref="StrokerLineJoin.MiterFixed"/> and
        /// <see cref="StrokerLineJoin.MiterVariable"/> line join styles, expressed as 16.16 fixed point value.
        /// </param>
        public void Set(int radius, StrokerLineCap lineCap, StrokerLineJoin lineJoin, Fixed16Dot16 miterLimit)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Stroker", "Cannot access a disposed object.");
            }

            FT.FT_Stroker_Set(Reference, radius, lineCap, lineJoin, (IntPtr)miterLimit.Value);
        }
Пример #15
0
 public static Fixed16Dot16 CeilFix(Fixed16Dot16 a)
 {
     return(Fixed16Dot16.FromRawValue((int)FT_CeilFix((IntPtr)a.Value)));
 }
Пример #16
0
 /// <summary>
 /// Reset a stroker object's attributes.
 /// </summary>
 /// <remarks>
 /// The radius is expressed in the same units as the outline coordinates.
 /// </remarks>
 /// <param name="radius">The border radius.</param>
 /// <param name="lineCap">The line cap style.</param>
 /// <param name="lineJoin">The line join style.</param>
 /// <param name="miterLimit">
 /// The miter limit for the <see cref="StrokerLineJoin.MiterFixed"/> and
 /// <see cref="StrokerLineJoin.MiterVariable"/> line join styles, expressed as 16.16 fixed point value.
 /// </param>
 public void Set(int radius, StrokerLineCap lineCap, StrokerLineJoin lineJoin, Fixed16Dot16 miterLimit) =>
 FT.FT_Stroker_Set(Reference, radius, lineCap, lineJoin, (IntPtr)miterLimit.Value);