from ctypes import CDLL, POINTER, byref, c_float, cast, c_void_p
from numpy import ndarray
import cupy as cp

from structs.pic_struct import PicStruct


def init_device(strip_value: cp.ndarray, field: PicStruct, lib: CDLL):
  width = strip_value.shape[0]
  height = strip_value.shape[1]
  # strip_type = (c_float * width) * height
  # strip = strip_type()
  # for i in range(width):
  #   for j in range(height):
  #       strip[i][j] = c_float(strip_value[i][j])
        # print(strip[i][j])
  # lib.init_device(width, height, byref(strip))
  lib.init_device(width, height, c_void_p(strip_value.data.ptr))
  # field.strip = cast(strip, POINTER(c_float))