======================
LOOK! LICENSING TERMS
======================
look! is licensed under the BSD 3-Clause (also known as "BSD New" or
"BSD Simplified"), as follows:
Copyright (c) 2010-2012, Look...
If you think the Android project Look listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/**
*-----------------------------------------------------------------------------
* Copyright (c) 2012, Look! Development Team
* All rights reserved./*fromwww.java2s.com*/
*
* Distributed under the terms of the BSD Simplified License.
*
* The full license is in the LICENSE file, distributed with this software.
*-----------------------------------------------------------------------------
*/package es.ucm.look.ar.ar3D.core;
publicclass Color4 {
publicfloat[] rgba;
privatestaticfinalfloat FACTOR = 0.2f;
public Color4(float r, float g, float b, float a) {
rgba = newfloat[] { r, g, b, a };
normalizeLevels();
}
public Color4(float r, float g, float b) {
this(r, g, b, 1.0f);
}
public Color4( float[] rgba ) throws IllegalArgumentException {
if ( rgba.length != 4 ){
thrownew IllegalArgumentException( "rgba array must have 4 components");
}
this.rgba = rgba;
normalizeLevels();
}
privatevoid normalizeLevels( ){
for ( int i = 0; i < rgba.length; i++ ){
rgba[i] = rgba[i] > 1.0f ? 1.0f : rgba[i];
rgba[i] = rgba[i] < 0.0f ? 0.0f : rgba[i];
}
}
public Color4 darker( ){
returnnew Color4( rgba[0] - FACTOR, rgba[1] - FACTOR, rgba[2] - FACTOR, rgba[3]);
}
public Color4 brighter( ){
returnnew Color4( rgba[0] + FACTOR, rgba[1] + FACTOR, rgba[2] + FACTOR, rgba[3]);
}
}