[SOLVED] Imagemap Alpha Issue

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
guiltyGG
Newbie
Posts: 13
Joined: Sat Aug 19, 2017 8:51 am
Contact:

[SOLVED] Imagemap Alpha Issue

#1 Post by guiltyGG »

I have an imagemap that uses partially transparent PNGs, but the hotspot rectangles are being drawn onto the imagemap in some almost bit-wise AND/OR fashion (that's kinda what they look like; the resulting image isn't one or the other, but a blend that isn't a direct overlay).

I probably should be using imagebuttons for this quick_menu replacement on top of a normal alpha image, but imagemaps are less work and easier to maintain later on. But, I'm still learning, so could be wrong on all counts.

(the large image is rendered in Ren'Py, but I added 'idle/hovered' captions / cleaned the layout with GIMP)

Thanks :)


Ren'Py version: 6.99.13.2919

Idle:
Image

Hover:
Image

Image

Code: Select all

screen test:
    #idle
    add "images/im-issue_idle.png" xpos 10 ypos 10
    
    #hover
    add "images/im-issue_hover.png" xpos 200 ypos 10
    
    #overlay
    add "images/im-issue_idle.png" xpos 400 ypos 10
    add "images/im-issue_hover.png" xpos 400 ypos 10    
    
    #captions
    text "Idle" xpos 10 ypos 230
    text "Hover" xpos 200 ypos 230
    text "Overlay" xpos 400 ypos 230
    
    imagemap:
        xalign 0.5 yalign 0.5
        auto "images/im-issue_%s.png"
        hotspot (20, 80, 132, 52) action NullAction()

image bg = Solid('#000')
        
label start:
    scene bg
    call screen test()
    return
Last edited by guiltyGG on Fri Mar 23, 2018 5:07 am, edited 2 times in total.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Imagemap Alpha Issue

#2 Post by PyTom »

So, the way an imagemap works is to figure out ground, hover, and idle images. The button is made out of the hover and idle images, and composed on the ground. You might be able to get away with a blank idle image, and just use hover and ground.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

guiltyGG
Newbie
Posts: 13
Joined: Sat Aug 19, 2017 8:51 am
Contact:

Re: Imagemap Alpha Issue

#3 Post by guiltyGG »

PyTom wrote: Wed Mar 21, 2018 7:39 pm So, the way an imagemap works is to figure out ground, hover, and idle images. The button is made out of the hover and idle images, and composed on the ground. You might be able to get away with a blank idle image, and just use hover and ground.
Using the transparent Idle image / switching Idle to Ground removed the box around the imagemap at its idle state, but I'm still getting an 'overlay'-type graphic at its hover state:

Image

You said the idle and hover images are composited on top of the ground image, which would cause the overlay graphic effect, as the pixels are just being added to one another (or a similar formula).

I tried a transparent ground image with normal idle/hover, but that resulted in no image at idle, and a hover image at hover. I could be misunderstanding, but is there a way to composite on top of a transparent image created by Ren'Py (blank-idle / blank-hover / blank-other), as that would remove the 'overlay' effect?

Thanks,

guiltyGG
Newbie
Posts: 13
Joined: Sat Aug 19, 2017 8:51 am
Contact:

Re: Imagemap Alpha Issue

#4 Post by guiltyGG »

I went for your 'might be able to get away with it' take, and just drew a box around each menu choice, thus hiding the hotspot borders:

Image

and, it works well enough, and I can keep the imagemap.

Thanks again :)

Post Reply

Who is online

Users browsing this forum: No registered users