crystalspace.jbind.impl.csgfx.rgbpixel
Class csRGBpixel

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csgfx.rgbpixel.csRGBpixel
All Implemented Interfaces:
iPointer

public class csRGBpixel
extends csNativeObject

An RGB pixel. In addition to R,G,B color components this structure also contains the Alpha channel component, which is used in images (that potentially have an alpha channel).

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/pubapi/structcsRGBpixel.php

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csRGBpixel()
          Constructor (initialize to zero, alpha to 255).
csRGBpixel(csRGBcolor c)
          Yet another copy constructor.
csRGBpixel(csRGBpixel p)
          Copy constructor.
csRGBpixel(int r, int g, int b)
          Initialize the pixel with some R/G/B value.
csRGBpixel(iPointer nPointer)
           
 
Method Summary
 void add(csRGBcolor c)
          Add a csRGBcolor.
 short alpha()
          The red, green, blue and alpha components.
 void alpha(short a)
          The red, green, blue and alpha components.
 short blue()
          The red, green, blue and alpha components.
 void blue(short b)
          The red, green, blue and alpha components.
 boolean eq(csRGBpixel p)
          Compare with another csRGBpixel, but don't take alpha into account.
 boolean equals(csRGBcolor c)
          Compare with an csRGBcolor.
 boolean equals(csRGBpixel p)
          Compare with an csRGBpixel (including alpha value).
 short green()
          The red, green, blue and alpha components.
 void green(short g)
          The red, green, blue and alpha components.
 int intensity()
          Get the pixel intensity.
protected  boolean isNativePointerValidSafe(long pointer)
           
 short luminance()
          Get the pixel luminance.
protected  void nDelete(long pointer)
           
 boolean nEquals(csRGBcolor c)
          Check if the csRGBpixel is not equal to an csRGBcolor.
 boolean nEquals(csRGBpixel p)
          Check if this csRGBpixel is not equal to another csRGBpixel (including alpha).
 short red()
          The red, green, blue and alpha components.
 void red(short r)
          The red, green, blue and alpha components.
 void safeAdd(csRGBpixel c)
          Use this in the general case.
 void set(csRGBpixel p)
          Assign another csRGBpixel.
 void set(int r, int g, int b)
          Assign given red/green/blue values to this pixel.
 void set(int r, int g, int b, int a)
          Assign given red/green/blue/alpha values to this pixel.
 void unsafeAdd(csRGBpixel c)
          Use this only if you know there is no overflow.
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, equals, finalize, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

csRGBpixel

public csRGBpixel(iPointer nPointer)
Parameters:
nPointer -

csRGBpixel

public csRGBpixel()
Constructor (initialize to zero, alpha to 255). Definition at line 103 of file rgbpixel.h. References alpha, blue, green, and red.


csRGBpixel

public csRGBpixel(csRGBpixel p)
Copy constructor. Definition at line 105 of file rgbpixel.h. References alpha, blue, green, and red.

Parameters:
p -

csRGBpixel

public csRGBpixel(csRGBcolor c)
Yet another copy constructor. Definition at line 108 of file rgbpixel.h. References alpha, blue, green, and red.

Parameters:
c -

csRGBpixel

public csRGBpixel(int r,
                  int g,
                  int b)
Initialize the pixel with some R/G/B value. Definition at line 111 of file rgbpixel.h. References alpha, blue, green, and red.

Parameters:
r -
g -
b -
Method Detail

nDelete

protected void nDelete(long pointer)
Specified by:
nDelete in class csNativeObject
See Also:
csNativeObject.nDelete(long)

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
crystalspace.jbind.impl.csNativeObject#isNativePointerValidSafe()

eq

public boolean eq(csRGBpixel p)
Compare with another csRGBpixel, but don't take alpha into account. Definition at line 135 of file rgbpixel.h. References operator==().

Parameters:
p -
Returns:

intensity

public int intensity()
Get the pixel intensity. Definition at line 138 of file rgbpixel.h. References blue, green, and red.

Returns:

luminance

public short luminance()
Get the pixel luminance. Definition at line 141 of file rgbpixel.h. References blue, green, and red.

Returns:

nEquals

public boolean nEquals(csRGBpixel p)
Check if this csRGBpixel is not equal to another csRGBpixel (including alpha). Definition at line 129 of file rgbpixel.h. References operator==().

Parameters:
p -
Returns:

nEquals

public boolean nEquals(csRGBcolor c)
Check if the csRGBpixel is not equal to an csRGBcolor. Definition at line 123 of file rgbpixel.h. References operator==().

Parameters:
c -
Returns:

add

public void add(csRGBcolor c)
Add a csRGBcolor. Definition at line 165 of file rgbpixel.h. References csRGBcolor::blue, blue, csRGBcolor::green, green, csRGBcolor::red, and red.

