gdi

AVI created with AVIStreamWrite has incorrect length and playback speed

陌路散爱 提交于 2019-12-13 08:28:45
问题 I'm trying to write to an AVI file using AVIStreamWrite but the resulting avi file is a bit messed up. The images in the avi contain the proper image and colors but the duration and speed of the video is off. I recorded a video that should have been around 7 seconds and looking at the file properties in Windows explorer it showed it had a duration of about 2 seconds. When I played it in Media Player it was too short and seemed to be playing very rapidly (motion in the video was like fast

GDI - How to create and fill bitmap?

允我心安 提交于 2019-12-13 07:15:11
问题 Someone can give me short explanation how to create bitmap runtime using GDI/GDI+ and to fill it with color ? Thanks in advance. 回答1: CreateBitmap , CreateCompatibleBitmap or CreateDIBSection (in case you want access to raw underlying data bits) CreateCompatibleDC SelectObject the bitmap into created device context FillRect or friends on the device context, and the painting takes place on your selected bitmap (there are options there: standard brushes for black and white, having RGB on hands

GDI+ : Changing DPI

孤街浪徒 提交于 2019-12-13 00:33:40
问题 I have two points that i need be to be clarifief on : changing image DPI from 200 to 100 does it mean that i have to resize the image by half or i could keep the actual dimensions but decrease the DPI. I herd that GDI+ could be a nice alternative to change the image DPI, i googled in that way but i found no example showing how to change the DPI with GDI+. Any Idea about those questions, and thank you. 回答1: Changing the dpi of an existing image doesn't make much sense. It records the

Enumerating active fonts in C# using DLL call to EnumFontFamiliesEx has me schtumped

大憨熊 提交于 2019-12-12 16:36:03
问题 My ultimate goal is to list all active fonts on a windows computer. For example, if you start WordPad or Word, you will see them all. Some of these fonts comes from the windows\fonts folder, but not all. Some are registered dynamically using the gdi32.dll call AddFontResource(...). Now, you would think C# had support for retrieving this entire list, and if so, let me know, please! However, after spending many hours on this, the regular C# calls to get installed system fonts retrieve just some

Is it possible to find out what is leaking GDI Objects

本小妞迷上赌 提交于 2019-12-12 13:26:44
问题 I have an application in Embarcadera RAD Studio 2010 (C++) . Is it possible to peek into it to see what would be leaking GDI Objects? A tree structured menu is leaking GDI Objects when text is set to Bold . My guess is that the "original" text is first created and then an instance where it is in bold and the first one is "forgotten about" and leaked. EDIT: Since no leak is reported usin AQTime, even though is obvoius by looking at Taskmanager, I traced the snippet of code that is creating and

How to draw text with transparency using GDI?

a 夏天 提交于 2019-12-12 12:59:47
问题 My goal is to dynamically put some arbitrary text into an HICON image (at runtime.) I'm using the following code: //Error checks are omitted for brevity //First create font LOGFONT lf = {0}; lf.lfHeight = -58; lf.lfWeight = FW_NORMAL; lf.lfOutPrecision = OUT_TT_PRECIS; //Use TrueType fonts for anti-alliasing lf.lfQuality = CLEARTYPE_QUALITY; lstrcpy(lf.lfFaceName, L"Segoe UI"); HFONT hFont = ::CreateFontIndirect(&lf); //HICON hIcon = original icon to use as a source //I'm using a large

Bitmap loses quality when stretched/shrinked on buttons background

笑着哭i 提交于 2019-12-12 12:05:04
问题 INTRODUCTION AND RELEVANT INFORMATION: I have an owner drawn static control. It should have bitmap on top of a gradient background. Static controls dimensions are not fixed , they are calculated during the creation of parent window. I load a bitmap with background color of RGB( 255, 163, 94 ) from resource file. Using TransparentBlt( ... , RGB( 255, 163, 94 ) ) API I stretch/shrink bitmap to fit the static controls client area ( bitmap is Device Dependant Bitmap, not a DIB, if that matters ).

Parameter is Invalid Exception when using Graphics.GetHdc

落爺英雄遲暮 提交于 2019-12-12 11:34:14
问题 I have been making an application to take snapshots of websites. Everything works well, until now: I have the application take MANY photos, and the process of the image taking is done as following: using (Graphics graphics = Graphics.FromImage(mBitmap)) { IntPtr hdc = graphics.GetHdc(); SendMessage(new HandleRef(mWebBrowser, mWebBrowser.Handle), 791, hdc, (IntPtr)30); BitBlt(new HandleRef(graphics, hdc), 0, 0, mBitmap.Width, mBitmap.Height, new HandleRef(graphics, hdc), 0, 0, 13369376);

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

How to draw over second monitor with GDIPLUS

邮差的信 提交于 2019-12-12 10:20:51
问题 I'm want to draw some text and lines over the desktop. I'm using gdiplus.h for print texts with the function DrawString. But its only print text on a primary screen monitor. If has in presentation mode, with 2 monitors I need to print text in a second monitor. #define _WIN32_WINNT 0x500 #include <windows.h> #include <gdiplus.h> using namespace Gdiplus; #pragma comment (lib,"Gdiplus.lib") int main() { HWND desktop = GetDesktopWindow(); HDC hdc = GetWindowDC(desktop); ULONG_PTR m_gdiplusToken;