當前位置: 首頁>>代碼示例>>C#>>正文


C# SharpDX.Matrix3x2類代碼示例

本文整理匯總了C#中SharpDX.Matrix3x2的典型用法代碼示例。如果您正苦於以下問題:C# Matrix3x2類的具體用法?C# Matrix3x2怎麽用?C# Matrix3x2使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Matrix3x2類屬於SharpDX命名空間,在下文中一共展示了Matrix3x2類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Rotate

 public void Rotate(float angle)
 {
     Control = 
         s.Matrix3x2.Multiply(
             s.Matrix3x2.Rotation(angle), // premultiply
             Control);
 }
開發者ID:JohnACarruthers,項目名稱:Eto,代碼行數:7,代碼來源:MatrixHandler.cs

示例2: RotateAt

		public void RotateAt(float angle, float centerX, float centerY)
		{
			angle = Conversions.DegreesToRadians(angle);
			var sina = (float)Math.Sin(angle);
			var cosa = (float)Math.Cos(angle);
			var matrix = new s.Matrix3x2(cosa, sina, -sina, cosa, centerX - centerX * cosa + centerY * sina, centerY - centerX * sina - centerY * cosa);
			Control = s.Matrix3x2.Multiply(matrix, Control);
		}
開發者ID:mhusen,項目名稱:Eto,代碼行數:8,代碼來源:MatrixHandler.cs

示例3: Matrix3x3

 public Matrix3x3(Matrix3x2 Other)
 {
     M00 = Other.M11;
     M01 = Other.M12;
     M02 = 0;
     M10 = Other.M21;
     M11 = Other.M22;
     M12 = 0;
     M20 = Other.M31;
     M21 = Other.M32;
     M22 = 1;
 }
開發者ID:Naronco,項目名稱:Rekd-Sharp,代碼行數:12,代碼來源:Matrix3x3.cs

示例4: Invert

        public static void Invert(ref Matrix3x2 matrix, out Matrix3x2 result)
        {
            float determinant = matrix.Determinant();

            if (MathUtil.WithinEpsilon(determinant, 0.0f)) {
                result = Matrix3x2.Identity;
                return;
            }

            float invdet = 1.0f / determinant;
            float _offsetX = matrix.M31;
            float _offsetY = matrix.M32;

            result = new Matrix3x2(
                matrix.M22 * invdet,
                -matrix.M12 * invdet,
                -matrix.M21 * invdet,
                matrix.M11 * invdet,
                (matrix.M21 * _offsetY - _offsetX * matrix.M22) * invdet,
                (_offsetX * matrix.M12 - matrix.M11 * _offsetY) * invdet);
        }
開發者ID:sleepless1,項目名稱:GameSharp,代碼行數:21,代碼來源:MathHelper.cs

示例5: DrawGlyphRun

        public Result DrawGlyphRun(object clientDrawingContext, float baselineOriginX, float baselineOriginY, MeasuringMode measuringMode, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, ComObject clientDrawingEffect)
        {
            var pathGeometry = new PathGeometry(_d2DFactory);
            var geometrySink = pathGeometry.Open();

            var fontFace = glyphRun.FontFace;
            if (glyphRun.Indices.Length > 0)
                fontFace.GetGlyphRunOutline(glyphRun.FontSize, glyphRun.Indices, glyphRun.Advances, glyphRun.Offsets, glyphRun.IsSideways, glyphRun.BidiLevel % 2 != 0, geometrySink);
            geometrySink.Close();
            geometrySink.Dispose();
            fontFace.Dispose();

            var matrix = new Matrix3x2()
            {
                M11 = 1,
                M12 = 0,
                M21 = 0,
                M22 = 1,
                M31 = baselineOriginX,
                M32 = baselineOriginY
            };

            var transformedGeometry = new TransformedGeometry(_d2DFactory, pathGeometry, matrix);

            var  brushColor = (Color4)Color.Black;

            if (clientDrawingEffect != null && clientDrawingEffect is ColorDrawingEffect)
                brushColor = (clientDrawingEffect as ColorDrawingEffect).Color;

            var brush = new SolidColorBrush(_renderTarget, brushColor);
            
            _renderTarget.DrawGeometry(transformedGeometry, brush);
            _renderTarget.FillGeometry(transformedGeometry, brush);

            pathGeometry.Dispose();
            transformedGeometry.Dispose();
            brush.Dispose();

            return SharpDX.Result.Ok;
        }
開發者ID:numo16,項目名稱:SharpDX,代碼行數:40,代碼來源:CustomTextRenderer.cs

示例6: CalculateMatrix

		/// <summary>
		/// 計算轉換矩陣。
		/// </summary>
		private void CalculateMatrix()
		{
			matrix = new Matrix3x2(1, 0, 0, 1, -shape.Center.X, -shape.Center.Y);
			if (rotate != 0)
			{
				matrix *= Matrix3x2.Rotation(this.rotateRadian);
			}
			if (this.scale != 1)
			{
				matrix *= Matrix3x2.Scaling(scale);
			}
			matrix *= Matrix3x2.Translation(offset.X + scale * shape.Center.X, offset.Y + scale * shape.Center.Y);
		}
