direct2d

what's the proper implementation of the Chroma-key Effect in Microsoft visual studio c++?

房东的猫 提交于 2019-12-25 08:24:49
问题 I've been trying to got into Direct2D, and although successful up to this point, i'm stumped on how to implement the Chroma-key Effect on bitmaps. I'm trying to follow: https://msdn.microsoft.com/en-us/library/windows/desktop/dn890715(v=vs.85).aspx , but the code being 4-8 years out of date on average, means i can't find the same methods and functions in the intellisense documentation while typing the code. Has anyone done this before, and had success in making a graphical program? and could

Direct2D: leave a region of a window render target untouched

旧街凉风 提交于 2019-12-25 05:08:06
问题 I am drawing to a regular HwndRengerTarget but other windows, which have nothing to do with Direct2D, overlap it. The problem is that these windows get painted over when I draw to the HwndRengerTarget . I would like to tell Direct2D not to touch a specific region of the HwndRengerTarget (i.e. don't touch the pixels that are already on the screen), so that these windows remain correctly visible. Is that possible? If I draw normally then call RedrawWindow on the windows, it flickers a lot.

How to get pixels from window using Direct2D

人走茶凉 提交于 2019-12-24 16:26:10
问题 My problem is getting the pixels in a window. I can't find a way to do this. I using standard windows functions and Direct2D (not DirectDraw). I am using standard initialization of new window: WNDCLASS wc; wc.style = CS_OWNDC; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(6); wc.lpszMenuName = 0; wc.lpszClassName = L"WINDOW";

Rendering part of a bitmap using Direct2D

北城以北 提交于 2019-12-24 14:30:30
问题 I'm in the process of converting a custom CAD software from GDI to Direct2D. I'm having issues when panning the drawing. What I would like to do is to create a bitmap that's 3x as wide as the drawing window & 3x as high. Then, when the user begins to pan, I would render the part of the bitmap that should be visible. Trouble is, it doesn't appear as though you can have bitmaps bigger than your render target. Here's approximately what I've done so far: // Get the size of my drawing window. RECT

Displaying large image with SharpDX

ぐ巨炮叔叔 提交于 2019-12-24 06:42:37
问题 I'm trying to use SharpDX to draw a large image (21000x7000) from file. The code looks like this: if (newBitmap==null) { ImagingFactory imagingFactory = new ImagingFactory(); NativeFileStream fileStream = new NativeFileStream(@"D:\path\myfile.png", NativeFileMode.Open, NativeFileAccess.Read); BitmapDecoder bitmapDecoder = new BitmapDecoder(imagingFactory, fileStream, DecodeOptions.CacheOnDemand); BitmapFrameDecode frame = bitmapDecoder.GetFrame(0); FormatConverter converter = new

What is the most effective pixel format for WIC bitmap processing?

只愿长相守 提交于 2019-12-24 05:24:06
问题 I'm trying to make a simple video player like program with Direct2D and WIC Bitmap. It requires fast and CPU economic drawing (with stretch) of YUV pixel format frame data. I've already tested with GDI. I hope switching to Direct2D give at least 10x performance gain (smaller CPU overhead). What I'll doing is basically such as below: Create an empty WIC bitmap A (for drawing canvas) Create another WIC bitmap B with YUV frame data (format conversion) Draw bitmap B onto A, then draw A to the D2D

Creating a Direct2D BitmapSource from a Win32 icon pointer

隐身守侯 提交于 2019-12-24 02:42:55
问题 I created an application in C# that gets icon images from window handles using user32.dll like this: [DllImport("user32.dll", EntryPoint = "GetClassLong")] private static extern int GetClassLongPtr32(IntPtr hWnd, int nIndex); public static IntPtr GetAppIcon(IntPtr hwnd) { return WI.GetClassLongPtr32(hwnd, WI.ICON_SMALL); } And I want to create a BitmapSource from this icon pointer. Usually for WPF I would use Imaging.CreateBitmapSourceFromHIcon(handle, Int32Rect.Empty, BitmapSizeOptions

How to make mouse movement work with no delay?

懵懂的女人 提交于 2019-12-22 10:40:02
问题 I'm making a program that let me click on the center of two concentric circles and, by mouse move, change it's position and i can do the same with it's radii. The thing is that the mouse movement is followed by a delay response from the circles drawing making the radius follow the mouse instead of being exactly in the same position during the movement. Would you guys know how to make it work like that? pin point following by the drawing. a bit of the code that treats the mouse clicking and

Direct2D - Emulating Color Keyed Transparent Bitmaps

痴心易碎 提交于 2019-12-21 02:38:30
问题 I'm currently updating a Windows GDI application to use Direct2D rendering and I need to support "transparent" bitmaps via color-keying for backwards compatibility. Right now I'm working with a HWND render target and a converted WIC bitmap source (to GUID_WICPixelFormat32bppPBGRA). My plan so far is to create a IWICBitmap from the converted bitmap, Lock() it, and then process each pixel setting it's alpha value to 0 if it matches the color key. This seems a bit "brute force" - Is this the

How to save a ID2D1Bitmap to a file using WIC?

心不动则不痛 提交于 2019-12-20 04:24:24
问题 I have a problem with saving a bitmap into a file. I'm using How to save ID2D1Bitmap to PNG file as a reference, but I have a different error than the one posted in that. I get error 0x88990015 HRESULT, which means: The resource used was created by a render target in a different resource domain. Here's my code: void Wnd::SavePng(LPCWSTR Path,ID2D1Bitmap* pBit) { CComPtr<ID2D1RenderTarget> pRT; CComPtr<IWICBitmap> pB; CComPtr<IWICBitmapEncoder> pEncoder; CComPtr<IWICBitmapFrameEncode> pFrame;