Created
April 12, 2011 10:33
-
-
Save goshki/915301 to your computer and use it in GitHub Desktop.
ActionScript 3 basic operations on an ARGB (alpha, red, green, blue) color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
public static function argbDecombine( ARGB:uint ):Array { | |
return [ ARGB >> 24, ( ARGB >> 16 ) & 0xFF, ( ARGB >> 8 ) & 0xFF, ARGB & 0xFF ]; | |
} | |
public static function argbCombine( ARGB:Array ):uint { | |
return argbCombine( ARGB[0], ARGB[1], ARGB[2], ARGB[3] ); | |
} | |
public static function argbCombine( A:uint, R:uint, G:uint, B:uint ):uint { | |
return ( A << 24 ) + ( R << 16 ) + ( G << 8 ) + B; | |
} | |
public static function argbGetA( ARGB:uint ):uint { | |
return ARGB >> 24; | |
} | |
public static function argbGetR( ARGB:uint ):uint { | |
return ( ARGB >> 16 ) & 0xFF; | |
} | |
public static function argbGetG( ARGB:uint ):uint { | |
return ( ARGB >> 8 ) & 0xFF; | |
} | |
public static function argbGetB( ARGB:uint ):uint { | |
return ARGB & 0xFF; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment