Before I upgrade nw.js, I use this code to smooth image.
bmp._context.imageSmoothingEnabled = true;
bmp._context.imageSmoothingQuality = 'high';
bmp.blt(anotherbmp, x, y, .....
I'm using this to draw thumbnail images of my level select menu. All images are a full sized screenshots and their thumbnail images are 200x134 in size.
This used to work nicely. But it stopped working after I upgrade nw.js to recent version. The thumb images are no longer smoothed.
I did some further research and found mv Bitmap uses canvas to store image data.
And Bitmap.blt uses CanvasRenderingContext2D.drawImage.
In older version, smoothing works on both image and canvas. But now it won't work if the source is another canvas.
New:
Old:
A workaround is using a fake Bitmap object for source. Like this:
bmp._context.imageSmoothingEnabled = true;
bmp._context.imageSmoothingQuality = 'high';
bmp.blt(anotherbmp, x, y, .....
I'm using this to draw thumbnail images of my level select menu. All images are a full sized screenshots and their thumbnail images are 200x134 in size.
This used to work nicely. But it stopped working after I upgrade nw.js to recent version. The thumb images are no longer smoothed.
I did some further research and found mv Bitmap uses canvas to store image data.
And Bitmap.blt uses CanvasRenderingContext2D.drawImage.
In older version, smoothing works on both image and canvas. But now it won't work if the source is another canvas.
New:
Old:
A workaround is using a fake Bitmap object for source. Like this:
Code:
function loadFakeBitmapForBlt(path){
var fakeBmp;
fakeBmp={_canvas:new Image()};
fakeBmp._canvas.src=path;
fakeBmp._canvas.bmp=fakeBmp;
fakeBmp._canvas.onload=function(){this.bmp.width=this.width;this.bmp.height=this.height;};
return fakeBmp;
}