開發者ID:CYJB,項目名稱:Cyjb.Projects.JigsawGame,代碼行數:16,代碼來源:JigsawPiece.cs

示例7: Append

		public void Append(IMatrix matrix)
		{
			Control = s.Matrix3x2.Multiply(this.Control, matrix.ToDx());
		}
開發者ID:mhusen,項目名稱:Eto,代碼行數:4,代碼來源:MatrixHandler.cs

示例8: ScaleAt

		public void ScaleAt(float scaleX, float scaleY, float centerX, float centerY)
		{
			var matrix = new s.Matrix3x2(scaleX, 0f, 0f, scaleY, centerX - centerX * scaleX, centerY - centerY * scaleY);
			Control = s.Matrix3x2.Multiply(matrix, Control);
		}
開發者ID:mhusen,項目名稱:Eto,代碼行數:5,代碼來源:MatrixHandler.cs

示例9: Scale

        public void Scale(float sx, float sy)
        {
			Control = s.Matrix3x2.Multiply(s.Matrix3x2.Scaling(sx, sy), Control); // premultiply
        }
開發者ID:mhusen,項目名稱:Eto,代碼行數:4,代碼來源:MatrixHandler.cs

示例10: MatrixHandler

 public MatrixHandler(ref s.Matrix3x2 m)
 {
     this.Control = m; // copied the value as Control is a struct
 }
開發者ID:mhusen,項目名稱:Eto,代碼行數:4,代碼來源:MatrixHandler.cs

示例11: Translation

 /// <summary>
 /// Creates a translation matrix using the specified offsets.
 /// </summary>
 /// <param name="value">The offset for both coordinate planes.</param>
 /// <param name="result">When the method completes, contains the created translation matrix.</param>
 public static void Translation(ref Vector2 value, out Matrix3x2 result)
 {
     Translation(value.X, value.Y, out result);
 }
開發者ID:CSharpDev,項目名稱:SharpDX,代碼行數:9,代碼來源:Matrix3x2.cs

示例12: Transformation

 /// <summary>
 /// Creates a transformation matrix.
 /// </summary>
 /// <param name="xScale">Scaling factor that is applied along the x-axis.</param>
 /// <param name="yScale">Scaling factor that is applied along the y-axis.</param>
 /// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis.</param>
 /// <param name="xOffset">X-coordinate offset.</param>
 /// <param name="yOffset">Y-coordinate offset.</param>
 /// <param name="result">When the method completes, contains the created transformation matrix.</param>
 public static void Transformation(float xScale, float yScale, float angle, float xOffset, float yOffset, out Matrix3x2 result)
 {
     result = Scaling(xScale, yScale) * Rotation(angle) * Translation(xOffset, yOffset);
 }
開發者ID:CSharpDev,項目名稱:SharpDX,代碼行數:13,代碼來源:Matrix3x2.cs

示例13: Rotation

 /// <summary>
 /// Creates a matrix that rotates about a specified center.
 /// </summary>
 /// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis.</param>
 /// <param name="center">The center of the rotation.</param>
 /// <param name="result">When the method completes, contains the created rotation matrix.</param>
 public static void Rotation(float angle, Vector2 center, out Matrix3x2 result)
 {
     result = Translation(-center) * Rotation(angle) * Translation(center);
 }
開發者ID:CSharpDev,項目名稱:SharpDX,代碼行數:10,代碼來源:Matrix3x2.cs

示例14: Scaling

        /// <summary>
        /// Creates a matrix that is scaling from a specified center.
        /// </summary>
        /// <param name="x">Scaling factor that is applied along the x-axis.</param>
        /// <param name="y">Scaling factor that is applied along the y-axis.</param>
        /// <param name="center">The center of the scaling.</param>
        /// <param name="result">The created scaling matrix.</param>
        public static void Scaling( float x, float y, ref Vector2 center, out Matrix3x2 result)
        {
            Matrix3x2 localResult;

            localResult.M11 = x;     localResult.M12 = 0.0f;
            localResult.M21 = 0.0f;  localResult.M22 = y;

            localResult.M31 = center.X - (x * center.X);
            localResult.M32 = center.Y - (y * center.Y);

            result = localResult;
        }
開發者ID:CSharpDev,項目名稱:SharpDX,代碼行數:19,代碼來源:Matrix3x2.cs

示例15: Invert

        public void Invert()
        {
			this.Control = s.Matrix3x2.Invert(this.Control);
        }
開發者ID:mhusen,項目名稱:Eto,代碼行數:4,代碼來源:MatrixHandler.cs


注:本文中的SharpDX.Matrix3x2類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。