public static RleElement[] createArray(int i_length) { RleElement[] ret = new RleElement[i_length]; for (int i = 0; i < i_length; i++) { ret[i] = new RleElement(); } return(ret); }
protected void initInstance(int i_width, int i_height) { this._raster_size.setValue(i_width, i_height); //120KB/QVGA +4K long t = (long)i_width * i_height * 3000 / (320 * 240) + 100;//full HD support this._rlestack = new RleInfoStack((int)t); this._rle1 = RleElement.createArray(i_width / 2 + 1); this._rle2 = RleElement.createArray(i_width / 2 + 1); this._max_area = AR_AREA_MAX; this._min_area = AR_AREA_MIN; return; }
/** * フラグメントをRLEスタックへ追加する。 * @param i_rel_img * @param i_nof * @param i_row_index * @param o_stack * @return * @ */ private bool addFragment(RleElement i_rel_img, int i_nof, int i_row_index, RleInfoStack o_stack) { int l = i_rel_img.l; int len = i_rel_img.r - l; i_rel_img.fid = i_nof;// REL毎の固有ID NyARRleLabelFragmentInfo v = o_stack.prePush(); if (v == null) { return(false); } v.entry_x = l; v.area = len; v.clip_l = l; v.clip_r = i_rel_img.r - 1; v.clip_t = i_row_index; v.clip_b = i_row_index; v.pos_x = (len * (2 * l + (len - 1))) / 2; v.pos_y = i_row_index * len; return(true); }