是否可以在 Win32 中的 8bpp 位图上绘制抗锯齿文本?

发布于 2024-09-08 09:45:14 字数 266 浏览 4 评论 0原文

我在 CDC 中选择了 8bpp 位图,并使用 ::TextOut () 绘制文本。字体质量为 ANTIALIASED_QUALITY,但文本以单色显示;没有灰色像素&锯齿状边缘。

8bpp 位图是从 24bpp 位图中提取的,该位图上已经绘制了抗锯齿文本,并且该文本没问题。 (两种文本类型都在同一个位图中。)

当然,我可以在 24bpp 上绘制并转换,但这更加复杂且缓慢。 (后面的文本发生了变化,并且重复了很多次。)是否可以将抗锯齿文本直接放入 8bpp 位图中?谢谢!

I've selected an 8bpp bitmap into a CDC, and used ::TextOut () to draw text. The font quality is ANTIALIASED_QUALITY, but the text comes out in monochrome; no gray pixels & jagged edges.

The 8bpp bitmap was extracted from a 24bpp bitmap that already had antialiased text drawn on it, and THAT text is ok. (Both text types are in the same bitmap.)

Of course I could draw on 24bpp and convert, but this is more complex and slow. (The later text changes, and is repeated many times.) Is it possible to get antialiased text directly into an 8bpp bitmap? Thanks!

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

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

发布评论

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

评论(2

月隐月明月朦胧 2024-09-15 09:45:14

不,GDI 不会对调色板位图进行抗锯齿输出,而这正是灰度位图。

No, GDI does not do antialiased output to a paletted bitmap, and that's exactly what a grayscale bitmap is.

盗琴音 2024-09-15 09:45:14

不,抗锯齿功能不适用于 8-bpp。如果您需要更快的更新,请考虑使用 OpenGL 等工具而不是 GDI 进行绘图。使用 OpenGL,绘图通常完全由图形硬件完成,因此即使在 32-bpp 下,绘图通常也比 GDI 执行 8-bpp 更快。

还值得注意的是,无论如何,32-bpp 可能比 8-或 24-bpp 更好。 GDI 可以使用(某些)硬件加速,但通常在 32-bpp 下效果最佳。

No, anti-aliasing doesn't work with 8-bpp. If you need faster updates, consider doing your drawing with something like OpenGL instead of via GDI. With OpenGL, the drawing will normally be done entirely by the graphics hardware, so even at 32-bpp, the drawing will usually be faster than GDI doing 8-bpp.

It's also worth noting that you'd probably be better off with 32-bpp than either 8- or 24-bpp in any case. GDI can use (some) hardware acceleration, but it's usually at its best with 32-bpp.

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