We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › PNG transparency
Page Index Toggle Pages: 1
PNG transparency (Read 552 times)
PNG transparency
Jun 19th, 2006, 5:42pm
 
Working over Zach Lieberman's Kinetic Type, I changed some values and tried to introduce a transparent image. I can see all the changes but the PNG file do not show transparency. Thanks for help.


Line ln;
Line lns[];
PFont f;
String k = "_______________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
_______________";
String words[] = {
 k, k, k, k, k, k, k, k, k, k, k, k, k, k, k, k, k, k, k, k
};

void setup()
{
 size(600, 107, P3D);
 framerate(30);


 lns = new Line[20];


 f = loadFont("FuturaVitimaBold-100.vlw");
 textFont(f, 5f);


 fill(255, 255, 0);


 for(int i = 0; i < 20; i++)
 {


   ln = new Line(words[i], 0, i * 80, f);
   lns[i] = ln;
 }
}


void draw()
{
 background(0, 0, 0);

 PImage m;
 m = loadImage("DeMarcoBros_transp.png");
 image(m, 8, 20);

 translate((float)(height / 5.0) - 350, (height / 5.0) - 10, -10);
 rotateY(mouseY);
 rotateX(mouseX*2);


 for(int i = 0; i < 20; i++)
 {
   float f1 = sin((i + 1.0) * (millis() / 10000.0) * TWO_PI);
   float f2 = sin((20.0 - i) * (millis() / 10000.0) * TWO_PI);
   Line line = lns[i];
   pushMatrix();
   translate(0.0, line.yPosition, 0.0);
   for(int j = 0; j < line.myLetters.length; j++)
   {
     if(j != 0) {
       translate(textWidth(line.myLetters[j - 1].myChar)*75, 0.0, 0.0);
     }
     rotateY(f1 * 0.035 * f2);
     pushMatrix();
     scale(75.0, 75.0, 75.0);
     text(line.myLetters[j].myChar, 0.0, 0.0);
     popMatrix();
   }
   popMatrix();
 }
}

class Letter
{
 char myChar;
 float x;
 float y;

 Letter(char c, float f, float f1)
 {
   myChar = c;
   x = f;
   y = f1;
 }
}

class Word
{
 String myName;
 int x;

 Word(String s)
 {
   myName = s;
 }

}

class Line
{
 String myString;
 int xPosition;
 int yPosition;
 int highlightNum;
 PFont f;
 float speed;
 float curlInX;
 Letter myLetters[];

 Line(String s, int i, int j, PFont bagelfont)
 {
   myString = s;
   xPosition = i;
   yPosition = j;
   f = bagelfont;
   myLetters = new Letter[s.length()];
   float f1 = 0.0;
   for(int k = 0; k < s.length(); k++)
   {
     char c = s.charAt(k);
     f1 += textWidth(c);
     Letter letter = new Letter(c, f1, 0.0);
     myLetters[k] = letter;
   }

   curlInX = 0.1;
 }
}
Re: PNG transparency
Reply #1 - Jun 20th, 2006, 1:53pm
 
http://dev.processing.org/bugs/show_bug.cgi?id=350
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1148067729
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1147862625
Page Index Toggle Pages: 1