当前位置: 首页>>代码示例>>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;未经允许,请勿转载。