nl_tokens: A stretchable image that has borders . Similar to the [ Android NinePatch ] {
pl_tokens: function NinePatch ( image ) { this . img = image ; var imgw = image . width - 1 ; var imgh = <mask> . height - 1 ; var context = getContextForImage ( image ) ; var firstDiv = imgw ; var secondDiv = imgw ; var pixel ; var alpha ; for ( var x = 0 ; x < imgw ; x ++ ) { pixel = context . getImageData ( x , imgh , 1 , 1 ) . data ; alpha = pixel [ 3 ] ; if ( firstDiv === imgw && alpha > 0 ) { firstDiv = x ; } if ( firstDiv < imgw && alpha === 0 ) { secondDiv = x ; break ; } } this . w1 = firstDiv ; this . w2 = secondDiv - firstDiv ; this . w3 = imgw - secondDiv ; firstDiv = secondDiv = imgh ; for ( var y = 0 ; y < imgh ; y ++ ) { pixel = context . getImageData ( imgw , y , 1 , 1 ) . data ; alpha = pixel [ 3 ] ; if ( firstDiv === imgh && alpha > 0 ) { firstDiv = y ; } if ( firstDiv < imgh && alpha === 0 ) { secondDiv = y ; break ; } } this . h1 = firstDiv ; this . h2 = secondDiv - firstDiv ; this . h3 = imgh - secondDiv ; }