void JB2Dict::JB2Codec::init_library(JB2Dict &jim) { int nshape = jim.get_inherited_shape_count(); shape2lib.resize(0,nshape-1); lib2shape.resize(0,nshape-1); libinfo.resize(0,nshape-1); for (int i=0; i<nshape; i++) { shape2lib[i] = i; lib2shape[i] = i; jim.get_bounding_box(i, libinfo[i]); } }
void JB2Dict::JB2Codec::init_library(JB2Dict &jim) { int nshape = jim.get_inherited_shape_count(); shape2lib.resize(0,nshape-1); lib2shape.resize(0,nshape-1); libinfo.resize(0,nshape-1); for (int i=0; i<nshape; i++) { shape2lib[i] = i; lib2shape[i] = i; JB2Shape &jshp = jim.get_shape(i); libinfo[i].compute_bounding_box(*(jshp.bits)); } }
void JB2Dict::JB2Codec::Decode::code_inherited_shape_count(JB2Dict &jim) { int size=CodeNum(0, BIGPOSITIVE, inherited_shape_count_dist); { GP<JB2Dict> dict = jim.get_inherited_dict(); if (!dict && size>0) { // Call callback function to obtain dictionary if (cbfunc) dict = (*cbfunc)(cbarg); if (dict) jim.set_inherited_dict(dict); } if (!dict && size>0) G_THROW( ERR_MSG("JB2Image.need_dict") ); if (dict && size!=dict->get_shape_count()) G_THROW( ERR_MSG("JB2Image.bad_dict") ); } }
void JB2Dict::JB2Codec::Encode::code_inherited_shape_count(JB2Dict &jim) { CodeNum(jim.get_inherited_shape_count(), 0, BIGPOSITIVE, inherited_shape_count_dist); }