Skip to content

Instantly share code, notes, and snippets.

@nuitsjp
Created October 17, 2016 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuitsjp/c9f386a95c52819a5f2d52fc1247e0b8 to your computer and use it in GitHub Desktop.
Save nuitsjp/c9f386a95c52819a5f2d52fc1247e0b8 to your computer and use it in GitHub Desktop.
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