• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Matrix3x2类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetTransform

        /// <summary>
        /// Get the transform matrix for the given Transform
        /// </summary>
        internal override Matrix3x2 GetTransform()
        {
            /* Avoid re-creating the transform if nothing has change
             * to help optimize for high perf scenarios */
            if (!m_isDirty)
                return m_cachedTransform;

            /* Create the translation */
            m_cachedTransform = Matrix3x2.Translation(X, Y);

            m_isDirty = false;

            return m_cachedTransform;
        }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:17,代码来源:TranslateTransform.cs


示例17: GetTransform

        /// <summary>
        /// Get the transform matrix for the given Transform
        /// </summary>
        internal override Matrix3x2 GetTransform()
        {
            m_cachedTransform = Matrix3x2.Identity;

            /* Loop over all of our child transforms */
            for (int i = 0; i < m_transformChildren.Count; i++)
            {
                var transform = m_transformChildren[i].GetTransform();
                /* Multiple the transforms together */
                m_cachedTransform *= transform;
            }

            return m_cachedTransform;
        }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:17,代码来源:TransformGroup.cs


示例18: GetTransform

        /// <summary>
        /// Get the transform matrix for the given Transform
        /// </summary>
        internal override Matrix3x2 GetTransform()
        {
            /* Avoid re-creating the transform if nothing has change
             * to help optimize for high perf scenarios */
            if (!m_isDirty)
                return m_cachedTransform;

            /* Create the rotation */
            m_cachedTransform = Matrix3x2.Rotation(Angle, new PointF(CenterX, CenterY));
            
            /* Flag that we are not dirty */
            m_isDirty = false;

            return m_cachedTransform;
        }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:18,代码来源:RotateTransform.cs


示例19: TextRenderUnit

        /// <summary>
        /// Initializes a new instance of the <see cref="TextRenderUnit" /> class.
        /// </summary>
        /// <param name="textLayout">The text layout.</param>
        /// <param name="brush">The brush.</param>
        /// <param name="transform">The text transform.</param>
        public TextRenderUnit(TextLayout textLayout, Brush brush, Matrix3x2 transform)
        {
            this.layout = textLayout;
            this.brush = brush;
            this.transform = transform;

            var topleft = Matrix3x2.TransformPoint(transform, new Vector2(0, 0));
            var bottomRight = Matrix3x2.TransformPoint(transform, new Vector2(textLayout.Metrics.Width, textLayout.Metrics.Height));

            this.bounds = new RectangleF
            {
                Top = topleft.Y,
                Left = topleft.X,
                Right = bottomRight.X,
                Bottom = bottomRight.Y
            };
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:23,代码来源:TextRenderUnit.cs


示例20: Create

        /// <summary>
        ///     Creates a new <see cref="EdgePartPosition" /> from an edge part, shape and transform.
        /// </summary>
        /// <param name="edgePart">The edge part.</param>
        /// <param name="shape">The shape.</param>
        /// <param name="transform">The transform.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">
        ///     <paramref name="edgePart" /> or <paramref name="shape" /> was <see langword="null" />.
        /// </exception>
        public static EdgePartPosition Create([NotNull] EdgePart edgePart, [NotNull] Shape shape, Matrix3x2 transform)
        {
            if (edgePart == null) throw new ArgumentNullException(nameof(edgePart));
            if (shape == null) throw new ArgumentNullException(nameof(shape));

            Edge edge = shape.GetEdge(edgePart.EdgePattern.EdgeName);

            Vector2 startPoint = edge.GetPointOnEdge(edgePart.StartAmount);
            Vector2 endPoint = edge.GetPointOnEdge(edgePart.StartAmount + edgePart.Amount);

            if (!transform.IsIdentity)
            {
                startPoint = Vector2.Transform(startPoint, transform);
                endPoint = Vector2.Transform(endPoint, transform);
            }

            return new EdgePartPosition(edgePart, startPoint, endPoint);
        }
开发者ID:billings7,项目名称:EscherTilier,代码行数:28,代码来源:EdgePartPosition.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Matrix3x3类代码示例发布时间:2022-05-24
下一篇:
C# Matrix3类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap