1 decade ago by gxxaxx
I am trying to use the image.resize method to scale a hud graphic.
I have a background image that I use behind my text for pop up messages to the player.
I tried something like this:
In the image.js file comments lead me to hope this might work:
// 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.
This gives me the following error:
Error: uncaught exception: [Exception... "Index or size is negative or greater than the allowed amount" code: "1" nsresult: "0x80530001 (NS_ERROR_DOM_INDEX_SIZE_ERR)" location: "impact/image.js Line: 165"]
I'm probably doing something totally out to lunch. Was hoping to find some code samples of a working example.
Has anyone worked with the image.resize successfully?
Thanks,
I have a background image that I use behind my text for pop up messages to the player.
I tried something like this:
reSizeIfNecessary: function() { var image = this.animSheet.image; if (image == null) { return; } if (image.width < ig.system.width) { return; } var scale = Math.floor(ig.system.width/image.width); image.resize(scale); },
In the image.js file comments lead me to hope this might work:
// 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.
This gives me the following error:
Error: uncaught exception: [Exception... "Index or size is negative or greater than the allowed amount" code: "1" nsresult: "0x80530001 (NS_ERROR_DOM_INDEX_SIZE_ERR)" location: "impact/image.js Line: 165"]
I'm probably doing something totally out to lunch. Was hoping to find some code samples of a working example.
Has anyone worked with the image.resize successfully?
Thanks,