3

I've heard about various methods of rendering to a Window, but these all involve using some thing such as GDI+, DirectX, OpenGL, or something else.

How do these libraries work, and how do they get pixels into a Window? Just out of curiosity, how hard is it to raw access a Window's image data?

Thanks.

Name McChange
  • 2,750
  • 5
  • 27
  • 46
  • They work by talking to a device driver. DirectX was intended to provide fairly...direct access to hardware, but it's still only *fairly* direct. Probably better to back up and tell us what you're trying to accomplish, and somebody can probably tell you more about how to do that. – Jerry Coffin Nov 19 '12 at 22:12
  • 1
    @jerryCoffin It's really more for learning sake. I was hoping to draw to a window without the assistance of GDI or DirectX (just to see if I could, really) – Name McChange Nov 20 '12 at 01:07
  • The short answer is that Windows doesn't allow particularly direct access. One of the big things it provides is a uniform interface to a wide variety of devices, and I'd be surprised to see them change that any time soon (having done programming under MS-DOS where it was *not* the case, I think they're best off avoiding it too). – Jerry Coffin Nov 20 '12 at 01:36

1 Answers1

0

That's a pretty broad question.

The various Windows subsystems that draw images interface with the video drivers. Or use so combination of working with GDI+ and interfacing with the video drivers. How the drivers work is going to depend on the video card manufacturer.

I don't know what you mean by "raw access a Window's image data." You can capture a window's image into a bitmap, massage it, and write it back to the window's DC. But getting to the actual bits that Windows uses to render the bitmap would require digging into undocumented data structures. You'd have to know how to follow a window handle down to the low-level data structures that are maintained inside the GDI subsystem.

Jim Mischel
  • 131,090
  • 20
  • 188
  • 351