mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.5 KiB
38 lines
1.5 KiB
// <copyright file="RotateFlip.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageProcessorCore
|
|
{
|
|
using Processors;
|
|
|
|
/// <summary>
|
|
/// Extension methods for the <see cref="Image"/> type.
|
|
/// </summary>
|
|
public static partial class ImageExtensions
|
|
{
|
|
/// <summary>
|
|
/// Rotates and flips an image by the given instructions.
|
|
/// </summary>
|
|
/// <param name="source">The image to rotate, flip, or both.</param>
|
|
/// <param name="rotateType">The <see cref="RotateType"/> to perform the rotation.</param>
|
|
/// <param name="flipType">The <see cref="FlipType"/> to perform the flip.</param>
|
|
/// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
|
|
/// <returns>The <see cref="Image"/></returns>
|
|
public static Image RotateFlip(this Image source, RotateType rotateType, FlipType flipType, ProgressEventHandler progressHandler = null)
|
|
{
|
|
RotateFlip processor = new RotateFlip(rotateType, flipType);
|
|
processor.OnProgress += progressHandler;
|
|
|
|
try
|
|
{
|
|
return source.Process(source.Width, source.Height, source.Bounds, source.Bounds, processor);
|
|
}
|
|
finally
|
|
{
|
|
processor.OnProgress -= progressHandler;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|