Lasso Soft Inc. > Home

[image->ishex]

Linkimage->ishex
AuthorKe Carlton
CategoryImage
Version9.x
LicensePublic Domain
Posted10 Jul 2013
Updated10 Jul 2013
More by this author...

Description

Sample Usage

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')

Source Code

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')

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft