We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi.
Code below does exactly what I want; fading picture into almost white. However it does fade always in Java mode it does not in Android mode, better to say I've only one image that does fade in Android mode. I've checked if the pictures have an alpha channel with GIMP and they do. How to generate images that will fade? This is driving me nuts. You can download my fading image here.
Any rescue?
(int i = 255;
boolean flag1;
PImage img;
void setup() {
size (600, 600);
background(255);
img = loadImage("uyf.png");
tint(255, 255);
image(img, 0, 0);
}
void draw() {
if (flag1){
background(255);
tint(255, i);
image(img, 0, 0);
i -= 6;
if(i < 40) flag1 = false;
}
}
void mousePressed(){
flag1 = true;
}
)
Answers
Well after a lot of head scratching l finaly found the solution. Take the picture to an editor like GIMP, select the whole image and give it a transparency of 5 or 10 %. Then it will fade in Android mode. Don't know if I have to report this as a bug.
Just to confirm: are you saying that a PNG image without alpha cannot be tinted with alpha in Android mode -- the file itself must already have alpha values, then it works?
If that is true then that sounds like a bug. I don't see any open issues already reported for
tint()
or alpha.@noel I need permission to access your image. Make it available through other means plz.
In the meantime, I tested both JAVA2D and P2D and the tint works. I used two images
https://www.svgimages.com/james-dean-rebel-stencil.html
https://www.svgimages.com/horse-stand.html
Kf
Confirmed. I just tried again. I googled images/horse and took the first one (horse.jpg). I tried java mode, and it faded perfectly. In Android mode nothing happens. I took it to GIMP and exported it with an alpha channel as horsewa.png. Nothing happend. I then opened the layer dialogbox and gave it 1% transparency and exported again as horsewa1.png. Now it perfectly fades. I tried kfrajer's code (thank you for that) but it crashes because it can't find the images. Trying to open the image link in the browser it really doesn't download. I'll try to substitute the images later, but meanwhile I used the P2D renderer with code above. Now it fades even the horse.jpg, but someting strange happens. It doesn't obey my code anymore, it just fades away in total white!
This time I used dropbox and made it public. Hope it works. https://www.dropbox.com/s/8d6dvqip1lsuo1d/horse.jpg?dl=0 https://www.dropbox.com/s/n2771ucpb4tccfd/horsewa.png?dl=0 https://www.dropbox.com/s/q94pls265cgwvl5/horsewa1.png?dl=0
Here is also a link for the ScrollView topic.
https://www.dropbox.com/s/1jdr2cncw7tmlbi/panorama.jpg?dl=0
@noel did you ever report this here? https://github.com/processing/processing-android/issues