1 line
5.5 KiB
Plaintext
1 line
5.5 KiB
Plaintext
|
{"version":3,"sources":["../src/index.js"],"names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round"],"mappings":";;;;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,CADW,EACRC,EADQ,EACJ;AACd;AACA,UAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,UAAID,CAAC,GAAG,CAAR,EAAW;AACT,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,0BAAtB,EAAkDF,EAAlD,CAAP;AACD;;AAED,UAAMG,EAAE,GAAGC,IAAI,CAACC,IAAL,CAAUN,CAAC,GAAG,IAAd,CAAX,CAVc,CAUkB;;AAChC,UAAMO,KAAK,GAAGH,EAAE,GAAG,CAAL,GAAS,CAAvB;AACA,UAAMI,GAAG,GAAGR,CAAC,GAAGA,CAAJ,GAAQ,CAApB;AACA,UAAMS,KAAK,GAAGD,GAAG,GAAGH,IAAI,CAACK,EAAzB;AAEA,UAAMC,OAAO,GAAG,EAAhB;;AAEA,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,KAApB,EAA2BK,CAAC,EAA5B,EAAgC;AAC9BD,QAAAA,OAAO,CAACC,CAAD,CAAP,GAAa,EAAb;;AACA,aAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,KAApB,EAA2BM,CAAC,EAA5B,EAAgC;AAC9B,cAAMC,GAAG,GAAG,SAACD,CAAC,GAAGT,EAAL,EAAY,CAAZ,aAAiBQ,CAAC,GAAGR,EAArB,EAA4B,CAA5B,CAAZ;AACAO,UAAAA,OAAO,C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@jimp/utils';\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== 'number') {\n return throwError.call(this, 'r must be a number', cb);\n }\n\n if (r < 1) {\n return throwError.call(this, 'r must be greater than 0', cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++
|