????

Your IP : 18.190.158.76


Current Path : C:/inetpub/vhost/invest.gdtsolutions.vn/api/node_modules/@jimp/plugin-resize/es/
Upload File :
Current File : C:/inetpub/vhost/invest.gdtsolutions.vn/api/node_modules/@jimp/plugin-resize/es/index.js.map

{"version":3,"file":"index.js","names":["throwError","isNodePattern","Resize","Resize2","constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","class","resize","w","h","mode","cb","call","constructor","AUTO","bitmap","width","height","Math","round","dst","data","Buffer","alloc","image","buffer","from"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nimport Resize from \"./modules/resize\";\nimport Resize2 from \"./modules/resize2\";\n\nexport default () => ({\n  constants: {\n    RESIZE_NEAREST_NEIGHBOR: \"nearestNeighbor\",\n    RESIZE_BILINEAR: \"bilinearInterpolation\",\n    RESIZE_BICUBIC: \"bicubicInterpolation\",\n    RESIZE_HERMITE: \"hermiteInterpolation\",\n    RESIZE_BEZIER: \"bezierInterpolation\",\n  },\n\n  class: {\n    /**\n     * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n     * @param {number} w the width to resize the image to (or Jimp.AUTO)\n     * @param {number} h the height to resize the image to (or Jimp.AUTO)\n     * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n     * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n     * @returns {Jimp} this for chaining of methods\n     */\n    resize(w, h, mode, cb) {\n      if (typeof w !== \"number\" || typeof h !== \"number\") {\n        return throwError.call(this, \"w and h must be numbers\", cb);\n      }\n\n      if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n        cb = mode;\n        mode = null;\n      }\n\n      if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n        return throwError.call(this, \"w and h cannot both be set to auto\", cb);\n      }\n\n      if (w === this.constructor.AUTO) {\n        w = this.bitmap.width * (h / this.bitmap.height);\n      }\n\n      if (h === this.constructor.AUTO) {\n        h = this.bitmap.height * (w / this.bitmap.width);\n      }\n\n      if (w < 0 || h < 0) {\n        return throwError.call(this, \"w and h must be positive numbers\", cb);\n      }\n\n      // round inputs\n      w = Math.round(w) || 1;\n      h = Math.round(h) || 1;\n\n      if (typeof Resize2[mode] === \"function\") {\n        const dst = {\n          data: Buffer.alloc(w * h * 4),\n          width: w,\n          height: h,\n        };\n        Resize2[mode](this.bitmap, dst);\n        this.bitmap = dst;\n      } else {\n        const image = this;\n        const resize = new Resize(\n          this.bitmap.width,\n          this.bitmap.height,\n          w,\n          h,\n          true,\n          true,\n          (buffer) => {\n            image.bitmap.data = Buffer.from(buffer);\n            image.bitmap.width = w;\n            image.bitmap.height = h;\n          }\n        );\n        resize.resize(this.bitmap.data);\n      }\n\n      if (isNodePattern(cb)) {\n        cb.call(this, null, this);\n      }\n\n      return this;\n    },\n  },\n});\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,OAAOC,MAAM,MAAM,kBAAkB;AACrC,OAAOC,OAAO,MAAM,mBAAmB;AAEvC,gBAAe,OAAO;EACpBC,SAAS,EAAE;IACTC,uBAAuB,EAAE,iBAAiB;IAC1CC,eAAe,EAAE,uBAAuB;IACxCC,cAAc,EAAE,sBAAsB;IACtCC,cAAc,EAAE,sBAAsB;IACtCC,aAAa,EAAE;EACjB,CAAC;EAEDC,KAAK,EAAE;IACL;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,MAAM,CAACC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,EAAE,EAAE;MACrB,IAAI,OAAOH,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;QAClD,OAAOb,UAAU,CAACgB,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAED,EAAE,CAAC;MAC7D;MAEA,IAAI,OAAOD,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;QA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