Questions tagged [gdi]

Graphics Device Interface (GDI) is a device-independent, pure software graphics API under the Windows operating system for drawing graphic primitives and text. It is the underlying base used to render the Windows GUI elements.

Graphics Device Interface (GDI) is a device-independent, pure software graphics API under the Windows operating system for drawing graphic primitives and text. It is the underlying base used to render the Windows GUI elements.

More information at http://en.wikipedia.org/wiki/Graphics_Device_Interface

2158 questions
6
votes
1 answer

Find out number of icons in an icon resource using Win32 API

I have an *.ico file that contains multiple icons in different sizes linked to my executable as a resource. I use this resource to set my application's icon with RegisterClassEx(), i.e.: wcx.hIcon = LoadIcon(hInstance,…
Andreas
  • 9,245
  • 9
  • 49
  • 97
6
votes
1 answer

Draw a marker like google maps with TCanvas on Delphi

On my application I need draw on TCanvas a "marker", like Google Maps marker (see the image). I'd like use as parameters the radius, the height and the origin: I don't have idea about algorithm to use. I can use an arc to draw the top, but how can…
Martin
  • 1,065
  • 1
  • 17
  • 36
6
votes
2 answers

Win32 DrawText line height

I'm calling the Win32 DrawText function to output some text into a device context. The text is long and wraps nicely onto a second line. The problem is I need to decrease the space between lines a bit (I guess decrease the line height?). Any…
DougN
  • 4,407
  • 11
  • 56
  • 81
6
votes
4 answers

Convert from 32-BPP to 8-BPP Indexed (C#)

I need to take a full color JPG Image and remap it's colors to a Indexed palette. The palette will consist of specific colors populated from a database. I need to map each color of the image to it's "closest" value in the index. I am sure there are…
at theChrisMarsh on twitter
6
votes
3 answers

win32 - How to draw a rectangle around a text string?

I am new to Win32 and trying to get a GDI based code in C++ ( for technical reasons don't want to use GDI+) Edit: Simplied the question: I need to draw a rectangle around the text that is drawn in the middle of the window. - How can I populate the…
ejuser
  • 181
  • 2
  • 5
  • 13
6
votes
1 answer

Direct2D - Emulating Color Keyed Transparent Bitmaps

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…
Carl
  • 86
  • 5
6
votes
1 answer

Drawing on C# Bitmap with C++

I have a 3rd party dll (plain C++) which draws on a HDC some lines. I want to have these lines on a C# Bitmap or Form. I tried to give the C++ a HBITMAP or a HDC of the Graphics.FromImage(bitmap) but none of the above ways worked for me. With a MFC…
6
votes
3 answers

Finding GDI/User resource usage from a crash dump

I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the Gdikdx.dll extension to look at Gdi information but this…
Jack Bolding
  • 3,801
  • 3
  • 39
  • 44
6
votes
1 answer

Capture screenshot of hidden desktop

I am using virtual desktops on Windows using simple app that i coded myself in C++, i was wondering if there is way to capture screenshot of secondary/hidden desktop ? I know that i can do SwitchDesktop -> capture screenshot -> SwitchDesktop, but it…
VisaToHell
  • 508
  • 1
  • 12
  • 29
5
votes
3 answers

What is Windows DIB?

I was just discussing if there was an alternative windows graphics library to GDI & Direct X in a forum. Someone mentioned WinDIB. Sadly, he didn't explain more about it. Now I've searched google. There seems to be no Wikipedia article on Windows…
ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
5
votes
1 answer

Accurately compute text widths in metric units

I want to compute the exact text width in metric units of a given string. My pseudocode looks like this: Bitmap.Canvas.Assign(Font); PixelWidth := Bitmap.Canvas.TextWidth(Font) MetricWidth := PtToMM * (PixelWidth * 72.0 / GetScreenDPI); PtToMM is a…
jpfollenius
  • 16,456
  • 10
  • 90
  • 156
5
votes
2 answers

When should I call DeleteObject() on bitmap

I'm examining some legacy Win32/MFC project. I've found the following (pseudo-code): HDC hDC = ::CreateCompatibleDC(hDCWnd); HANDLE hFileMap = ::CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, dwSize, FileMapName); HBITMAP hBmp =…
Rom098
  • 2,445
  • 4
  • 35
  • 52
5
votes
1 answer

Parameter is Invalid Exception when using Graphics.GetHdc

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 =…
Nati Cohen
  • 230
  • 4
  • 11
5
votes
4 answers

How to debug GDI Object Leaks?

I'm not quite sure how to go about doing this. It is a large app, and we are having GDI object "leaks" on most of our forms. Is there a tool to help out? Is there a tutorial on how to use such a tool? Should I just start deleting code from our…
XenoPuTtSs
  • 1,254
  • 1
  • 11
  • 31
5
votes
0 answers

Is this a known GDI leak bug in .NET Framework/.NET Core/.NET 6?

I have a .NET Framework Console app (4.6.2 and 4.7.2 exhibit this issue). It opens a SaveFileDialog 5 times in a row, each time waiting for the previous dialog to close. Looking at the GDI column in TaskManager, I'm seeing the GDI object count start…
pushkin
  • 9,575
  • 15
  • 51
  • 95