[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[TSVN] TBlame colour scheme again

From: Simon Large <slarge_at_blazepoint.co.uk>
Date: 2004-09-14 13:56:50 CEST

Hi Stefan,

I have been looking at the TBlame colourising scheme with a view to sending
a patch. I found out why I am getting funny colours, and it is simply that
you can't do plain arithmetic reliably on a COLORREF, because you get
integer overflows in the colour components. For example, my highlight
background is 0x80.00.00. If you subtract 0x30.30.30 you get 0x4f.cf.d0
which is a different colour, but probably not what you wanted; the red and
green components have underflowed to a high value.

It would be easy to add a function to adjust one colour component at a time
to avoid this, but you then run into another problem. The user may not be
using the default colour scheme; in fact he (she) may be using a high
visibility scheme which is based on white-on-black, in which case you need
to make the backgrounds lighter, not darker.

The workaround I came up with was a function which computes a colour which
is somewhere between the text and background colours using a percentage
value:

COLORREF MakeInterColour(COLORREF Text, COLORREF Bgnd, int Slider)

Slider is a percentage:
    Slider <= 0 returns Text
    Slider >= 100 returns Bgnd
    Values in between return a colour which lies between the two.

Ideally to get the right luminance it should convert both colours from RGB
to HSL, interpolate the in-between colour, then convert back. But that is
possibly more complicated than is strictly necessary!

The final hurdle is that I do not understand the intent of some of the code.
In DrawBlame(), you have code to set colours based on the revision and
author of the line that the mouse is over, or that has been selected.
However, I cannot see any instance where the author is used. It seems to be
overridden by the revision every time. I am not sure what you intended here.
Should there be additional code to determine whether the mouse is over the
author or rev column?

Simon

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Tue Sep 14 15:03:38 2004

This is an archived mail posted to the TortoiseSVN Dev mailing list.