Class: Vissen::Output::Pixel

Inherits:
Color
  • Object
show all
Defined in:
lib/vissen/output/pixel.rb

Overview

The ‘Pixel` object is used by the `PixelBuffer` to store the colors of its points.

TODO: How do we want the pixel to saturate? When written or when read?

Instance Attribute Summary

Attributes inherited from Color

#b, #g, #r

Instance Method Summary collapse

Methods inherited from Color

#==, from, #initialize, #mix_with, #mix_with!, #to_a

Constructor Details

This class inherits a constructor from Vissen::Output::Color

Instance Method Details

#clear!self

Reset the pixel color to black (0, 0, 0).

Returns:

  • (self)


13
14
15
16
17
18
# File 'lib/vissen/output/pixel.rb', line 13

def clear!
  self.r = 0
  self.g = 0
  self.b = 0
  self
end

#inspectString

Returns a string representation of the pixel.

Returns:

  • (String)

    a string representation of the pixel.



21
22
23
# File 'lib/vissen/output/pixel.rb', line 21

def inspect
  format '(%.1f, %.1f, %.1f)', r, g, b
end