nft-art-engine
Advanced tools
Comparing version 0.1.15 to 0.1.16
@@ -44,2 +44,10 @@ export interface dimention { | ||
export interface sign { | ||
registerFont?: { | ||
path: string; | ||
fontFace?: { | ||
family: string; | ||
weight?: string; | ||
style?: string; | ||
}; | ||
}; | ||
fillStyle: string; | ||
@@ -66,2 +74,11 @@ font: string; | ||
export interface previewConfig { | ||
dimention: dimention; | ||
rarities?: rarities; | ||
layers: layer[]; | ||
blacklist?: blackList; | ||
whitelist?: whiteList; | ||
sign?: sign; | ||
} | ||
export interface compressConfig { | ||
@@ -78,5 +95,3 @@ dimention: dimention; | ||
export declare function preview( | ||
config: generateConfig, | ||
): Promise<Buffer>; | ||
export declare function preview(config: previewConfig): Promise<Buffer>; | ||
@@ -88,5 +103,3 @@ export declare function generate( | ||
export declare function extend( | ||
config: extendConfig, | ||
): Promise<Buffer>; | ||
export declare function extend(config: extendConfig): Promise<Buffer>; | ||
@@ -96,2 +109,2 @@ export declare function compress( | ||
callback: (progress: number, filename: string, image: Buffer) => void | ||
): Promise<void>; | ||
): Promise<void>; |
14
index.js
const fs = require("fs"); | ||
const { createCanvas, loadImage } = require("canvas"); | ||
const { registerFont, createCanvas, loadImage } = require("canvas"); | ||
@@ -168,2 +168,6 @@ const dnaSeparator = "|"; | ||
async function generate(_config, _callback) { | ||
if (_config.sign && _config.sign.registerFont) { | ||
registerFont(_config.sign.registerFont.path, _config.sign.registerFont.fontFace) | ||
} | ||
_config.categories = getCategories(_config.layers) | ||
@@ -216,2 +220,6 @@ _config.layers = getNoneRarity(_config.layers) | ||
async function extend(_config) { | ||
if (_config.sign && _config.sign.registerFont) { | ||
registerFont(_config.sign.registerFont.path, _config.sign.registerFont.fontFace) | ||
} | ||
const canvas = createCanvas(_config.dimention.width, _config.dimention.height); | ||
@@ -239,2 +247,6 @@ const ctx = canvas.getContext("2d"); | ||
async function preview(_config) { | ||
if (_config.sign && _config.sign.registerFont) { | ||
registerFont(_config.sign.registerFont.path, _config.sign.registerFont.fontFace) | ||
} | ||
_config.categories = getCategories(_config.layers) | ||
@@ -241,0 +253,0 @@ _config.layers = getNoneRarity(_config.layers) |
{ | ||
"name": "nft-art-engine", | ||
"version": "0.1.15", | ||
"version": "0.1.16", | ||
"description": "NFT ART Engine is a package used to create multiple different instances of artworks based on provided layers.", | ||
@@ -5,0 +5,0 @@ "author": "Bagus Abdul Kurniawan", |
234507
327