Class: WinFFI::Gdi32::PIXELFORMATDESCRIPTOR
- Defined in:
- lib/win-ffi/structs/gdi32/pixel_format_descriptor.rb
Constant Summary collapse
- FLAGS_INV =
PFDFlags.to_hash.reduce(Hash.new{|h,k| h[k] = []}){|h,(k,v)| h[v] << k; h}.freeze
Instance Method Summary collapse
- #dwFlags ⇒ Object
- #dwFlags=(flags) ⇒ Object
-
#initialize ⇒ PIXELFORMATDESCRIPTOR
constructor
TODO undef_method :nSize=.
- #to_s ⇒ Object
Methods inherited from FFIStruct
Constructor Details
#initialize ⇒ PIXELFORMATDESCRIPTOR
TODO undef_method :nSize=
38 39 40 41 |
# File 'lib/win-ffi/structs/gdi32/pixel_format_descriptor.rb', line 38 def initialize super self[:nSize] = self.size end |
Instance Method Details
#dwFlags ⇒ Object
43 44 45 46 |
# File 'lib/win-ffi/structs/gdi32/pixel_format_descriptor.rb', line 43 def dwFlags val = self[:dwFlags] Set.new(FLAGS_INV.select{|k,_| val & k != 0}.reduce([]) {|a,(_,v)| a << v}.flatten) end |
#dwFlags=(flags) ⇒ Object
48 49 50 |
# File 'lib/win-ffi/structs/gdi32/pixel_format_descriptor.rb', line 48 def dwFlags=(flags) self[:dwFlags] = [*flags].reduce(0) {|a,f| a | PFDFlags[f].to_i} end |
#to_s ⇒ Object
52 53 54 |
# File 'lib/win-ffi/structs/gdi32/pixel_format_descriptor.rb', line 52 def to_s [:iPixelType, :cColorBits, :cAccumBits, :cDepthBits, :iLayerType, :dwFlags].map{|n| "#{n} = #{send(n).inspect}"}.join(', ') end |