有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java stbi_加载方法不接受我的参数

bi = ImageIO.read(new File(filename));
width = bi.getWidth();
height = bi.getHeight();
            
ByteBuffer data = stbi_load("/sprites/" + filename, width, height, 0, 0);

出于某种原因,stbi_load不接受方法中的第二个、第三个和第四个参数,即使它们都是有效的整数。它给出了以下错误

The method stbi_load(ByteBuffer, IntBuffer, IntBuffer, IntBuffer, int) in the type STBImage is not applicable for the arguments (String, int, int, int, int).

知道为什么会这样吗?任何答案都将不胜感激


共 (1) 个答案

  1. # 1 楼答案

    请出示stbi_load方法签名

    也许它需要ByteBufferIntBuffer类型的参数,而不是您提供的Stringint类型的参数