Class: Resedit::ColorMap
- Inherits:
-
Object
- Object
- Resedit::ColorMap
- Defined in:
- lib/resedit/convert/colors.rb
Instance Method Summary collapse
- #gradient(steps) ⇒ Object
-
#initialize(from, to) ⇒ ColorMap
constructor
A new instance of ColorMap.
- #mapBpp(bpp) ⇒ Object
Constructor Details
Instance Method Details
#gradient(steps) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/resedit/convert/colors.rb', line 56 def gradient(steps) map = [@from.to_i] c = steps for i in 1..steps-2 v = 1.0 * i / c map << (@from*(1.0-v) + @to*v).to_i end map << @to.to_i #puts map return map end |
#mapBpp(bpp) ⇒ Object
68 69 70 |
# File 'lib/resedit/convert/colors.rb', line 68 def mapBpp(bpp) return gradient(1<<bpp) end |