// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using System.Numerics; namespace SixLabors.Primitives { /// /// Extension methods for the struct. /// public static class Matrix3x2Extensions { /// /// Creates a translation matrix from the given vector. /// /// The translation position. /// A translation matrix. public static Matrix3x2 CreateTranslation(PointF position) => Matrix3x2.CreateTranslation(position); /// /// Creates a scale matrix that is offset by a given center point. /// /// Value to scale by on the X-axis. /// Value to scale by on the Y-axis. /// The center point. /// A scaling matrix. public static Matrix3x2 CreateScale(float xScale, float yScale, PointF centerPoint) => Matrix3x2.CreateScale(xScale, yScale, centerPoint); /// /// Creates a scale matrix from the given vector scale. /// /// The scale to use. /// A scaling matrix. public static Matrix3x2 CreateScale(SizeF scales) => Matrix3x2.CreateScale(scales); /// /// Creates a scale matrix from the given vector scale with an offset from the given center point. /// /// The scale to use. /// The center offset. /// A scaling matrix. public static Matrix3x2 CreateScale(SizeF scales, PointF centerPoint) => Matrix3x2.CreateScale(scales, centerPoint); /// /// Creates a scale matrix that scales uniformly with the given scale with an offset from the given center. /// /// The uniform scale to use. /// The center offset. /// A scaling matrix. public static Matrix3x2 CreateScale(float scale, PointF centerPoint) => Matrix3x2.CreateScale(scale, centerPoint); /// /// Creates a skew matrix from the given angles in degrees. /// /// The X angle, in degrees. /// The Y angle, in degrees. /// A skew matrix. public static Matrix3x2 CreateSkewDegrees(float degreesX, float degreesY) => Matrix3x2.CreateSkew(GeometryUtilities.DegreeToRadian(degreesX), GeometryUtilities.DegreeToRadian(degreesY)); /// /// Creates a skew matrix from the given angles in radians and a center point. /// /// The X angle, in radians. /// The Y angle, in radians. /// The center point. /// A skew matrix. public static Matrix3x2 CreateSkew(float radiansX, float radiansY, PointF centerPoint) => Matrix3x2.CreateSkew(radiansX, radiansY, centerPoint); /// /// Creates a skew matrix from the given angles in degrees and a center point. /// /// The X angle, in degrees. /// The Y angle, in degrees. /// The center point. /// A skew matrix. public static Matrix3x2 CreateSkewDegrees(float degreesX, float degreesY, PointF centerPoint) => Matrix3x2.CreateSkew(GeometryUtilities.DegreeToRadian(degreesX), GeometryUtilities.DegreeToRadian(degreesY), centerPoint); /// /// Creates a rotation matrix using the given rotation in degrees. /// /// The amount of rotation, in degrees. /// A rotation matrix. public static Matrix3x2 CreateRotationDegrees(float degrees) => Matrix3x2.CreateRotation(GeometryUtilities.DegreeToRadian(degrees)); /// /// Creates a rotation matrix using the given rotation in radians and a center point. /// /// The amount of rotation, in radians. /// The center point. /// A rotation matrix. public static Matrix3x2 CreateRotation(float radians, PointF centerPoint) => Matrix3x2.CreateRotation(radians, centerPoint); /// /// Creates a rotation matrix using the given rotation in degrees and a center point. /// /// The amount of rotation, in degrees. /// The center point. /// A rotation matrix. public static Matrix3x2 CreateRotationDegrees(float degrees, PointF centerPoint) => Matrix3x2.CreateRotation(GeometryUtilities.DegreeToRadian(degrees), centerPoint); } }