Created
April 23, 2024 17:07
-
-
Save kalwalt/fa0fadaa6df90a9ad8b87058b1e950f2 to your computer and use it in GitHub Desktop.
test with Vector type instead of Array (Virgil)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def imgProc_gray(width: int, height: int, channels: u8, inputData: Pointer) -> Pointer { | |
var imgProc = ImgProc.new(width, height, channels); | |
var inputData_size = width * height * channels; | |
var internal_data: Vector<byte> = Vector<byte>.new(); | |
for (i = 0; i < inputData_size; i++) { | |
internal_data[i] = (inputData + i).load<byte>(); | |
} | |
return Pointer.atContents(imgProc.grayscale(internal_data)); | |
} | |
/* | |
// This is the error with the Vector version | |
./build.sh | |
[FiltersWasm.v3 @ 29:30] TypeError: cannot infer type parameter T of "atContents" | |
return Pointer.atContents(imgProc.grayscale(internal_data)); | |
^ | |
[FiltersWasm.v3 @ 29:31] TypeError: call requires type Range<?> and found Vector<byte> | |
return Pointer.atContents(imgProc.grayscale(internal_data)); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment