Class: FreeImage::RGBQuad

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

Overview

Used to specify a color for a :bitmap image type. – This structure is packed with pragma (1)

Constant Summary collapse

RED =

Big Endian (PPC / Linux, MaxOSX) : RGB(A) order

0
GREEN =
1
BLUE =
2
ALPHA =
3
RED_MASK =
0xFF000000
GREEN_MASK =
0x00FF0000
BLUE_MASK =
0x0000FF00
ALPHA_MASK =
0x000000FF
RED_SHIFT =
24
GREEN_SHIFT =
16
BLUE_SHIFT =
8
ALPHA_SHIFT =
0
RGB_MASK =
(RED_MASK | GREEN_MASK | BLUE_MASK)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(red, green, blue, reserved = 0) ⇒ Object

Creates a new RGBQuad 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

reserved

Reserved value, by default is 0



60
61
62
63
64
65
66
67
# File 'lib/free-image/types/rgb_quad.rb', line 60

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

Instance Method Details

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

Returns:



69
70
71
72
73
74
75
# File 'lib/free-image/types/rgb_quad.rb', line 69

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

#to_sObject



78
79
80
# File 'lib/free-image/types/rgb_quad.rb', line 78

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