Class: FreeImage::RGBTriple

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/free-image/types/rgb_triple.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(red, green, blue) ⇒ Object

Creates a new RGBTriple color

Parameters

red

Value for red, should be between 0 and 255

green

Value for green, should be between 0 and 255

blue

Value for blue, should be between 0 and 255



22
23
24
25
26
27
28
# File 'lib/free-image/types/rgb_triple.rb', line 22

def self.create(red, green, blue)
  result = self.new
  result[:red] = red
  result[:green] = green
  result[:blue] = blue
  result
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:



30
31
32
33
34
35
# File 'lib/free-image/types/rgb_triple.rb', line 30

def eql?(other)
  other.instance_of?(RGBQuad) and
  self[:red]   == other[:red] and
  self[:green] == other[:green] and
  self[:blue]  == other[:blue]
end

#to_sObject



38
39
40
# File 'lib/free-image/types/rgb_triple.rb', line 38

def to_s
  "RGBQuad - Red: #{self[:red]}, Green: #{self[:green]}, Blue: #{self[:blue]}"
end