Tint for LiveComposite?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
LabaroDD
Regular
Posts: 34
Joined: Thu Apr 14, 2016 7:47 am
Contact:

Tint for LiveComposite?

#1 Post by LabaroDD » Sat Feb 04, 2017 9:04 pm

Hello everyone!
I would like to apply matrix color to LiveComposite (I have an animated sprite here, lip-flapping and blinking). I want to use it for night/evening sceneries, but I can't find the way to make this... The solution is pretty simple, I guess, but I just can't realise how to do this ^^"

Any help will be appreciated!

User avatar
ISAWHIM
Veteran
Posts: 287
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

Re: Tint for LiveComposite?

#2 Post by ISAWHIM » Tue Feb 07, 2017 3:36 am

Try the ALPHABLEND() function...
I think you can create a "color" as an image, but I forgot the code for that... Not sure if it accepts "alpha" as one of the "colors"... But alphablend would work with an image.

It will not "colorize it", it will "tint" it, as a transparent overlay. (Thus, blacks will also gain the "color" of the tint.) However, if you have a tinted version of that image, with the shades, it will then blend perfectly, only tinting where you have the colors that exist in the overlay image, by a percentage.

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Tint for LiveComposite?

#3 Post by nyaatrap » Tue Feb 07, 2017 4:15 am

Code: Select all

init python
    def ColorBlend(d, color="#000", alpha=.5):
        return AlphaBlend(Transform(d, alpha = alpha), d, Solid(color, xysize=(config.screen_width, config.screen_height)), alpha=True)

image darkend_sprite = ColorBlend(Image("sprite.png"))

User avatar
IrinaLazareva
Veteran
Posts: 374
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: IKG
Location: St.Petersburg, Russia
Contact:

Re: Tint for LiveComposite?

#4 Post by IrinaLazareva » Tue Feb 07, 2017 5:51 am

or... (for LiveComposite)

Code: Select all

    image storm normal = LiveComposite((config.screen_width, config.screen_height),
        (0, 0), "image.png",
        )
    image storm night = LiveComposite((config.screen_width, config.screen_height),
        (0, 0), "image.png",
        (0, 0), "#0009",
        )
    image storm evening = LiveComposite((config.screen_width, config.screen_height),
        (0, 0), "image.png",
        (0, 0), "#0225",
        )
    image storm moning = LiveComposite((config.screen_width, config.screen_height),
        (0, 0), "image.png",
        (0, 0), "#7105",
        )

By the way, about alpha in hex code:
https://css-tricks.com/8-digit-hex-codes/
There is a light at the end of the tunnel, just pray it's not a train.
___
TODO: unresolved/нерешённое

LabaroDD
Regular
Posts: 34
Joined: Thu Apr 14, 2016 7:47 am
Contact:

Re: Tint for LiveComposite?

#5 Post by LabaroDD » Fri Feb 10, 2017 3:30 pm

Oh my! Thank you everyone! I'll try it all.

Post Reply

Who is online

Users browsing this forum: No registered users