from asciiWriter.marks import sentence, space # Set the canvas width = 75 height = 75 # We are going to draw multiple lines and collect them # in a list named 'layers' layers = [] # Set the position of the line, do this in a loop # from 10 to 75 in steps of then for x in range(10, 75, 10): # Define the line, x will start at 10 and grow in steps of 10 image_pattern = vertical(x) # Fill the line with the sentence 'OPEN DESIGN COURSE ' mark = sentence('OPEN DESIGN COURSE ') # Set the blank space blank = space() # Make a canvas lines = make_lines(width, height) # Make a layer with the line layer = visit(lines, image_pattern, mark, blank) # Add the layer to the list of layers layers.append(layer) # Merge the list of layers into a single layer result = merge(width, height, blank(), layers) # Print the result print_lines(result)
#!/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)
# 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)