Using tint() on a PImage object, not the whole canvas

Howdy all,

I'm trying to use the tint() function on a PImage object. I'm working on an LED project in which we have a huge map of LEDs. I'm mapping images onto them by opening said image using PImage, then doing some geometry on where the coordinates of the LEDs are in the image, and then displaying that color.

I've found that the colors come out a lot richer if I do white-to-alpha and save as a png in Gimp first, but I want to apply that transparency function in Processing instead and tint() seemed the right way to go, but it seems to change my canvas instead of my PImage object. (the control knobs of our 3d openGL simulation change color and the pattern on the LEDs doesn't change)

Any suggestions? If anyone has ideas on how to apply something like the third example here ("apply transparency without changing color") on a pixel by pixel basis to the image that would also work great.

Code snippet:

//Constructor for class MentalImage public MentalImage(String imagepath){ this.imagecolors = loadImage(imagepath); loadPixels(); tint(255,128); this.imagecolors.loadPixels(); this.imagedims = new int[] {(int)imagecolors.width, (int)imagecolors.height}; //Map the points in the image to the model, once. for (LXPoint p : model.points) { //this is the code for int[] point_loc_in_img=scaleLocationInImageToLocationInBrain(p); this.pixel_to_pixel.put(p.index,point_loc_in_img); } }

Entire project:

Thanks! Alex



Sign In or Register to comment.