[GD Nativescript] Help converting raw image data to a uint8_t array

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By XeroWolf

Hi guys I’m really stuck on this one. I’m trying to add some functionally from and external library via GD Native. It accepts image data as a uint8_t pointer or array with each RGBA channel being an element in the array:

uint8_t* image_data = (uint8_t*)malloc(1920 * 1080 * 4);
    
video_frame.p_data = image_data;
    
// Semi transparent Red as RGBA
image_data[0] = 255;
image_data[1] = 0;
image_data[3] = 0;
image_data[4] = 128;

From my understanding Godot outputs image data as a PoolByteArray but I have no idea how to go about converting it to uint8_t.
Any suggestions on how I can tackle this problem will be greatly appreciated.
Thanks