public void blur_x(IImageByte img, int radius) { throw new NotImplementedException(); #if false if (radius < 1) { return; } int x, y, xp, i; int stack_ptr; int stack_start; color_type pix; color_type * stack_pix; calculator_type sum; calculator_type sum_in; calculator_type sum_out; int w = img.width(); int h = img.height(); int wm = w - 1; int div = radius * 2 + 1; int div_sum = (radius + 1) * (radius + 1); int mul_sum = 0; int shr_sum = 0; int max_val = base_mask; if (max_val <= 255 && radius < 255) { mul_sum = stack_blur_tables.g_stack_blur8_mul[radius]; shr_sum = stack_blur_tables.g_stack_blur8_shr[radius]; } m_buf.allocate(w, 128); m_stack.allocate(div, 32); for (y = 0; y < h; y++) { sum.clear(); sum_in.clear(); sum_out.clear(); pix = img.pixel(0, y); for (i = 0; i <= radius; i++) { m_stack[i] = pix; sum.add(pix, i + 1); sum_out.add(pix); } for (i = 1; i <= radius; i++) { pix = img.pixel((i > wm) ? wm : i, y); m_stack[i + radius] = pix; sum.add(pix, radius + 1 - i); sum_in.add(pix); } stack_ptr = radius; for (x = 0; x < w; x++) { if (mul_sum) { sum.calc_pix(m_buf[x], mul_sum, shr_sum); } else { sum.calc_pix(m_buf[x], div_sum); } sum.sub(sum_out); stack_start = stack_ptr + div - radius; if (stack_start >= div) { stack_start -= div; } stack_pix = &m_stack[stack_start]; sum_out.sub(*stack_pix); xp = x + radius + 1; if (xp > wm) { xp = wm; } pix = img.pixel(xp, y); *stack_pix = pix; sum_in.add(pix); sum.add(sum_in); ++stack_ptr; if (stack_ptr >= div) { stack_ptr = 0; } stack_pix = &m_stack[stack_ptr]; sum_out.add(*stack_pix); sum_in.sub(*stack_pix); } img.copy_color_hspan(0, y, w, &m_buf[0]); } #endif }
public void blur_x(IImageByte img, int radius) { throw new NotImplementedException(); #if false if(radius < 1) return; int x, y, xp, i; int stack_ptr; int stack_start; color_type pix; color_type* stack_pix; calculator_type sum; calculator_type sum_in; calculator_type sum_out; int w = img.width(); int h = img.height(); int wm = w - 1; int div = radius * 2 + 1; int div_sum = (radius + 1) * (radius + 1); int mul_sum = 0; int shr_sum = 0; int max_val = base_mask; if(max_val <= 255 && radius < 255) { mul_sum = stack_blur_tables.g_stack_blur8_mul[radius]; shr_sum = stack_blur_tables.g_stack_blur8_shr[radius]; } m_buf.allocate(w, 128); m_stack.allocate(div, 32); for(y = 0; y < h; y++) { sum.clear(); sum_in.clear(); sum_out.clear(); pix = img.pixel(0, y); for(i = 0; i <= radius; i++) { m_stack[i] = pix; sum.add(pix, i + 1); sum_out.add(pix); } for(i = 1; i <= radius; i++) { pix = img.pixel((i > wm) ? wm : i, y); m_stack[i + radius] = pix; sum.add(pix, radius + 1 - i); sum_in.add(pix); } stack_ptr = radius; for(x = 0; x < w; x++) { if(mul_sum) sum.calc_pix(m_buf[x], mul_sum, shr_sum); else sum.calc_pix(m_buf[x], div_sum); sum.sub(sum_out); stack_start = stack_ptr + div - radius; if(stack_start >= div) stack_start -= div; stack_pix = &m_stack[stack_start]; sum_out.sub(*stack_pix); xp = x + radius + 1; if(xp > wm) xp = wm; pix = img.pixel(xp, y); *stack_pix = pix; sum_in.add(pix); sum.add(sum_in); ++stack_ptr; if(stack_ptr >= div) stack_ptr = 0; stack_pix = &m_stack[stack_ptr]; sum_out.add(*stack_pix); sum_in.sub(*stack_pix); } img.copy_color_hspan(0, y, w, &m_buf[0]); } #endif }