Module: Pixels::NoAlphaChannel
Overview
Mix-in module for image types having no alpha channel.
It makes has_alpha? return false, and it emulates rgba_from_color and color_from_rgba.
Instance Method Summary collapse
-
#color_from_rgba(r, g, b, a) ⇒ Object
Given separate [r, g, b, a] values, return the integer colour value.
-
#has_alpha? ⇒ Boolean
Return true of the image has an alpha channel.
-
#rgba_from_color(color) ⇒ Object
Given an integer colour value, return separate [r, g, b, 255] values.
Instance Method Details
#color_from_rgba(r, g, b, a) ⇒ Object
Given separate [r, g, b, a] values, return the integer colour value.
This is a wrapper around color_from_rgb. The alpha channel is ignored.
419 420 421 |
# File 'lib/pixels.rb', line 419 def color_from_rgba(r, g, b, a) return color_from_rgb(r, g, b) end |
#has_alpha? ⇒ Boolean
Return true of the image has an alpha channel. Otherwise, return false.
404 405 406 |
# File 'lib/pixels.rb', line 404 def has_alpha? false end |
#rgba_from_color(color) ⇒ Object
Given an integer colour value, return separate [r, g, b, 255] values.
This is a wrapper around rgb_from_color. The alpha channel is always set fully opaque.
412 413 414 |
# File 'lib/pixels.rb', line 412 def rgba_from_color(color) return rgb_from_color(color) + [255] end |