Link | image->ishex |
Author | Ke Carlton |
Category | Image |
Version | 9.x |
License | Public Domain |
Posted | 10 Jul 2013 |
Updated | 10 Jul 2013 |
More by this author... |
local(i) = image('somefile.jpg') #i->isblack ? fail(-1,'Error, image is solid black') #i->iswhite ? fail(-1,'Error, image is solid white') #i->ishex('#FF0000') ? fail(-1,'Red is not welcome here')
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define image->ishex(hex::string,units::integer=8) => { // Example usage: // image('myimage.jpg')->ishex('#FF0000') ? fail(-1,'Red is not welcome here') local( x = .width / #units, y = .height / #units, i = 0 ) while(#i < #units) => { .pixel(#i * #x,#i * #y,-hex)->asstring != #hex ? return false .pixel((#units - #i) * #x -1,(#units - #i) * #y -1,-hex)->asstring != #hex ? return false #i++ } return true } define image->isblack => .ishex('#000000') define image->iswhite => .ishex('#FFFFFF')
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft