---------------------------> Information about this behaviour
-- [S] Tint bitmap behaviour
-- Behaviour written by Barry Swan
-- E-mail: gerbil@theburrow.co.uk
-- WWW: http://www.theburrow.co.uk
---------------------------> Property definitions for the behaviour
property pSN, pS
property pOldInk, pOldBGColor, pOldColor
property pRed, pGreen, pBlue
property pOldRed, pOldGreen, pOldBlue
---------------------------> Initialise the sprite and properties
on beginSprite me
-- Set up sprite properties
pSN = me.spriteNum
pS = sprite(pSN)
pOldInk = pS.ink
pOldBGColor = pS.bgcolor
pOldColor = pS.color
-- Set to use darken ink
pS.ink = 41
-- Set up behaviour properties (to guarantee a refresh on the first prepareFrame)
pOldRed = -1
pOldGreen = -1
pOldBlue = -1
end
---------------------------> Check for values being changed - if so update sprite
on prepareFrame me
-- Change sprite if brightness or contrast has changed
if pRed <> pOldRed OR pGreen <> pOldGreen OR pBlue <> pOldBlue then
me.UpdateTint()
-- Store current values
pOldRed = pRed
pOldGreen = pGreen
pOldBlue = pBlue
end if
end
---------------------------> The actual handler to change the sprite values
on UpdateTint me
---------------------------> Reset the sprite when finished
on endSprite me
-- Restore the old sprite values
pS.ink = pOldInk
pS.bgcolor = pOldBGColor
pS.color = pOldColor
end
---------------------------> Input the initial property values
on getPropertyDescriptionList me
-- Set up list
tlData = [:]
-- Options for red
tlData[#pRed] = [¬
#format: #integer,¬
#default: 100,¬
#range: [#min: 0, #max: 200],¬
#comment: "Red intensity (measured in percentage with 100% being no change):"¬
]
-- Options for green
tlData[#pGreen] = [¬
#format: #integer,¬
#default: 100,¬
#range: [#min: 0, #max: 200],¬
#comment: "Green intensity (measured in percentage with 100% being no change):"¬
]
-- Options for blue
tlData[#pBlue] = [¬
#format: #integer,¬
#default: 100,¬
#range: [#min: 0, #max: 200],¬
#comment: "Blue intensity (measured in percentage with 100% being no change):"¬
]
-- Return list
return tlData
end
---------------------------> Description of the behaviour in the behaviour inspector
on getBehaviorDescription me
tInfo = tInfo & "Drop this behaviour onto a bitmap sprite to alter it's tint without altering the graphic itself." & RETURN
tInfo = tInfo & "Note that it uses the DARKEN ink. Therefore it will override the ink setting for the sprite in the score." & RETURN
tInfo = tInfo & "The DARKEN ink has transparency identical to MATTE ink." & RETURN & RETURN
tInfo = tInfo & "Red intensity - measured as a percentage with 100% being normal. 0% is none, 200% is maximum oversaturation." & RETURN
tInfo = tInfo & "Green intensity - measured as a percentage with 100% being normal. 0% is none, 200% is maximum oversaturation." & RETURN
tInfo = tInfo & "Blue intensity - measured as a percentage with 100% being normal. 0% is none, 200% is maximum oversaturation." & RETURN & RETURN
tInfo = tInfo & "You can change the properties and the behaviour will automatically update the graphic to represent the new values." & RETURN
tInfo = tInfo & "To alter the red intensity change the 'pRed' property of the behaviour." & RETURN
tInfo = tInfo & "To alter the green intensity change the 'pGreen' property of the behaviour." & RETURN
tInfo = tInfo & "To alter the blue intensity change the 'pBlue' property of the behaviour."
-- Return string
return tInfo
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA