如何删除窗口上放置的 setpixel? (c++)

发布于 2024-08-23 06:33:15 字数 203 浏览 2 评论 0原文

我使用 SetPixel 在我的窗口上制作东西,这是最简单的,因为我只想一次设置一个像素。 SetPixel 很棒,但我每次更新时都需要删除颜色,我可以用黑色覆盖颜色,但是..这真是浪费时间,有什么方法可以将所有颜色覆盖为黑色吗? (我想要比将它们全部重置为黑色更快的东西)。我制作一个窗口,然后使用 setpixel 进行着色(还有其他方法(在窗口上绘制),但我只想一次设置一个像素/颜色)

im using SetPixel to make stuff on my window which is the easyest because i only want to set one pixel at a time. SetPixel is great but i need to remove the color every time i update it, i could overwrite the color by black but.. it's a really big waste of time is there some way i can over write all of the colors to black? (i would like something that is faster then reseting them all to black). i make a window and then color with setpixel (there is other ways (to draw on the window) but i only want to set one pixel/color at a time)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

琉璃繁缕 2024-08-30 06:33:16

您通常应该创建一个位图,锁定它,直接设置和取消设置其像素 - 可能通过直接访问而不是使用 API 调用,如果有大量更新 - 解锁然后使窗口无效,以便您的绘制处理程序可以位图位图之后。

如果要恢复像素,可以保留两张位图并将要恢复的值存储在一张位图中。

You should typically create a bitmap, lock it, set and unset its pixels directly - possibly by direct access rather than using API calls, if there are a lot of updates - unlock and then invalidate the window so that your paint handler can blit the bitmap later.

If you want to restore pixels, you can keep two bitmaps and store the values to restore in one bitmap.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文