Taking background color value and save function

edited December 2013 in Programming Questions

Hi

I was just wondering if it's possible to take the RGB value of the background() function and passing it to the draw() area for example. For example i have code that will change the color of the background in my drawing app and obviously i want the eraser to erase stuff in the same color as the background. Same thing for my clear the page code, i want it to clear the page using the same RGB value as the current background. I'm guessing this is immensely easy to do but so far i have had no luck with what i've tried. I'm kind of new to processing.

Also one final thing, i have got a save image function that works for android, but it saves the whole screen including my icons and everything. I wanted it to save just my drawing canvas and this seems easy enough using the get() function on PC but doesnt work on Android. Is there a way i can do this? Select an area of screen to save as my image, on Android?

Any help is much appreciated, i'm very new to this so i'm learning.

Thanks

Answers

  • When you set the background color, can't you just save that into a variable and use that whenever you want?

    I'm not really sure about your saving function, but it seems to me that if you can get the entire screen as an image, you should be able to access a subsection of that image?

  • I don't suppose you can give me an example for this? For the background color.

    And that is exactly what i did with get() function, but android is not happy about it, it crashes.

  • The process of using a variable for a background is very simple.

    First you would make a color variable with your 3 values: color c = color(red, green, blue);

    Then you just use it as your background color: background(c);

    If you need to modify the color, just assign new values to the variable. That's about it.

Sign In or Register to comment.