Skip to content

Instantly share code, notes, and snippets.

@nuitsjp
Created October 17, 2016 02:11
Embed
What would you like to do?
Rotation BitmapSource
public static BitmapSource Rotation(this BitmapSource source, int angle)
{
if (source == null) throw new ArgumentNullException(nameof(source));
var transformedBitmap = new TransformedBitmap();
transformedBitmap.BeginInit();
transformedBitmap.Source = source;
transformedBitmap.Transform = new RotateTransform(90);
transformedBitmap.EndInit();
return transformedBitmap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment