private unsafe static void CreateResourceTexture(EffectContext context, System.Guid resourceId, SharpDX.Direct2D1.ResourceTextureProperties resourceTextureProperties, byte[] data, int[] strides, ResourceTexture outTexture) { var resourceTexturePropertiesNative = new ResourceTextureProperties.__Native(); resourceTextureProperties.__MarshalTo(ref resourceTexturePropertiesNative); if (resourceTextureProperties.Extents == null || resourceTextureProperties.Extents.Length != resourceTextureProperties.Dimensions) throw new ArgumentException("Extents array must be same size than dimensions", "resourceTextureProperties"); if (resourceTextureProperties.ExtendModes == null || resourceTextureProperties.ExtendModes.Length != resourceTextureProperties.Dimensions) throw new ArgumentException("ExtendModes array must be same size than dimensions", "resourceTextureProperties"); fixed (void* pExtents = resourceTextureProperties.Extents) { fixed (void* pExtendModes = resourceTextureProperties.ExtendModes) { resourceTexturePropertiesNative.ExtentsPointer = (IntPtr)pExtents; resourceTexturePropertiesNative.ExtendModesPointer = (IntPtr)pExtendModes; context.CreateResourceTexture(resourceId, new IntPtr(&resourceTexturePropertiesNative), data, strides, data == null ? 0 : data.Length, outTexture); } } }
private unsafe static void CreateResourceTexture(EffectContext context, System.Guid resourceId, SharpDX.Direct2D1.ResourceTextureProperties resourceTextureProperties, byte[] data, int[] strides, ResourceTexture outTexture) { var resourceTexturePropertiesNative = new ResourceTextureProperties.__Native(); resourceTextureProperties.__MarshalTo(ref resourceTexturePropertiesNative); if (resourceTextureProperties.Extents == null || resourceTextureProperties.Extents.Length != resourceTextureProperties.Dimensions) { throw new ArgumentException("Extents array must be same size than dimensions", "resourceTextureProperties"); } if (resourceTextureProperties.ExtendModes == null || resourceTextureProperties.ExtendModes.Length != resourceTextureProperties.Dimensions) throw new ArgumentException("ExtendModes array must be same size than dimensions", "resourceTextureProperties"); fixed(void *pExtents = resourceTextureProperties.Extents) { fixed(void *pExtendModes = resourceTextureProperties.ExtendModes) { resourceTexturePropertiesNative.ExtentsPointer = (IntPtr)pExtents; resourceTexturePropertiesNative.ExtendModesPointer = (IntPtr)pExtendModes; context.CreateResourceTexture(resourceId, new IntPtr(&resourceTexturePropertiesNative), data, strides, data == null ? 0 : data.Length, outTexture); } } }