Class: OpenCL::ImageFormat

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

Overview

Maps the :cl_image_fomat type of OpenCL

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image_channel_order, image_channel_data_type) ⇒ ImageFormat

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



82
83
84
85
86
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 82

def initialize( image_channel_order, image_channel_data_type )
  super()
  self[:image_channel_order] = image_channel_order
  self[:image_channel_data_type] = image_channel_data_type
end

Class Method Details

.from_pointer(ptr) ⇒ Object

Creates a new ImageFormat using an FFI::Pointer, fonctionality was lost when initialize was defined



119
120
121
122
123
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 119

def self.from_pointer( ptr )
  object = allocate
  object.parent_initialize( ptr )
  object
end

Instance Method Details

#channel_data_typeObject

Returns a new ChannelType corresponding to the ImageFormat internal value



99
100
101
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 99

def channel_data_type
  return OpenCL::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



104
105
106
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 104

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



89
90
91
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 89

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

#channel_order=(order) ⇒ Object

Sets the ImageFormat internal value for the image channel order



94
95
96
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 94

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

#parent_initialize(ptr) ⇒ Object

A workaroud to call the parent initialize from another function (from_pointer)



114
115
116
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 114

def parent_initialize(ptr)
  super(ptr)
end

#to_sObject

Returns a String containing a user friendly representation of the ImageFormat



109
110
111
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 109

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