Question on "blend"

Started by Zefk, December 22, 2016, 12:05:41 AM

Previous topic - Next topic
I am a bit confused. The mode "blend" looks no different than any other image.


Code ( lua) Select
   
    --This drawable object is alpha-blended onto the destination surface
    blend_red_img:draw(screen,100,200)
    blend_red_img:set_blend_mode("blend")

    blend_green_img:draw(screen,100,200)
    blend_green_img:set_blend_mode("blend")

    blend_blue_img:draw(screen,100,200)
    blend_blue_img:set_blend_mode("blend")


It looks like this: (Unless the alpha is at 255)



I thought it was suppose to be like this:

I see....I fingered it out. It blends on the surface and I was trying to blend them on the screen. Here is a sample.

Code ( lua) Select
surface_img:draw(screen)
    --fill suface with a orange color
    surface_img:fill_color({245,68,0})
   
   --"blend" blend mode.
    blend_test_img:draw(screen)
    blend_red_img:draw(surface_img,100,200)
    blend_red_img:set_blend_mode("blend")

    blend_green_img:draw(blend_test_img,100,200)
    blend_green_img:set_blend_mode("blend")

    blend_blue_img:draw(blend_test_img,100,200)
    blend_blue_img:set_blend_mode("blend")

     surface_img:set_opacity(80)