atVec<T> method

T atVec<T>(
  1. int row,
  2. int col
)

Implementation

T atVec<T>(int row, int col) {
  // Vec2b, Vec3b, Vec4b
  if (T == Vec2b) {
    return Vec2b.fromPointer(ccore.cv_Mat_get_Vec2b(ref, row, col)) as T;
  } else if (T == Vec3b) {
    return Vec3b.fromPointer(ccore.cv_Mat_get_Vec3b(ref, row, col)) as T;
  } else if (T == Vec4b) {
    return Vec4b.fromPointer(ccore.cv_Mat_get_Vec4b(ref, row, col)) as T;
  }
  // Vec2w, Vec3w, Vec4w
  else if (T == Vec2w) {
    return Vec2w.fromPointer(ccore.cv_Mat_get_Vec2w(ref, row, col)) as T;
  } else if (T == Vec3w) {
    return Vec3w.fromPointer(ccore.cv_Mat_get_Vec3w(ref, row, col)) as T;
  } else if (T == Vec4w) {
    return Vec4w.fromPointer(ccore.cv_Mat_get_Vec4w(ref, row, col)) as T;
  }
  // Vec2s, Vec3s, Vec4s
  else if (T == Vec2s) {
    return Vec2s.fromPointer(ccore.cv_Mat_get_Vec2s(ref, row, col)) as T;
  } else if (T == Vec3s) {
    return Vec3s.fromPointer(ccore.cv_Mat_get_Vec3s(ref, row, col)) as T;
  } else if (T == Vec4s) {
    return Vec4s.fromPointer(ccore.cv_Mat_get_Vec4s(ref, row, col)) as T;
  }
  // Vec2i, Vec3i, Vec4i, Vec6i, Vec8i
  else if (T == Vec2i) {
    return Vec2i.fromPointer(ccore.cv_Mat_get_Vec2i(ref, row, col)) as T;
  } else if (T == Vec3i) {
    return Vec3i.fromPointer(ccore.cv_Mat_get_Vec3i(ref, row, col)) as T;
  } else if (T == Vec4i) {
    return Vec4i.fromPointer(ccore.cv_Mat_get_Vec4i(ref, row, col)) as T;
  } else if (T == Vec6i) {
    return Vec6i.fromPointer(ccore.cv_Mat_get_Vec6i(ref, row, col)) as T;
  } else if (T == Vec8i) {
    return Vec8i.fromPointer(ccore.cv_Mat_get_Vec8i(ref, row, col)) as T;
  }
  // Vec2f, Vec3f, Vec4f, Vec6f
  else if (T == Vec2f) {
    return Vec2f.fromPointer(ccore.cv_Mat_get_Vec2f(ref, row, col)) as T;
  } else if (T == Vec3f) {
    return Vec3f.fromPointer(ccore.cv_Mat_get_Vec3f(ref, row, col)) as T;
  } else if (T == Vec4f) {
    return Vec4f.fromPointer(ccore.cv_Mat_get_Vec4f(ref, row, col)) as T;
  } else if (T == Vec6f) {
    return Vec6f.fromPointer(ccore.cv_Mat_get_Vec6f(ref, row, col)) as T;
  }
  // Vec2d, Vec3d, Vec4d, Vec6d
  else if (T == Vec2d) {
    return Vec2d.fromPointer(ccore.cv_Mat_get_Vec2d(ref, row, col)) as T;
  } else if (T == Vec3d) {
    return Vec3d.fromPointer(ccore.cv_Mat_get_Vec3d(ref, row, col)) as T;
  } else if (T == Vec4d) {
    return Vec4d.fromPointer(ccore.cv_Mat_get_Vec4d(ref, row, col)) as T;
  } else if (T == Vec6d) {
    return Vec6d.fromPointer(ccore.cv_Mat_get_Vec6d(ref, row, col)) as T;
  } else {
    throw UnsupportedError("at<$T>() for ${type.asString()} is not supported!");
  }
}