当前位置: 首页>>代码示例>>C#>>正文


C# Matrix3x2类代码示例

本文整理汇总了C#中Matrix3x2的典型用法代码示例。如果您正苦于以下问题:C# Matrix3x2类的具体用法?C# Matrix3x2怎么用?C# Matrix3x2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Matrix3x2类属于命名空间,在下文中一共展示了Matrix3x2类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Matrix3x2IdentityTest

        public void Matrix3x2IdentityTest()
        {
            Matrix3x2 val = new Matrix3x2();
            val.M11 = val.M22 = 1.0f;

            Assert.True(MathHelper.Equal(val, Matrix3x2.Identity), "Matrix3x2.Indentity was not set correctly.");
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:Matrix3x2Tests.cs

示例2: DrawGlyphRun

        public void DrawGlyphRun(float baselineOriginX, float baselineOriginY, Graphics.Direct2D.MeasuringMode measuringMode, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, ClientDrawingEffect clientDrawingEffect)
        {
            using (PathGeometry pathGeometry = _factory.CreatePathGeometry())
            {

                using (GeometrySink sink = pathGeometry.Open())
                {
                    glyphRun.FontFace.GetGlyphRunOutline(
                        glyphRun.EmSize,
                        glyphRun.GlyphIndices,
                        glyphRun.GlyphAdvances,
                        glyphRun.GlyphOffsets,
                        glyphRun.IsSideways,
                        glyphRun.BidiLevel != 0,
                        sink);
                    sink.Close();
                }

                CustomGeometrySink customSink = new CustomGeometrySink();
                pathGeometry.Stream(customSink);
                customSink.Close();
                System.Diagnostics.Debug.WriteLine(customSink.ToString());

                Matrix3x2 matrix = new Matrix3x2(1, 0, 0, 1, baselineOriginX, baselineOriginY);
                using (TransformedGeometry transformedGeometry = _factory.CreateTransformedGeometry(pathGeometry, matrix))
                {
                    _renderTarget.DrawGeometry(_outlineBrush, 5, transformedGeometry);
                    _renderTarget.FillGeometry(_fillBrush, transformedGeometry);
                }
            }
        }
开发者ID:eugeniomiro,项目名称:Terrarium,代码行数:31,代码来源:CustomTextRenderer.cs

示例3: ConstructorValuesAreAccessibleByIndexer

        public void ConstructorValuesAreAccessibleByIndexer()
        {
            Matrix3x2 matrix3x2;

            matrix3x2 = new Matrix3x2();

            for (int x = 0; x < matrix3x2.Columns; x++)
            {
                for (int y = 0; y < matrix3x2.Rows; y++)
                {
                    Assert.Equal(0, matrix3x2[x, y], Epsilon);
                }
            }

            double value = 33.33;
            matrix3x2 = new Matrix3x2(value);

            for (int x = 0; x < matrix3x2.Columns; x++)
            {
                for (int y = 0; y < matrix3x2.Rows; y++)
                {
                    Assert.Equal(value, matrix3x2[x, y], Epsilon);
                }
            }

            GenerateFilledMatrixWithValues(out matrix3x2);

            for (int y = 0; y < matrix3x2.Rows; y++)
            {
                for (int x = 0; x < matrix3x2.Columns; x++)
                {
                    Assert.Equal(y * matrix3x2.Columns + x, matrix3x2[x, y], Epsilon);
                }
            }
        }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:35,代码来源:Test3x2.cs

示例4: Transform

        private static MaskF Transform(MaskF mask, Matrix3x2 transformation)
        {
            var original = mask.UnderlayingArray;
            var transformedPoints = new Vector2[original.Length];

            // Initializing the transformed bounds
            double sumX = 0;
            double sumY = 0;
            var first = Vector2.Transform(original[0], transformation);
            float left = first.X;
            float top = first.Y;
            float right = first.X;
            float bottom = first.Y;

            // Calculating the transformed coordinates
            for (int i = 0; i < original.Length; i++)
            {
                var pt = Vector2.Transform(original[i], transformation);
                sumX += pt.X;
                sumY += pt.Y;
                UpdateBoundaries(pt, ref left, ref top, ref right, ref bottom);
                transformedPoints[i] = pt;
            }

            Vector2 transformedCenter = new Vector2((float)(sumX / original.Length),
                                                  (float)(sumY / original.Length));
            MaskF transformedMask = FromArrayAndProperties(transformedPoints, transformedCenter, left, top, right, bottom);
            return transformedMask;
        }
开发者ID:Mirandatz,项目名称:Trauer,代码行数:29,代码来源:MaskFTransformations.cs

示例5: Equal

 public static bool Equal(Matrix3x2 a, Matrix3x2 b)
 {
     return
         Equal(a.M11, b.M11) && Equal(a.M12, b.M12) &&
         Equal(a.M21, b.M21) && Equal(a.M22, b.M22) &&
         Equal(a.M31, b.M31) && Equal(a.M32, b.M32);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:MathHelper.cs

示例6: GenerateMatrixNumberFrom1To6

 static Matrix3x2 GenerateMatrixNumberFrom1To6()
 {
     Matrix3x2 a = new Matrix3x2();
     a.M11 = 1.0f; a.M12 = 2.0f;
     a.M21 = 3.0f; a.M22 = 4.0f;
     a.M31 = 5.0f; a.M32 = 6.0f;
     return a;
 }
开发者ID:fengweijp,项目名称:Win2D,代码行数:8,代码来源:Matrix3x2Test.cs

示例7: TransformSession

		private TransformSession(CanvasDrawingSession session, Matrix3x2 oldTransform, SvgMatrix multiply)
		{
			this.Session = session;
			this.OldTransform = oldTransform;

			var transform = new Matrix3x2((float)multiply.A, (float)multiply.B, (float)multiply.C, (float)multiply.D, (float)multiply.E, (float)multiply.F);
			session.Transform = transform * session.Transform;
		}
开发者ID:lallous,项目名称:SvgForXaml,代码行数:8,代码来源:TransformSession.cs

示例8: RadialGradientStyle

 /// <summary>
 ///     Initializes a new instance of the <see cref="RadialGradientStyle" /> class.
 /// </summary>
 /// <param name="unitOriginOffset">The unit origin offset.</param>
 /// <param name="transform">The transform.</param>
 /// <param name="gradientStops">The gradient stops.</param>
 public RadialGradientStyle(
     Vector2 unitOriginOffset,
     Matrix3x2 transform,
     [NotNull] IReadOnlyList<GradientStop> gradientStops)
     : base(gradientStops)
 {
     UnitOriginOffset = unitOriginOffset;
     GradientTransform = transform;
 }
开发者ID:billings7,项目名称:EscherTilier,代码行数:15,代码来源:RadialGradientStyle.cs

示例9: ConstantValuesAreCorrect

        public void ConstantValuesAreCorrect()
        {
            Matrix3x2 matrix3x2 = new Matrix3x2();

            Assert.Equal(3, matrix3x2.Columns);
            Assert.Equal(2, matrix3x2.Rows);
            Assert.Equal(Matrix3x2.ColumnCount, matrix3x2.Columns);
            Assert.Equal(Matrix3x2.RowCount, matrix3x2.Rows);
        }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:9,代码来源:Test3x2.cs

示例10: MatrixVectorMultiplication

        public void MatrixVectorMultiplication()
        {
            var v = new Vector3(2, 2, 1);
            var m = new Matrix3x2(1, 0, 0, 1, 5, 6);

            var r = Matrix3x2.Multiply(ref m, v);

            Assert.AreEqual(r.X, 7);
            Assert.AreEqual(r.Y, 8);
        }
开发者ID:nicolas-repiquet,项目名称:Granite,代码行数:10,代码来源:Matrices.cs

示例11: Transform

        /// <summary>
        ///     Returns a copy of this style with the given transform applied.
        /// </summary>
        /// <param name="matrix">The transform matrix.</param>
        /// <returns>
        ///     The transformed style.
        /// </returns>
        public override IStyle Transform(Matrix3x2 matrix)
        {
            if (matrix == Matrix3x2.Identity) return this;

            Vector2 start = Vector2.Transform(Start, matrix);
            Vector2 end = Vector2.Transform(End, matrix);

            if (start == Start && end == End) return this;
            return new LinearGradientStyle(start, end, GradientStops);
        }
开发者ID:billings7,项目名称:EscherTilier,代码行数:17,代码来源:LinearGradientStyle.cs

示例12: Write

        /// <summary>
        /// Writes a value to the output stream.
        /// </summary>
        /// <param name="writer">The binary writer.</param>
        /// <param name="value">The value to write.</param>
        public static void Write(this BinaryWriter writer, Matrix3x2 value)
        {
            writer.Write(value.M11);
            writer.Write(value.M21);
            writer.Write(value.M31);

            writer.Write(value.M12);
            writer.Write(value.M22);
            writer.Write(value.M32);
        }
开发者ID:vetuomia,项目名称:rocket,代码行数:15,代码来源:Extensions.Write.cs

示例13: Tile

 /// <summary>
 ///     Initializes a new instance of the <see cref="Tile" /> class.
 /// </summary>
 /// <param name="label">The label.</param>
 /// <param name="shape">The shape.</param>
 /// <param name="transform">The transform.</param>
 /// <param name="partShapes">The part shapes.</param>
 /// <exception cref="System.ArgumentNullException"></exception>
 public Tile(
     [NotNull] string label,
     [NotNull] Shape shape,
     Matrix3x2 transform,
     [NotNull] IReadOnlyList<EdgePartShape> partShapes)
     : base(label, shape, transform)
 {
     if (partShapes == null) throw new ArgumentNullException(nameof(partShapes));
     PartShapes = partShapes;
 }
开发者ID:billings7,项目名称:EscherTilier,代码行数:18,代码来源:Tile.cs

示例14: LayerParameters1

 /// <summary>
 /// Initializes a new instance of the <see cref="LayerParameters1"/> struct.
 /// </summary>
 /// <param name="contentBounds">The content bounds.</param>
 /// <param name="geometryMask">The geometry mask.</param>
 /// <param name="maskAntialiasMode">The mask antialias mode.</param>
 /// <param name="maskTransform">The mask transform.</param>
 /// <param name="opacity">The opacity.</param>
 /// <param name="opacityBrush">The opacity brush.</param>
 /// <param name="layerOptions">The layer options.</param>
 public LayerParameters1(RectangleF contentBounds, Geometry geometryMask, AntialiasMode maskAntialiasMode, Matrix3x2 maskTransform, float opacity, Brush opacityBrush, LayerOptions1 layerOptions)
     : this()
 {
     ContentBounds = contentBounds;
     geometricMask_ = geometryMask.NativePointer;
     MaskAntialiasMode = maskAntialiasMode;
     MaskTransform = maskTransform;
     Opacity = opacity;
     opacityBrush_ = opacityBrush.NativePointer;
     LayerOptions = layerOptions;
 }
开发者ID:QuantumDeveloper,项目名称:SharpDX,代码行数:21,代码来源:LayerParameters1.cs

示例15: Transform

        /// <summary>
        ///     Returns a copy of this style with the given transform applied.
        /// </summary>
        /// <param name="matrix">The transform matrix.</param>
        /// <returns>
        ///     The transformed style.
        /// </returns>
        public IStyle Transform(Matrix3x2 matrix)
        {
            if (matrix.IsIdentity) return this;
            Vector2 pos = Vector2.Transform(Position, matrix);

            // ReSharper disable CompareOfFloatsByEqualityOperator
            if (Math.Round(pos.X, 3) == Math.Round(Position.X, 3) &&
                Math.Round(pos.X, 3) == Math.Round(Position.X, 3))
                // ReSharper restore CompareOfFloatsByEqualityOperator
                return this;

            return new RandomColourStyle(From, To, pos);
        }
开发者ID:billings7,项目名称:EscherTilier,代码行数:20,代码来源:RandomColourStyle.cs


注:本文中的Matrix3x2类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。