Good reference for basic video effects programming

Can anyone refer me to a web site or a book that discusses how to code
special video effects (dissolve, rotate, zoom, etc)?

All my search hits come up with is someone else’s software that I can
buy. I want to CODE it into a game.

TIA.

Bruce

– Sent from my meager, humble desktop computer.

Rotate and zoom are actually trivial with SDL, if you’re using an accelerated
backend.? Instead of rendering normally:

Create a render target that’s the same size as your output window.
Render everything to it.
Render it to the screen.

If you want to rotate, render the target an angle with SDL_RenderCopyEx.
If you want to zoom, render a portion of the target to the full screen.

Dissolve is a bit trickier.? The setup is a bit involved, but you can do it with
render targets as well:

* Render whatever you're dissolving from to a render target, like a normaldraw cycle.
* Render whatever you're dissolving *to* to a second render target the size of the screen. (Assuming you're using a dissolve as a transition and not fading to black or another solid color. If you are, it gets simpler.)
* Create an array of integers. Its length should be equal to the number of blocks you're going to use in your dissolve.? (The maximum size would be the width of your window * the height, if the size of your dissolve block is 1 pixel.)? Call it Blocks.

* Fill the array such that for each element, Blocks[x] = x.? Then shuffle the array randomly. (see http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle for a way to do that.)
* Decide how long the dissolve should take. For each frame:
* You want the dissolve to progress by a certain number of pixels.? Determine how many, based on the amount of time is left in the dissolve, and call that Count.
* You should be keeping an index marker into Blocks that says how far along you are in the dissolve.? Take the next Count number of pixel values from Blocks and set the alpha for the corresponding pixel to 0 in the "before" target for each one, advancing the index as you go.
* Render the "after" target to the window. (Or fill it with a solid color.)
* Render the "before" target on top of it.? Wherever the alpha is set to 0, the "after" image will show through.
* Once you reach the end of the Blocks array, the dissolve will be complete.

Mason________________________________
From: bruce.bowman tds.net <bruce.bowman at tds.net>
To: sdl at lists.libsdl.org
Sent: Monday, February 18, 2013 2:11 PM
Subject: [SDL] Good reference for basic video effects programming

Can anyone refer me to a web site or a book that discusses how to code
special video effects (dissolve, rotate, zoom, etc)?

All my search hits come up with is someone else’s software that I can
buy. I want to CODE it into a game.

TIA.

Bruce

– Sent from my meager, humble desktop computer.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Rotate and zoom are actually trivial with SDL, if you’re using an accelerated
backend.? Instead of rendering normally:

Create a render target that’s the same size as your output window.
Render everything to it.
Render it to the screen.

Thanks Mason. Not using SDL 2.0 at this time. Maybe I should be.

Bruce

– Sent from my meager, humble desktop computer.

Yeah, you probably should.? It’s a much better API than SDL 1.2, especially on the
graphics side of things.

Mason________________________________
From: bruce.bowman tds.net <bruce.bowman at tds.net>
To: sdl at lists.libsdl.org
Sent: Monday, February 18, 2013 8:42 PM
Subject: Re: [SDL] Good reference for basic video effects programming

Rotate and zoom are actually trivial with SDL, if you’re using an accelerated
backend.? Instead of rendering normally:

Create a render target that’s the same size as your output window.
Render everything to it.
Render it to the screen.

Thanks Mason. Not using SDL 2.0 at this time. Maybe I should be.

Bruce

– Sent from my meager, humble desktop computer.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org