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
5 answers

How can drawString method be used for writing diagonal way

I am using c# 2005 i want to write string diagonally on image. But by default c# provides the option to write horizontally or vertically. how we write diagonally? Thanks
SelvirK
  • 925
  • 3
  • 18
  • 42
6
votes
1 answer

StretchDIBits seems slow, Is there any API faster?

I want to draw a dib on to a HDC, the same size. I am using : des and src are of the same size. ::StretchDIBits(hdc, des.left,des.top,des.right - des.left,des.bottom - des.top, src.left, GetHeight() - src.bottom,…
user25749
  • 4,825
  • 14
  • 61
  • 83
6
votes
3 answers

Calculate Width and Height from 4 points of a polygon

I have four points which form a rectangle, and I am allowing the user to move any point and to rotate the rectangle by an angle (which rotates each point around the center point). It stays in near-perfect Rectangle shape (as far as PointF precision…
Trevor Elliott
  • 11,292
  • 11
  • 63
  • 102
6
votes
1 answer

The result of CreateCompatibleDC only has two colors

In the following code, anytime CreateCompatibleDC is called, the resulting device context only has two colors: black and white. case WM_PAINT: { PAINTSTRUCT ps; ps.hdc=GetDC(g_CSkeletalViewerApp.m_hWnd); …
Erik Wyatt
  • 61
  • 1
  • 2
6
votes
4 answers

Can a PDF be converted to a vector image format that can be printed from .NET?

We have a .NET app which prints to both real printers and PDF, currently using PDFsharp, although that part can be changed if there's a better option. Most of the output is generated text or images, but there can be one or more pages that get…
Bryce Wagner
  • 2,640
  • 1
  • 26
  • 43
6
votes
4 answers

How does computer draw a line??

Windows GDI has these functions: MoveTo(); LineTo(); They accept coordinates where to start drawing and where to stop drawing. But how are these functions implemented?? (especially LineTo) Do they need to calculate all points between point A and…
DrStrangeLove
  • 11,227
  • 16
  • 59
  • 72
6
votes
0 answers

How to properly clone and extend two specific monitors on Windows

I am developing a module for Windows 10 that manages and applies configuration to connected monitors. With the code below I can clone and extend monitors connected via HDMI, VGA, DP and DVI but I'm having trouble cloning usb-connected monitor that…
Jimmy Loyola
  • 189
  • 10
6
votes
4 answers

DWORD,LPTSR,LPBYTE,HANDLE what do these terms mean?

I came across these terms recently, while studying a program. I got an idea that they were data types...? Are they really? Could you please explain me what these terms really mean? I have not found their documentation.
saplingPro
  • 20,769
  • 53
  • 137
  • 195
6
votes
2 answers

Copying a bitmap from another HBITMAP

I'm trying to write a class to wrap bitmap functionality in my program. One useful feature would be to copy a bitmap from another bitmap handle. I'm a bit stuck: void operator=( MyBitmapType & bmp ) { HDC dcMem; HDC…
jtsPimp
  • 63
  • 1
  • 5
6
votes
3 answers

Find the postscript names of all the installed fonts

I need to enumerate the postsript names of all the installed fonts. for example: foreach (FontFamily item in FontFamily.Families) { listBox1.Items.Add(item.Name); } This will give only the actual font names. But…
user438959
  • 141
  • 3
  • 14
6
votes
2 answers

Performance efficient way of setting pixels in GDI

I've created a basic program that renders sprites in a windows console using the SetPixel() method, and it works fine, but there is massive overhead. I've made some optimizations to this, which helped but it's still too slow. Currently my program…
Kivi
  • 77
  • 1
  • 8
6
votes
1 answer

What type of DC is returned by calling GetDC(NULL)?

The Windows API function GetDC() accepts a single parameter: hWnd A handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire screen. Further down the page, the following is noted: After…
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
6
votes
2 answers

Correct (and flicker-free) way of setting window pixels?

I'm struggling to figure out the proper way of dumping an array of plain RGBA values into the client area of a Win32 window during WM_PAINT. I have the following code but it already seems convoluted and I'm not even finished: case WM_ERASEBKGND: …
nythrix
  • 81
  • 6
6
votes
1 answer

Why does custom cursor image show up incorrect?

Background I have written a function, which creates a custom cursor, based on the bitmap associated with a given Device Context. I use this to create drag-and-drop cursors that appear as "tear-offs" - a bit like they are used in "Trello". I've been…
6
votes
1 answer

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

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. …
jnm2
  • 7,960
  • 5
  • 61
  • 99