@techandsoftware/teletext-plugin-smooth-mosaic

0.1.8 • Public • Published

This is a plugin for @techandsoftware/teletext, which uses a pixel art scaling algorithm to create a smooth rendition of teletext mosaic graphics. The scaling algorithm used is hqx.

The following image shows a page from Ceefax with normal rendering and with smoothed graphics on the right: A Ceefax page with a map of the UK in teletext blocky format and with smoothed graphics

Demo

See https://teletextmoduledemo.tech-and-software.ltd.uk/ . Press 'p' or click the button marked with 'p' to load the plugin.

See the docs directory in the repo for an SVG created with the plugin.

Using

ES6 module

The easiest option is to use jsdelivr:

const module = await import('https://cdn.jsdelivr.net/npm/@techandsoftware/teletext-plugin-smooth-mosaic@latest/dist/teletext-plugin-smooth-mosaic.min.js');

// teletext is the @techandsoftware/teletext instance
teletext.registerViewPlugin(module.SmoothMosaicPlugin);

If installing from npm, you'll also need to use tooling like rollup to resolve the dependency for your browser.

import { SmoothMosaicPlugin } from '@techandsoftware/teletext-plugin-smooth-mosaic';
teletext.registerViewPlugin(SmoothMosaicPlugin);

As the module is fairly large, you could import dynamically:

const module = await import('@techandsoftware/teletext-plugin-smooth-mosaic');
teletext.registerViewPlugin(module.SmoothMosaicPlugin);

Non-ES6

If you want to support browsers that can't use ES6 modules, a UMD version is also available in the dist directory for importing with <script>. It exports the module in the global ttxsmooth. It's likely you'll also need to transpile the code for your target browsers.

Dependencies

Credits

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i @techandsoftware/teletext-plugin-smooth-mosaic

    Weekly Downloads

    0

    Version

    0.1.8

    License

    (ISC OR LGPL-2.1-or-later)

    Unpacked Size

    344 kB

    Total Files

    7

    Last publish

    Collaborators

    • robhardy