Skip to content

Instantly share code, notes, and snippets.

@wonderburg7 wonderburg7/Alphabet.pde
Last active Nov 11, 2018

Embed
What would you like to do?
PImage img, img1, img2, img3, img4; // Declare a variable of type PImage
int bigdistance = 2000;
int distance = 100;
int gridpoints = (bigdistance/distance);
int picheight = 210,picwidth = 210;
String string1 = "the0tsuvi0are0slavers";
int numberofcharacters = string1.length();
int x = picwidth/2;
int y = (height/2)+(picwidth/2);
int h = 1;
static final color BG = -3;
void setup() {
size(6000,1000);
imageMode(CENTER);
noLoop();
}
void draw() {
background(BG);
for (int j = 0; j < numberofcharacters; j++){
pushMatrix();
string1.charAt(j);
img = loadImage(string1.charAt(j)+"i.png");
img.resize(picheight,picwidth);
translate(x,y);
if ((h % 2) == 0){
rotate(radians(180));
}
image(img,0,0);
h++;
x += distance;
popMatrix();
/*saveTransparentCanvas(BG, "umimg");*/
}
PImage text = get(0,0,((picwidth*numberofcharacters)),(picwidth*2));
text.save("text.png");
saveTransparentCanvas(BG, "img");
println("Ready");
}
void mousePressed() {
// Pass same color used for background():
saveTransparentCanvas(BG, "img");
}
void saveTransparentCanvas(final color bg, final String name) {
final PImage canvas = get(0,0,((distance*numberofcharacters)+picwidth),(picwidth+(picwidth/2)));
canvas.format = ARGB;
final color p[] = canvas.pixels, bgt = bg & ~#000000;
for (int i = 0; i != p.length; ++i) if (p[i] == bg) p[i] = bgt;
canvas.updatePixels();
canvas.save(string1 + ".png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.