Quantcast
Channel: WriteableBitmapEx
Viewing all articles
Browse latest Browse all 360

New Post: GetPixel throws an AccessViolationException

$
0
0
Hi, I am quite new to WriteableBitmapEx. I tried to load a png file in a WinRT Project by using a WriteableBitmap object and WriteableBitmapEx included via nuget.
The Image is http://commons.wikimedia.org/wiki/File:Plan.cathedrale.Amiens.png

My code is
        async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            WriteableBitmap image = new WriteableBitmap(100, 100);

            StorageFile file = await Package.Current.InstalledLocation.GetFileAsync("Assets\\Plan_cathedrale_Amiens.png");

            IRandomAccessStreamWithContentType randomAccessStream = await file.OpenReadAsync();
            image.SetSource(randomAccessStream);
            this.Transform(image);
        }
        private void Transform(WriteableBitmap source)
        {
            Color bottomleft = source.GetPixel(5, 5);
        }
The line Color bottomleft = source.GetPixel(5, 5); is the one goind bad and throwing an AccessViolationException.

I would very much appreciate any help.

Best Regards,
Andreas

Viewing all articles
Browse latest Browse all 360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>