Image processing D lodepng编译错误

Image processing D lodepng编译错误,image-processing,compiler-errors,d,Image Processing,Compiler Errors,D,我在编译lodepng时遇到了一些麻烦(http://lodev.org/lodepng/)为了我的项目 在Encode.d中,我有以下代码,其中编译器不需要assert语句。 删除此块可以解决此问题 invariant { assert(compressionLevel >=0 && compressionLevel <= 9, "invalid zlib compression level"); assert(targetColorType ==

我在编译lodepng时遇到了一些麻烦(http://lodev.org/lodepng/)为了我的项目

在Encode.d中,我有以下代码,其中编译器不需要assert语句。 删除此块可以解决此问题

invariant
{
    assert(compressionLevel >=0 && compressionLevel <= 9, "invalid zlib compression level");
    assert(targetColorType == ColorType.Any ||
            targetColorType == ColorType.RGB ||
            targetColorType == ColorType.RGBA, "colortype is not supported");
}
这里的旧语法有问题吗?我该如何解决?
是否有其他方法以简单的方式在D中创建png图像?

不确定不变的问题,但第二个问题应该通过将“inout”替换为“ref”(D2语法更改)来解决。

我放弃了lodepng,在上使用了代码
在做了一些小改动之后,它就可以工作了。

我试过了,但是代码中有太多奇怪的错误,编译器在这些替换之后发现了这些错误。
info.backgroundColor.length = chunk.data.length / 2;
foreach(index, inout value; info.backgroundColor)
    value = chunk.data[index * 2];