Created
March 4, 2016 17:46
-
-
Save dupuyjs/2e2b86fc15e34f20ac74 to your computer and use it in GitHub Desktop.
Visual Layer - Image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Image Visual | |
Uri localUri = new Uri("ms-appx:///Assets/windowscube.jpg"); | |
var imageFactory = CompositionImageFactory.CreateCompositionImageFactory(_compositor); | |
CompositionImageOptions options = new CompositionImageOptions() | |
{ | |
DecodeWidth = 450, | |
DecodeHeight = 300, | |
}; | |
var image = imageFactory.CreateImageFromUri(localUri, options); | |
var imageBrush = _compositor.CreateSurfaceBrush(image.Surface); | |
var visual = _compositor.CreateSpriteVisual(); | |
visual.Size = new Vector2(450.0f, 300.0f); | |
visual.Offset = new Vector3(250.0f, 250.0f, 0.0f); | |
visual.Brush = imageBrush; | |
root.Children.InsertAtTop(visual); | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment