Esempio n. 1
0
#!/usr/bin/env python3
"""
  Uses an image to define where to put chars.
  In this case with the sentence/word ASCII
"""

from asciiWriter.patterns import image
from asciiWriter.utils import make_lines, visit, print_lines
from asciiWriter.marks import sentence, space

width = 75
height = 75

# Where to find the image
image_path = 'images/blobs-small.png'
image_path = 'images/shapes.png'
# Construct the pattern
image_pattern = image(image_path)
# Set the marker, in this case a sentence
mark = sentence('U.R.S O.P.E.N.  D.E.S.I.G.N  C.O.')
# Define what to use on a blank space, as a variation you coul use: single('*')
blank = space()

# Make a canvas
lines = make_lines(width, height)
# Draw the picture
result = visit(lines, image_pattern, mark, blank)

# Print the result
print_lines(result)
Esempio n. 2
0
# Define width and height of the output
width = 75
height = 40

# As we draw multiple sinoids we will collect
# them in a list of layers
layers = []

# Loop through an offset from -40 to 40 in steps of 10
for x in range(-40, 40, 10):
    # Set the pattern with the changing offset
    pattern = sinus_vertical(period=40, amplitude=30, offset=x)
    # We use a sentence to draw the text
    mark = sentence('OPEN DESIGN COURSE OPEN DESIGN OPEN')
    # Define a blank character
    blank = space()

    # Make the canvas
    lines = make_lines(width, height)

    # Draw the sinoid, but add it to the list
    result = visit(lines, pattern, mark, blank)
    # Add it the result to the list of layers
    layers.append(result)

# Merge the layers into one layer again
merged = merge(width, height, blank(), layers)

# Print the result
print_lines(merged)