StretchBlt HALFTONE == BILINEAR用于所有缩放? [英] Is StretchBlt HALFTONE == BILINEAR for all scaling?

查看:208
本文介绍了StretchBlt HALFTONE == BILINEAR用于所有缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以澄清GDI是否 StretchBlt 工作站的功能Win32 API执行双线性插值,以扩展为 更大和更小的图像,用于24/32位彩色图像?如果没有,是否有一个GDI( GDI +)函数执行此操作?

Can anyone clarify if the GDI StretchBlt function for the workstation Win32 API performs bilinear interpolation for scaling to both larger and smaller images for 24/32-bit color images? And if not, is there a GDI (not GDI+) function that does this?

SetStretchBltMode fn的设置为 HALFTONE ,其记录如下:

The SetStretchBltMode fn has a setting HALFTONE which is documented as follows:


HALFTONE
将源矩形中的像素映射为块目标矩形中的像素。目标像素块上的平均颜色近似于源像素的颜色。

HALFTONE Maps pixels from the source rectangle into blocks of pixels in the destination rectangle. The average color over the destination block of pixels approximates the color of the source pixels.

我见过引用(请参阅第一个答案的后续内容),这会在缩小图像时执行双线性插值,但不清楚回答扩展时会发生什么。

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.

我注意到 Windows Mobile CE SDK支持BILINEAR标志 - 与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用于所有缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