ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: colo-hex
Date: Thu, 09 Jul 2009 12:53:19 +0200	[thread overview]
Message-ID: <4A55CC1F.4040709@gmx.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]

Hi,

there is a small bug in colo-hex, which leads to slightly wrong colors 
(at max. -0.390625%).
In line 41 of both mark related files there is

\newdimen\hexcolorfraction \hexcolorfraction=\dimexpr(1pt/256)
.
This should be 255 (#fractions) instead of 256 (#values); I made the 
same error a quite while ago. If I patch the files, I get the correct 
color in case of mark ii, but mark iv still gives the wrong one (remade 
the formats). Mh, strange.

Here the output of my beloved 'tabbyCalc' (result of operation is always 
in next line, which is then used for next operation):

1/255
 0,0039215686*255
 0,999999993

1/256
 0,00390625*255
 0,99609375-1*100
 -0,390625

I attached a small test file, which hopefully 'shows' (depends on your 
monitor) the difference. The border line goes from the lower left to the 
upper right corner; you have to look 'closely'. :D
I case of pdftex you can also peek into the eps file to see the color 
values (before and after patching). No such help for mkiv. I have no 
clue why mkiv still gives the wrong color...


Best wishes,  Peter


[-- Attachment #2: hex.tex --]
[-- Type: text/plain, Size: 833 bytes --]

\setupcolors[state=start]
\setupcolor[hex]

%% fraction=  1/255*65536= 257.004
%\newdimen\hexcolorfraction \hexcolorfraction=\dimexpr1pt/255\relax% = 257sp

\definecolor[testcolor] [r=0.87843,g=0.87451,b=0.89020] % RGB(224,223,227))
\definecolor[testcolorHEX] [h=E0DFE3]% same as HEX (currently transformed to RGB(223,222,226) )
\definecolor[testcolor] [r=1,g=1,b=1] % RGB(224,223,227))
\definecolor[testcolorHEX] [h=FFFFFF]% same as HEX (currently transformed to RGB(223,222,226) )


\startMPpage
    path p;
    p:= unitsquare xyscaled(5cm,5cm);
    fill (point 0 of p -- point 1 of p -- point 2 of p --cycle)
    withcolor \MPcolor{testcolorHEX}; % bottom right part of the square
    fill (point 0 of p -- point 3 of p -- point 2 of p --cycle)
    withcolor \MPcolor{testcolor}; % top left part
\stopMPpage


[-- Attachment #3: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2009-07-09 10:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 10:53 Peter Rolf [this message]
2009-07-09 11:27 ` colo-hex Peter Rolf
2009-07-10 21:55 ` colo-hex Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A55CC1F.4040709@gmx.net \
    --to=indiego@gmx.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).