direct2d

WIC Direct2D CreateBitmapFromMemory: limitations on width and height?

拥有回忆 提交于 2019-12-11 02:56:36
问题 CreateBitmapFromMemory executes successfully when _nWidth is equal to or less than 644. If the value exceeds this value, the HRESULT value is -2003292276 Do limits exist on the width and height? #include <d2d1.h> #include <d2d1helper.h> #include <wincodecsdk.h> // Use this for WIC Direct2D functions void test() { IWICImagingFactory *m_pIWICFactory; ID2D1Factory *m_pD2DFactory; IWICBitmap *m_pEmbeddedBitmap; ID2D1Bitmap *m_pD2DBitmap; unsigned char *pImageBuffer = new unsigned char[1024*1024];

Windows Imaging Component - Direct2D C++ - Drawing, Saving

非 Y 不嫁゛ 提交于 2019-12-10 12:16:33
问题 Using Windows Image Component (WIC), I want to do the following for my windows desktop application (Direct2D/C++ with Windows 7 SP1 - Visual Studio 2013) Choose any type of RenderTarget (Direct2D Hwnd/Bitmap/WICBitmap - etc) for drawing Create a empty bitmap (D2D1Bitmap or IWICBitmap - whichever applicable) Begin draw - Fill colour, draw some lines and ellipses - End draw ==> (All in the Bitmap) At some point of time, I need to save the drawn content in the bitmap as an image in my computer

How to use a font from a file in SharpDX?

早过忘川 提交于 2019-12-10 11:36:34
问题 i want to generate image for windows 8 app, i'm going to use SharpDX API here is the code sample which i thankfully coped and paste private MemoryStream RenderStaticTextToBitmap() { var width = 400; var height = 100; var pixelFormat = WicPixelFormat.Format32bppBGR; var wicFactory = new ImagingFactory(); var dddFactory = new SharpDX.Direct2D1.Factory(); var dwFactory = new SharpDX.DirectWrite.Factory(); var wicBitmap = new Bitmap( wicFactory, width, height, pixelFormat, BitmapCreateCacheOption

How to convert a image file loaded in memory to a ID2D1Bitmap in C++

烈酒焚心 提交于 2019-12-08 04:50:36
问题 I'm trying to convert a image file (a png, but could be anything) that I just extracted into memory from a compressed file to a ID2D1Bitmap to draw using Direct 2D. I tried to look for some documentation, but I can only find methods that receive "const char* path" or ask me width and height of my image, that I can't know before-hand. Searching on google for it got me nowhere. The file is raw in memory, and I would like to avoid to extract images to the hdd into a temporary file just to read

Intermittent Access Violation ID2D1RenderTarget::EndDraw

此生再无相见时 提交于 2019-12-08 04:46:18
问题 I have my Direct2D drawing loop which is running successfully for hours, even days, except for the intermittent access violation error. There is no pattern for this to happen, mostly after several hours, sometimes after just a few seconds. Unhandled exception at 0x5f990099 (d3d11.dll) in XX.exe: 0xC0000005: Access violation reading location 0x00000fe0. I am keeping a log of the return HRESULT of EndDraw if not successful. All the previous EndDraw s seem to return S_OK . There aren't any other

What are the best practices for multithreading with Direct2D & DXGI (D3D interop)?

烂漫一生 提交于 2019-12-07 09:12:01
问题 Ideally I'd like to have multiple worker threads to be able to render to off-screen render targets and then 'transfer' the rendered content to the on-screen target. With hwnd render targets this does not seem to be a problem (msdn has an example of it). I'm not quite sure how to do it when the on-screen render target is based on DXGI swap chain. As far as I know, I can only have one swap chain per window. Therefore I can only have a single render target based on the swap chain. This implies

GDI rendering to direct2D ID2D1BitmapRenderTarget is always transparent

倖福魔咒の 提交于 2019-12-07 08:18:40
问题 I want to port my movie rendering software from DirectDraw to Direct2D. Because of compatibility issues, GDI rendering needs to be done on top of the image. To optimize performance I want to implement some kind of backbuffer mechanism, but there seems to be a problem with the alpha channel information, all GDI drawing appears somehow transparent . I create a ID2D1HwndRenderTarget for my window handle and and a ID2D1Bitmap to copy the images to. The pixelformat of the bitmap is DXGI_FORMAT

Direct2D interface and blurry text issue

一世执手 提交于 2019-12-07 04:53:18
问题 My new application will feature a rich interface which should be resizable on-the-fly uses transparent icons/images etc. For this application I'm trying to decide on using the new Direct2D API against the good old GDI. One of the downsides is of course it does not run on XP, although I've found a bit nastier issues to decide upon: I noticed that outputting text in a Direct2D environment seems a bit blurry (although marketed as a feature). Just look at the text in Firefox 4 with hardware

How does one use a memory stream instead of files when rendering Direct2D images via SharpDX?

自闭症网瘾萝莉.ら 提交于 2019-12-07 03:09:47
问题 The setup Consider the given scratch program that uses SharpDX, a managed wrapper for Direct* libraries, to render a bitmap and save it as a PNG: namespace ConsoleApplication5 { using System; using System.Diagnostics; using System.IO; using SharpDX; using SharpDX.Direct2D1; using SharpDX.DirectWrite; using SharpDX.DXGI; using SharpDX.IO; using SharpDX.WIC; using AlphaMode = SharpDX.Direct2D1.AlphaMode; using Bitmap = SharpDX.WIC.Bitmap; using D2DPixelFormat = SharpDX.Direct2D1.PixelFormat;

How to convert a image file loaded in memory to a ID2D1Bitmap in C++

懵懂的女人 提交于 2019-12-06 16:36:23
I'm trying to convert a image file (a png, but could be anything) that I just extracted into memory from a compressed file to a ID2D1Bitmap to draw using Direct 2D. I tried to look for some documentation, but I can only find methods that receive "const char* path" or ask me width and height of my image, that I can't know before-hand. Searching on google for it got me nowhere. The file is raw in memory, and I would like to avoid to extract images to the hdd into a temporary file just to read their data from there. Any ideas? if you have the HBITMAP handle, you can do this: The the size of your