wonderburg7
11/6/2018 - 11:25 PM

alphabet 2.0.pde

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 = "channeler";
int numberofcharacters = string1.length();
int x = picwidth;
int y = picwidth;
static final color BG = -32;

void setup() {
  size(4000,1000, JAVA2D);
  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 (((j-1) % 2) == 0){
rotate(radians(180));
} 

image(img,0,0);
 
x += distance;
 
 popMatrix();
 /*saveTransparentCanvas(BG, "umimg");*/
}
 //PImage text = get(0,0,((picwidth*numberofcharacters)),(picwidth*2));
 // text.save("text.png");
  saveTransparentCanvas(BG, "img");
  print("Done");
  
}

void saveTransparentCanvas(final color bg, final String name) {
  final PImage canvas = get(0,0,int((picwidth*numberofcharacters)*0.75),(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");
}