-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitmap.prototype.getAlphaPixel return the wrong type #107
Comments
Nevermind my version was outdated without I noticed |
I am reopening again due that I noticed that yes this was indeed having a error /**
* Returns pixel color at the specified point.
*
* @method getPixel
* @param {Number} x The x coordinate of the pixel in the bitmap
* @param {Number} y The y coordinate of the pixel in the bitmap
* @return {String} The pixel color (hex format)
*/
Bitmap.prototype.getPixel = function(x, y) {
var data = this._context.getImageData(x, y, 1, 1).data;
var result = '#';
for (var i = 0; i < 3; i++) {
result += data[i].toString(16).padZero(2);
}
return result;
};
/**
* Returns alpha pixel value at the specified point.
*
* @method getAlphaPixel
* @param {Number} x The x coordinate of the pixel in the bitmap
* @param {Number} y The y coordinate of the pixel in the bitmap
* @return {String} The alpha value
*/
Bitmap.prototype.getAlphaPixel = function(x, y) {
var data = this._context.getImageData(x, y, 1, 1).data;
return data[3];
}; getPixel is indeed converted but not AlphaPixel |
Should we add color class? |
getAlphaPixel returns alpha value of specified pixel, so It's correct. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I noticed meanwhile working on the typescript conversion I noticed that
Bitmap.prototype.getAlphaPixel is supposed to return a String although my linter show it's return an Uint8ClampedArray
wich is making the documentation wrong.
I suggest for fix this to either change the return type from the comment from String to Uint8ClampedArray or to do this :
thanks for your time!
The text was updated successfully, but these errors were encountered: