bitblt

Is it possible to BitBlt directly from a GDI+ bitmap?

混江龙づ霸主 提交于 2019-12-31 23:10:06
问题 Is it possible to use BitBlt to copy directly out of a GDI+ bitmap without using GetHBitmap? GetHBitmap is slow because it makes a new copy of the whole image, in addition to and slower than the BitBlt copy, and the given HBITMAP must be disposed. The image is large. Is there a way to point BitBlt to use the pixel data of the original GDI+ image? EDIT: I can get a pointer to where the GDI+ bitmap pixel data is in the memory. Can I create an HBITMAP that points to the GDI+ bitmap pixel data to

Screenshot (PIL)ImageGrab.grab / BitBlt on Win10 only return the Background?

白昼怎懂夜的黑 提交于 2019-12-25 16:47:48
问题 i have a big problem with windows 10, normaly i used PIL (Python) to get a nice and clean screenshot from inside a program. but with windows 10 this does not work anymore, now i become only everything on the Desktop but my FullScreen Window is missing. i also tryed to use: BitBlt(screen_copy, 0, 0, width, height, screen, left, top, SRCCOPY | CAPTUREBLT) but the result is exactly the same :( does anybody has any solution or idea what has changed in Win10? thank you so much. 回答1: Another

Using BitBlt to capture desktop pixel colors

心不动则不痛 提交于 2019-12-25 04:46:05
问题 Right now I'm using GetPixel() to retrieve about 64 pixels from the desktop in order to obtain their color. I read about GetPixel() being slow but didn't think it would matter for a few pixels but it's taking like 1.5 seconds each time I run the routine. After doing some research I've concluded that bitblt seems like what I'm looking for. What I want to do is grab a defined area of the desktop (including all windows) and then grab pixel colors at given offsets. Here's what I'm doing now: for

Crop function BitBlt(…)

﹥>﹥吖頭↗ 提交于 2019-12-20 03:18:32
问题 I want to create a crop function in an existing engine. This is what I already have: bool Bitmap::Crop(RECT cropArea) { BITMAP bm; GetObject(m_Handle, sizeof(bm), &bm); HDC hSrc = CreateCompatibleDC(NULL); SelectObject(hSrc, m_Handle); HDC hNew = CreateCompatibleDC(NULL); HBITMAP hBmp = CreateCompatibleBitmap(hNew, bm.bmWidth, bm.bmHeight); HBITMAP hOld = (HBITMAP)SelectObject(hNew, hBmp); BitBlt(hNew, 0, 0, bm.bmWidth, bm.bmHeight, hSrc, 0, 0, SRCCOPY); SelectObject(hNew, hOld); DeleteDC

Screenshot captured using BitBlt in C# results a black image on Windows 10

情到浓时终转凉″ 提交于 2019-12-18 17:28:28
问题 Screenshot captured using BitBlt in c# resulted a black image on Windows 10 . Please help me to resolve this. Screenshot is black image for Chrome (when hardware accelerated mode is on) and IE/Edge windows. Output image is black only for Edge, IE browser windows in Windows 10 and Chrome browser window when hardware accelerated mode is ON. Apart from all other windows including transparent windows screenshots are good. Here is the code: const int Srccopy = 0x00CC0020; var windowRect = new Rect

Using BitBlt to capture screenshot, how?

天大地大妈咪最大 提交于 2019-12-13 04:35:06
问题 I have run into this "BitBlt" from time to time in my searched, but i don´t get how to use it. From what people say, it seems to be the fastest way to capture a screen that Windows show. However, i can´t say anything about that myself as i don´t got it working. The only thing i have manage to atleast, try the method, is with this: gfxBmp.CopyFromScreen(0,0,0,0 rc.Size,CopyPixelOperation.CaptureBlt); Which i guess uses it? (rc.size = size of a certain window) Sadly, it doesn´t do anything, i

Are the GDI functions BitBlt and StretchBlt hardware accelerated in Win32?

自闭症网瘾萝莉.ら 提交于 2019-12-12 10:47:47
问题 I can't seem to get a definite answer to this via searching. Are the Win32 blitting operations hardware accelerated (GDI, not GDI+). I don't know how these functions interface with the graphics driver. Is there any function call to verify this functionality, like ?GetCaps? for a specific graphics device (win32 graphics device) to see if these functions are receiving hardware acceleration? 回答1: According to this, GDI is only hardware accelerated on windows 7 onwards. This lists how to specify

Capturing a program window with BitBlt always returns the same image

半世苍凉 提交于 2019-12-10 15:19:19
问题 I wrote the following code (C++ Win32) to capture a game window screen and get pixel color array from the image. Function autoB() does the job. Then I draw the result array into my window to visually check what I got. The problem is that this program works only once after I start the computer, after the first time it "caches" the first screenshot taken from the game and I always get the same array of pixels. Even if I close and restart the program I get the same screenshot. The game is not

Win32双缓冲绘图和位图的绘制

最后都变了- 提交于 2019-12-10 15:01:10
前言: 为什么需要使用双缓冲技术?可能很多朋友会问,不知道你们有没有发现,当屏幕刷新的时候会有闪烁,这样让人的体验感极差。原因是绘图与显示器刷新不同步,有时间差,为解决这一问题,这就需要用到双缓冲技术来绘图了。双缓冲技术是相对单缓冲而言的,单缓冲就是直接在设备DC上绘图;而双缓冲就是先在一个与设备DC相兼容的内存缓冲区里进行绘图,然后再一次性复制到设备DC上。一次性在屏幕上显示就不会出现闪烁的现象。 这里需要注意的是:我们创建的兼容DC,不能直接在上面绘图,这里还需要一块画布,那我们创建的兼容DC就相当于画板,有了画板、画布,将画布选放在画板兼容DC上就可以进行绘图了。然后一次性贴在设备DC上就搞定了。如下: HDC mdc = CreateComatibleDC ( hdc ) ; // 创建兼容DC 画板 HBITMAP bmp = CreatrCompatibleBitnap ( hdc , 600 , 600 ) ; // 创建画布 SelectObject ( mdc , bmp ) ; // 将画布选入画板 一、双缓冲技术的使用 双缓冲绘图步骤: 在内存中创建兼容DC缓冲区(依次包括创建兼容DCCreateComatibleDC、创建画布CreatrCompatibleBitnap、将画布选入SelectObject)。 在缓冲区进行画图操作(可以画图形、也可以贴位图)

How to speed up BitBlt to capture screen with aero?

我是研究僧i 提交于 2019-12-10 13:45:19
问题 I use following code to capture the screen with GDI functions: // Prologue: int iScreenWidth = GetSystemMetrics(SM_CXSCREEN); int iScreenHeight = GetSystemMetrics(SM_CYSCREEN); HDC hScreenDC = GetDC(0); HDC hCaptureDC = CreateCompatibleDC(hScreenDC); HBITMAP hCaptureBitmap = CreateCompatibleBitmap(hScreenDC, iScreenWidth, iScreenHeight); HBITMAP hOldBitmap = (HBITMAP)SelectObject(hCaptureDC, hCaptureBitmap); // Capture: BitBlt(hCaptureDC, 0, 0, iScreenWidth, iScreenHeight, hScreenDC, 0, 0,