public void VGSwapBuffers() { Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action( delegate { var image = new byte[kWidth * kHeight * 4]; // Copy the array to unmanaged memory. Marshal.Copy(VgContext.vgGetSurfacePixelsAM(), image, 0, image.Length); var wbi = new WriteableBitmap(kWidth, kHeight, 96.0f, 96.0f, PixelFormats.Bgra32, null); wbi.WritePixels(new Int32Rect(0, 0, wbi.PixelWidth, wbi.PixelHeight), image, (wbi.PixelWidth * wbi.Format.BitsPerPixel) / 8, 0); mImage.Source = wbi; } )); }
static void VGDestroy() { VgContext.vgDestroyContextAM(); }
static uint VGInit() { return((uint)VgContext.vgInitContextAM(kWidth, kHeight, VGboolean.VG_TRUE)); }