private SurfaceImageSourceInterop CreateSurfaceImageSource(BrushType type, Rect r1, float[] args1, Rect r2, float[] args2) { SurfaceImageSourceInterop sis = null; if (type == BrushType.SIS) { sis = new SurfaceImageSourceInterop(400, 400); } else { sis = new VirtualSurfaceImageSourceInterop(400, 400); } sis.SetDevice(dxgiDevice); SurfaceImageSourceWrapper surfaceImageSourceWrapper = new SurfaceImageSourceWrapper(sis, r1, args1, r2, args2, dxgiDevice); // Add a call back to redraw VSIS if (type == BrushType.VSIS) { ((VirtualSurfaceImageSourceInterop)sis).RegisterForUpdatesNeeded(new DXInteropVirtualSurfaceUpdatesCallback(surfaceImageSourceWrapper)); } else { // Update SIS only,since the call back will update VSIS. sis.UpdateSurface(r1, args1); sis.UpdateSurface(r2, args2); } SurfaceImageSourceList.Add(surfaceImageSourceWrapper); return(sis); }
public SurfaceImageSourceWrapper(SurfaceImageSourceInterop v_sis, Rect rect1arg, float[] colorargs1, Rect rectarg2, float[] colorargs2, IDXGIDevice device) { surfaceImageSource = v_sis; color1 = colorargs1; color2 = colorargs2; rect1 = rect1arg; rect2 = rectarg2; this.device = device; }