RGB

Representation for a single colour pixel.  The shortcut for RGB.new( r, g, b ) is RGB( r, g, b ).

Summary
RGBRepresentation for a single colour pixel.
Properties
rRed colour component.
gGreen colour component.
bBlue colour component.
Functions
RGB.newConstructor.
RGB.generic?Used internally.
inspectReturn string with information about this object.
integer?Used internally.
greyConvert to grey-value.
+@The plus operator has no effect.
-@Return negative element.
+Add a scalar or another RGB-object.
-Subtract a scalar or another RGB-object.
*Multiply with a scalar or another RGB-object.
/Divide by a scalar value or another RGB-object.
%Remainder of division with scalar value or another RGB-object.
**Element-wise power using a scalar value or another RGB-object.
zero?Check whether red, green, and blue component are zero.
nonzero?Check whether red, green, or blue component is not zero.
majorChoose larger value for each channel and return result.
minorChoose smaller value for each channel and return result.
<Test for lower than.
&Bitwise and.
|Bitwise or.
^Bitwise xor.
<<Shift left.
<=Test for lower than or equal.
>Test for greater than.
>=Test for greater than or equal.
<=>Comparison operator.
coerceType coercion (used internally).
jit_assignUsed internally to enable JIT-compilation of variable-assignments.
jit_allocUsed internally to enable JIT-compilation of allocation of variable.

Properties

r

Red colour component.

g

Green colour component.

b

Blue colour component.

Functions

RGB.new

def RGB.new(r,
g,
b)

Constructor.

Parameters

rred colour component
ggreen colour component
bblue colour component

RGB.generic?

def RGB.generic?(value)

Used internally.  This method checks whether binary operations with the other Ruby object can be performed without requiring coercion.

Parameters

valueRuby object.

Returns

false if Ruby object requires coercion.

inspect

def inspect

Return string with information about this object.

Returns

Something like this: “RGB( 5, 4, 2 )”.

integer?

def integer?

Used internally.  Returns false.

grey

def grey

Convert to grey-value.

+@

def +@

The plus operator has no effect.

-@

def -@

Return negative element.  “-RGB( 5, 4, 3 )” will evaluate to “RGB( -5, -4, -3 )”.

+

def +(other)

Add a scalar or another RGB-object.

-

def -(other)

Subtract a scalar or another RGB-object.

*

def *(other)

Multiply with a scalar or another RGB-object.

/

def /(other)

Divide by a scalar value or another RGB-object.

%

def %(other)

Remainder of division with scalar value or another RGB-object.

**

def **(other)

Element-wise power using a scalar value or another RGB-object.

zero?

def zero?

Check whether red, green, and blue component are zero.

nonzero?

def nonzero?

Check whether red, green, or blue component is not zero.

major

def major(other)

Choose larger value for each channel and return result.

minor

def minor(other)

Choose smaller value for each channel and return result.

<

Test for lower than.

&

def &(other)

Bitwise and.

|

def |(other)

Bitwise or.

^

def ^(other)

Bitwise xor.

<<

Shift left.

<=

Test for lower than or equal.

>

def >(other)

Test for greater than.

>=

def >=(other)

Test for greater than or equal.

<=>

def <=>(other)

Comparison operator.

Returns

-1when self is smaller than other
0when self is equal to other
1when self is greater than other

coerce

def coerce(other)

Type coercion (used internally).

jit_assign

def jit_assign(value)

Used internally to enable JIT-compilation of variable-assignments.

jit_alloc

def jit_alloc

Used internally to enable JIT-compilation of allocation of variable.

def RGB.new(r,
g,
b)
Constructor.
def RGB.generic?(value)
Used internally.
def inspect
Return string with information about this object.
def integer?
Used internally.
def grey
Convert to grey-value.
def +@
The plus operator has no effect.
def -@
Return negative element.
def +(other)
Add a scalar or another RGB-object.
def -(other)
Subtract a scalar or another RGB-object.
def *(other)
Multiply with a scalar or another RGB-object.
def /(other)
Divide by a scalar value or another RGB-object.
def %(other)
Remainder of division with scalar value or another RGB-object.
def **(other)
Element-wise power using a scalar value or another RGB-object.
def zero?
Check whether red, green, and blue component are zero.
def nonzero?
Check whether red, green, or blue component is not zero.
def major(other)
Choose larger value for each channel and return result.
def minor(other)
Choose smaller value for each channel and return result.
def |(other)
Bitwise or.
def ^(other)
Bitwise xor.
def >=(other)
Test for greater than or equal.
def coerce(other)
Type coercion (used internally).
def jit_assign(value)
Used internally to enable JIT-compilation of variable-assignments.
def jit_alloc
Used internally to enable JIT-compilation of allocation of variable.
Close