agglomerative-clustering 4.0.0-beta.2 → 4.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -17,7 +17,8 @@ export type ImageFormat = 'rgb' | 'rgba' | 'bgra' | 'rgbx' | 'bgrx';
17
17
  * newer format version or one using a colour space it doesn't know, or an older one that lacks what was asked for),
18
18
  * `out-of-memory`, `wasm-load-failed` (the WebAssembly module could not be loaded or compiled: a missing or blocked file, a
19
19
  * browser without SIMD, or a `.wasm` from another version of the library), and in the worker entry
20
- * `worker-terminated`, `worker-failed` and `invalid-handle`.
20
+ * `worker-terminated`, `worker-failed` (the worker could not start, crashed, or runs a script from another version of the
21
+ * package) and `invalid-handle`.
21
22
  */
22
23
  export type ErrorCode = 'invalid-argument' | 'invalid-clustering' | 'unsupported-version' | 'out-of-memory' | 'wasm-load-failed'
23
24
  | 'worker-terminated' | 'worker-failed' | 'invalid-handle';
@@ -165,7 +166,7 @@ export class Palette extends Uint8Array {
165
166
  * `Uint8Array`, which functions still accept at run time; `new Clustering(bytes)` gives them the type back (TypeScript
166
167
  * wants it) and checks they are a clustering.
167
168
  *
168
- * It has methods for the cluster-once workflow: `clustering.getPalette(k)` is `getPaletteFromClustering(clustering, k)`, and
169
+ * It has methods for the cluster-once workflow: `clustering.getPalette(k)` cuts a palette from it, and
169
170
  * so on. They run on the calling thread with the main entry, so in a worker-only app they compile but reject with
170
171
  * `wasm-load-failed`. They exist only on values from this library or `new Clustering(bytes)`: slices and clones are plain
171
172
  * bytes, and a cast (`bytes as Clustering`) or a `structuredClone` keeps the type without them: wrap those with
@@ -274,7 +275,7 @@ export interface ClusteringOptions extends ProgressOptions {
274
275
  * PNG), and it gives the same palette everywhere: `buildPalette(image, k, { transparent })` is the palette
275
276
  * `quantizeToIndices(image, k, { transparent })` uses, apart from that function's extra transparent entry.
276
277
  * Cluster with it to get the palette you will map with (see `IndexOptions.transparent`). The cutoff is recorded in the
277
- * clustering (see `ClusteringInfo.transparent`), and `quantizeToIndicesFromClustering` uses it unless you name one.
278
+ * clustering (see `ClusteringInfo.transparent`), and `clustering.quantizeToIndices(image, k)` uses it unless you name one.
278
279
  * It replaces `alpha` (with a cutoff, pixels count whole or not at all), so giving both is an `invalid-argument` error.
279
280
  */
280
281
  transparent?: boolean | number | undefined;
@@ -305,11 +306,11 @@ export type DitherOptions =
305
306
  | { method?: 'floyd-steinberg' | 'atkinson' | undefined; strength?: number | undefined; steps?: undefined }
306
307
  | { method: 'ordered'; strength?: number | undefined; steps?: DitherSteps | undefined };
307
308
 
308
- /** Options for mapping pixels to a palette: `quantizeFromClustering`, `quantizeWithPalette`, and the mapping half of `quantize` and `quantizeToIndices`. With `signal` or `onProgress`, mapping runs in slices, as clustering does. */
309
+ /** Options for mapping pixels to a palette: `clustering.quantize`, `quantizeWithPalette`, and the mapping half of `quantize` and `quantizeToIndices`. With `signal` or `onProgress`, mapping runs in slices, as clustering does. */
309
310
  export interface MappingOptions extends ProgressOptions {
310
311
  /**
311
312
  * The space pixels are matched to their nearest palette colour in. The default is the space the colours were made in:
312
- * the clustering's in `quantizeFromClustering`, a `Palette`'s own in `quantizeWithPalette` and
313
+ * the clustering's in `clustering.quantize`, a `Palette`'s own in `quantizeWithPalette` and
313
314
  * `quantizeToIndicesWithPalette`; `'rgb'` for plain bytes, and in `quantize` and `quantizeToIndices`, which match in the
314
315
  * space they cluster in.
315
316
  */
@@ -343,14 +344,14 @@ export interface IndexOptions {
343
344
  * this function builds the palette itself it also leaves the pixels below the cutoff out of clustering (see
344
345
  * `ClusteringOptions.transparent`), so its palette is `buildPalette(image, k - 1, { transparent })`'s. With a palette
345
346
  * you supply (`quantizeToIndicesWithPalette`) there is no `k`: the entry is added to your palette as it is. In
346
- * `quantizeToIndicesFromClustering` the default is the cutoff the clustering was made with.
347
+ * `clustering.quantizeToIndices` the default is the cutoff the clustering was made with.
347
348
  */
348
349
  transparent?: boolean | number | undefined;
349
350
  }
350
351
 
351
352
  /** The options of `quantizeToIndices`: clustering, mapping and indexed-output options. */
352
353
  export type QuantizeIndexOptions = QuantizeOptions & IndexOptions;
353
- /** The options of `quantizeToIndicesFromClustering` and `quantizeToIndicesWithPalette`: mapping and indexed-output options. */
354
+ /** The options of `clustering.quantizeToIndices` and `quantizeToIndicesWithPalette`: mapping and indexed-output options. */
354
355
  export type MappingIndexOptions = MappingOptions & IndexOptions;
355
356
 
356
357
  interface IndexedImageFields {
@@ -401,10 +402,10 @@ export interface InitOptions {
401
402
  export const version: string;
402
403
 
403
404
  /**
404
- * The version of the data this library stores: the format of the clusterings `buildClustering` writes (`getClusteringInfo`
405
+ * The version of the data this library stores: the format of the clusterings `buildClustering` writes (`clustering.getClusteringInfo()`
405
406
  * reports a clustering's own as its `formatVersion`). One integer for the library's stored data, unrelated to `version`: it
406
407
  * changes only when the stored format does, so a new release that keeps the format keeps this number, and a minor release
407
- * may raise it. Every earlier format from 2 on stays readable (see `getClusteringInfo` for what 2.x clusterings lack).
408
+ * may raise it. Every earlier format from 2 on stays readable (see `clustering.getClusteringInfo()` for what 2.x clusterings lack).
408
409
  */
409
410
  export const formatVersion: number;
410
411
 
@@ -417,12 +418,10 @@ export function init(options?: InitOptions): Promise<void>;
417
418
 
418
419
  /**
419
420
  * Builds the colour hierarchy for an image: the expensive step, done once. The result is a `Clustering` (opaque bytes) you can
420
- * cache or store next to the image. Cut it to a palette of any size with `getPaletteFromClustering`, or map pixels
421
- * with `quantizeFromClustering`. An image with no visible pixels gives a clustering that cuts to an empty palette.
421
+ * cache or store next to the image. Cut it to a palette of any size with `clustering.getPalette(k)`, or map pixels
422
+ * with `clustering.quantize(image, k)`. An image with no visible pixels gives a clustering that cuts to an empty palette.
422
423
  */
423
424
  export function buildClustering(image: ImageLike, options?: ClusteringOptions): Promise<Clustering>;
424
- /** @deprecated Renamed {@link buildClustering} in 3.4.0 (the same function). Removed in 4.0. */
425
- export function getClustering(image: ImageLike, options?: ClusteringOptions): Promise<Clustering>;
426
425
 
427
426
  /**
428
427
  * A palette of at most `k` colours for `image` (fewer if it has fewer distinct colours), as flat RGB bytes in split
@@ -433,20 +432,6 @@ export function getClustering(image: ImageLike, options?: ClusteringOptions): Pr
433
432
  * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
434
433
  */
435
434
  export function buildPalette(image: ImageLike, k: number, options?: ClusteringOptions): Promise<Palette>;
436
- /** @deprecated Renamed {@link buildPalette} in 3.4.0 (the same function). Removed in 4.0. */
437
- export function getPalette(image: ImageLike, k: number, options?: ClusteringOptions): Promise<Palette>;
438
-
439
- /**
440
- * Cuts a clustering to at most `k` colours, in split order: index 0 is the dominant colour at two colours and keeps its
441
- * place as the palette grows (it is not always the heaviest entry of a larger one), and the palette for
442
- * `k + 1` is the palette for `k` with one entry refined and one colour appended.
443
- *
444
- * @param k The most palette entries in the result (`k` means this in every function). A flat palette has no transparent
445
- * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
446
- *
447
- * @deprecated Use `clustering.getPalette(k)`; off the main thread, `(await worker.load(clustering)).getPalette(k)` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
448
- */
449
- export function getPaletteFromClustering(clustering: Clustering, k: number): Promise<Palette>;
450
435
 
451
436
  /**
452
437
  * A palette with how much of the image each of its colours covers, for swatches with percentages. The three arrays come
@@ -473,21 +458,8 @@ export interface Swatches {
473
458
  * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
474
459
  */
475
460
  export function buildSwatches(image: ImageLike, k: number, options?: ClusteringOptions): Promise<Swatches>;
476
- /** @deprecated Renamed {@link buildSwatches} in 3.4.0 (the same function). Removed in 4.0. */
477
- export function getSwatches(image: ImageLike, k: number, options?: ClusteringOptions): Promise<Swatches>;
478
461
 
479
- /**
480
- * The same as `buildSwatches` from a clustering you already have, so trying another `k` costs well under a millisecond.
481
- * Needs a clustering from 3.x; a 2.x clustering has no weights and is rejected.
482
- *
483
- * @param k The most palette entries in the result (`k` means this in every function). A flat palette has no transparent
484
- * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
485
- *
486
- * @deprecated Use `clustering.getSwatches(k)`; off the main thread, `(await worker.load(clustering)).getSwatches(k)` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
487
- */
488
- export function getSwatchesFromClustering(clustering: Clustering, k: number): Promise<Swatches>;
489
-
490
- /** What a clustering holds (`getClusteringInfo`). */
462
+ /** What a clustering holds (`clustering.getClusteringInfo()`). */
491
463
  export interface ClusteringInfo {
492
464
  /**
493
465
  * The format of the clustering's bytes: the data version (compare it with the exported `formatVersion`, the one this
@@ -499,7 +471,7 @@ export interface ClusteringInfo {
499
471
  precision: number;
500
472
  /**
501
473
  * The alpha cutoff (1-255) the clustering was made with (`transparent` in `ClusteringOptions`), or `false` for none. It is
502
- * the default `transparent` of `quantizeToIndicesFromClustering`, so clustering and mapping agree unless you name another.
474
+ * the default `transparent` of `clustering.quantizeToIndices`, so clustering and mapping agree unless you name another.
503
475
  */
504
476
  transparent: false | number;
505
477
  /** The largest palette it can be cut to: its number of distinct clustered colours (fewer than the image's own when `precision` is below 8). */
@@ -523,15 +495,6 @@ export interface ClusteringInfo {
523
495
  explained: Float64Array;
524
496
  }
525
497
 
526
- /**
527
- * Reads what a clustering holds, including its error curve for choosing a palette size. Needs a clustering from 3.x: a 2.x
528
- * clustering recorded no weights, so it is rejected with `unsupported-version` (as `clustering.getSwatches(k)` rejects it);
529
- * the palette and mapping functions still read it.
530
- *
531
- * @deprecated Use `clustering.getClusteringInfo()`; off the main thread, `(await worker.load(clustering)).getClusteringInfo()` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
532
- */
533
- export function getClusteringInfo(clustering: Clustering): Promise<ClusteringInfo>;
534
-
535
498
  /**
536
499
  * Reduces `image` to at most `k` colours and returns the mapped image as the same kind of thing you gave: a `Uint8Array`
537
500
  * for a `Uint8Array`, `ImageData` for `ImageData`, an object with the same `format` for a `RawImage` (`ImageResult`; a
@@ -542,22 +505,10 @@ export function getClusteringInfo(clustering: Clustering): Promise<ClusteringInf
542
505
  */
543
506
  export function quantize<I extends ImageLike>(image: I, k: number, options?: QuantizeOptions): Promise<ImageResult<I>>;
544
507
 
545
- /**
546
- * Maps `image` to the `k`-colour cut of a clustering you already have, so trying another `k` or another image mapping
547
- * costs milliseconds. Matches in the clustering's colour space unless `colorSpace` is given. Returns the same kind of
548
- * thing as `quantize`.
549
- *
550
- * @param k The most palette entries in the result (`k` means this in every function). A flat palette has no transparent
551
- * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
552
- *
553
- * @deprecated Use `clustering.quantize(image, k, options)`; off the main thread, `(await worker.load(clustering)).quantize(image, k, options)` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
554
- */
555
- export function quantizeFromClustering<I extends ImageLike>(image: I, clustering: Clustering, k: number, options?: MappingOptions): Promise<ImageResult<I>>;
556
-
557
508
  /**
558
509
  * Maps each pixel of `image` to its nearest colour in a palette you supply (an edited swatch, a brand palette, one cut
559
510
  * from a clustering). Pixels are matched in the palette's own colour space if it is a `Palette` (one this library made),
560
- * so an OKLab palette maps the way `quantizeFromClustering` does; plain bytes carry no space and are matched in RGB. Name a
511
+ * so an OKLab palette maps the way `clustering.quantize` does; plain bytes carry no space and are matched in RGB. Name a
561
512
  * `colorSpace` to override either. Returns the same kind of thing as `quantize`.
562
513
  */
563
514
  export function quantizeWithPalette<I extends ImageLike>(image: I, palette: PaletteLike, options?: MappingOptions): Promise<ImageResult<I>>;
@@ -574,18 +525,6 @@ export function quantizeWithPalette<I extends ImageLike>(image: I, palette: Pale
574
525
  */
575
526
  export function quantizeToIndices(image: ImageLike, k: number, options?: QuantizeIndexOptions): Promise<IndexedImage>;
576
527
 
577
- /**
578
- * Like `quantizeFromClustering`, but returns palette indices. The palette is `clustering.getPalette(k)`'s.
579
- *
580
- * @param k The most palette entries in the result (`k` means this in every function), counting the transparent entry
581
- * if there is one, so `256` is the most a GIF or palette PNG holds. Fewer come back when the image has fewer distinct colours.
582
- * A colour is kept besides the transparent entry whenever the image has visible pixels, so with `transparent`,
583
- * `k = 1` can give 2 entries; an image with no visible pixels gives just the transparent entry.
584
- *
585
- * @deprecated Use `clustering.quantizeToIndices(image, k, options)`; off the main thread, `(await worker.load(clustering)).quantizeToIndices(image, k, options)` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
586
- */
587
- export function quantizeToIndicesFromClustering(image: ImageLike, clustering: Clustering, k: number, options?: MappingIndexOptions): Promise<IndexedImage>;
588
-
589
528
  /** Like `quantizeWithPalette`, but returns indices into `palette`, which is returned too. */
590
529
  export function quantizeToIndicesWithPalette(image: ImageLike, palette: PaletteLike, options?: MappingIndexOptions): Promise<IndexedImage>;
591
530
  export {};
package/dist/index.d.ts CHANGED
@@ -17,7 +17,8 @@ export type ImageFormat = 'rgb' | 'rgba' | 'bgra' | 'rgbx' | 'bgrx';
17
17
  * newer format version or one using a colour space it doesn't know, or an older one that lacks what was asked for),
18
18
  * `out-of-memory`, `wasm-load-failed` (the WebAssembly module could not be loaded or compiled: a missing or blocked file, a
19
19
  * browser without SIMD, or a `.wasm` from another version of the library), and in the worker entry
20
- * `worker-terminated`, `worker-failed` and `invalid-handle`.
20
+ * `worker-terminated`, `worker-failed` (the worker could not start, crashed, or runs a script from another version of the
21
+ * package) and `invalid-handle`.
21
22
  */
22
23
  export type ErrorCode = 'invalid-argument' | 'invalid-clustering' | 'unsupported-version' | 'out-of-memory' | 'wasm-load-failed'
23
24
  | 'worker-terminated' | 'worker-failed' | 'invalid-handle';
@@ -165,7 +166,7 @@ export class Palette extends Uint8Array {
165
166
  * `Uint8Array`, which functions still accept at run time; `new Clustering(bytes)` gives them the type back (TypeScript
166
167
  * wants it) and checks they are a clustering.
167
168
  *
168
- * It has methods for the cluster-once workflow: `clustering.getPalette(k)` is `getPaletteFromClustering(clustering, k)`, and
169
+ * It has methods for the cluster-once workflow: `clustering.getPalette(k)` cuts a palette from it, and
169
170
  * so on. They run on the calling thread with the main entry, so in a worker-only app they compile but reject with
170
171
  * `wasm-load-failed`. They exist only on values from this library or `new Clustering(bytes)`: slices and clones are plain
171
172
  * bytes, and a cast (`bytes as Clustering`) or a `structuredClone` keeps the type without them: wrap those with
@@ -274,7 +275,7 @@ export interface ClusteringOptions extends ProgressOptions {
274
275
  * PNG), and it gives the same palette everywhere: `buildPalette(image, k, { transparent })` is the palette
275
276
  * `quantizeToIndices(image, k, { transparent })` uses, apart from that function's extra transparent entry.
276
277
  * Cluster with it to get the palette you will map with (see `IndexOptions.transparent`). The cutoff is recorded in the
277
- * clustering (see `ClusteringInfo.transparent`), and `quantizeToIndicesFromClustering` uses it unless you name one.
278
+ * clustering (see `ClusteringInfo.transparent`), and `clustering.quantizeToIndices(image, k)` uses it unless you name one.
278
279
  * It replaces `alpha` (with a cutoff, pixels count whole or not at all), so giving both is an `invalid-argument` error.
279
280
  */
280
281
  transparent?: boolean | number | undefined;
@@ -305,11 +306,11 @@ export type DitherOptions =
305
306
  | { method?: 'floyd-steinberg' | 'atkinson' | undefined; strength?: number | undefined; steps?: undefined }
306
307
  | { method: 'ordered'; strength?: number | undefined; steps?: DitherSteps | undefined };
307
308
 
308
- /** Options for mapping pixels to a palette: `quantizeFromClustering`, `quantizeWithPalette`, and the mapping half of `quantize` and `quantizeToIndices`. With `signal` or `onProgress`, mapping runs in slices, as clustering does. */
309
+ /** Options for mapping pixels to a palette: `clustering.quantize`, `quantizeWithPalette`, and the mapping half of `quantize` and `quantizeToIndices`. With `signal` or `onProgress`, mapping runs in slices, as clustering does. */
309
310
  export interface MappingOptions extends ProgressOptions {
310
311
  /**
311
312
  * The space pixels are matched to their nearest palette colour in. The default is the space the colours were made in:
312
- * the clustering's in `quantizeFromClustering`, a `Palette`'s own in `quantizeWithPalette` and
313
+ * the clustering's in `clustering.quantize`, a `Palette`'s own in `quantizeWithPalette` and
313
314
  * `quantizeToIndicesWithPalette`; `'rgb'` for plain bytes, and in `quantize` and `quantizeToIndices`, which match in the
314
315
  * space they cluster in.
315
316
  */
@@ -343,14 +344,14 @@ export interface IndexOptions {
343
344
  * this function builds the palette itself it also leaves the pixels below the cutoff out of clustering (see
344
345
  * `ClusteringOptions.transparent`), so its palette is `buildPalette(image, k - 1, { transparent })`'s. With a palette
345
346
  * you supply (`quantizeToIndicesWithPalette`) there is no `k`: the entry is added to your palette as it is. In
346
- * `quantizeToIndicesFromClustering` the default is the cutoff the clustering was made with.
347
+ * `clustering.quantizeToIndices` the default is the cutoff the clustering was made with.
347
348
  */
348
349
  transparent?: boolean | number | undefined;
349
350
  }
350
351
 
351
352
  /** The options of `quantizeToIndices`: clustering, mapping and indexed-output options. */
352
353
  export type QuantizeIndexOptions = QuantizeOptions & IndexOptions;
353
- /** The options of `quantizeToIndicesFromClustering` and `quantizeToIndicesWithPalette`: mapping and indexed-output options. */
354
+ /** The options of `clustering.quantizeToIndices` and `quantizeToIndicesWithPalette`: mapping and indexed-output options. */
354
355
  export type MappingIndexOptions = MappingOptions & IndexOptions;
355
356
 
356
357
  interface IndexedImageFields {
@@ -401,10 +402,10 @@ export interface InitOptions {
401
402
  export const version: string;
402
403
 
403
404
  /**
404
- * The version of the data this library stores: the format of the clusterings `buildClustering` writes (`getClusteringInfo`
405
+ * The version of the data this library stores: the format of the clusterings `buildClustering` writes (`clustering.getClusteringInfo()`
405
406
  * reports a clustering's own as its `formatVersion`). One integer for the library's stored data, unrelated to `version`: it
406
407
  * changes only when the stored format does, so a new release that keeps the format keeps this number, and a minor release
407
- * may raise it. Every earlier format from 2 on stays readable (see `getClusteringInfo` for what 2.x clusterings lack).
408
+ * may raise it. Every earlier format from 2 on stays readable (see `clustering.getClusteringInfo()` for what 2.x clusterings lack).
408
409
  */
409
410
  export const formatVersion: number;
410
411
 
@@ -417,12 +418,10 @@ export function init(options?: InitOptions): Promise<void>;
417
418
 
418
419
  /**
419
420
  * Builds the colour hierarchy for an image: the expensive step, done once. The result is a `Clustering` (opaque bytes) you can
420
- * cache or store next to the image. Cut it to a palette of any size with `getPaletteFromClustering`, or map pixels
421
- * with `quantizeFromClustering`. An image with no visible pixels gives a clustering that cuts to an empty palette.
421
+ * cache or store next to the image. Cut it to a palette of any size with `clustering.getPalette(k)`, or map pixels
422
+ * with `clustering.quantize(image, k)`. An image with no visible pixels gives a clustering that cuts to an empty palette.
422
423
  */
423
424
  export function buildClustering(image: ImageLike, options?: ClusteringOptions): Promise<Clustering>;
424
- /** @deprecated Renamed {@link buildClustering} in 3.4.0 (the same function). Removed in 4.0. */
425
- export function getClustering(image: ImageLike, options?: ClusteringOptions): Promise<Clustering>;
426
425
 
427
426
  /**
428
427
  * A palette of at most `k` colours for `image` (fewer if it has fewer distinct colours), as flat RGB bytes in split
@@ -433,20 +432,6 @@ export function getClustering(image: ImageLike, options?: ClusteringOptions): Pr
433
432
  * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
434
433
  */
435
434
  export function buildPalette(image: ImageLike, k: number, options?: ClusteringOptions): Promise<Palette>;
436
- /** @deprecated Renamed {@link buildPalette} in 3.4.0 (the same function). Removed in 4.0. */
437
- export function getPalette(image: ImageLike, k: number, options?: ClusteringOptions): Promise<Palette>;
438
-
439
- /**
440
- * Cuts a clustering to at most `k` colours, in split order: index 0 is the dominant colour at two colours and keeps its
441
- * place as the palette grows (it is not always the heaviest entry of a larger one), and the palette for
442
- * `k + 1` is the palette for `k` with one entry refined and one colour appended.
443
- *
444
- * @param k The most palette entries in the result (`k` means this in every function). A flat palette has no transparent
445
- * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
446
- *
447
- * @deprecated Use `clustering.getPalette(k)`; off the main thread, `(await worker.load(clustering)).getPalette(k)` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
448
- */
449
- export function getPaletteFromClustering(clustering: Clustering, k: number): Promise<Palette>;
450
435
 
451
436
  /**
452
437
  * A palette with how much of the image each of its colours covers, for swatches with percentages. The three arrays come
@@ -473,21 +458,8 @@ export interface Swatches {
473
458
  * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
474
459
  */
475
460
  export function buildSwatches(image: ImageLike, k: number, options?: ClusteringOptions): Promise<Swatches>;
476
- /** @deprecated Renamed {@link buildSwatches} in 3.4.0 (the same function). Removed in 4.0. */
477
- export function getSwatches(image: ImageLike, k: number, options?: ClusteringOptions): Promise<Swatches>;
478
461
 
479
- /**
480
- * The same as `buildSwatches` from a clustering you already have, so trying another `k` costs well under a millisecond.
481
- * Needs a clustering from 3.x; a 2.x clustering has no weights and is rejected.
482
- *
483
- * @param k The most palette entries in the result (`k` means this in every function). A flat palette has no transparent
484
- * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
485
- *
486
- * @deprecated Use `clustering.getSwatches(k)`; off the main thread, `(await worker.load(clustering)).getSwatches(k)` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
487
- */
488
- export function getSwatchesFromClustering(clustering: Clustering, k: number): Promise<Swatches>;
489
-
490
- /** What a clustering holds (`getClusteringInfo`). */
462
+ /** What a clustering holds (`clustering.getClusteringInfo()`). */
491
463
  export interface ClusteringInfo {
492
464
  /**
493
465
  * The format of the clustering's bytes: the data version (compare it with the exported `formatVersion`, the one this
@@ -499,7 +471,7 @@ export interface ClusteringInfo {
499
471
  precision: number;
500
472
  /**
501
473
  * The alpha cutoff (1-255) the clustering was made with (`transparent` in `ClusteringOptions`), or `false` for none. It is
502
- * the default `transparent` of `quantizeToIndicesFromClustering`, so clustering and mapping agree unless you name another.
474
+ * the default `transparent` of `clustering.quantizeToIndices`, so clustering and mapping agree unless you name another.
503
475
  */
504
476
  transparent: false | number;
505
477
  /** The largest palette it can be cut to: its number of distinct clustered colours (fewer than the image's own when `precision` is below 8). */
@@ -523,15 +495,6 @@ export interface ClusteringInfo {
523
495
  explained: Float64Array;
524
496
  }
525
497
 
526
- /**
527
- * Reads what a clustering holds, including its error curve for choosing a palette size. Needs a clustering from 3.x: a 2.x
528
- * clustering recorded no weights, so it is rejected with `unsupported-version` (as `clustering.getSwatches(k)` rejects it);
529
- * the palette and mapping functions still read it.
530
- *
531
- * @deprecated Use `clustering.getClusteringInfo()`; off the main thread, `(await worker.load(clustering)).getClusteringInfo()` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
532
- */
533
- export function getClusteringInfo(clustering: Clustering): Promise<ClusteringInfo>;
534
-
535
498
  /**
536
499
  * Reduces `image` to at most `k` colours and returns the mapped image as the same kind of thing you gave: a `Uint8Array`
537
500
  * for a `Uint8Array`, `ImageData` for `ImageData`, an object with the same `format` for a `RawImage` (`ImageResult`; a
@@ -542,22 +505,10 @@ export function getClusteringInfo(clustering: Clustering): Promise<ClusteringInf
542
505
  */
543
506
  export function quantize<I extends ImageLike>(image: I, k: number, options?: QuantizeOptions): Promise<ImageResult<I>>;
544
507
 
545
- /**
546
- * Maps `image` to the `k`-colour cut of a clustering you already have, so trying another `k` or another image mapping
547
- * costs milliseconds. Matches in the clustering's colour space unless `colorSpace` is given. Returns the same kind of
548
- * thing as `quantize`.
549
- *
550
- * @param k The most palette entries in the result (`k` means this in every function). A flat palette has no transparent
551
- * entry, so its entries are all colours. Fewer come back when the image has fewer distinct colours.
552
- *
553
- * @deprecated Use `clustering.quantize(image, k, options)`; off the main thread, `(await worker.load(clustering)).quantize(image, k, options)` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
554
- */
555
- export function quantizeFromClustering<I extends ImageLike>(image: I, clustering: Clustering, k: number, options?: MappingOptions): Promise<ImageResult<I>>;
556
-
557
508
  /**
558
509
  * Maps each pixel of `image` to its nearest colour in a palette you supply (an edited swatch, a brand palette, one cut
559
510
  * from a clustering). Pixels are matched in the palette's own colour space if it is a `Palette` (one this library made),
560
- * so an OKLab palette maps the way `quantizeFromClustering` does; plain bytes carry no space and are matched in RGB. Name a
511
+ * so an OKLab palette maps the way `clustering.quantize` does; plain bytes carry no space and are matched in RGB. Name a
561
512
  * `colorSpace` to override either. Returns the same kind of thing as `quantize`.
562
513
  */
563
514
  export function quantizeWithPalette<I extends ImageLike>(image: I, palette: PaletteLike, options?: MappingOptions): Promise<ImageResult<I>>;
@@ -574,18 +525,6 @@ export function quantizeWithPalette<I extends ImageLike>(image: I, palette: Pale
574
525
  */
575
526
  export function quantizeToIndices(image: ImageLike, k: number, options?: QuantizeIndexOptions): Promise<IndexedImage>;
576
527
 
577
- /**
578
- * Like `quantizeFromClustering`, but returns palette indices. The palette is `clustering.getPalette(k)`'s.
579
- *
580
- * @param k The most palette entries in the result (`k` means this in every function), counting the transparent entry
581
- * if there is one, so `256` is the most a GIF or palette PNG holds. Fewer come back when the image has fewer distinct colours.
582
- * A colour is kept besides the transparent entry whenever the image has visible pixels, so with `transparent`,
583
- * `k = 1` can give 2 entries; an image with no visible pixels gives just the transparent entry.
584
- *
585
- * @deprecated Use `clustering.quantizeToIndices(image, k, options)`; off the main thread, `(await worker.load(clustering)).quantizeToIndices(image, k, options)` (`worker.load` is in the worker entry). Deprecated in 3.8, removed in 4.0; no warning at run time.
586
- */
587
- export function quantizeToIndicesFromClustering(image: ImageLike, clustering: Clustering, k: number, options?: MappingIndexOptions): Promise<IndexedImage>;
588
-
589
528
  /** Like `quantizeWithPalette`, but returns indices into `palette`, which is returned too. */
590
529
  export function quantizeToIndicesWithPalette(image: ImageLike, palette: PaletteLike, options?: MappingIndexOptions): Promise<IndexedImage>;
591
530
  export {};