Class: ImColor
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- ImColor
- Defined in:
- lib/imgui.rb
Overview
Helper: ImColor() implicitly converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float) Prefer using IM_COL32() macros if you want a guaranteed compile-time ImU32 for usage with ImDrawList API. **Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class. MAY OBSOLETE. **None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. Explicitly cast to ImU32 or ImVec4 if needed.
Class Method Summary collapse
Class Method Details
.col32(r = 0, g = 0, b = 0, a = 255) ⇒ Object
2855 2856 2857 |
# File 'lib/imgui.rb', line 2855 def ImColor.col32(r = 0, g = 0, b = 0, a = 255) return ((a.to_i << 24) | (b.to_i << 0) | (g.to_i << 8) | (r.to_i << 16)) end |
.create(r = 0, g = 0, b = 0, a = 255) ⇒ Object
2845 2846 2847 2848 2849 2850 2851 2852 2853 |
# File 'lib/imgui.rb', line 2845 def ImColor.create(r = 0, g = 0, b = 0, a = 255) sc = 1.0 / 255.0 instance = ImColor.new instance[:Value][:x] = r.to_f * sc instance[:Value][:y] = g.to_f * sc instance[:Value][:z] = b.to_f * sc instance[:Value][:w] = a.to_f * sc return instance end |