gpt4 book ai didi

c++ - StretchBlt 收缩损坏

转载 作者:可可西里 更新时间:2023-11-01 09:43:30 25 4
gpt4 key购买 nike

我正在使用 Windows(7 和 XP - 均为 32 位)并使用 C++ 进行编码

我正在从外部源接收位图。这些位图具有固定分辨率(384x288)

收到位图后,我需要根据可变大小的布局调整它的大小,因此我目前正在使用 StretchBlt 来执行这些任务。

如果我将位图的大小调整为更大的屏幕图像,效果很好。

但是,如果我将传入的位图缩小到较小的版本以放置在屏幕上,我会在图像上出现一些奇怪的“拳击”类型的效果。

在以下示例中,三个面板中的每一个的源图像都是相同的。但是左手两个(调整得更小)都对它们产生了拳击/线条效果。

enter image description here

对于实际的 StretchBlt 调用,我这样做:

        memcpy(at_TempPointer[PortNo], // Destination
(void *)VideoBufferAddress, // Source
FIXED_IMAGE_WIDTH * FIXED_IMAGE_HEIGHT * BYTES_PER_PIXEL // Number of bytes
);

StretchBlt(at_ImageDC[PortNo], // HDC Dest
0, // X Origin Dest
0, // Y Origin Dest
at_Width[PortNo], // Width Dest
at_Height[PortNo], // Height Dest
at_GhDC[PortNo], // HDC Source
0, // X Origin Source
0, // Y Origin Source
FIXED_IMAGE_WIDTH, // Width Source
FIXED_IMAGE_HEIGHT, // Height Source
SRCCOPY // Graphic Operation
);

但我想知道问题是否出在其他地方。

有没有其他人有过这种调整大小的图像损坏的经验,知道我该如何修复它?

最佳答案

您是否正在使用 SetStretchBltMode 设置 StretchBlt 模式? ?

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.

After setting the HALFTONE stretching mode, an application must call the SetBrushOrgEx function to set the brush origin. If it fails to do so, brush misalignment occurs.

关于c++ - StretchBlt 收缩损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9079579/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com