I was kind of irritated with my past self for not socking away a Processing program to generate house icons (w/ identifiers for each location) someplace where my current self could find it and reuse it this year, so I had to make it from scratch.
It brought to mine how I'm a bit slow to use Github (or equivalent) for source control. I guess I'm a bit of a cheapskate, and don't want to pay Github for private repositories, while being a little shy about airing my "dirty laundry" to the world. (Though I have a few projects with a more public face there already.) I guess bitbucket might provide some free private repositories, but even then I'm worried about conflicts with my use of Dropbox for more seamless synching.
When I mentioned my reticence on Facebook, my buddy Kay Rhodes wrote
Stick it on GitHub, add a README that clearly states it's an unfinished work in progress (and what it is). Others can still benefit.I guess that points to some of my skepticism about some types of code sharing in general... Github really feels more geared towards collaborative sharing on ongoing projects than for distribution and installation of mostly ready to go stuff. Even when a project is using it for the latter, it's even odds whether the README.md will actually provide a clear path to installation and use.
I was riding in a van of a friend whose kid is obsessed with Jurassic Park, so on the second or third playthrough I started thinking of how Github sites are kind of "just the DNA" repositories for software, but one of the reason cloning and software installation is so hard is that you need guidance on making the right environment for the stuff to grow. I've seen few Github repository homepages that were adequate substitutes for a standalone websites, but plenty of projects that assume they are. (Sometimes you just want a Download Now link...) Similarly, tech blogs and stackoverflow seem to be much more human ways of sharing code information in a way humans can understand. (And if people were REALLY reading code regularly, stuff like the heartbleed bug wouldn't have been able to hide away for years.)
Anyway, for what it's worth, here's a Processing program that will make batches of house shaped icons and pointers. It shows off a few techniques like generating transparent PNGs in Processing and drawing shapes. (I really should shift gears so my website uses a sprite sheet for these...)
ArrayList<Point> housePoints = new ArrayList<Point>();
color LITEORANGE = #FA8072;
color DARKORANGE = #804000;
color WHITE = #FFFFFF;
color BLACK = #000000;
color PURPLE =#9a88cd;
color GREEN = #BAD579;
color LITEGRAY = #c5c5c5;
color DARKGRAY = #5b5b5b;
int WIDTH = 28;
int POINTERHEIGHT = 34;
int HEIGHT = 28;
PFont myFont;
void setup() {
size(WIDTH, HEIGHT);
myFont = createFont("Arial-Black", 12);
makeHousePoints();
drawSetOfHouses(null);
drawSetOfHouses("T");
drawSetOfHouses("H");
}
void drawSetOfHouses(String badge){
String postfix = "";
if(badge != null) postfix = "_"+badge;
drawHouses("icon_on"+postfix, false, true, badge);
drawHouses("icon_off"+postfix, false, false, badge);
drawHouses("pointer_on"+postfix, true, true, badge);
drawHouses("pointer_off"+postfix, true, false, badge);
}
void drawHouses(String folder, boolean pointer, boolean active, String badge ) {
background(200);
int h = HEIGHT;
if (pointer) h = POINTERHEIGHT;
PGraphics g = createGraphics(WIDTH, h);
g.beginDraw();
g.strokeWeight(2);
g.textFont(myFont);
// g.smooth();
for (int i = -1; i <= 99; i++) {
String fileName = String.valueOf(i);
String display = String.valueOf(i);
if (i == -1) {
fileName = "blank";
display = "";
}
color textColor;
if (active) {
g.fill(LITEORANGE);
g.stroke(DARKORANGE);
textColor = DARKORANGE;
}
else {
g.fill(LITEGRAY);
g.stroke(DARKGRAY);
textColor = DARKGRAY;
}
if(pointer){
g.line(WIDTH/2,h/2,WIDTH/2,h);
}
g.beginShape();
for (Point p : housePoints) {
g.vertex(p.x, p.y);
}
g.endShape(CLOSE);
g.stroke(0);
g.fill(textColor);
g.textAlign(CENTER, CENTER);
g.text(display, 14, 14);
if(badge != null){
g.noStroke();
g.fill(PURPLE);
g.rect(16,0,13,13);
g.fill(WHITE);
g.text(badge,22,4);
}
g.endDraw();
image(g, 0, 0);
g.save(folder+"/"+fileName+".png");
}
}
class Point {
float x, y;
Point(float px, float py) {
x = px;
y = py;
}
}
void makeHousePoints() {
addHousePoint(14, 2);
addHousePoint(0, 13);
addHousePoint(5, 13);
addHousePoint(5, 24);
addHousePoint(23, 24);
addHousePoint(23, 13);
addHousePoint(27, 13);
}
void addHousePoint(float x, float y) {
housePoints.add(new Point(x, y));
}