gdi

Are GDI, GDI+ and OpenGL really obsolete/deprecated? [closed]

China☆狼群 提交于 2019-11-30 06:18:15
If you open the page "Graphics and Gaming (Windows)" on microsoft.com the last category is described as Legacy Graphics: Technologies that are obsolete and should not be used in new applications. This category includes (among others) the following APIs: GDI GDI+ OpenGL What's your opinion? If i want to roll out a new software today it must support Windows XP (still about 50% of all installed systems). Direct2D requires Windows 7/Vista. What else should be used? I suspect that Microsoft's definition of "legacy" has little to do with what any sensible developer should do, and is instead based on

Is it possible to detect GDI leaks from the Visual Studio debugger?

a 夏天 提交于 2019-11-30 06:03:21
Leaking GDI objects can be seen from the task manager or from Process Explorer . (Well you don't see the leaks, but you can see if object uasage count continually goes up.) There are also tools that allow to view GDI objects by type, such as GDIView [a], DeLeaker , DPUS or the GDIDebug (sourecode) . [a] Note that I consider GDIView a great tool to get the job done of identifying and confirming the existance GDI leaks, but it doesn't really help you to find the leaking code in large applications. (I will also note here that the tool works very nicely and seems well behaved, although its

Is StretchBlt HALFTONE == BILINEAR for all scaling?

不想你离开。 提交于 2019-11-30 05:39:44
问题 Can anyone clarify if the GDI StretchBlt function for the workstation Win32 API performs bilinear interpolation for scaling to both larger and smaller images for 24/32-bit color images? And if not, is there a GDI ( not GDI+) function that does this? The SetStretchBltMode fn has a setting HALFTONE which is documented as follows: HALFTONE Maps pixels from the source rectangle into blocks of pixels in the destination rectangle. The average color over the destination block of pixels approximates

How can I measure diagonal distance points?

偶尔善良 提交于 2019-11-30 04:37:37
问题 I can compute horizontal and vertical points, but I cant figure out how to compute distance using diagonal points. Can someone help me with this. here's the code for my horizontal and vertical measuring: private float ComputeDistance(float point1, float point2) { float sol1 = point1 - point2; float sol2 = (float)Math.Abs(Math.Sqrt(sol1 * sol1)); return sol2; } protected override void OnMouseMove(MouseEventArgs e) { _endPoint.X = e.X; _endPoint.Y = e.Y; if (ComputeDistance(_startPoint.X,

Printing on roll paper

偶尔善良 提交于 2019-11-30 03:02:05
I am using C# with Winforms. I am trying to print bills on a paper roll. The width of the paper is 3in but the length of the paper is dynamic (its a roll paper). The length depends on how many items are there in the list. E.g. in a purchase if there are 100 items sold then it will be quite long roll while for a single item purchased it would be of small length. When I print the report, after the end job, printer eject the last page more than I need. It eject paper as long as A4 size. I want to print the required lines, then stop printing. I use a roll of paper, not A4 or A3 and an Epson LQ-300

How to rotate Bitmap in windows GDI?

隐身守侯 提交于 2019-11-30 01:57:04
问题 How would I go about rotating a Bitmap in Windows GDI,C++? 回答1: You can do it with GDI+ ( #include <gdiplus.h> ). The Graphics class has the RotateTransform method. That allows arbitrary rotations. Use Image::RotateFlip() if you only need to rotate by 90 degree increments, that's a lot more efficient. 回答2: Sounds like you have to use PlgBlt. Take your rectangle's 4 corners as 2D Points, rotate them, then call PlgBlt. From MSDN Bitmap Rotation: To copy a bitmap into a parallelogram; use the

What is the difference between GetClientRect and GetWindowRect in WinApi?

安稳与你 提交于 2019-11-30 01:38:19
What of these should I use in InvalidateRect to refresh my window? And why? David Heffernan The window rect includes the non-client area, i.e. the window borders, caption bar etc. The client rect does not. GetWindowRect returns a rect in screen coordinates whereas GetClientRect returns a rect in client coordinates. InvalidateRect receives a rect in client coordinates. If you want to invalidate your entire client area, then pass NULL to InvalidateRect . You could pass in the rect returned by GetClientRect , but it is far simpler and clearer to pass NULL . GetClientRect gets the coordinates of

WMF / EMF File Format conversion C#

萝らか妹 提交于 2019-11-29 21:16:42
问题 In my program, I have a requirement to "playback" or "parse" windows metafiles (WMF and EMF). I have dug through MSDN and Google, and the closest I have come is the Graphics. EnumerateMetafile method. I can get it to work, in that my EnumerateMetafileProc callback is called, and I can then call PlayRecord. What is missing, is how to get usefull data out of that callback. Example I looked at: http://msdn.microsoft.com/en-us/library/ms142060.aspx The callback has a recordType parameter, which

Enumerating monitors on a computer

穿精又带淫゛_ 提交于 2019-11-29 20:09:10
I have found 7 different ways to enumerate the monitors attached to the computer. But all solutions give different results (number of the monitors and information on each monitor). These solutions are: Using the famous EnumDisplayDevices Using EnumDisplayMonitors Using the Windows Management Instrumentation (WMI) : With the following query: SELECT * FROM WmiMonitorID in the root\\WMI namespace. Again using the WMI : With the new query: SELECT * FROM Win32_DesktopMonitor in the root\\CIMV2 namespace. Using the Setup API : By first calling SetupDiGetClassDevs to retrieve the device information

Disable antialiasing for a specific GDI device context

青春壹個敷衍的年華 提交于 2019-11-29 14:21:22
问题 I'm using a third party library to render an image to a GDI DC and I need to ensure that any text is rendered without any smoothing/antialiasing so that I can convert the image to a predefined palette with indexed colors. The third party library i'm using for rendering doesn't support this and just renders text as per the current windows settings for font rendering. They've also said that it's unlikely they'll add the ability to switch anti-aliasing off any time soon. The best work around I