Class: OpenCL::ImageFormat

Inherits:
Struct
  • Object
show all
Defined in:
lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb

Overview

Maps the :cl_image_fomat type of OpenCL

Instance Method Summary collapse

Constructor Details

#initialize(image_channel_order = nil, image_channel_data_type = nil) ⇒ ImageFormat

Creates a new ImageFormat from an image channel order and data type



50
51
52
53
54
55
56
57
58
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 50

def initialize( image_channel_order = nil, image_channel_data_type = nil )
  if image_channel_order.is_a?(FFI::Pointer) then
    super(image_channel_order)
  else
    super()
    self[:image_channel_order] = image_channel_order if image_channel_order
    self[:image_channel_data_type] = image_channel_data_type if image_channel_data_type
  end
end

Instance Method Details

#channel_data_typeObject

Returns a new ChannelType corresponding to the ImageFormat internal value



71
72
73
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 71

def channel_data_type
  return ChannelType::new(self[:image_channel_data_type])
end

#channel_data_type=(data_type) ⇒ Object

Sets the ImageFormat internal value for the image channel data type



76
77
78
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 76

def channel_data_type=(data_type)
  return self[:image_channel_data_type] = data_type
end

#channel_orderObject

Returns a new ChannelOrder corresponding to the ImageFormat internal value



61
62
63
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 61

def channel_order
  return ChannelOrder::new(self[:image_channel_order])
end

#channel_order=(order) ⇒ Object

Sets the ImageFormat internal value for the image channel order



66
67
68
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 66

def channel_order=(order)
  return self[:image_channel_order] = order
end

#inspectObject



45
46
47
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 45

def inspect
  return "#<#{self.class.name}: #{channel_order} #{channel_data_type}>"
end

#to_sObject

Returns a String containing a user friendly representation of the ImageFormat



81
82
83
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 81

def to_s
  return "{ channel_order: #{self.channel_order}, channel_data_type: #{self.channel_data_type} }"
end