/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package tankcalc;

/**
 *
 * @author lutusp
 */
final public class IColor {
    int a = 0,r,g,b;
    
    public IColor(int rv,int gv,int bv) {
        r = rv;
        g = gv;
        b = bv;
    }
    
    public IColor(int av,int rv,int gv,int bv) {
        a = av;
        r = rv;
        g = gv;
        b = bv;
    }
    
    public IColor(int v) {
        r = v >> 16 & 0xff;
        g = v >> 8 & 0xff;
        b = b & 0xff;
    }
    
    public int getRGB() {
        return r << 16 | g << 8 | b;
    }
    
    public int getARGB() {
        return a << 24 | r << 16 | g << 8 | b;
    }
    
    public void setARGB(int argb) {
        b = argb & 0xff;
        g = (argb >> 8) & 0xff;
        r = (argb >> 16) & 0xff;
        a = (argb >> 24) & 0xff;
    }
    
    public void setRGB(int argb) {
        b = argb & 0xff;
        g = (argb >> 8) & 0xff;
        r = (argb >> 16) & 0xff;
    }
    
}
