Drawing pixels in a window in Windows

In summary, the speaker is looking to implement a "framebuffer in a window" for a digital video application that can run alongside other windows on the desktop. They are unsure of how to proceed and have considered using device context and overlay or integrating Windows Media Player, but have found those options to be inefficient. Instead, they have discovered that using DIB and blitting to the primary surface is the most efficient solution.
  • #1
chroot
Staff Emeritus
Science Advisor
Gold Member
10,295
41
I need to implement a sort of "framebuffer in a window" for a digital video application I'm working on. I need the window to be displayed alongside other windows (running Windows XP) and get along nicely with other windows on the desktop. The window will display the pixel data in an arbitrary framebuffer. I need the solution to be as efficient as possible, as I'm hoping to display full-motion color standard-resolution TV.

I roughly know the terms "device context" and "overlay," but I'm not sure how to proceed, or even if I'm supposed to be using overlays, or DirectX, or what. MSDN.com provides inspiring glimpses, but I largely cannot make heads or tails of what to do. I know it can be done, because, well, lots of applications do it.

- Warren
 
Computer science news on Phys.org
  • #2
chroot said:
I need the window to be displayed alongside other windows (running Windows XP) and get along nicely with other windows on the desktop.

Create a Win32 or MFC application and the framework will take care of that for you.

chroot said:
I roughly know the terms "device context" and "overlay," but I'm not sure how to proceed, or even if I'm supposed to be using overlays, or DirectX, or what.

Have you considered integrating Windows Media Player into your application? That is the easiest way to accomplish what you want. Otherwise you'll have to write it from scratch and deal with DirectX, OpenGL or some video library.
 
  • #3
Wave,

Sorry, but both of those suggestions are very poor, as they do not even approach the efficiency I need. (Think high-end video game efficiency.)

I discovered that the correct way to go about doing this is to use DIB (device independent bitmaps) and blit the bitmaps to the primary surface.

- Warren
 
  • #4
chroot said:
Wave,

Sorry, but both of those suggestions are very poor, as they do not even approach the efficiency I need. (Think high-end video game efficiency.)

I discovered that the correct way to go about doing this is to use DIB (device independent bitmaps) and blit the bitmaps to the primary surface.

- Warren

I thought you wanted digital video playback. Consider DDB if efficiency is what you're looking for.
 

1. How do I draw pixels in a window in Windows?

To draw pixels in a window in Windows, you can use the SetPixel function in the Windows API. This function takes in the device context of the window and the coordinates of the pixel you want to draw, along with the desired color. Alternatively, you can use a library such as DirectX or OpenGL for more advanced pixel drawing capabilities.

2. Can I draw pixels in a window using any programming language?

Yes, you can draw pixels in a window in Windows using any programming language that has access to the Windows API. This includes languages such as C++, C#, Visual Basic, and more.

3. How do I control the size of the pixels when drawing in a window?

The size of the pixels when drawing in a window is determined by the resolution and pixel density of the monitor. You can also use scaling functions in the Windows API to adjust the size of the pixels in your window.

4. Can I draw pixels in a window without using the Windows API?

No, drawing pixels in a window in Windows requires the use of the Windows API. However, you can use libraries such as DirectX or OpenGL which provide a layer of abstraction on top of the Windows API for easier pixel drawing.

5. Are there any limitations to drawing pixels in a window in Windows?

There are some limitations to drawing pixels in a window in Windows. These include the maximum resolution and pixel density of the monitor, as well as any hardware limitations of the graphics card. Additionally, the performance of pixel drawing can be impacted by the complexity of the drawing operations and the capabilities of the computer's hardware.

Similar threads

  • Computing and Technology
Replies
12
Views
2K
  • Computing and Technology
Replies
2
Views
5K
Replies
3
Views
2K
  • Computing and Technology
Replies
2
Views
2K
  • Classical Physics
Replies
9
Views
6K
Replies
14
Views
3K
Replies
2
Views
5K
Replies
7
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
Replies
1
Views
1K
Back
Top