问题描述
任何人都可以澄清GDI是否 fn的设置为 HALFTONE ,其记录如下:
The SetStretchBltMode fn has a setting HALFTONE which is documented as follows:
我见过,这会在缩小图像时执行双线性插值,但不清楚回答扩展时会发生什么。
I've seen references (see follow-up to first answer) that this performs bilinear interpolation when scaling down an image, but no clear answer of what happens when scaling up.
我注意到 - 与HALFTONE注释完全相反(仅适用于扩展)。
I have noticed that the Windows Mobile CE SDK does support a BILINEAR flag - which is documented exactly opposite of the HALFTONE comments (only works for scaling up).
请注意,对于这个问题的范围,我不想追求GDI +(有多种插值选项),OpenGL,DirectX等作为替代品,所以请不要打扰后续关于这些其他API或替代图像库。
Note that for the scope of this question, I'm not interested in pursuing GDI+ (which has numerous interpolation options), OpenGL, DirectX, etc. as alternatives, so please don't bother with follow-ups regarding these other APIs or alternate image libraries.
我真的是什么希望找到一些明确的MS / MSDN或其他高质量文档,清楚地记录Win32(桌面)GDI行为的这种行为。
What I'm really hoping to find is some definitive MS/MSDN or other high-quality documentation that clearly documents this behavior of the Win32 (desktop) GDI behavior.
同时,我会尝试一些实验比较了GDI和Direct2D(它有一个明确的标志来控制它)并发布我的发现。
Meanwhile, I'll try some experiments comparing GDI vs. Direct2D (which does have an explicit flag to control this) and post my findings.
谢谢!
推荐答案
HALFTONE模式基于在定义的方格上改变转换阈值,在图像上执行非常块状的半色调抖动。我从未见过它会被认为是最佳选择的情况。
HALFTONE mode performs a very blocky halftone dithering on the image, based on varying the conversion thresholds over a defined square. I have never seen a situation where it would be considered the best choice.
COLORONCOLOR是彩色图像的最佳模式,但正如你所见,它没有给出很棒的结果。
COLORONCOLOR is the best mode for color images, but as you've seen it doesn't give great results.
GDI不支持双线性模式(除了你发现的Windows Mobile CE)。缩小图像时,双线性的朴素实现并不是很好,因为它只是试图在两个相邻的输入像素之间进行插值,而不是试图从更大的区域进行绘制。
GDI does not support a bilinear mode (except in Windows Mobile CE as you discovered). The naive implementation of bilinear does not do very well when shrinking an image, as it simply tries to interpolate between two adjacent input pixels without trying to draw from a larger area.
这篇关于StretchBlt HALFTONE == BILINEAR用于所有缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!