4.0.0 • Published 11 months ago

@4bitlabs/image v4.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

@4bitlabs/image License NPM Version NPM Downloads

A collection of image primitives and manipulation functions for rendering Sierra On-line SCI-engine assets.

Palette Filter

The createPaletteFilter() function generates a palette filter for processing 4-bit pixel data from view, cursor, and font assets.

import { Palettes } from '@4bitlabs/color';
import { createPaletteFilter } from '@4bitlabs/image';

// Generate a classic 1x1 EGA dither
const dither = createPaletteFilter(Palettes.CGA);
const ouput = dither(visual);

Dither Filter

The createDitherFilter() function generates a dither filter for processing 8-bit dither-pairs from raw render data of visual layer SCI-engine PIC assets.

import { Dithers } from '@4bitlabs/color';
import { createDitherFilter } from '@4bitlabs/image';

// Generate a classic 1x1 EGA dither
const dither = createDitherFilter(Dithers.CGA);
const ouput = dither(visual);

Executing Pipelines

You can also execute more complex transformation pipelines with renderPixelData() for both paletted and dithered pixel-data.

import { Palette, Dithers } from '@4bitlabs/color';
import { scale5x6 } from '@4bitlabs/blur-filters';
import { hBoxBlur } from '@4bitlabs/blur-filters';
import {
  renderPixelData,
  createDitherFilter,
  type RenderPipeline,
} from '@4bitlabs/image';

const imageData = renderPixelData(visual, {
  // First, scale the image using the scale5x6 algorithm
  pre: [scale5x6],
  // Dither with CGA pairs, using a 5 by 6 pattern
  dither: createDitherFilter(Dithers.CGA, [5, 6]),
  // Finally, apply a horizontal box blur to the image
  post: [hBoxBlur(3)], //
});
3.3.10

1 year ago

3.3.11

1 year ago

3.3.9

1 year ago

4.0.0

11 months ago

3.3.8

1 year ago

3.3.7

1 year ago

3.3.6

1 year ago

3.3.5

1 year ago

3.3.4

1 year ago

3.3.3

1 year ago

3.3.2

1 year ago

3.3.0

1 year ago

3.2.0

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

3.0.3

1 year ago

3.0.2

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

2.2.3

1 year ago

2.2.4

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.2.2

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.3

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago