diff --git a/.github/workflows/cimg.yml b/.github/workflows/cimg.yml index f3f23a7..132c0fb 100644 --- a/.github/workflows/cimg.yml +++ b/.github/workflows/cimg.yml @@ -23,7 +23,7 @@ jobs: name: Update CImg.h runs-on: ubuntu-latest needs: check-version - if: ${{ needs.check-version.outputs.latest-tag != 'v.3.3.4' }} + if: ${{ needs.check-version.outputs.latest-tag != 'v.3.3.5' }} steps: - uses: actions/checkout@v2 name: Checkout this repository @@ -36,7 +36,7 @@ jobs: location: 'src' - name: Commit new CImg version (and update script) run: | - sed -i 's/v.3.3.4/${{ needs.check-version.outputs.latest-tag }}/' .github/workflows/cimg.yml + sed -i 's/v.3.3.5/${{ needs.check-version.outputs.latest-tag }}/' .github/workflows/cimg.yml git config user.name 'GitHub Actions' git config user.email 'actions@github.com' git commit -am "Update CImg to ${{ needs.check-version.outputs.latest-tag }}" diff --git a/src/CImg.h b/src/CImg.h index ca2a4df..9d776d6 100644 --- a/src/CImg.h +++ b/src/CImg.h @@ -54,7 +54,7 @@ // Set version number of the library. #ifndef cimg_version -#define cimg_version 334 +#define cimg_version 335 /*----------------------------------------------------------- # @@ -20599,9 +20599,7 @@ namespace cimg_library { (*ns!=')' || level[ns - expr._data]!=clevel)) ++ns; arg2 = compile(s,ns,depth1,0,block_flags); if (is_vector(arg2)) // Vector argument allowed to specify cordinates and color - CImg::sequence(size(arg2),arg2 + 1, - arg2 + (ulongT)size(arg2)). - move_to(l_opcode); + CImg::sequence(size(arg2),arg2 + 1,arg2 + (ulongT)size(arg2)).move_to(l_opcode); else CImg::vector(arg2).move_to(l_opcode); s = ns; @@ -20887,6 +20885,32 @@ namespace cimg_library { _cimg_mp_return(p3); } + if (!std::strncmp(ss,"flood(",6)) { // Flood fill image + if (!is_inside_critical) is_parallelizable = false; + _cimg_mp_op("Function 'flood()'"); + if (*ss6=='#') { // Index specified + s0 = ss7; while (s0::vector((ulongT)mp_flood,_cimg_mp_slot_nan,0,p1).move_to(l_opcode); + for (s = s0; s::sequence(size(arg2),arg2 + 1,arg2 + (ulongT)size(arg2)).move_to(l_opcode); + else + CImg::vector(arg2).move_to(l_opcode); + s = ns; + } + (l_opcode>'y').move_to(opcode); + opcode[2] = opcode._height; + opcode.move_to(code); + _cimg_mp_return_nan(); + } + if (!std::strncmp(ss,"floor(",6)) { // Floor _cimg_mp_op("Function 'floor()'"); arg1 = compile(ss6,se1,depth1,0,block_flags); @@ -21209,7 +21233,7 @@ namespace cimg_library { _cimg_mp_op("Function 'isbool()'"); if (ss7==se1) _cimg_mp_return(0); try { arg1 = compile(ss7,se1,depth1,0,block_flags); } - catch(CImgException&) { _cimg_mp_return(0); } + catch (CImgException&) { _cimg_mp_return(0); } if (is_vector(arg1)) _cimg_mp_vector1_v(mp_isbool,arg1); if (is_const_scalar(arg1)) _cimg_mp_return(mem[arg1]==0. || mem[arg1]==1.); _cimg_mp_scalar1(mp_isbool,arg1); @@ -21219,7 +21243,7 @@ namespace cimg_library { _cimg_mp_op("Function 'isconst()'"); if (ss8==se1) _cimg_mp_return(0); try { arg1 = compile(ss8,se1,depth1,0,block_flags); } - catch(CImgException&) { _cimg_mp_return(0); } + catch (CImgException&) { _cimg_mp_return(0); } if (is_const_scalar(arg1)) _cimg_mp_return(1); _cimg_mp_return(0); } @@ -21274,12 +21298,27 @@ namespace cimg_library { if (!std::strncmp(ss,"isint(",6)) { // Is integer? _cimg_mp_op("Function 'isint()'"); if (ss6==se1) _cimg_mp_return(0); - try { arg1 = compile(ss6,se1,depth1,0,block_flags); } - catch(CImgException&) { _cimg_mp_return(0); } - if (is_vector(arg1)) _cimg_mp_vector1_v(mp_isint,arg1); - if (is_const_scalar(arg1)) - _cimg_mp_return((unsigned int)((double)(longT)mem[arg1]==mem[arg1])); - _cimg_mp_scalar1(mp_isint,arg1); + s1 = ss6; while (s1=mem[arg2]); + _cimg_mp_return(is_sth && val>=mem[arg2] && val<=mem[arg3]); + } + _cimg_mp_scalar3(mp_isint,arg1,arg2,arg3); } if (!std::strncmp(ss,"isnan(",6)) { // Is NaN? @@ -25668,6 +25707,46 @@ namespace cimg_library { return p2 &img = ind==~0U?mp.imgout:mp.imglist[ind]; + CImg color(img._spectrum,1,1,1,0); + bool is_high_connectivity = false; + float tolerance = 0, opacity = 1; + int x0 = 0, y0 = 0, z0 = 0; + unsigned int i = 4; + if (i::nan(); + } + static double mp_floor(_cimg_math_parser& mp) { return std::floor(_mp_arg(2)); } @@ -26177,7 +26256,11 @@ namespace cimg_library { } static double mp_isint(_cimg_math_parser& mp) { - return (double)((double)(longT)_mp_arg(2)==_mp_arg(2)); + double val = _mp_arg(2), intpart; + const bool is_int = std::modf(val,&intpart)==0; + if (mp.opcode[3]==~0U) return is_int; + if (mp.opcode[4]==~0U) return is_int && val>=_mp_arg(3); + return is_int && val>=_mp_arg(3) && val<=_mp_arg(4); } static double mp_isfile(_cimg_math_parser& mp) {