Optical encoder wheel generator

Steps (around the wheel) (for a 1-bit quadrature wheel, this should be twice the number of slots)
Bits (how many to generate the wheel for)
Inner radius (pixels)
Width of each band (pixels)
Space between bands (pixels)
Use plain binary instead of gray code encoding?
Least significant bit on the inside instead of the outside?
Make pretty for humans, bad for printing? (adds colored grid lines to the output)
Add extra human-usable guides when bits are narrower than bands? (ignored if above not checked)
Add sensor alignment guides around each band?
Draw an inner 0-position index track?
  
Generate matching photodiode mask?
Width of the photodiode slots, in percent of bit width?
Width of the photodiode slots, in percent of band width?
Spacing of photodiode slots around the wheel, as they would be spaced if there were this number around the wheel? (will be adjusted to a factor of the steps if the 1/2 bit offset is selected, to ensure proper alignment)
Number of slots to actually draw, at above spacing?
Add a 1/2 bit offset to the other positions, for quadrature wheels? (an indicator will be drawn for the non-shifted slot)
Only draw one slot per group, for oversize sensors?

NOTE: This is a very simple program, and will generate stupid output if you give stupid input. As an important example, if your bits end up being less than 2 pixels wide or so (due to trying to generate too small of a wheel with a small inner radius), they will not be filled in even though they should be. You have been warned!

More notes: If you add an index track, you probably also want to add one to the number of encoder slots to draw in the mask, if you're making a mask. Also, your number of steps should be a multiple of 2^bits, if you want a wheel that repeats nicely.

Wow, people are actually using this! If you're over 18, go to my toy store and buy something to help pay for all the bandwidth. Yes, you! Hackers (and geeks) like toys, right? :)