//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageProcessorCore
{
using Processors;
///
/// Extension methods for the type.
///
public static partial class ImageExtensions
{
///
/// Skews an image by the given angles in degrees, expanding the image to fit the skewed result.
///
/// The pixel format.
/// The packed format. uint, long, float.
/// The image to skew.
/// The angle in degrees to perform the rotation along the x-axis.
/// The angle in degrees to perform the rotation along the y-axis.
/// The
public static Image Skew(this Image source, float degreesX, float degreesY)
where TColor : IPackedVector
where TPacked : struct
{
return Skew(source, degreesX, degreesY, true);
}
///
/// Skews an image by the given angles in degrees.
///
/// The pixel format.
/// The packed format. uint, long, float.
/// The image to skew.
/// The angle in degrees to perform the rotation along the x-axis.
/// The angle in degrees to perform the rotation along the y-axis.
/// Whether to expand the image to fit the skewed result.
/// The
public static Image Skew(this Image source, float degreesX, float degreesY, bool expand)
where TColor : IPackedVector
where TPacked : struct
{
SkewProcessor processor = new SkewProcessor { AngleX = degreesX, AngleY = degreesY, Expand = expand };
return source.Process(source.Width, source.Height, source.Bounds, source.Bounds, processor);
}
}
}