🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

image-mosaic

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-mosaic

Set image mosaic.

1.0.4
latest
Source
npm
Version published
Weekly downloads
4
-55.56%
Maintainers
1
Weekly downloads
 
Created
Source

image-mosaic

Set mosaic to image by canvas.

    import Mosaic from 'image-mosaic';

    const canvas = document.querySelector('#canvas');
    const ctx = canvas.getContext('2d');

    const mosaic =  new Mosaic(ctx, {
        tileWidth: 10,
        tileHeight: 10,
        brushSize: 3,
    });

    // Mosaic on full image.
    mosaic.drawAllTiles();

Instance property

{
    context, // canvas context.
    imageData, // canvas image data.
    width, // canvas width.
    height, // canvas height.
    tileWidth,
    tileHeight,
    tileRowSize, // tile count in a row.
    tileColumnSize, // tile count in a column.
    tiles: [ // tiles.
        {
            row, // tile row position.
            column, // tile column position.
            pixelWidth, // tile pixel number.
            pixelHeight, // tile pixel number.
            data, // tile data.
            color,
            isFilled,
        }, ...
    ]
}

Methods

    mosaic.drawTile(tiles);

    mosaic.drawTileByPoint(x, y);

    mosaic.getTilesByPoint(x, y, isBrushSize);

    mosaic.drawAllTiles();

    mosaic.eraseTile(tiles);

    mosaic.eraseTileByPoint(x, y, isBrushSize);

    mosaic.eraseAllTiles();

Demon Page

Demon image

Keywords

mosaic

FAQs

Package last updated on 22 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts