Class: Originals::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/originals.rb

Overview

add Fabricator/Artist/Artfactory/? alias or such - why? why not?

Constant Summary collapse

MARILYN_ATTRIBUTES =
['Female 3', 'Wild Blonde', 'Mole',
'Blue Eye Shadow']
PHILIP_ATTRIBUTES =
['Male 3']

Instance Method Summary collapse

Instance Method Details

#_background(base, background) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/originals.rb', line 130

def _background( base, background )
    width, height = base.width, base.height

    img = if background.is_a?( String ) && ['ua', 'ukraine'].include?( background.downcase )
              Image.new( width, height ).ukraine
          elsif background.is_a?( String ) && ['rainbow', 'pride'].include?( background.downcase )
              Image.new( width, height ).pride
          else
            Image.new( width, width, background )
          end

    img2 = Image.new( width, width )
    img2.compose!( img )
    img2.compose!( base )
    img2
end

#_generate_punk(*attributes, mirror: false, background: nil) ⇒ Object

helpers



117
118
119
120
121
122
123
124
125
126
127
# File 'lib/originals.rb', line 117

def _generate_punk( *attributes,
                     mirror:     false,
                     background: nil )
   punk = Cryptopunks::Image.generate( *attributes )

   punk = punk.mirror         if mirror
   ## note: add background as LAST step  (after mirror operation)
   ##                that is, if mirror=true background will NOT get mirrored
   punk = _background( punk, background )  if background
   punk
end

#marilyn(*attributes, background: nil) ⇒ Object



85
86
87
88
89
90
# File 'lib/originals.rb', line 85

def marilyn( *attributes, background: nil )
   _generate_punk( *MARILYN_ATTRIBUTES,
                   *attributes,
                   mirror: true,
                   background: background )
end

#philip(*attributes, background: nil) ⇒ Object



94
95
96
97
98
99
# File 'lib/originals.rb', line 94

def philip( *attributes, background: nil )
  _generate_punk( *PHILIP_ATTRIBUTES,
                  *attributes,
                  mirror: true,
                  background: background )
end

#phunk(*attributes, background: nil) ⇒ Object



75
76
77
78
79
# File 'lib/originals.rb', line 75

def phunk( *attributes, background: nil )
   punk( *attributes,
          mirror: true,
          background: background )
end

#punk(*attributes, mirror: false, background: nil) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/originals.rb', line 65

def punk( *attributes, mirror: false, background: nil )
    ## note: if no attributes passed in
    ##    default to ['Male 2']
    attributes = ['Male 2']  if attributes.size == 0

   _generate_punk( *attributes,
                   mirror:     mirror,
                   background: background )
end

#shiba(*attributes, background: nil) ⇒ Object



103
104
105
106
107
108
109
110
111
# File 'lib/originals.rb', line 103

def shiba( *attributes, background: nil )
    ## note: if no attributes passed in
    ##    default to ['Classic']
    attributes = ['Classic']  if attributes.size == 0

    doge = Shiba::Image.generate( *attributes )
    doge = _background( doge, background )  if background
    doge
end