Parameters:
c -

equals

public boolean equals(csRGBpixel p)
Compare with an csRGBpixel (including alpha value). Definition at line 120 of file rgbpixel.h. References blue, green, and red.

Parameters:
p -
Returns:

equals

public boolean equals(csRGBcolor c)
Compare with an csRGBcolor. Definition at line 117 of file rgbpixel.h. References blue, csRGBcolor::blue, green, csRGBcolor::green, red, and csRGBcolor::red. Referenced by eq(), and operator!=().

Parameters:
c -
Returns:

safeAdd

public void safeAdd(csRGBpixel c)
Use this in the general case. This version test for overflow. Note that alpha is ignored by this routine. Definition at line 185 of file rgbpixel.h. References blue, green, and red.

Parameters:
c -

set

public void set(csRGBpixel p)
Assign another csRGBpixel. Definition at line 162 of file rgbpixel.h. References alpha, blue, green, and red.

Parameters:
p -

set

public void set(int r,
                int g,
                int b,
                int a)
Assign given red/green/blue/alpha values to this pixel. Definition at line 154 of file rgbpixel.h. References alpha, blue, green, and red.

Parameters:
r -
g -
b -
a -

set

public void set(int r,
                int g,
                int b)
Assign given red/green/blue values to this pixel. Definition at line 146 of file rgbpixel.h. References alpha, blue, green, and red.

Parameters:
r -
g -
b -

unsafeAdd

public void unsafeAdd(csRGBpixel c)
Use this only if you know there is no overflow. Also take care to set alpha to 0 in 'c'! Definition at line 175 of file rgbpixel.h. References blue, green, and red.

Parameters:
c -

alpha

public short alpha()
The red, green, blue and alpha components. Definition at line 101 of file rgbpixel.h. Referenced by csEffectVector4::csEffectVector4(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Set(), and csShaderVariable::SetValue().

Returns:

alpha

public void alpha(short a)
The red, green, blue and alpha components. Definition at line 101 of file rgbpixel.h. Referenced by csEffectVector4::csEffectVector4(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Set(), and csShaderVariable::SetValue().

Parameters:
a -

blue

public short blue()
The red, green, blue and alpha components. Definition at line 101 of file rgbpixel.h. Referenced by csEffectVector4::csEffectVector4(), csPackRGBpixelToRGB(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Intensity(), Luminance(), operator csRGBcolor(), operator+=(), operator==(), SafeAdd(), Set(), csShaderVariable::SetValue(), and UnsafeAdd().

Returns:

blue

public void blue(short b)
The red, green, blue and alpha components. Definition at line 101 of file rgbpixel.h. Referenced by csEffectVector4::csEffectVector4(), csPackRGBpixelToRGB(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Intensity(), Luminance(), operator csRGBcolor(), operator+=(), operator==(), SafeAdd(), Set(), csShaderVariable::SetValue(), and UnsafeAdd().

Parameters:
b -

green

public short green()
The red, green, blue and alpha components. Definition at line 101 of file rgbpixel.h. Referenced by csEffectVector4::csEffectVector4(), csPackRGBpixelToRGB(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Intensity(), Luminance(), operator csRGBcolor(), operator+=(), operator==(), SafeAdd(), Set(), csShaderVariable::SetValue(), and UnsafeAdd().

Returns:

green

public void green(short g)
The red, green, blue and alpha components. Definition at line 101 of file rgbpixel.h. Referenced by csEffectVector4::csEffectVector4(), csPackRGBpixelToRGB(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Intensity(), Luminance(), operator csRGBcolor(), operator+=(), operator==(), SafeAdd(), Set(), csShaderVariable::SetValue(), and UnsafeAdd().

Parameters:
g -

red

public short red()
The red, green, blue and alpha components. Definition at line 101 of file rgbpixel.h. Referenced by csEffectVector4::csEffectVector4(), csPackRGBpixelToRGB(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Intensity(), Luminance(), operator csRGBcolor(), operator+=(), operator==(), SafeAdd(), Set(), csShaderVariable::SetValue(), and UnsafeAdd().

Returns:

red

public void red(short r)
The red, green, blue and alpha components. Definition at line 101 of file rgbpixel.h. Referenced by csEffectVector4::csEffectVector4(), csPackRGBpixelToRGB(), csPackRGBpixelToRGBA(), csRGBpixel(), csUnpackRGBAtoRGBpixel(), csShaderVariable::GetValue(), Intensity(), Luminance(), operator csRGBcolor(), operator+=(), operator==(), SafeAdd(), Set(), csShaderVariable::SetValue(), and UnsafeAdd().

Parameters:
r -