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:
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.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