Class: RbSDL2::Window::Display::GammaRamp

Inherits:
Object
  • Object
show all
Defined in:
lib/rb_sdl2/window/display.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ GammaRamp

Returns a new instance of GammaRamp.



53
54
55
# File 'lib/rb_sdl2/window/display.rb', line 53

def initialize(ptr)
  @ptr = ptr
end

Class Method Details

.[](*a) ⇒ Object

Raises:

  • (ArgumentError)


38
39
40
41
42
43
44
# File 'lib/rb_sdl2/window/display.rb', line 38

def [](*a)
  raise ArgumentError if a.length != 256
  ptr = ::FFI::MemoryPointer.new(:uint16, 256).write_array_of_uint16(a)
  obj = allocate
  obj.__send__(:initialize, ptr)
  obj
end

.new(gamma) ⇒ Object



46
47
48
49
50
# File 'lib/rb_sdl2/window/display.rb', line 46

def new(gamma)
  ptr = ::FFI::MemoryPointer.new(:uint16, 256)
  ::SDL.CalculateGammaRamp(gamma, ptr)
  super(ptr)
end

Instance Method Details

#to_aObject Also known as: to_ary



59
# File 'lib/rb_sdl2/window/display.rb', line 59

def to_a = @ptr.read_array_of_uint16(256)

#to_ptrObject



57
# File 'lib/rb_sdl2/window/display.rb', line 57

def to_ptr = @ptr