Blending options?

Hi

I didn’t understand if it is possible to choose how to blit a surface.

is it possible to blit in “multiply” (or “lighten” or “darken” or “overlay”) mode?

thanks

MandarX------------------------
http://mandarx.xoom.it/index.php?lang=eng

I haven’t seen anything about this, so I’m guessing it’s something
you’d have to do yourself, using per-pixel manipulations.

-bill!
(who just added gamma-correction to the scaling routine used in
Tux Paint :wink: )On Thu, Feb 25, 2010 at 03:02:18AM -0800, mandarx wrote:

Hi

I didn’t understand if it is possible to choose how to blit a surface.

is it possible to blit in “multiply” (or “lighten” or “darken” or
"overlay") mode?

SDL 1.3 gives you access to the following blend modes:
SDL_BLENDMODE_BLEND, /< dst = (src * A) + (dst * (1-A)) */
SDL_BLENDMODE_ADD, /
< dst = (src * A) + dst */
SDL_BLENDMODE_MOD /**< dst = src * dst */

Other modes you’d have to code up yourself using surfaces or OpenGL.On Thu, Feb 25, 2010 at 3:02 AM, mandarx wrote:

Hi

I didn’t understand if it is possible to choose how to blit a surface.

is it possible to blit in “multiply” (or “lighten” or “darken” or “overlay”)
mode?

thanks

MandarX


http://mandarx.xoom.it/index.php?lang=eng


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Sam Lantinga wrote:

SDL 1.3 gives you access to the following blend modes:
SDL_BLENDMODE_BLEND, /< dst = (src * A) + (dst * (1-A)) */
SDL_BLENDMODE_ADD, /
< dst = (src * A) + dst */
SDL_BLENDMODE_MOD /**< dst = src * dst */

great, thanks!

Sam Lantinga wrote:

Other modes you’d have to code up yourself using surfaces or OpenGL.

I’ve found these formulas:

Multiply: Result Color = (Top Color) * (Bottom Color) /255
Screen: Result Color = 255 - [((255 - Top Color)*(255 - Bottom Color))/255]

Should I use pixel operations or there is a way to use bitwise operation?

MandarX------------------------
http://mandarx.xoom.it/index.php?lang=eng

Multiply is the same as SDL_BLENDMODE_MOD.

Other formulae you would have to do youself with software surfaces or
OpenGL.

See ya!
–SamOn Fri, Feb 26, 2010 at 12:54 AM, mandarx wrote:

Sam Lantinga wrote:

SDL 1.3 gives you access to the following blend modes:
SDL_BLENDMODE_BLEND, /< dst = (src * A) + (dst * (1-A)) */
SDL_BLENDMODE_ADD, /
< dst = (src * A) + dst */
SDL_BLENDMODE_MOD /**< dst = src * dst */

great, thanks!

Sam Lantinga wrote:

Other modes you’d have to code up yourself using surfaces or OpenGL.

I’ve found these formulas:

Multiply: Result Color = (Top Color) * (Bottom Color) /255
Screen: Result Color = 255 - [((255 - Top Color)*(255 - Bottom Color))/255]

Should I use pixel operations or there is a way to use bitwise operation?

MandarX


http://mandarx.xoom.it/index.php?lang=eng


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC