private void LoadImage() { try { if (!File.Exists(Path.Combine(Application.ResourceUrl, mUrl))) { Console.Write("Image file not found:"); Console.Write(Path.Combine(Application.ResourceUrl, mUrl)); return; } var data = File.ReadAllBytes(mUrl); var height = XpBitConverter.ToInt32(data, 0); var width = XpBitConverter.ToInt32(data, 4); var size = data.Length - 8; var raw = Marshal.AllocHGlobal(size); Marshal.Copy(data, 8, raw, size); //mCache = VG.vgCreateImage(PixelFormat, Width, Height, VGImageQuality.VG_IMAGE_QUALITY_BETTER); //VG.vgImageSubData(mCache, raw, 4 * Width, PixelFormat, 0, 0, Width, Height); VG.vgWritePixels(raw, 4 * width, VGImageFormat.VG_sBGRA_8888, 0, 0, width, height); //VG.vgWritePixels(raw, 4*width, PixelFormat, 0, 0, width, height); Marshal.FreeHGlobal(raw); } catch (Exception ex) { Debug.Print(ex.ToString()); } }