void JB2Dict::JB2Codec::Encode::code_image_size(JB2Dict &jim) { CodeNum(0, 0, BIGPOSITIVE, image_size_dist); CodeNum(0, 0, BIGPOSITIVE, image_size_dist); JB2Codec::code_image_size(jim); }
void JB2Dict::JB2Codec::Decode::code_absolute_mark_size(GBitmap &bm, int border) { int xsize=CodeNum(0, BIGPOSITIVE, abs_size_x); int ysize=CodeNum(0, BIGPOSITIVE, abs_size_y); if ((xsize!=(unsigned short)xsize) || (ysize!=(unsigned short)ysize)) G_THROW( ERR_MSG("JB2Image.bad_number") ); bm.init(ysize, xsize, border); }
void JB2Dict::JB2Codec::Decode::code_image_size(JB2Dict &jim) { int w=CodeNum(0, BIGPOSITIVE, image_size_dist); int h=CodeNum(0, BIGPOSITIVE, image_size_dist); if (w || h) G_THROW( ERR_MSG("JB2Image.bad_dict2") ); JB2Codec::code_image_size(jim); }
void JB2Dict::JB2Codec::Encode::code_image_size(JB2Image &jim) { image_columns = jim.get_width(); CodeNum(image_columns, 0, BIGPOSITIVE, image_size_dist); image_rows = jim.get_height(); CodeNum(image_rows, 0, BIGPOSITIVE, image_size_dist); JB2Codec::code_image_size(jim); }
void JB2Dict::JB2Codec::Decode::code_image_size(JB2Image &jim) { image_columns=CodeNum(0, BIGPOSITIVE, image_size_dist); image_rows=CodeNum(0, BIGPOSITIVE, image_size_dist); if (!image_columns || !image_rows) G_THROW( ERR_MSG("JB2Image.zero_dim") ); jim.set_dimension(image_columns, image_rows); JB2Codec::code_image_size(jim); }
void JB2Dict::JB2Codec::Encode::code_absolute_location(JB2Blit *jblt, int rows, int columns) { // Check start record if (!gotstartrecordp) G_THROW( ERR_MSG("JB2Image.no_start") ); // Code TOP and LEFT CodeNum(jblt->left+1, 1, image_columns, abs_loc_x); CodeNum(jblt->bottom+rows-1+1, 1, image_rows, abs_loc_y); }
void JB2Dict::JB2Codec::Decode::code_absolute_location(JB2Blit *jblt, int rows, int columns) { // Check start record if (!gotstartrecordp) G_THROW( ERR_MSG("JB2Image.no_start") ); int left=CodeNum(1, image_columns, abs_loc_x); int top=CodeNum(1, image_rows, abs_loc_y); jblt->bottom = top - rows + 1 - 1; jblt->left = left - 1; }
void JB2Dict::JB2Codec::Decode::code_relative_mark_size(GBitmap &bm, int cw, int ch, int border) { int xdiff=CodeNum(BIGNEGATIVE, BIGPOSITIVE, rel_size_x); int ydiff=CodeNum(BIGNEGATIVE, BIGPOSITIVE, rel_size_y); int xsize = cw + xdiff; int ysize = ch + ydiff; if ((xsize!=(unsigned short)xsize) || (ysize!=(unsigned short)ysize)) G_THROW( ERR_MSG("JB2Image.bad_number") ); bm.init(ysize, xsize, border); }
void JB2Dict::JB2Codec::Encode::code_comment(GUTF8String &comment) { // Encode size int size=comment.length(); CodeNum(size, 0, BIGPOSITIVE, dist_comment_length); for (int i=0; i<size; i++) { CodeNum(comment[i], 0, 255, dist_comment_byte); } }
void JB2Dict::JB2Codec::Decode::code_comment(GUTF8String &comment) { int size=CodeNum(0, BIGPOSITIVE, dist_comment_length); comment.empty(); char *combuf = comment.getbuf(size); for (int i=0; i<size; i++) { combuf[i]=CodeNum(0, 255, dist_comment_byte); } comment.getbuf(); }
int JB2Dict::JB2Codec::Decode::code_match_index(int &index, JB2Dict &) { int match=CodeNum(0, lib2shape.hbound(), dist_match_index); index = lib2shape[match]; return match; }
int JB2Dict::JB2Codec::Encode::code_match_index(int &index, JB2Dict &jim) { int match=shape2lib[index]; CodeNum(match, 0, lib2shape.hbound(), dist_match_index); return match; }
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_relative_mark_size(GBitmap &bm, int cw, int ch, int border) { CodeNum(bm.columns()-cw, BIGNEGATIVE, BIGPOSITIVE, rel_size_x); CodeNum(bm.rows()-ch, BIGNEGATIVE, BIGPOSITIVE, rel_size_y); }
void JB2Dict::JB2Codec::Encode::code_absolute_mark_size(GBitmap &bm, int border) { CodeNum(bm.columns(), 0, BIGPOSITIVE, abs_size_x); CodeNum(bm.rows(), 0, BIGPOSITIVE, abs_size_y); }
inline int JB2Dict::JB2Codec::Encode::get_diff(int x_diff,NumContext &rel_loc) { CodeNum(x_diff, BIGNEGATIVE, BIGPOSITIVE, rel_loc); return x_diff; }
inline int JB2Dict::JB2Codec::Decode::get_diff(int,NumContext &rel_loc) { return CodeNum(BIGNEGATIVE, BIGPOSITIVE, rel_loc); }
void JB2Dict::JB2Codec::Encode::code_inherited_shape_count(JB2Dict &jim) { CodeNum(jim.get_inherited_shape_count(), 0, BIGPOSITIVE, inherited_shape_count_dist); }
inline void JB2Dict::JB2Codec::Encode::code_record_type(int &rectype) { CodeNum(rectype, START_OF_DATA, END_OF_DATA, dist_record_type); }
inline void JB2Dict::JB2Codec::Decode::code_record_type(int &rectype) { rectype=CodeNum( START_OF_DATA, END_OF_DATA, dist_record_type); }