| #include <string> |
| #include <limits> /* std::numeric_limits */ |
| #include <stdexcept> /* std::domain_error(-) */ |
| #include "igs_maxmin_getput.h" |
| #include "igs_maxmin_multithread.h" |
| #include "igs_maxmin.h" |
| |
| void igs::maxmin::convert( |
| |
| const unsigned char *inn, unsigned char *out |
| |
| , |
| const int height, const int width, const int channels, const int bits |
| |
| |
| , |
| const unsigned char *ref |
| , |
| const int ref_bits |
| , |
| const int ref_mode |
| |
| |
| , |
| const double radius |
| , |
| const double smooth_outer_range |
| , |
| const int polygon_number |
| , |
| const double roll_degree |
| |
| |
| , |
| const bool min_sw |
| , |
| const bool alpha_rendering_sw |
| , |
| const bool add_blend_sw |
| |
| |
| , |
| const int number_of_thread |
| ) { |
| if ((igs::image::rgba::siz != channels) && |
| (igs::image::rgb::siz != channels) && (1 != channels) |
| ) { |
| throw std::domain_error("Bad channels,Not rgba/rgb/grayscale"); |
| } |
| |
| if ((std::numeric_limits<unsigned char>::digits == bits) && |
| ((std::numeric_limits<unsigned char>::digits == ref_bits) || |
| (0 == ref_bits))) { |
| igs::maxmin::multithread<unsigned char, unsigned char> mthread( |
| inn, out, height, width, channels |
| |
| , |
| ref, ref_mode |
| |
| , |
| radius, smooth_outer_range, polygon_number, roll_degree, min_sw, |
| alpha_rendering_sw, add_blend_sw, number_of_thread); |
| mthread.run(); |
| mthread.clear(); |
| } else if ((std::numeric_limits<unsigned short>::digits == bits) && |
| ((std::numeric_limits<unsigned char>::digits == ref_bits) || |
| (0 == ref_bits))) { |
| igs::maxmin::multithread<unsigned short, unsigned char> mthread( |
| reinterpret_cast<const unsigned short *>(inn), |
| reinterpret_cast<unsigned short *>(out), height, width, channels |
| |
| , |
| ref, ref_mode |
| |
| , |
| radius, smooth_outer_range, polygon_number, roll_degree, min_sw, |
| alpha_rendering_sw, add_blend_sw, number_of_thread); |
| mthread.run(); |
| mthread.clear(); |
| } else if ((std::numeric_limits<unsigned short>::digits == bits) && |
| (std::numeric_limits<unsigned short>::digits == ref_bits)) { |
| igs::maxmin::multithread<unsigned short, unsigned short> mthread( |
| reinterpret_cast<const unsigned short *>(inn), |
| reinterpret_cast<unsigned short *>(out), height, width, channels |
| |
| , |
| reinterpret_cast<const unsigned short *>(ref), ref_mode |
| |
| , |
| radius, smooth_outer_range, polygon_number, roll_degree, min_sw, |
| alpha_rendering_sw, add_blend_sw, number_of_thread); |
| mthread.run(); |
| mthread.clear(); |
| } else if ((std::numeric_limits<unsigned char>::digits == bits) && |
| (std::numeric_limits<unsigned short>::digits == ref_bits)) { |
| igs::maxmin::multithread<unsigned char, unsigned short> mthread( |
| inn, out, height, width, channels |
| |
| , |
| reinterpret_cast<const unsigned short *>(ref), ref_mode |
| |
| , |
| radius, smooth_outer_range, polygon_number, roll_degree, min_sw, |
| alpha_rendering_sw, add_blend_sw, number_of_thread); |
| mthread.run(); |
| mthread.clear(); |
| } else { |
| throw std::domain_error("Bad bits,Not uchar/ushort"); |
| } |
| } |