Skip to content

This is a question, not an issue #2

@q-hung

Description

@q-hung

Sorry for asking you here, but I'm trying to understand your code.

function filter(imageData) {
    const bufferPointerIn = 1024,
        {data, width, height} = imageData,
        bufferIn = new Uint8Array(wasmModule.memory.buffer, bufferPointerIn, width * height * 4),
        bufferPointerOut = 2048 + width * height * 4,
        bufferOut = new Uint8Array(wasmModule.memory.buffer, bufferPointerOut, width * height * 4);

    bufferIn.set(data);
    wasmModule.outline_c(bufferPointerIn, bufferPointerOut, width, height);
    data.set(bufferOut);
    return data;
}

I just wonder how bufferPointerIn and bufferPointerOut work? In the C code, they areunsigned char* buffer_in and unsigned char* buffer_out. How can we use two byteOffset as pointers? I am looking forward for you answer. Danke sehr!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions