Sorry for this, I didn't notice it before.
Sadly, I couldn't find the sources for this project anymore.
All I came across was a kind of plugin, names dynscale.js (instead of game-resize.js).
Some modifications are needed, consequently. (EDIT : making filenames match shoud be enough).
Heres the stuff :
/*
/// DYNAMIC PIXEL SCALING PLUGIN
*/
ig.module( 'plugins.dynscale' )
.requires(
'impact.impact',
'impact.game'
)
.defines(function(){
//ig.dynscale = ig.Class.extend({});
ig.Game.inject({
init: function() {
this.resizeGame();
this.parent();
},
});
ig.Image.inject({
dataUnscaled: null,
widthUnscaled: 0,
heightUnscaled: 0,
onload: function( event ) {
this.widthUnscaled = this.data.width;
this.heightUnscaled = this.data.height;
this.dataUnscaled = this.data;
this.parent( event );
},
resize: function( scale ) {
/* if (scale>1 && scale<5) {
this.data = hqx(this.data, scale);
} else {
this.parent( scale );
}
*/
this.resizeNearestNeighbor(scale);
},
resizeNearestNeighbor: function (scale) {
// Nearest-Neighbor scaling
// The original image is drawn into an offscreen canvas of the same size
// and copied into another offscreen canvas with the new size.
// The scaled offscreen canvas becomes the image (data) of this object.
var w = this.widthUnscaled;
var h = this.heightUnscaled;
/* if (cascade) {
w = this.width;
h = this.height;
}
*/
var widthScaled = w * scale;
var heightScaled = h * scale;
var orig = ig.$new('canvas');
orig.width = w;
orig.height = h;
var origCtx = orig.getContext('2d');
origCtx.drawImage(this.dataUnscaled, 0, 0, w, h, 0, 0, w, h);
var origPixels = origCtx.getImageData(0, 0, w, h);
var scaled = ig.$new('canvas');
scaled.width = widthScaled;
scaled.height = heightScaled;
var scaledCtx = scaled.getContext('2d');
var scaledPixels = scaledCtx.getImageData(0, 0, widthScaled, heightScaled);
for (var y = 0; y < heightScaled; y++) {
for (var x = 0; x < widthScaled; x++) {
var index = ((y / scale).floor() * w + (x / scale).floor()) * 4;
var indexScaled = (y * widthScaled + x) * 4;
scaledPixels.data[indexScaled] = origPixels.data[index];
scaledPixels.data[indexScaled + 1] = origPixels.data[index + 1];
scaledPixels.data[indexScaled + 2] = origPixels.data[index + 2];
scaledPixels.data[indexScaled + 3] = origPixels.data[index + 3];
}
}
scaledCtx.putImageData(scaledPixels, 0, 0);
this.data = scaled;
},
});
}); // end define
The NN scaling routine is redundant with the same code (uglily splashed) in /lib/impact/image.js.
I frankly cannot remember how I came up with this...
In fact the trick was to double interpolate images when possible : first with NN, then with HQX.
In images.js :
resize: function (scale) {
if (scale == 1 ) {
this.data = this.dataUnscaled;
return; }//TODO (now we can resize back to 1)
if (CONFIG.EFFECTS.HQX) {
switch( scale ) {
case 2: this.resize_hqx(scale); break;
case 3: this.resize_hqx(scale); break;
case 4: this.resize_hqx(scale); break;
case 5: this.resize_nearest_neighbor(2.5); this.resize_hqx(2, true); break; // non integer ratio
case 6: this.resize_nearest_neighbor(2); this.resize_hqx(3, true); break;
case 7: this.resize_nearest_neighbor(3.5); this.resize_hqx(2, true); break; // non integer ratio
case 8: this.resize_nearest_neighbor(2); this.resize_hqx(4, true); break;
case 9: this.resize_nearest_neighbor(3); this.resize_hqx(3, true); break;
case 10: this.resize_nearest_neighbor(5); this.resize_hqx(2, true); break;
case 11: this.resize_nearest_neighbor(5.5); this.resize_hqx(2, true); break; // non integer ratio
case 12: this.resize_nearest_neighbor(3); this.resize_hqx(4, true); break;
case 13: this.resize_nearest_neighbor(6.5); this.resize_hqx(2, true); break; // non integer ratio
case 14: this.resize_nearest_neighbor(3.5); this.resize_hqx(4, true); break; // non integer ratio
case 15: this.resize_nearest_neighbor(5); this.resize_hqx(3, true); break;
case 16: this.resize_nearest_neighbor(4); this.resize_hqx(4, true); break;
default: this.resize_nearest_neighbor(scale);
}
} else {
this.resize_nearest_neighbor(scale);
}
The real problem was to scale entities : for those present on screen (and in ig.Ressources or something like this), it was ok, but I couln't access to entities not spawned in the game.
Exemple with the jump'n'run demo : player and monsters scaled nicely, but if no bullet on screen, then bullets didn't scaled at all.
Also was needed a kind of cache, to keep unscaled versions of each image.
Hope it helps a bit...