Module: DXRubySDL::Color
- Included in:
- Image
- Defined in:
- lib/dxruby_sdl/color.rb
Class Method Summary collapse
- .normalize_dxruby(color) ⇒ Object
- .to_dxruby_argb(color) ⇒ Object
- .to_sdl_alpha(color) ⇒ Object
- .to_sdl_color(color) ⇒ Object
- .to_sdl_rgba(color) ⇒ Object
Class Method Details
.normalize_dxruby(color) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/dxruby_sdl/color.rb', line 35 def normalize_dxruby(color) if color.length == 4 color else [0xFF] + color end end |
.to_dxruby_argb(color) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/dxruby_sdl/color.rb', line 27 def to_dxruby_argb(color) if color.length == 4 [color[3], *color[0..2]] else [0xFF, *color] end end |
.to_sdl_alpha(color) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/dxruby_sdl/color.rb', line 15 def to_sdl_alpha(color) if color.length == 4 color[0] else 0xFF end end |
.to_sdl_color(color) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/dxruby_sdl/color.rb', line 7 def to_sdl_color(color) if color.length == 4 return color[1..3] else color end end |
.to_sdl_rgba(color) ⇒ Object
23 24 25 |
# File 'lib/dxruby_sdl/color.rb', line 23 def to_sdl_rgba(color) [*to_sdl_color(color), to_sdl_alpha(color)] end |