This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import sys | |
import os | |
print ".--=============--------------=============--." | |
print "| Welcome to Image Matrix Maker! |" | |
print ".--=============--------------=============--." | |
yeswords = ["yes", "y", "ya", "ok", "okay"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bitmap = [[0,0,1,1,0,0,0,1,0,0],[0,1,1,0,0,1,1,1,0,0],[0,1,0,0,0,0,0,0,0,0],[0,0,0,1,1,1,0,0,1,1],[0,0,0,0,1,1,1,1,1,0],[0,1,1,0,0,0,0,0,0,0]] | |
height = len(bitmap) | |
width = len(bitmap[0]) | |
visited = [[0]*width for x in range(0, height)] | |
count = 0 | |
def visitAll(x, y): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bitarray import bitarray | |
class Bitmap: | |
def __init__(self, width, height, major_axis = 'x'): | |
self._width = width | |
self._height = height | |
self._data = (width * height) * bitarray('0') | |
self._major_axis = major_axis | |
def _get_rows(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
def generate_gradient(): | |
im = Image.new("RGB", (255, 255)) | |
for x in range(255): | |
for y in range(255): | |
im.putpixel((x, y), (x, 0, y)) | |
im.save("../../portfolio/less1/gradient.png") | |
im.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
def generate_gradient(): | |
im = Image.new("RGB", (255, 255)) | |
for x in range(255): | |
for y in range(255): | |
im.putpixel((x, y), (x, 0, y)) | |
im.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum | |
class OpType(Enum): | |
permutation = 1 | |
variation = 4 | |
variation_repetition = 2 | |
combination = 5 | |
combination_repetition = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def generate_points(n, canvas_size, gauss=False): | |
points = [] | |
for i in range(n): | |
if gauss: | |
x = -1 | |
y = -1 | |
while not (point_in_bounds((x, y,), canvas_size)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import radians, cos, sin | |
import random | |
from python.common.svg import Svg | |
from python.less5.generate_points import generate_points, point_in_bounds | |
from python.common import line as ln | |
def generate_lines(n, length, canvas_size, gauss=False): | |
lines = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from python.common import line as ln | |
from python.common.svg import Svg | |
from python.less5.generate_points import generate_points | |
def triangulate(number_of_points, canvas_size, sort=True, name="triangulation", gauss=False): | |
svg = Svg() | |
points = generate_points(number_of_points, canvas_size, gauss) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
class Line: | |
def __init__(self, x1, y1, x2, y2, draw=True): | |
self.x1 = x1 | |
self.x2 = x2 | |
self.y1 = y1 | |
self.y2 = y2 | |
self.draw = draw |