|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpslib.PSColour
public class PSColour
PSColour Class
The PSColour object allows the storage of RGBA component colour values. Stored values may be modified as required whilst preserving the object reference.
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.
Constructor Summary | |
---|---|
PSColour()
Create a new object instance with default values |
|
PSColour(float g)
Create a new object instance with the specified value (0f-1f) |
|
PSColour(float g,
float a)
Create a new object instance with the specified values (0f-1f) |
|
PSColour(float r,
float g,
float b)
Create a new object instance with the specified values (0f-1f) |
|
PSColour(int g)
Create a new object instance with the specified value (0-255) |
|
PSColour(int g,
int a)
Create a new object instance with the specified values (0-255) |
|
PSColour(int r,
int g,
int b)
Create a new object instance with the specified values (0-255) |
|
PSColour(int r,
int g,
int b,
int a)
Create a new object instance with the specified values (0-255) |
Method Summary | |
---|---|
static int |
colourToInteger(PSColour c)
Return a 32bit ARGB integer representing the component colour values of the specified PSColour object |
PSColour |
copy()
Return a copy of this object |
int |
getAlpha()
Return the component alpha value (0-255) |
int |
getARGB()
Return a hexadecimal ARGB integer containing the component colour values of this object |
int |
getBlue()
Return the component blue value (0-255) |
int |
getBrightness()
Return the brightness value of this object (0-255) |
java.awt.Color |
getColor()
Return a java.awt.Color object containing the component colour values of this object |
int[] |
getComponents()
Return an integer array containing the component colour values of this object (0-255) |
float[] |
getComponents(float[] c)
Fill the specified float array with the component colour values of this object (0f-1f) and return the result |
int[] |
getComponents(int[] c)
Fill the specified integer array with the component colour values of this object (0-255) and return the result |
int |
getGreen()
Return the component green value (0-255) |
int |
getRed()
Return the component red value (0-255) |
static PSColour |
integerToColour(int h)
Return a PSColour object with component values derived from the specified 32bit ARGB integer |
void |
set(java.awt.Color c)
Set the component values of this object to those of the specified java.awt.Color object |
void |
set(float r,
float g,
float b)
Set the component values of this object (0f-1f) |
void |
set(float r,
float g,
float b,
float a)
Set the component values of this object (0f-1f) |
void |
set(int h)
Set the component values of this object to those specified by the 32 bit ARGB value |
void |
set(int r,
int g,
int b)
Set the component values of this object (0-255) |
void |
set(int r,
int g,
int b,
int a)
Set the component values of this object (0-255) |
void |
set(PSColour c)
Set the component values of this object to those of the specified PSColour object |
void |
setAlpha(float a)
Set the alpha component value (0f-1f) |
void |
setAlpha(int a)
Set the alpha component value (0-255) |
void |
setBlue(float b)
Set the blue component value (0f-1f) |
void |
setBlue(int b)
Set the blue component value (0-255) |
void |
setGreen(float g)
Set the green component value (0f-1f) |
void |
setGreen(int g)
Set the green component value (0-255) |
void |
setRed(float r)
Set the red component value (0f-1f) |
void |
setRed(int r)
Set the red component value (0-255) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PSColour()
public PSColour(int g)
g
- greyscalepublic PSColour(int g, int a)
g
- greyscalea
- alphapublic PSColour(int r, int g, int b)
r
- redg
- greenb
- bluepublic PSColour(int r, int g, int b, int a)
r
- redg
- greenb
- bluea
- alphapublic PSColour(float g)
g
- greyscalepublic PSColour(float g, float a)
g
- greyscalea
- alphapublic PSColour(float r, float g, float b)
r
- redg
- greenb
- blueMethod Detail |
---|
public final void setRed(int r)
r
- redpublic final void setRed(float r)
r
- redpublic final void setGreen(int g)
g
- greenpublic final void setGreen(float g)
g
- greenpublic final void setBlue(int b)
b
- bluepublic final void setBlue(float b)
b
- bluepublic final void setAlpha(int a)
a
- alphapublic final void setAlpha(float a)
a
- alphapublic final void set(java.awt.Color c)
c
- Color objectpublic final void set(PSColour c)
c
- PSColour objectpublic final void set(int h)
h
- ARGB valuepublic final void set(int r, int g, int b)
r
- redg
- greenb
- bluepublic final void set(int r, int g, int b, int a)
r
- redg
- greenb
- bluea
- alphapublic final void set(float r, float g, float b)
r
- redg
- greenb
- bluepublic final void set(float r, float g, float b, float a)
r
- redg
- greenb
- bluea
- alphapublic final int getRed()
public final int getGreen()
public final int getBlue()
public final int getAlpha()
public final int getBrightness()
The brightness value is calculated as the average of the component colour values.
public final PSColour copy()
public final int[] getComponents()
public final int[] getComponents(int[] c)
c
- integer array
public final float[] getComponents(float[] c)
c
- float array
public final java.awt.Color getColor()
public final int getARGB()
public static int colourToInteger(PSColour c)
c
- colour
public static PSColour integerToColour(int h)
h
- ARGB integer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |