Class: DynamicPDFApi::Grayscale

Inherits:
Color
  • Object
show all
Defined in:
lib/ruby_client/Grayscale.rb

Overview

Represents a grayscale color.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gray_level = 0) ⇒ Grayscale

Initializes a new instance of the Grayscale class.

Parameters:

  • gray_level (float) (defaults to: 0)

    The gray level for the color.



13
14
15
16
17
# File 'lib/ruby_client/Grayscale.rb', line 13

def initialize(gray_level = 0)
  super()
  @gray_level = gray_level
  @_color_string = "gray(#{gray_level})"
end

Instance Attribute Details

#_color_stringObject

Returns the value of attribute _color_string.



39
40
41
# File 'lib/ruby_client/Grayscale.rb', line 39

def _color_string
  @_color_string
end

Class Method Details

.blackObject

Gets the color black.



28
29
30
# File 'lib/ruby_client/Grayscale.rb', line 28

def self.black
  Grayscale.new(0)
end

.create_grayscale(gray_level) ⇒ Object



19
20
21
22
23
# File 'lib/ruby_client/Grayscale.rb', line 19

def self.create_grayscale(gray_level)
  gray_scale = Grayscale.new
  gray_scale._color_string = gray_level
  gray_scale
end

.whiteObject

Gets the color white.



35
36
37
# File 'lib/ruby_client/Grayscale.rb', line 35

def self.white
  Grayscale.new(1)
end