all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* alpha support for colors
@ 2012-10-29 20:19 aaditya sood
  2012-10-30  1:52 ` Chong Yidong
  0 siblings, 1 reply; 11+ messages in thread
From: aaditya sood @ 2012-10-29 20:19 UTC (permalink / raw
  To: emacs-devel

Hi all,

Does emacs support alpha blending on colors on faces? In particular 
can I specify colors in ARGB format?

I want to only selectively enhance one color component via face overlay.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-29 20:19 alpha support for colors aaditya sood
@ 2012-10-30  1:52 ` Chong Yidong
  2012-10-30  5:02   ` aaditya sood
  0 siblings, 1 reply; 11+ messages in thread
From: Chong Yidong @ 2012-10-30  1:52 UTC (permalink / raw
  To: aaditya sood; +Cc: emacs-devel

aaditya sood <aaditya@sood.net.in> writes:

> Does emacs support alpha blending on colors on faces? In particular 
> can I specify colors in ARGB format?

No.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-30  1:52 ` Chong Yidong
@ 2012-10-30  5:02   ` aaditya sood
  2012-10-30  5:07     ` Masatake YAMATO
                       ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: aaditya sood @ 2012-10-30  5:02 UTC (permalink / raw
  To: emacs-devel

Chong Yidong <cyd <at> gnu.org> writes:

> 
> aaditya sood <aaditya <at> sood.net.in> writes:
> 
> > Does emacs support alpha blending on colors on faces? In particular 
> > can I specify colors in ARGB format?
> 
> No.

Ok, I guess my googling wasn't in vain. 

Are people interested in this capability? I'm interested in working on this 
feature, with (hopefully) some guidance from emacs developers.

If I wanted to start work on it:

1. Where should I begin?
2. Is it even do-able in terms of complexity, or will it touch the fabled and 
    scary redisplay engine?

What do people think?

I've have some experience with C and elisp, but mostly an emacs user 
till date. Perhaps my chance to contribute back.

regards
--
aaditya






^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-30  5:02   ` aaditya sood
@ 2012-10-30  5:07     ` Masatake YAMATO
  2012-10-30  6:51     ` joakim
  2012-10-30 17:43     ` Eli Zaretskii
  2 siblings, 0 replies; 11+ messages in thread
From: Masatake YAMATO @ 2012-10-30  5:07 UTC (permalink / raw
  To: aaditya; +Cc: emacs-devel

Hi,

Nothing to do with faces but it is nice if a popup menu can be rendered
in translucent.

Just request:-P

Masatake YAMATO

> Chong Yidong <cyd <at> gnu.org> writes:
> 
>> 
>> aaditya sood <aaditya <at> sood.net.in> writes:
>> 
>> > Does emacs support alpha blending on colors on faces? In particular 
>> > can I specify colors in ARGB format?
>> 
>> No.
> 
> Ok, I guess my googling wasn't in vain. 
> 
> Are people interested in this capability? I'm interested in working on this 
> feature, with (hopefully) some guidance from emacs developers.
> 
> If I wanted to start work on it:
> 
> 1. Where should I begin?
> 2. Is it even do-able in terms of complexity, or will it touch the fabled and 
>     scary redisplay engine?
> 
> What do people think?
> 
> I've have some experience with C and elisp, but mostly an emacs user 
> till date. Perhaps my chance to contribute back.
> 
> regards
> --
> aaditya
> 
> 
> 
> 



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-30  5:02   ` aaditya sood
  2012-10-30  5:07     ` Masatake YAMATO
@ 2012-10-30  6:51     ` joakim
  2012-10-30  7:37       ` aaditya sood
  2012-10-30 17:43     ` Eli Zaretskii
  2 siblings, 1 reply; 11+ messages in thread
From: joakim @ 2012-10-30  6:51 UTC (permalink / raw
  To: aaditya sood; +Cc: emacs-devel

aaditya sood <aaditya@sood.net.in> writes:

> Chong Yidong <cyd <at> gnu.org> writes:
>
>> 
>> aaditya sood <aaditya <at> sood.net.in> writes:
>> 
>> > Does emacs support alpha blending on colors on faces? In particular 
>> > can I specify colors in ARGB format?
>> 
>> No.
>
> Ok, I guess my googling wasn't in vain. 
>
> Are people interested in this capability? I'm interested in working on this 
> feature, with (hopefully) some guidance from emacs developers.
>
> If I wanted to start work on it:
>
> 1. Where should I begin?

What would the interface be? So, lets say you want an alpha component
for the foreground. try adding that somewhere in the face descriptor,
just temporarily in your own experimental branch. Then, how do you
propose to add the faces together? Let's say you add a function
blend-faces, that adds the colours together, taking in consideration the
alpha value, and creates a new face. Then you use this function to do
what you want.

(I'm just guessing what you want to do, so my advice is probably pretty lame)

> 2. Is it even do-able in terms of complexity, or will it touch the fabled and 
>     scary redisplay engine?

Maybe, but it's not THAT scary. It's actually pretty cool when you get
to understand it a little bit.

>
> What do people think?
>
> I've have some experience with C and elisp, but mostly an emacs user 
> till date. Perhaps my chance to contribute back.

My suggestion is to make a separate branch where you hack a bit to try
to gauge the complexity.

> regards
> --
> aaditya
>
>
>

-- 
Joakim Verona



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-30  6:51     ` joakim
@ 2012-10-30  7:37       ` aaditya sood
  2012-10-30 13:28         ` Stefan Monnier
  2012-10-30 17:45         ` Eli Zaretskii
  0 siblings, 2 replies; 11+ messages in thread
From: aaditya sood @ 2012-10-30  7:37 UTC (permalink / raw
  To: emacs-devel


Hi,

 <joakim <at> verona.se> writes:

> What would the interface be? So, lets say you want an alpha
> component for the foreground. try adding that somewhere in the face
> descriptor, just temporarily in your own experimental branch. Then,
> how do you propose to add the faces together? Let's say you add a
> function blend-faces, that adds the colours together, taking in
> consideration the alpha value, and creates a new face. Then you use
> this function to do what you want.

> (I'm just guessing what you want to do, so my advice is probably pretty lame)

IMO you're spot on. We'd want to do a composition of all the faces
that exist for a particular character, taking into account things like
alpha values.

I think a good use case is things like flymake error faces. I want my
error lines to be more "reddish" while still retaining the original
font lock highlighting.

>> 2. Is it even do-able in terms of complexity, or will it touch the
>>     fabled and scary redisplay engine?
>  Maybe, but it's not THAT scary. It's actually pretty cool when you
> get to understand it a little bit.

:)

> My suggestion is to make a separate branch where you hack a bit to
> try to gauge the complexity.

That is my intent. However I'd like to discuss some of the design
issues, or where to start hacking beforehand. This is to reduce the
complexity of merging into trunk at a future date.

regards
--
aaditya




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-30  7:37       ` aaditya sood
@ 2012-10-30 13:28         ` Stefan Monnier
  2012-10-30 17:45         ` Eli Zaretskii
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2012-10-30 13:28 UTC (permalink / raw
  To: aaditya sood; +Cc: emacs-devel

> I think a good use case is things like flymake error faces.  I want my
> error lines to be more "reddish" while still retaining the original
> font lock highlighting.

I was sold on your idea long before you suggested it (actually, I've
been wishing for it mostly to automatically create "lighter/darker"
faces and I'm not completely sure if alpha-blending can do that well).

I think to do it you'll want to look at the face merging code in
src/xfaces.c.  There's already code to merge heights (where faces can
specify relative sizes or even an Elisp function that computes the new
height from the height of underlying faces), so it really shouldn't be
that hard.

There's a secondary alpha-blending issue, which I think is orthogonal,
which is how to blend foreground and background.  This part would not be
handled in src/xfaces.c.

And then again there's the alpha-blending of the Emacs window with the
windows that might appear underneath, but this is yet another
orthogonal issue.


        Stefan



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-30  5:02   ` aaditya sood
  2012-10-30  5:07     ` Masatake YAMATO
  2012-10-30  6:51     ` joakim
@ 2012-10-30 17:43     ` Eli Zaretskii
  2 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2012-10-30 17:43 UTC (permalink / raw
  To: aaditya sood; +Cc: emacs-devel

> From: aaditya sood <aaditya@sood.net.in>
> Date: Tue, 30 Oct 2012 05:02:56 +0000 (UTC)
> 
> If I wanted to start work on it:
> 
> 1. Where should I begin?

By publishing the proposed APIs and the use cases you want to support.
What you said until now is not detailed enough, IMO.

> 2. Is it even do-able in terms of complexity, or will it touch the fabled and 
>     scary redisplay engine?

If all you want is a way to create faces by alpha-blending other
faces, then the display engine doesn't need to be touched at all.  The
display engine doesn't care about faces, they are just small numbers
as far as display is concerned.  The part that does care are the
terminal-specific back-ends: xterm.c/xfns.c, w32term.c/w32fns.c, etc.
That is where you will need to make changes to introduce support for
alpha.

However, since I don't really understand what features do you want to
support, the above might miss the point completely.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-30  7:37       ` aaditya sood
  2012-10-30 13:28         ` Stefan Monnier
@ 2012-10-30 17:45         ` Eli Zaretskii
  2012-10-31  2:06           ` Stephen J. Turnbull
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2012-10-30 17:45 UTC (permalink / raw
  To: aaditya sood; +Cc: emacs-devel

> From: aaditya sood <aaditya@sood.net.in>
> Date: Tue, 30 Oct 2012 07:37:07 +0000 (UTC)
> 
> We'd want to do a composition of all the faces that exist for a
> particular character, taking into account things like alpha values.

What do you mean by "composition of all the faces"?  Why "all"?

> I think a good use case is things like flymake error faces. I want my
> error lines to be more "reddish" while still retaining the original
> font lock highlighting.

How is this different from changing the color of the face to be more
"reddish"?

> However I'd like to discuss some of the design issues, or where to
> start hacking beforehand.

Then please tell more.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-30 17:45         ` Eli Zaretskii
@ 2012-10-31  2:06           ` Stephen J. Turnbull
  2012-10-31  4:00             ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen J. Turnbull @ 2012-10-31  2:06 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: aaditya sood, emacs-devel

Eli Zaretskii writes:

 > What do you mean by "composition of all the faces"?  Why "all"?

I suspect aaditya is thinking in terms of bitmap composition
operations on graphics layers, not Emacs faces.

So he'd like to put an overlay on some text, give that overlay a 'face
property of '(+ red), and turn all the blue text in the overlay to
violet (the RGB sum of #F00 and #00F == #F0F).



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: alpha support for colors
  2012-10-31  2:06           ` Stephen J. Turnbull
@ 2012-10-31  4:00             ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2012-10-31  4:00 UTC (permalink / raw
  To: Stephen J. Turnbull; +Cc: aaditya, emacs-devel

> From: "Stephen J. Turnbull" <stephen@xemacs.org>
> Cc: aaditya sood <aaditya@sood.net.in>,
>     emacs-devel@gnu.org
> Date: Wed, 31 Oct 2012 11:06:11 +0900
> 
> Eli Zaretskii writes:
> 
>  > What do you mean by "composition of all the faces"?  Why "all"?
> 
> I suspect aaditya is thinking in terms of bitmap composition
> operations on graphics layers, not Emacs faces.

Maybe.  I just don't understand clearly enough what exactly was the
intent.

As you know, Emacs doesn't operate on the bitmap level, except very
low in the terminal-specific code.  At that level, there are no faces
anymore, just colors and other graphics-related stuff.

> So he'd like to put an overlay on some text, give that overlay a 'face
> property of '(+ red), and turn all the blue text in the overlay to
> violet (the RGB sum of #F00 and #00F == #F0F).

Maybe I don't get something, but (a) this _is_ about faces and their
combination, '(+ red) being a kind of "syntactic sugar"; and (b) all
it needs is the ability to combine colors when merging faces, instead
of just selecting one color of the two.  By contrast, alpha-blending,
AFAIU, is about transparency, not about combining any 2 colors.  So
I'm probably still missing something.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-10-31  4:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-29 20:19 alpha support for colors aaditya sood
2012-10-30  1:52 ` Chong Yidong
2012-10-30  5:02   ` aaditya sood
2012-10-30  5:07     ` Masatake YAMATO
2012-10-30  6:51     ` joakim
2012-10-30  7:37       ` aaditya sood
2012-10-30 13:28         ` Stefan Monnier
2012-10-30 17:45         ` Eli Zaretskii
2012-10-31  2:06           ` Stephen J. Turnbull
2012-10-31  4:00             ` Eli Zaretskii
2012-10-30 17:43     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.