From 33d5f503120e2de18afd3407976e1b1101d8f219 Mon Sep 17 00:00:00 2001 From: "adam :)" <48551808+Pyrojs@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:56:51 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=92=96=20Bobross?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/module/montage/bobross.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/module/montage/bobross.js diff --git a/src/module/montage/bobross.js b/src/module/montage/bobross.js new file mode 100644 index 0000000..bc33393 --- /dev/null +++ b/src/module/montage/bobross.js @@ -0,0 +1,22 @@ +const { createCanvas, loadImage } = require("canvas"); + +class Bobross { + /** + * Bobross + * @param {image} image1 + */ + async getImage(image1){ + if (!image1) throw new Error(`You must provide an image as argument.`); + const base = await loadImage(`${__dirname}/../../assets/bobross.png`); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext("2d"); + image1 = await loadImage(image1); + ctx.fillStyle = "white"; + ctx.fillRect(0, 0, base.width, base.height); + ctx.drawImage(image1, 15, 20, 440, 440); + ctx.drawImage(base, 0, 0); + return canvas.toBuffer() + } +} + +// -N²O Pyro ;) From 11c501fe5a8033ba6d0444bae8b2f9b2f118b5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=A4KayJayDee?= Date: Fri, 17 Jul 2020 14:15:33 +0200 Subject: [PATCH 2/2] Exported the Bobross class --- src/module/montage/bobross.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module/montage/bobross.js b/src/module/montage/bobross.js index bc33393..4ea107c 100644 --- a/src/module/montage/bobross.js +++ b/src/module/montage/bobross.js @@ -1,6 +1,6 @@ const { createCanvas, loadImage } = require("canvas"); -class Bobross { +module.exports = class Bobross { /** * Bobross * @param {image} image1