Last active
November 11, 2018 15:05
-
-
Save wonderburg7/3c6f8858e459ddd4bd3082ee821a9eb4 to your computer and use it in GitHub Desktop.
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
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