Function
Static Public Summary | ||
public |
copyPixelToRect(srcImage: Image, srcX: number, srcY: number, destImage: Image, destX: number, destY: number, destW: number, destH: number) This copies the source pixel to every pixel in the destination rectangle without any alpha blending. |
|
public |
copyPixels(srcImage: Image, srcX: number, srcY: number, srcW: number, srcH: number, destImage: Image, destX: number, destY: number) This copies the source pixels to the destination without any alpha blending. |
|
public |
async extrudeTilesetToBuffer(tileWidth: integer, tileHeight: integer, inputPath: string, options: object): Promise<Buffer> Accepts an image path and returns a Promise that resolves to a Buffer containing the extruded tileset image. |
|
public |
async extrudeTilesetToImage(tileWidth: integer, tileHeight: integer, inputPath: string, outputPath: string, options: object): Promise Accepts an image path and saves out an extruded version of the tileset to |
|
public |
async extrudeTilesetToJimp(tileWidth: integer, tileHeight: integer, inputPath: string, options: object): Promise<Image> Accepts an image path and returns a Jimp image object containing the extruded image. |
Static Public
public copyPixelToRect(srcImage: Image, srcX: number, srcY: number, destImage: Image, destX: number, destY: number, destW: number, destH: number) source
import {copyPixelToRect} from 'tile-extruder/src/copy-pixels.js'
This copies the source pixel to every pixel in the destination rectangle without any alpha blending.
Params:
Name | Type | Attribute | Description |
srcImage | Image | A Jimp image to copy pixel from. |
|
srcX | number | X position of the source pixel. |
|
srcY | number | Y position of the source pixel. |
|
destImage | Image | A Jimp image to paste the pixel to. |
|
destX | number | X position to start pasting to (left). |
|
destY | number | Y position to start pasting to (top). |
|
destW | number | The width of the destination region. |
|
destH | number | The height of the destination region. |
public copyPixels(srcImage: Image, srcX: number, srcY: number, srcW: number, srcH: number, destImage: Image, destX: number, destY: number) source
import {copyPixels} from 'tile-extruder/src/copy-pixels.js'
This copies the source pixels to the destination without any alpha blending.
Params:
Name | Type | Attribute | Description |
srcImage | Image | A Jimp image to copy pixels from. |
|
srcX | number | X position to start copying from (left). |
|
srcY | number | Y position to start copying from (top). |
|
srcW | number | The width of the region to copy. |
|
srcH | number | The height of the region to copy. |
|
destImage | Image | A Jimp image to paste the pixels to. |
|
destX | number | X position to start pasting to (left). |
|
destY | number | Y position to start pasting to (top). |
public async extrudeTilesetToBuffer(tileWidth: integer, tileHeight: integer, inputPath: string, options: object): Promise<Buffer> source
import {extrudeTilesetToBuffer} from 'tile-extruder'
Accepts an image path and returns a Promise that resolves to a Buffer containing the extruded tileset image.
Params:
Name | Type | Attribute | Description |
tileWidth | integer | tile width in pixels. |
|
tileHeight | integer | tile height in pixels. |
|
inputPath | string | the path to the tileset you want to extrude. |
|
options | object |
|
optional settings. |
options.mime | string |
|
the mime type that should be used for the buffer. Defaults to Jimp.AUTO which tries to use the image's original mime type, and if not available, uses png. Supported mime options: "image/png", "image/jpeg", "image/bmp". |
options.margin | integer |
|
number of pixels between tiles and the edge of the tileset image. |
options.spacing | integer |
|
number of pixels between neighboring tiles. |
options.extrusion | integer |
|
number of pixels to extrude the tiles. |
options.color | number |
|
color to use for the background color, which only matters if there is margin or spacing. This is passed directly to jimp which takes RGBA hex or a CSS color string, e.g. '#FF0000'. This defaults to transparent white. |
public async extrudeTilesetToImage(tileWidth: integer, tileHeight: integer, inputPath: string, outputPath: string, options: object): Promise source
import {extrudeTilesetToImage} from 'tile-extruder'
Accepts an image path and saves out an extruded version of the tileset to outputPath
. It
returns a Promise that resolves when the file has finished saving.
Params:
Name | Type | Attribute | Description |
tileWidth | integer | tile width in pixels. |
|
tileHeight | integer | tile height in pixels. |
|
inputPath | string | the path to the tileset you want to extrude. |
|
outputPath | string | the path to output the extruded tileset image. |
|
options | object |
|
optional settings. |
options.margin | integer |
|
number of pixels between tiles and the edge of the tileset image. |
options.spacing | integer |
|
number of pixels between neighboring tiles. |
options.extrusion | integer |
|
number of pixels to extrude the tiles. |
options.color | number |
|
color to use for the background color, which only matters if there is margin or spacing. This is passed directly to jimp which takes RGBA hex or a CSS color string, e.g. '#FF0000'. This defaults to transparent white. |
public async extrudeTilesetToJimp(tileWidth: integer, tileHeight: integer, inputPath: string, options: object): Promise<Image> source
import {extrudeTilesetToJimp} from 'tile-extruder'
Accepts an image path and returns a Jimp image object containing the extruded image. This is exposed for advanced image processing purposes. For more common uses, see extrudeTilesetToImage or extrudeTilesetToBuffer. It returns a Promise that resolves when it is finished extruding the image.
Params:
Name | Type | Attribute | Description |
tileWidth | integer | tile width in pixels. |
|
tileHeight | integer | tile height in pixels. |
|
inputPath | string | the path to the tileset you want to extrude. |
|
options | object |
|
optional settings. |
options.margin | integer |
|
number of pixels between tiles and the edge of the tileset image. |
options.spacing | integer |
|
number of pixels between neighboring tiles. |
options.extrusion | integer |
|
number of pixels to extrude the tiles. |
options.color | number |
|
color to use for the background color, which only matters if there is margin or spacing. This is passed directly to jimp which takes RGBA hex or a CSS color string, e.g. '#FF0000'. This defaults to transparent white. |