0

您好我正在尝试将 QR 库 quirc 转换为 WASM。为此,我编写了一个 C++ 包装器,这样我就可以使用 webIDL 使转换更加直接。但是,我在 webIDL 中定义数组类型时遇到了麻烦。下一个片段的正确 webIDL 是什么

        struct Point {
            int x;
            int y;
        };

        struct Code {
            /* The four corners of the QR-code, from top left, clockwise */
            Point corners[4];

            /* The number of cells across in the QR-code. The cell bitmap
            * is a bitmask giving the actual values of cells. If the cell
            * at (x, y) is black, then the following bit is set:
            *
            *     cell_bitmap[i >> 3] & (1 << (i & 7))
            *
            * where i = (y * size) + x.
            */
            int         size;
            uint8_t     cell_bitmap[QUIRC_MAX_BITMAP];
        };

4

1 回答 1

0

下面的 idl 文件有效

interface Point {
    attribute long x;
    attribute long y;
};

interface Code {
    [Value] attribute Point[] corners;
    attribute long size;
    [BoundsChecked] attribute byte[] cell_bitmap;
};
于 2020-05-29T15:03:32.697 回答