 |
Author |
Topic: fades/compositing without drawing on screen (Read 759 times) |
|
kensuguro
|
fades/compositing without drawing on screen
« on: Oct 27th, 2004, 5:39am » |
|
Still trying to find my way around Processing, but it's a great tool to learn. Much more welcoming than c++. I'm trying to find a way to do a fade between 2 images, but without having to draw it on screen. The basic approach I guess would be to take each pixel of the 2 image and scale the values, and add them together. Something like this: Code: for(int i0; j<320*240; j++){ nowred = int( red(old.pixels[j])* 0.7 + red(video.pixels[j])* 0.3); nowgreen = int( green(old.pixels[j])* 0.7 + green(video.pixels[j])* 0.3); nowblue = int( blue(old.pixels[j])* 0.7 + blue(video.pixels[j])* 0.3); colorMode(RGB, 100); old.pixels[j] = color( nowred, nowgreen, nowblue); } |
| But I was told that another approach would be to set the alpha values for both the images, and then draw both of them on screen where they are blended. This would be much easier, only the result is shown on screen, and not in a buffer that I can use later on. Question is, is there a way that I can take the alpha approach, and just draw into an off screen BImage object instead?
|
« Last Edit: Oct 27th, 2004, 5:40am by kensuguro » |
|
|
|
|
JohnG
|
Re: fades/compositing without drawing on screen
« Reply #1 on: Oct 28th, 2004, 10:57am » |
|
You can create a BGraphics object, that works exactly the same way that the screen does, e.g.: Code: BGraphics buff=new BGrpahics(200,200); buff.stroke(255,128,0) buff.line(0,0,50,25); buff.fill(0,128,255); buff.ellipse(100,150,50,50); |
| etc, so all the functions that draw to screen can be prefixed by the name of your BGraphics object, and will draw to that instead of the screen. you can then copy parts of that BGraphics onto the screen with BImage foo=(yourBGrpahics).copy(x,y,width,height) (IIRC)
|
|
|
|
kensuguro
|
Re: fades/compositing without drawing on screen
« Reply #2 on: Oct 28th, 2004, 3:39pm » |
|
thnx. I've started to look into the BGraphics object, and it's awesome! Is there an official or unofficial documentation on BGraphics? Or are people figuring it out as they go?
|
|
|
|
fry
|
Re: fades/compositing without drawing on screen
« Reply #3 on: Oct 28th, 2004, 7:43pm » |
|
you're always drawing into a BGraphics object, so essentially, the documentation is just what's on the site for things like line, point, beginShape etc.. however as far as docs on creating your own BGraphics and the specifics of that, there are none as yet (ppl just have to search the forums here) since we're still finalizing the specifics on how it should be set up.
|
|
|
|
kensuguro
|
Re: fades/compositing without drawing on screen
« Reply #4 on: Oct 29th, 2004, 6:26am » |
|
k, thanx. will look forward to finding out more.
|
|
|
|
|