ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* colo-hex
@ 2009-07-09 10:53 Peter Rolf
  2009-07-09 11:27 ` colo-hex Peter Rolf
  2009-07-10 21:55 ` colo-hex Hans Hagen
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Rolf @ 2009-07-09 10:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- 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
___________________________________________________________________________________

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

* Re: colo-hex
  2009-07-09 10:53 colo-hex Peter Rolf
@ 2009-07-09 11:27 ` Peter Rolf
  2009-07-10 21:55 ` colo-hex Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Rolf @ 2009-07-09 11:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1802 bytes --]

sorry, wrong version of test file. the right one is attached now.

Peter Rolf schrieb:
> 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
>
> ------------------------------------------------------------------------
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 2715 bytes --]

[-- Attachment #2: hex.tex --]
[-- Type: text/plain, Size: 677 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) )


\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
___________________________________________________________________________________

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

* Re: colo-hex
  2009-07-09 10:53 colo-hex Peter Rolf
  2009-07-09 11:27 ` colo-hex Peter Rolf
@ 2009-07-10 21:55 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2009-07-10 21:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Peter Rolf wrote:
> Hi,
> 
> there is a small bug in colo-hex, which leads to slightly wrong colors 
> (at max. -0.390625%).

fixed in next beta (current), both in mkii and mkiv (built in btw)


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


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

end of thread, other threads:[~2009-07-10 21:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09 10:53 colo-hex Peter Rolf
2009-07-09 11:27 ` colo-hex Peter Rolf
2009-07-10 21:55 ` colo-hex Hans Hagen

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).