sharpdx

Mapping corners to arbitrary positions using Direct2D

我的梦境 提交于 2019-12-02 04:38:27
问题 I'm using WIC and Direct2D (via SharpDX) to composite photos into video frames. For each frame I have the exact coordinates where each corner will be found. While the photos themselves are a standard aspect ratio (e.g. 4:3 or 16:9) the insertion points are not -- they may be rotated, scaled, and skewed. Now I know in Direct2D I can apply matrix transformations to accomplish this... but I'm not exactly sure how. The examples I've seen are more about applying specific transformations (e.g.

Launching SharpDX/DirectX app with DeviceCreationFlags.Debug

不羁的心 提交于 2019-12-02 04:18:10
I am trying to launch my directX/SharpDX app with DeviceCreationFlags.Debug but i am getting the following crash upon startup: SharpDX.SharpDXException: HRESULT: [0x80004005], Module: [General], ApiCode: [E_FAIL/Unspecified error], Message: Unspecified error at SharpDX.Result.CheckError() at SharpDX.Direct3D11.Device.CreateDevice(Adapter adapter, DriverType driverType, DeviceCreationFlags flags, FeatureLevel[] featureLevels) at SharpDX.Direct3D11.Device..ctor(Adapter adapter, DeviceCreationFlags flags, FeatureLevel[] featureLevels) at SharpDX.Toolkit.Graphics.GraphicsDevice..ctor

Mapping corners to arbitrary positions using Direct2D

我的梦境 提交于 2019-12-01 23:18:32
I'm using WIC and Direct2D (via SharpDX) to composite photos into video frames. For each frame I have the exact coordinates where each corner will be found. While the photos themselves are a standard aspect ratio (e.g. 4:3 or 16:9) the insertion points are not -- they may be rotated, scaled, and skewed. Now I know in Direct2D I can apply matrix transformations to accomplish this... but I'm not exactly sure how. The examples I've seen are more about applying specific transformations (e.g. rotate 30 degrees) than trying to match an exact destination. Given that I know the exact coordinates (A,B

How can I play multiple sounds at the same time using SharpDX in WinRT?

一曲冷凌霜 提交于 2019-12-01 11:44:48
I am trying to make a musical instrument type of application. The problem I am having is that a new sound will only play if the old one is finished. I would like to be able to play them simultaneously. This is how my code looks like: First, the MyWave class which simply holds an audio buffer and some other info: class MyWave { public AudioBuffer Buffer { get; set; } public uint[] DecodedPacketsInfo { get; set; } public WaveFormat WaveFormat { get; set; } } In the SoundPlayer class: private XAudio2 xaudio; private MasteringVoice mvoice; Dictionary<string, MyWave> sounds; // Constructor public

Is there a SharpDx Template, for a Windows Universal App?

微笑、不失礼 提交于 2019-11-30 16:05:08
I tried to write a game for Windows and Windows Phone 8.1, with SharpDx. But when I try, to add a Windows Phone 8.1 Version to my already existing Windows 8.1 Game, I get a few errors and the App doesn't work. Now the question: Is there an SharpDx Template in XNA Style for a Windows Universal App, like the Template I got for my only Windows 8.1 Game (from the SharpDx Visual Studio Extension)? No there isn't, yet. What you should do is open an issue ( https://github.com/sharpdx/SharpDX/issues ) and ask for the feature to be implemented. But you can still get started while waiting for it to be

How to create bitmap from Surface (SharpDX)

妖精的绣舞 提交于 2019-11-30 14:42:22
I am new to DirectX and trying to use SharpDX to capture a screen shot using the Desktop Duplication API. I am wondering if there is any easy way to create bitmap that I can use in CPU (i.e. save on file, etc.) I am using the following code the get the desktop screen shot: var factory = new SharpDX.DXGI.Factory1(); var adapter = factory.Adapters1[0]; var output = adapter.Outputs[0]; var device = new SharpDX.Direct3D11.Device(SharpDX.Direct3D.DriverType.Hardware, DeviceCreationFlags.BgraSupport | DeviceCreationFlags.Debug); var dev1 = device.QueryInterface<SharpDX.DXGI.Device1>(); var output1 =

MF SinkWriter Write Sample Failed

允我心安 提交于 2019-11-30 10:38:31
I'm trying to encode the ID3D11Texture2D to mp4 using MediaFoundation. Below is my current code. Initializing Sink Writer private int InitializeSinkWriter(String outputFile, int videoWidth, int videoHeight) { IMFMediaType mediaTypeIn = null; IMFMediaType mediaTypeOut = null; IMFAttributes attributes = null; int hr = 0; if (Succeeded(hr)) hr = (int)MFExtern.MFCreateAttributes(out attributes, 1); if (Succeeded(hr)) hr = (int)attributes.SetUINT32(MFAttributesClsid.MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 1); if (Succeeded(hr)) hr = (int)attributes.SetUINT32(MFAttributesClsid.MF_LOW_LATENCY, 1); /

Replace GDI+ DrawImage with PInvoked GDI and transparent PNG's

血红的双手。 提交于 2019-11-30 07:31:29
I've created an image service in C# which takes a base layer image (JPG), layers one more more transparent PNG's (32 bit), and then outputs a final JPG image. I'm trying to squeeze every last millisecond out of this function and my code is bottlenecking at the DrawImage call in GDI+. Managed code here: // Load base image and create graphics Image image = LoadImage(renderSettings.RenderedImageDirectory + baseLayer); Graphics graphics = Graphics.FromImage(image); graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; graphics.InterpolationMode = System.Drawing

MF SinkWriter Write Sample Failed

拥有回忆 提交于 2019-11-29 16:30:43
问题 I'm trying to encode the ID3D11Texture2D to mp4 using MediaFoundation. Below is my current code. Initializing Sink Writer private int InitializeSinkWriter(String outputFile, int videoWidth, int videoHeight) { IMFMediaType mediaTypeIn = null; IMFMediaType mediaTypeOut = null; IMFAttributes attributes = null; int hr = 0; if (Succeeded(hr)) hr = (int)MFExtern.MFCreateAttributes(out attributes, 1); if (Succeeded(hr)) hr = (int)attributes.SetUINT32(MFAttributesClsid.MF_READWRITE_ENABLE_HARDWARE

Replace GDI+ DrawImage with PInvoked GDI and transparent PNG's

两盒软妹~` 提交于 2019-11-29 10:30:00
问题 I've created an image service in C# which takes a base layer image (JPG), layers one more more transparent PNG's (32 bit), and then outputs a final JPG image. I'm trying to squeeze every last millisecond out of this function and my code is bottlenecking at the DrawImage call in GDI+. Managed code here: // Load base image and create graphics Image image = LoadImage(renderSettings.RenderedImageDirectory + baseLayer); Graphics graphics = Graphics.FromImage(image); graphics.CompositingQuality =