Class RGB

class colormodel.RGB(r, g, b, a=255)

An instance is a RGB color value.

Constructor: creates a new RGB value (r,g,b,a).

param r:initial red value
param g:initial green value
param b:initial blue value
param a:initial alpha value (default 255)

The alpha channel is 255 by default, unless otherwise specified.

Precondition: r, g, b, a must all be ints between 0 and 255, inclusive

Attributes

red

The red channel.

Invariant: Value must be an int between 0 and 255, inclusive.

green

The green channel.

Invariant: Value must be an int between 0 and 255, inclusive.

blue

The blue channel.

Invariant: Value must be an int between 0 and 255, inclusive.

alpha

The alpha channel.

Used for transparency effects (but not in this course).

Invariant: Value must be an int between 0 and 255, inclusive.

Methods

glColor()

Returns: 4 element list of the attributes in the range 0 to 1

This is a conversion of this object into a format that can be used in openGL graphics

Table Of Contents

Previous topic

Documentation for A3: Color Models

Next topic

Class CMYK

This Page