简体   繁体   English

在屏幕上快速绘制像素

[英]Fast pixel drawing on the screen

I need to fill a window with pixels, very fast of course. 我当然需要非常快地用像素填充窗口。 This is for an 'old school' project with software 3D graphics (proof of concept). 这是针对带有软件3D图形(概念验证)的“老学校”项目。

The requirements are: 要求是:

  • Pointer to the screen buffer to write colors and a method to display it 指向屏幕缓冲区以写入颜色的指针及其显示方法

  • No OpenGL, Direct3D or SDL 没有OpenGL,Direct3D或SDL

  • Pure WinAPI 纯WinAPI

Question: How do I draw pixels on a window with WinAPI? 问题:如何使用WinAPI在窗口上绘制像素?

  • CreateDIBSection to create a HBITMAP bitmap with handle along with raw pointer to bits CreateDIBSection创建带有句柄以及指向位的原始指针的HBITMAP位图
  • BitBlt to copy data between HDC device contexts, from a device context with the bitmap (see above) selected into, to the other one associated with the window you are to "paint on" BitBlt ,用于在HDC设备上下文之间复制数据,从选择了位图的设备上下文(请参见上文)复制到与要“绘制”窗口的关联的另一个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM