diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-10 18:49:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-10 18:49:48 +0000 |
commit | 8d656f7b22badc7a1e4e48811521048ef3df7101 (patch) | |
tree | 207c9332ac340eef8b84e90d67a0f0c6a734e547 /Build/source/utils/asymptote/base/plain_pens.asy | |
parent | c75ad7aa4d5821b7c4034c949a5ed2401e589bea (diff) |
asy 2.47 sources
git-svn-id: svn://tug.org/texlive/trunk@49658 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/base/plain_pens.asy')
-rw-r--r-- | Build/source/utils/asymptote/base/plain_pens.asy | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Build/source/utils/asymptote/base/plain_pens.asy b/Build/source/utils/asymptote/base/plain_pens.asy index 627ce2e8c84..22cf5ca4817 100644 --- a/Build/source/utils/asymptote/base/plain_pens.asy +++ b/Build/source/utils/asymptote/base/plain_pens.asy @@ -324,10 +324,16 @@ pen rgba(real[] a) // Return a pen corresponding to a given 6-character RGB hexidecimal string. pen rgb(string s) { - real value(string s, int i) {return hex(substr(s,2i,2))/255;} + int offset=substr(s,0,1) == '#' ? 1 : 0; + real value(string s, int i) {return hex(substr(s,2i+offset,2))/255;} return rgb(value(s,0),value(s,1),value(s,2)); } +pen RGB(int r, int g, int b) +{ + return rgb(r/255,g/255,b/255); +} + pen[] operator +(pen[] a, pen b) { return sequence(new pen(int i) {return a[i]+b;},a.length); |