Current location - Quotes Website - Personality signature - How does the signature plug-in jsignature sign board judge whether there is a signature?
How does the signature plug-in jsignature sign board judge whether there is a signature?
Get canvas image data, context.getimagedata (x, y, width, height).

This method returns an ImageData object, which has three main properties:

ImageData.width: How many elements are there in each line?

ImageData.height: How many elements are there in each column?

ImageData.data: stores a one-dimensional array of RGBA values of each pixel obtained from the canvas. The array holds four values for each pixel-red, green, blue and alpha transparency. Each value is between 0 and 255. Therefore, each pixel on the canvas becomes four integer values in the array. Arrays are filled from left to right and from top to bottom.

Judge that the pixel values are all 255, that is, all pixels are blank. How many values do non-white pixels need to be valid?