I would like to combine 2 equal dimension PImages into one PImage by set() -ing one of the images directly on top of another
The problem with this is that if the top image has transparency, the set() function will replace all the transparent pixels with the colour white when set() -ing it rather than skip the transparent pixels.
How can I solve this problem? I have tried using the blend() function but it didn't work.
What would be faster? A 2D array with 26 'columns' and 18 'rows'? Or An ArrayList with 26 bins and each bin is an Arraylist of 18 bins? Keep in mind that these arraylists will have the values in their bins shift position frequently.
I have some code that loads a 512 by 512 .png. Each 32 * 32 section of the png is a separate tile and I wrote some code that reads an int 2D array and prints the tile it points to. Here's an example of my code:
So basically, I'm drawing 16 rows of tiles with each line drawing a different tile 16 times. However, my program is really slow! What am I doing wrong? (I know this example is full speed, but I'm doing the exact same thing except on a very slightly larger scale and I get half my normal framerate)
I've tried to follow the minim documentation to control the volume of the track playing, but I can't get it to work. What am I doing wrong? Here's my code:
With this code, whenever I highlight a text option, it brightens up (via the fill()). However, I cannot get sound to play. It sometimes play when it's supposed to, and it sometimes doesn't. What am I doing wrong?
Simply put, is there a function that'll change the text that appears in the title bar of the sketch window? Right now, it matches my .pde file name. However, I want to be able to change it without changing the name of my file.
I'll keep this short. Let's say I'm trying to print two images on top of each other:
PImage peach = loadimage("peach.png");
PImage grey = loadimage("grey.png");
void draw()
{
image(peach, 0, 0, 256, 256);
//Next image to print on top of previous one
image(grey, 0, 0, 256, 256);
}
The images:
peach.png:
grey.png:
With my current code, all you would see is the grey box (since the peach gets overlapped). However, in photoshop, if you put the grey layer on top of the peach layer and turn the blend mode of the grey layer to 'luminosity', you get this result:
My question is, how can I produce that^^ same result in processing? Please breakdown your explanation.
Ok, what happens when you hold down a letter on the keyboard? (ie 'k'). One 'k' will display, then after a small time lapse, a stream of ks will flood the screen.
This causes a problem. I want to detect when the user is holding down the key, but the pause that happens bugs up my program. Any way around this?
Ok, I've programmed my menu options. They highlight green whenever the mouse cursor is over them and return to black when my mouse isn't over it.
Now I want a sound to play once when I've highlighted an option. Here's what I'm basically doing (not real code):
void draw()
{
int text_r = 0;
int text_g = 0;
int text_b = 0;
if (mouseOverOption() == true)
{
text_g = 200;
playSound();
}
drawText("Option", text_r, text_g, text_b);
}
The problem is that if my mouse lingers on an option, the sound plays countless times rapidly. How can I change my code so that sound is only played once when you highlight an option?