Set reprojection canvas context options

Add example of disabling image smoothing

Add test for reprojection context options
This commit is contained in:
mike-000
2019-12-15 23:24:07 +00:00
parent 4c0bdda8b8
commit 560931e976
18 changed files with 272 additions and 6 deletions

View File

@@ -25,6 +25,8 @@ import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
* @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {object} [reprojectionContextOptions] Optional properties to set on the canvas context used
* for reprojection. For example specify `{imageSmoothingEnabled: false}` to disable image smoothing.
* @property {import("./State.js").default} [state] Source state.
* @property {typeof import("../ImageTile.js").default} [tileClass] Class used to instantiate image tiles.
* Default is {@link module:ol/ImageTile~ImageTile}.
@@ -123,6 +125,12 @@ class TileImage extends UrlTile {
*/
this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold;
/**
* @private
* @type {object|undefined}
*/
this.reprojectionContextOptions_ = options.reprojectionContextOptions;
/**
* @private
* @type {boolean}
@@ -296,7 +304,7 @@ class TileImage extends UrlTile {
function(z, x, y, pixelRatio) {
return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);
}.bind(this), this.reprojectionErrorThreshold_,
this.renderReprojectionEdges_);
this.renderReprojectionEdges_, this.reprojectionContextOptions_);
newTile.key = key;
if (tile) {