Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Types point2D and colorA [3/8]

The type colorA specifies a color with transparency. It has 4 members: .r, .g, .b, .a.

The member .a from type colorA specifies the transparency. Transparency can range from fully opaque, represented by the value 100, to fully transparent, represented by the value 0.

The type colorA has two initializers. The initializer with 3 arguments is virtually identical to the initializer of type color. The transparency is set to fully opaque, setting the value of member .a to 100.

The initializer with 4 arguments sets the desired values to all 4 members of type colorA: .r, .g, .b, .a.

A value of type color can be automatically converted to type colorA, where the value of member .a is set to 100.

Loading...