af_array array::array_proxy::get() const { array tmp = *this; af_array out = 0; AF_THROW(af_retain_array(&out, tmp.get())); return out; }
af_err af_color_space(af_array *out, const af_array image, const af_cspace_t to, const af_cspace_t from) { if (from==to) { return af_retain_array(out, image); } switch(from) { case AF_GRAY : return convert<AF_GRAY >(out, image, to); case AF_RGB : return convert<AF_RGB >(out, image, to); case AF_HSV : return convert<AF_HSV >(out, image, to); case AF_YCbCr: return convert<AF_YCbCr>(out, image, to); default: return AF_ERR_ARG; } }
/////////////////////////////////////////////////////////////////////////// // Operator = /////////////////////////////////////////////////////////////////////////// array& array::operator=(const array &other) { if (this->get() == other.get()) { return *this; } //TODO: Unsafe. loses data if af_weak_copy fails if(this->arr != 0) { AF_THROW(af_release_array(this->arr)); } af_array temp = 0; AF_THROW(af_retain_array(&temp, other.get())); this->arr = temp; return *this; }
array::array(const array& in) : arr(0) { AF_THROW(af_retain_array(&arr, in.get())); }