~zodiacsohma/armagetronad/vectron

« back to all changes in this revision

Viewing changes to src/orfaust/Rgb.as

  • Committer: zodiacsohma1 at gmail
  • Date: 2014-01-22 02:46:23 UTC
  • Revision ID: zodiacsohma1@gmail.com-20140122024623-1dyhnemuhogi23gp
Converted all tab characters into spaces (4 gaps).

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
package orfaust
27
27
{
28
 
        public class Rgb
29
 
        {
30
 
                private static const MIN:uint = 0;
31
 
                private static const MAX:uint = 255;
32
 
                private var _r:uint;
33
 
                private var _g:uint;
34
 
                private var _b:uint;
35
 
                
36
 
                public function Rgb(red:uint = 0,green:uint = 0,blue:uint = 0):void
37
 
                {
38
 
                        _r = checkVal(red);
39
 
                        _g = checkVal(green);
40
 
                        _b = checkVal(blue);
41
 
                }
42
 
 
43
 
                private function checkVal(val:uint):uint
44
 
                {
45
 
                        if(val < MIN) return MIN;
46
 
                        if(val > MAX) return MAX;
47
 
                        return val;
48
 
                }
49
 
                public function set red(val:uint):void          {_r = checkVal(val);}
50
 
                public function get red():uint                          {return _r;}
51
 
 
52
 
                public function set green(val:uint):void        {_g = checkVal(val);}
53
 
                public function get green():uint                        {return _g;}
54
 
 
55
 
                public function set blue(val:uint):void         {_b = checkVal(val);}
56
 
                public function get blue():uint                         {return _b;}
57
 
                
58
 
                public function get value():uint                        {return _r * 65536 + _g * 256 + _b;}
59
 
        }
 
28
    public class Rgb
 
29
    {
 
30
        private static const MIN:uint = 0;
 
31
        private static const MAX:uint = 255;
 
32
        private var _r:uint;
 
33
        private var _g:uint;
 
34
        private var _b:uint;
 
35
 
 
36
        public function Rgb(red:uint = 0,green:uint = 0,blue:uint = 0):void
 
37
        {
 
38
            _r = checkVal(red);
 
39
            _g = checkVal(green);
 
40
            _b = checkVal(blue);
 
41
        }
 
42
 
 
43
        private function checkVal(val:uint):uint
 
44
        {
 
45
            if(val < MIN) return MIN;
 
46
            if(val > MAX) return MAX;
 
47
            return val;
 
48
        }
 
49
        public function set red(val:uint):void        {_r = checkVal(val);}
 
50
        public function get red():uint                {return _r;}
 
51
 
 
52
        public function set green(val:uint):void    {_g = checkVal(val);}
 
53
        public function get green():uint            {return _g;}
 
54
 
 
55
        public function set blue(val:uint):void        {_b = checkVal(val);}
 
56
        public function get blue():uint                {return _b;}
 
57
 
 
58
        public function get value():uint            {return _r * 65536 + _g * 256 + _b;}
 
59
    }
60
60
}
 
 
b'\\ No newline at end of file'