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



55
56
57
58
59
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 55

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



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

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



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

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



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

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



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

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



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

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)



87
88
89
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb', line 87

def parent_initialize(ptr)
  super(ptr)
end

#to_sObject

Returns a String containing a user friendly representation of the ImageFormat



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

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