mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-24 22:26:10 +03:00
Merge pull request #1507 from jetic83/master
Enable to switch off smoothed rendering of images on canvas
This commit is contained in:
commit
959f8e739a
@ -600,6 +600,27 @@ $.Drawer.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Turns image smoothing on or off for this viewer. Note: Ignored in some (especially older) browsers that do not support this property.
|
||||
*
|
||||
* @function
|
||||
* @param {Boolean} [imageSmoothingEnabled] - Whether or not the image is
|
||||
* drawn smoothly on the canvas; see imageSmoothingEnabled in
|
||||
* {@link OpenSeadragon.Options} for more explanation.
|
||||
*/
|
||||
setImageSmoothingEnabled: function(imageSmoothingEnabled){
|
||||
if ( this.useCanvas ) {
|
||||
var context = this.context;
|
||||
context.mozImageSmoothingEnabled = imageSmoothingEnabled;
|
||||
context.webkitImageSmoothingEnabled = imageSmoothingEnabled;
|
||||
context.msImageSmoothingEnabled = imageSmoothingEnabled;
|
||||
context.imageSmoothingEnabled = imageSmoothingEnabled;
|
||||
|
||||
this.viewer.forceRedraw();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the canvas size
|
||||
* @param {Boolean} sketch If set to true return the size of the sketch canvas
|
||||
|
@ -198,6 +198,11 @@
|
||||
* 'destination-over', 'destination-atop', 'destination-in',
|
||||
* 'destination-out', 'lighter', 'copy' or 'xor'
|
||||
*
|
||||
* @property {Boolean} [imageSmoothingEnabled=true]
|
||||
* Image smoothing for canvas rendering (only if canvas is used). Note: Ignored
|
||||
* by some (especially older) browsers which do not support this canvas property.
|
||||
* This property can be changed in {@link Viewer.Drawer.setImageSmoothingEnabled}.
|
||||
*
|
||||
* @property {String|CanvasGradient|CanvasPattern|Function} [placeholderFillStyle=null]
|
||||
* Draws a colored rectangle behind the tile if it is not loaded yet.
|
||||
* You can pass a CSS color value like "#FF8800".
|
||||
@ -1178,6 +1183,7 @@ function OpenSeadragon( options ){
|
||||
opacity: 1,
|
||||
preload: false,
|
||||
compositeOperation: null,
|
||||
imageSmoothingEnabled: true,
|
||||
placeholderFillStyle: null,
|
||||
|
||||
//REFERENCE STRIP SETTINGS
|
||||
|
@ -466,6 +466,12 @@ $.Viewer = function( options ) {
|
||||
$.requestAnimationFrame( function(){
|
||||
beginControlsAutoHide( _this );
|
||||
} );
|
||||
|
||||
// Initial canvas options
|
||||
if ( this.imageSmoothingEnabled !== undefined && !this.imageSmoothingEnabled){
|
||||
this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** @lends OpenSeadragon.Viewer.prototype */{
|
||||
|
Loading…
Reference in New Issue
Block a user