gpt4 book ai didi

c++ - 使用 EasyBMP 库编译错误

转载 作者:行者123 更新时间:2023-11-28 08:23:50 24 4
gpt4 key购买 nike

我正在尝试编写一个程序,可以将给定的 BMP 文件旋转 180 度,并使用旋转后的图像创建一个新的 BMP 文件。我正在使用 EasyBMP 库。但是,每次我尝试编译时,都会收到以下警告:

EasyBMP Warning: Attempted to access non-existent pixel (359, 236);
Truncating request to fit in the range [0,358] x [0,269].

我得到了数百个! (有问题的图像是 359x270)奇怪的是我的代码实际上 100% 有效。当我运行该程序时,它确实创建了一个旋转的图像并且看起来很完美。

最佳答案

如果应该

for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
color = in(x, y);
*(out(width - x - 1, height - y - 1)) = *color;
}
}

(注意 < 而不是 <=- 1 添加)。

关于c++ - 使用 EasyBMP 库编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4772148/

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