another MetaPost question (this time on ConTeXt->MetaPost
Hey--- There seems to be a change with color transfer from ConTeXt to MetaPost. Using string references to defined (spot?) colors seemed to work but now does not; all of my colorful figures are now rendered only in shades of gray when using defined (spot?) colors…. The figure drawn by the MWE should have a dark orange border and a transparent (thin) orange fill. However, all colors of this sort seem to end up being a single shade of gray (e.g. black), rendering a box perfect for Halloween use but not for my current purposes. Is there a change to how colors defined in ConTeXt are referenced in MetaPost that I've missed or is there an issue with transferring color (name or parameter) information to MetaPost? Defined (spot?) colors work fine in ConTeXt but not in MetaPost. Many thanks, ---K %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % system > ConTeXt ver: 2021.07.21 19:54 LMTX fmt: 2021.7.22 int: english/english \startMPdefinitions presetparameters "parameters_Test" [ ] def Test = applyparameters "parameters_Test" "do_Test" enddef; def do_Test = pushparameters "parameters_Test"; string p; p = getparameter "prefix"; show p; string c; c = getparameter "color"; show c; path s; s = unitsquare scaled 10cm; show s; fill s withpen pencircle scaled 5pt withcolor p&c; draw s withpen pencircle scaled 5pt withcolor c; enddef; \stopMPdefinitions \starttext \definespotcolor[Thin:orange][orange][p=1,a=normal,t=0.5] \color[orange]{hello} \startalignment[center] \startplacefigure \startMPcode Test [ prefix = "Thin", color = "orange" ]; \stopMPcode \stopplacefigure \stopalignment \color[Thin:orange]{goodbye} \stoptext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Kevin W. Rudd, Ph.D. CAPT, USN (Ret) Computer Architecture & Computer Engineering Advanced Computing Systems (ACS) Research Program Laboratory for Physical Sciences (LPS) 443-654-7878 kevin@lps.umd.edumailto:kevin@lps.umd.edu Visiting Research Professor United States Naval Academy rudd@usna.edumailto:rudd@usna.edu
... fixed minor typo that actually produced new information! invalid color => black, valid color => transparent black!---it seems like the color disappears in the transfer but not the transparency. Hey--- There seems to be a change with color transfer from ConTeXt to MetaPost. Using string references to defined (spot?) colors seemed to work but now does not; all of my colorful figures are now rendered only in shades of gray when using defined (spot?) colors…. The figure drawn by the MWE should have a dark orange border and a transparent (thin) orange fill. However, all colors of this sort seem to end up being a single shade of gray (e.g. black), rendering a box perfect for Halloween use but not for my current purposes. Is there a change to how colors defined in ConTeXt are referenced in MetaPost that I've missed or is there an issue with transferring color (name or parameter) information to MetaPost? Defined (spot?) colors work fine in ConTeXt but not in MetaPost. Many thanks, ---K %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % system > ConTeXt ver: 2021.07.21 19:54 LMTX fmt: 2021.7.22 int: english/english \startMPdefinitions presetparameters "parameters_Test" [ ] def Test = applyparameters "parameters_Test" "do_Test" enddef; def do_Test = pushparameters "parameters_Test"; string p; p = getparameter "prefix"; show p; string c; c = getparameter "color"; show c; path s; s = unitsquare scaled 10cm; show s; path t; t = unitsquare scaled 5cm; show t; % new fill s withcolor p&":"&c; % tweaked fill t withcolor p &c; % new (and old) draw s withpen pencircle scaled 5pt withcolor c; enddef; \stopMPdefinitions \starttext \definespotcolor[Thin:orange][orange][p=1,a=normal,t=0.5] \color[orange]{hello} \startalignment[center] \startplacefigure \startMPcode Test [ prefix = "Thin", color = "orange" ]; \stopMPcode \stopplacefigure \stopalignment \color[Thin:orange]{goodbye} \stoptext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Kevin W. Rudd, Ph.D. CAPT, USN (Ret) Computer Architecture & Computer Engineering Advanced Computing Systems (ACS) Research Program Laboratory for Physical Sciences (LPS) 443-654-7878 kevin@lps.umd.edumailto:kevin@lps.umd.edu Visiting Research Professor United States Naval Academy rudd@usna.edumailto:rudd@usna.edu
On 7/22/2021 2:59 PM, Rudd, Kevin wrote:
Hey---
There seems to be a change with color transfer from ConTeXt to MetaPost. Using string references to defined (spot?) colors seemed to work but now does not; all of my colorful figures are now rendered only in shades of gray when using defined (spot?) colors….
I need to catch that case (string spot) indeed but even then, you need in your case p & ":" & c; you missed the colon. Anyway, fixed in next upload. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Rudd, Kevin