-
-I've written a [tartan designer](design.cgi) that will take a sett
-pattern in modified xtartan format, and output a PNG image of said
-tartan. Below are some tartans I've made with it.
-
-If you have one you'd like to contribute to my database, or would like
-the code that generates this stuff, feel free to [email
-me](mailto:neale-tartan@woozle.org).
-
diff --git a/tartans/index.mdwn b/tartans/index.mdwn
new file mode 100644
index 0000000..94554ca
--- /dev/null
+++ b/tartans/index.mdwn
@@ -0,0 +1,16 @@
+Title: Tartans
+Header:
+
+
+
+Sett:
+Weight:
+
+Preset:
+
+
+
+If you have one you'd like to contribute to my database, or would like the code that generates this stuff, feel free to email me.
+
diff --git a/tartans/loom.html b/tartans/loom.html
deleted file mode 100644
index 46c5890..0000000
--- a/tartans/loom.html
+++ /dev/null
@@ -1,154 +0,0 @@
-
-
-
- loom
-
-
-
-
Loom
-
-
-
diff --git a/tartans/loom.py b/tartans/loom.py
deleted file mode 100755
index e317656..0000000
--- a/tartans/loom.py
+++ /dev/null
@@ -1,204 +0,0 @@
-#! /usr/bin/python
-# coding: utf-8
-
-import re
-import random
-
-class Yarn:
- """A spool of yarn.
-
- Color is specified as a 3-tuple (red, green, blue) of
- saturation values ranging from 0.0 (no saturation) to
- 1.0 (full saturation).
-
- Since we're pretending to be actual dyes here, we can fuzz it out a
- bit by not doing full screen saturation and adding a little bit of
- randomness to the color when queried.
-
- """
-
- maxval = 190
- fuzz = 0
-
- def __init__(self, r, g, b):
- self.rgb = (r, g, b)
- self.intrgb = [int(c * self.maxval) for c in self.rgb]
-
- intfuzz = int(self.fuzz * self.maxval)
- self.limits = [(max(0, c - intfuzz), min(self.maxval, c + intfuzz))
- for c in self.intrgb]
-
- def __repr__(self):
- return '' % (self.rgb)
-
- def get_color(self):
- if self.fuzz:
- color = [random.randrange(l, h) for (l, h) in self.limits]
- return color
- else:
- return self.intrgb
-
-
-class Loom:
- def __init__(self, warp):
- self.warp = warp
- self.fabric = []
-
- def weave(self, yarn, up=1, down=1, skip=0, repeat=0):
- offset = (len(self.fabric) / (repeat + 1)) * (skip + 1)
- harnesses = up + down
- row = []
- for i in range(len(self.warp)):
- j = (i + offset) % harnesses
- if j < down:
- row.append(self.warp[i])
- else:
- row.append(yarn)
- self.fabric.append(row)
-
- def plain_weave(self, yarn):
- # AKA tabby weave, taffeta weave
- self.weave(yarn)
-
- def twill(self, yarn, up=2, down=2):
- self.weave(yarn, up, down)
-
- def satin_weave(self, yarn):
- # 1/16, skip 4
- self.weave(yarn, 1, 16, 4)
-
- def basket_weave(self, yarn):
- # 2/2, skip 1, repeat 1
- self.weave(yarn, 2, 2, 1, 1)
-
-
-class PNGLoom(Loom):
- def png(self, outf, scale=1):
- import Image
- import array
-
- imgstr = array.array('B')
- for fr in self.fabric:
- row = []
- for c in fr:
- for i in range(scale):
- row.extend(c.get_color())
- for i in range(scale):
- imgstr.fromlist(row)
- x = len(fr * scale)
- y = len(self.fabric * scale)
- img = Image.fromstring('RGB', (x, y), imgstr.tostring())
- img.save(outf, 'PNG')
-
-
-def ascii_test():
- print('Plain weave')
- l = Loom('||||||||||||||||||||||||||||||||')
- for i in range(16):
- l.plain_weave('-')
- for row in l.fabric:
- print(' ', ''.join(row))
-
- print('Twill')
- l = Loom('||||||||||||||||||||||||||||||||')
- for i in range(16):
- l.twill('-')
- for row in l.fabric:
- print(' ', ''.join(row))
-
- print('2/1 twill')
- l = Loom('||||||||||||||||||||||||||||||||')
- for i in range(16):
- l.twill('-', 2, 1)
- for row in l.fabric:
- print(' ', ''.join(row))
-
- print('Satin weave')
- l = Loom('||||||||||||||||||||||||||||||||')
- for i in range(16):
- l.satin_weave('-')
- for row in l.fabric:
- print(' ', ''.join(row))
-
- print('Basketweave')
- l = Loom('||||||||||||||||||||||||||||||||')
- for i in range(16):
- l.basket_weave('-')
- for row in l.fabric:
- print(' ', ''.join(row))
-
-
-##
-## Tartan junk
-##
-
-#
-# Colors according to http://www.tartanregister.gov.uk/guidance.aspx
-#
-colors = {'R': Yarn(0.50, 0.00, 0.00), # Red
- 'G': Yarn(0.00, 0.40, 0.00), # Green
- 'B': Yarn(0.00, 0.00, 0.50), # Blue
- 'C': Yarn(0.00, 0.50, 0.50), # Cyan
- 'Y': Yarn(0.80, 0.80, 0.00), # Yellow
- 'P': Yarn(0.60, 0.00, 0.60), # Purple
- 'W': Yarn(0.90, 0.90, 0.90), # White
- 'K': Yarn(0.00, 0.00, 0.00), # Black
- 'BK': Yarn(0.00, 0.00, 0.00), # Black
- 'GR': Yarn(0.50, 0.50, 0.50), # Gray
- 'DB': Yarn(0.00, 0.00, 0.30), # Dark Blue
- 'LB': Yarn(0.00, 0.40, 0.90), # Light Blue
- 'LR': Yarn(0.80, 0.00, 0.00), # Light Red
- 'LG': Yarn(0.00, 0.60, 0.00), # Light Green
- 'LV': Yarn(0.50, 0.25, 0.60), # Lavender
- 'BR': Yarn(0.60, 0.40, 0.20), # Brown
- 'LGR': Yarn(0.60, 0.60, 0.60), # Light Gray
- 'LBR': Yarn(0.80, 0.70, 0.50), # Light Brown
- }
-sett_re = re.compile('([A-Za-z]{1,3}|\([A-Fa-f0-9]{3}\))(\d{1,3})')
-
-
-def str_to_sett(s):
- """Convert an xtartan sett string into a sett tuple."""
-
- sett = []
- while s:
- m = sett_re.search(s)
- if not m:
- break
- cs = m.group(1)
- if cs[0] == '(' and cs[-1] == ')':
- ca = []
- for a in cs[1:-1]:
- ca.append(int(a+a, 16) / 256.0)
- y = Yarn(*ca)
- else:
- y = colors[cs]
-
- for i in range(int(m.group(2))):
- sett.append(y)
- s = s[m.end():]
- if not s.endswith('.'):
- o = sett[:]
- o.reverse()
- sett += o
- if len(sett) % 4:
- sett += sett
- return sett
-
-def tartan(sett):
- l = PNGLoom(sett)
- for y in sett:
- l.twill(y)
- return l
-
-if __name__ == '__main__':
- import sys
-
- for line in sys.stdin:
- if line.startswith('Sett:'):
- _, s = line.split(':', 1)
- s = s.strip()
- break
- sett = str_to_sett(s)
- l = tartan(sett)
- l.png(sys.stdout, 1)
diff --git a/tartans/lstartans b/tartans/lstartans
deleted file mode 100755
index 6abd656..0000000
--- a/tartans/lstartans
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-
-cat $1; shift
-
-for i in "$@"; do
- base=$(basename $i .tartan)
- name=$(awk -F': ' '(/^Name:/) {print $2; exit;}' $i)
- echo "* [$name]($base.html)"
-done
diff --git a/tartans/nm-proc.png b/tartans/nm-proc.png
deleted file mode 100644
index e4d6896..0000000
Binary files a/tartans/nm-proc.png and /dev/null differ
diff --git a/tartans/nm.tartan b/tartans/nm.tartan
deleted file mode 100644
index 9815b31..0000000
--- a/tartans/nm.tartan
+++ /dev/null
@@ -1,10 +0,0 @@
-Name: New Mexico
-Sett: R4 G24 B4 G16 B36 Y8 R4 Y4
-
-Designed by Ralph Stevenson Jr, [officially recognized in 2003](nm-proc.png)
-by the Secretary of State. It is similar in design to the [Albuquerque
-tartan](albuquerque.html). I bought a scarf of this plaid from
-Mr. Stevenson; it came with a photocopy of the tartan registration and a
-few other documents.
-
-[Bally Dun Celtic Treasures](http://www.ballydun.com/) sells this tartan.
diff --git a/tartans/nmloe.tartan b/tartans/nmloe.tartan
deleted file mode 100644
index 7246afb..0000000
--- a/tartans/nmloe.tartan
+++ /dev/null
@@ -1,7 +0,0 @@
-Name: New Mexico Land Of Enchantment
-Sett: LG8 LV32 R4 G32 LG32 Y4 LG4
-
-This isn't official but I think it's pretty. I just guessed at the
-sett pattern but I think I got pretty close.
-[Kathy Lare](http://www.kathyskilts.com/) is the sole source for this
-fabric.
diff --git a/tartans/nv.tartan b/tartans/nv.tartan
deleted file mode 100644
index 9aaf44e..0000000
--- a/tartans/nv.tartan
+++ /dev/null
@@ -1,6 +0,0 @@
-Name: Nevada
-Sett: W4 LGR16 B4 LGR8 B8 Y4 B4 R4 B20
-
-Based on a terrible gif that is apparently a part of [Nevada Revised
-Statute 235.130](http://leg.state.nv.us/NRS/NRS-235.html#NRS235Sec130).
-Designed by Richard Zygmunt Pawlowski, approved May 8, 2001.
diff --git a/tartans/ok.tartan b/tartans/ok.tartan
deleted file mode 100644
index 7c28ef6..0000000
--- a/tartans/ok.tartan
+++ /dev/null
@@ -1,4 +0,0 @@
-Name: Oklahoma
-Sett: R4 W8 LB64 Y6 BK16
-
-Based on a photo on a web page.
diff --git a/tartans/or.tartan b/tartans/or.tartan
deleted file mode 100644
index 4886a4d..0000000
--- a/tartans/or.tartan
+++ /dev/null
@@ -1,11 +0,0 @@
-Name: Oregon
-Sett: Y3 LV10 G4 LV4 G4 W2 G8 LBR24 R4 LB2 K2
-
-I had to reverse-engineer this from the UK tartan registry. If you
-create an account with them, and request a sett, they'll email up to 5
-per day to you. I don't understand why a state's official tartan should
-be so difficult to obtain: it seems like it ought to belong to the
-people of that state and be easily accessed by them.
-
-Well, here you go, people of Oregon.
-
diff --git a/tartans/pjs.tartan b/tartans/pjs.tartan
deleted file mode 100644
index 07811c7..0000000
--- a/tartans/pjs.tartan
+++ /dev/null
@@ -1,7 +0,0 @@
-Name: Neale's PJs
-Sett: W7 C3 GR5 BK3 C5 BK3 C6 GR3 C5
-
-This is an approximation of the pajamas I was wearing when I wrote the
-tartan designer. They weren't actually a tartan. I guess modern
-weavers feel they ought to show off the fact that they can do fancy
-tricks with their looms.
diff --git a/tartans/pjs2.tartan b/tartans/pjs2.tartan
deleted file mode 100644
index 37e554e..0000000
--- a/tartans/pjs2.tartan
+++ /dev/null
@@ -1,5 +0,0 @@
-Name: Neale's PJs II
-Sett: W3 G24 Y2 W2 G2 W2 G2 W1
-
-More of my PJs. This one is an exact copy, I can count the threads
-in this fabric.
diff --git a/tartans/shrek.tartan b/tartans/shrek.tartan
deleted file mode 100644
index beeaf20..0000000
--- a/tartans/shrek.tartan
+++ /dev/null
@@ -1,6 +0,0 @@
-Name: Shrek
-Sett: LBR4 BR8 G16 R2 G16 BR32
-
-I (Neale) created this based on Shrek's pants in a couple of frame grabs
-from the movie. It appears to be different from the recently-released
-"Shrek's Tartan".
diff --git a/tartans/tartan.m4 b/tartans/tartan.m4
deleted file mode 100644
index a5ae7be..0000000
--- a/tartans/tartan.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-Title: TARTAN Tartan
-
-