Subject: Re: bug#40845: SVG rendering issues

From: Alan Third <[email-masked]>
Date: Sun, 3 May 2020 19:38:39 +0100

On Sun, May 03, 2020 at 07:49:45PM +0300, Eli Zaretskii wrote:
> > Date: Sun, 3 May 2020 17:24:17 +0100
> > From: Alan Third <[email-masked]>
> > Cc: [email-masked], [email-masked], [email-masked]
> > 
> > One thing is that it gets the foreground colour from the default face
> > instead of the current face. I’m not sure how to solve that.
> 
> Can you describe the difficulty in using the current face?

I’m mostly unsure how I access it. I don’t think images or image.c
have any real concept of where they are in the buffer.

I think we’d also have to recreate the image any time the face
changed. For example in Clement’s test code from the original bug
report, he has the face changing when the mouse hovers over the text.
In order to handle that case we would need to create a new version of
the image with the updated foreground and background when the mouse
moves over it.

We can work around having to update the background by using proper
transparency, but I don’t know what other problems that might
introduce. It’s harder for the foreground. Pip Cet suggested creating
masks for foreground and background and using them to draw the image
in sections, but I feel that’s perhaps getting a little complex,
especially when I think most images won’t be changing their foreground
and background colours.

I feel it would be easier just to have two or more cached images with
different foreground and backgrounds as required.

> > I’m unsure if my use of malloc is OK, as I know Emacs code uses some
> > different methods in different places.
> 
> It's okay to call malloc and free in image.c.

Excellent, thanks.
-- 
Alan Third