@versatiles/png-renderer 2.5.0 → 2.6.0
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/README.md +1 -1
- package/dist/index.d.ts +49 -1
- package/dist/index.js +966 -778
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ Which MapLibre GL JS features are covered, and which are not yet: [MapLibre GL J
|
|
|
116
116
|
|
|
117
117
|
### `new PNGMapRenderer(options)`
|
|
118
118
|
|
|
119
|
-
An [`SVGMapRenderer`](https://github.com/versatiles-org/versatiles-svg-renderer/blob/main/packages/svg-renderer/README.md#new-svgmaprendereroptions) that can also render PNG. It takes the options of `SVGMapRenderer` (`style`, `
|
|
119
|
+
An [`SVGMapRenderer`](https://github.com/versatiles-org/versatiles-svg-renderer/blob/main/packages/svg-renderer/README.md#new-svgmaprendereroptions) that can also render PNG. It takes the options of `SVGMapRenderer` (e.g. `style`, `labels`, `tileCacheSize`, `fetch`, `images`), plus `fonts` as above.
|
|
120
120
|
|
|
121
121
|
- **`renderPNG(view?): Promise<Uint8Array>`** renders one view as PNG. `view` takes `width`, `height`, `lon`, `lat`, `zoom` and `scale`, with the same defaults as `renderToPNG`.
|
|
122
122
|
- **`renderCanvas(view?): Promise<Canvas>`** renders one view onto a canvas, to draw on or to encode in another format; see [above](#drawing-on-the-map-or-saving-another-format).
|
package/dist/index.d.ts
CHANGED
|
@@ -2282,6 +2282,15 @@ type RasterLayerSpecification = {
|
|
|
2282
2282
|
*/
|
|
2283
2283
|
"raster-opacity"?: PropertyValueSpecification<number>;
|
|
2284
2284
|
"raster-opacity-transition"?: TransitionSpecification;
|
|
2285
|
+
/**
|
|
2286
|
+
* Controls how the layer is composited with the content already rendered beneath it. Unlike [`raster-opacity`](#raster-opacity), which only fades the layer, this property determines how its colors interact with the existing map contents.
|
|
2287
|
+
*
|
|
2288
|
+
* @default
|
|
2289
|
+
* ```json
|
|
2290
|
+
* "normal"
|
|
2291
|
+
* ```
|
|
2292
|
+
*/
|
|
2293
|
+
"raster-layer-blend"?: "normal" | "multiply" | "color" | "luminosity" | "plus-lighter" | "screen" | "overlay";
|
|
2285
2294
|
/**
|
|
2286
2295
|
* Rotates hues around the color wheel.
|
|
2287
2296
|
*/
|
|
@@ -3167,6 +3176,32 @@ interface FetchRequestInit {
|
|
|
3167
3176
|
*/
|
|
3168
3177
|
type FetchFunction = (url: string, init?: FetchRequestInit) => Promise<FetchResponse>;
|
|
3169
3178
|
|
|
3179
|
+
/**
|
|
3180
|
+
* An image that the style uses besides those of its sprite, as MapLibre GL JS takes it with
|
|
3181
|
+
* `map.addImage(id, { width, height, data }, { pixelRatio, sdf })`.
|
|
3182
|
+
*/
|
|
3183
|
+
interface StyleImage {
|
|
3184
|
+
/** The name that the style uses, e.g. in `icon-image` or `fill-pattern`. No sprite id is put before it. */
|
|
3185
|
+
id: string;
|
|
3186
|
+
/** Width in pixels. */
|
|
3187
|
+
width: number;
|
|
3188
|
+
/** Height in pixels. */
|
|
3189
|
+
height: number;
|
|
3190
|
+
/** The pixels as RGBA, row by row, not premultiplied: `width * height * 4` bytes. */
|
|
3191
|
+
data: Uint8Array | Uint8ClampedArray;
|
|
3192
|
+
/**
|
|
3193
|
+
* Image pixels per pixel of the map, e.g. `2` for an image drawn at half its size.
|
|
3194
|
+
* @defaultValue `1`
|
|
3195
|
+
*/
|
|
3196
|
+
pixelRatio?: number;
|
|
3197
|
+
/**
|
|
3198
|
+
* Whether the image is a signed distance field, as a sprite image can be: only its alpha
|
|
3199
|
+
* channel counts, and `icon-color` and the icon halo color it.
|
|
3200
|
+
* @defaultValue `false`
|
|
3201
|
+
*/
|
|
3202
|
+
sdf?: boolean;
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3170
3205
|
/** Options for {@link SVGMapRenderer}: what stays the same for every view of the map. */
|
|
3171
3206
|
interface SVGMapRendererOptions {
|
|
3172
3207
|
/**
|
|
@@ -3253,6 +3288,19 @@ interface SVGMapRendererOptions {
|
|
|
3253
3288
|
* @defaultValue the defaults of the style's `state`
|
|
3254
3289
|
*/
|
|
3255
3290
|
globalState?: GlobalState;
|
|
3291
|
+
/**
|
|
3292
|
+
* Images that the style uses besides those of its sprite, like `map.addImage(id, image,
|
|
3293
|
+
* { pixelRatio, sdf })` in MapLibre GL JS: for `icon-image`, `fill-pattern`, `line-pattern`
|
|
3294
|
+
* and `background-pattern`, by their `id`, which no sprite id is put before. An SDF image is
|
|
3295
|
+
* colored by `icon-color` and its halo, like one of the sprite.
|
|
3296
|
+
*
|
|
3297
|
+
* As in MapLibre GL JS, where `addImage` fails for an id that exists, an image of the sprite
|
|
3298
|
+
* with the same id is drawn instead, reported through
|
|
3299
|
+
* {@link SVGMapRendererOptions.onWarning}. In an SVG, each image is a data URI of a PNG file
|
|
3300
|
+
* without compression.
|
|
3301
|
+
* @defaultValue none
|
|
3302
|
+
*/
|
|
3303
|
+
images?: readonly StyleImage[];
|
|
3256
3304
|
}
|
|
3257
3305
|
/** The view to render: size, centre and zoom. */
|
|
3258
3306
|
interface ViewOptions {
|
|
@@ -3600,4 +3648,4 @@ declare class PNGMapRenderer extends SVGMapRenderer {
|
|
|
3600
3648
|
}
|
|
3601
3649
|
|
|
3602
3650
|
export { PNGMapRenderer, SVGMapRenderer, renderToCanvas, renderToPNG, renderToSVG };
|
|
3603
|
-
export type { FetchFunction, FetchRequestInit, FetchResponse, GlobalState, PNGMapRendererOptions, PNGViewOptions, RenderToPNGOptions, RenderToSVGOptions, SVGMapRendererOptions, ViewOptions };
|
|
3651
|
+
export type { FetchFunction, FetchRequestInit, FetchResponse, GlobalState, PNGMapRendererOptions, PNGViewOptions, RenderToPNGOptions, RenderToSVGOptions, SVGMapRendererOptions, StyleImage, ViewOptions };
|