Hi!

Am 30.10.19 um 10:53 schrieb Peter Geerds:
[...]
> 
> Anhänge werden auf dieser Mailingliste nicht durchgelassen.
> 

Sorry, habe das erst jetzt gesehen.

Hier ist das Script also "inline":

%!
/oldsetrgbcolor /setrgbcolor load def
/setrgbcolor {
(in replacement setrgbcolor\n) print
                                %% R G B
  1 index 1 index       %% R G B G B
  eq {                  %%
     2 index 1 index    %% R G B R B
     eq {
                        %% Here if R = G = B
      pop pop           %% remove two values
      % setgray % "replace the 'setgray' with":
      0 0 0 4 -1 roll % setcmykcolor
      -1 mul          %% obtain -R on top of stack
      1 add           %% obtain 1-R on top of stack
      setcmykcolor    %% now set(cmykcolor) K (as 1-R)
     } {
       oldsetrgbcolor   %% set the RGB values
     } ifelse
   }{
    oldsetrgbcolor      %% Set the RGB values
    currentcmykcolor    %puts 4 numbers on the stack
    (cmyk-) print pstack %display the colors (remove when things work correctly)
    3 -1 roll           %put magenta on top of stack
    dup                 %make copy of magenta value
    .5                  %put magenta test value on stack (then may not be 
exactly .5, see pstack)
    eq                  %see of magenta is equal to test value (.5)
    {pop 1}if           %if it is equal, pop off the .5 and put a 1 onto the 
stack
    3 1 roll            %put magenta back where it belongs in the stack
    setcmykcolor        %reset the cmyk to have new magenta value
  }ifelse

} bind def
/oldsetgray /setgray load def
/setgray {
(in replacement setgray\n) print
  % == % debug: pop last element and print it
  % here we're at a gray value;
  % http://www.tailrecursive.org/postscript/operators.html#setcymkcolor
  % setgray: "gray-value must be a number from 0 (black) to 1 (white)."
  % setcymkcolor: "The components must be between 0 (none) to 1 (full)."
  % so convert here again:
  0 0 0 4 -1 roll % push CMY:000 after Gray and roll down,
                  % so top of stack becomes
                  % ...:C:M:Y:Gray
  -1 mul          %% obtain -Gray on top of stack
  1 add           %% obtain 1-Gray on top of stack
  setcmykcolor    %% now set(cmykcolor) K (as 1-Gray)
} bind def


Die Zeilen mit "print" am Ende sind nur Debug-Ausgaben und
können bei Bedarf auskommentiert werden.

HTH

- andreas

-- 
Andreas Haumer                     | mailto:andr...@xss.co.at
*x Software + Systeme              | http://www.xss.co.at/
Karmarschgasse 51/2/20             | Tel: +43-1-6060114-0
A-1100 Vienna, Austria             | Fax: +43-1-6060114-71


-- 
Liste abmelden mit E-Mail an: users+unsubscr...@de.libreoffice.org
Probleme? 
https://de.libreoffice.org/hilfe-kontakt/mailing-listen/abmeldung-liste/
Tipps zu Listenmails: https://wiki.documentfoundation.org/Netiquette/de
Listenarchiv: https://listarchives.libreoffice.org/de/users/
Datenschutzerklärung: https://www.documentfoundation.org/privacy

Antwort per Email an