Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #3473

Re: Omit a color

From ken <ken@spamcop.net>
Newsgroups comp.lang.postscript
Subject Re: Omit a color
Date 2019-11-27 08:26 +0000
Message-ID <MPG.38484371f7887f479898a8@usenet.plus.net> (permalink)
References <5631c8cb-807a-4453-913d-96f47acf6ce4@googlegroups.com>

Show all headers | View raw


In article <5631c8cb-807a-4453-913d-96f47acf6ce4@googlegroups.com>, 
news@ademmler.com says...

> I would like to ask if there is a way to suppress a given separation 
color,
> while rip output. This means to "remove" this color from output.
> I have tried something like this:
> << [ /Separation (SpotcolorName) /DeviceGray { 0.0 sub } ] 0.0 setcolor >>
> But I get a postscript error.

That code simply declares a dictionary, it doesn't do anything with it. 
Leaving stuff lying around on the stack is quite likely to cause a 
PostScript error.

Even if it did do something, it probably wouldn't be what you expect, 
and it certainly wouldn't override the definition of the colour space in 
the PostScript program.


> In other words I am looking for a ps function to disable a color 
separation.
> Any hint is more than welcome.

PostScript doesn't contain such an operator.

What you can do is take advantage of the fact that, in order to draw 
anything in a given colour, the program must first set that colour to be 
current, and if its a complex colour, such as a Separation, then it must 
first set the colour space.

To do this the program must first set the colour space, and to do that 
it must use the setcolorspace operator. What you can therefore do is 
create your own definition of setcolorspace, and you can have that re-
definition do whatever you want with the current colour.

Eg:

/original_setcolorspace /setcolorspace load def

/setcolorspace
{
  dup type arraytype eq {
    dup length 4 eq {
      dup 1 get cvn /TargetSpot eq {
        % Found the spot we are interested in, do something with it
      } {
        original_setcolorspace
      } ifelse
    }{
      original_setcolorspace
    } ifelse
  }{
    % Not an array type so can't be a complex space
    original_setcolorspace
  } ifselse
} bind def

The first thing to be aware of is that this can be defeated, if the 
PostScript program following it pulls the definition of setcolorspace 
directly from systemdict, instead of using the current definition.

In that case you are, basically, out of luck, you can't normally change 
the contents of systemdict because its read only.


The second thing you need to think about is what you are going to do 
with the colour space. Your original code subtracted 0 from the colour 
value and used that as a colour in DeviceGray. That still causes the 
marking operations to mark the output, but in shades gray instead of 
colour.

It looked like you might have been trying to use 0 setgray, which will 
actually set the colour to black (gray is inverted with respect to 
CMYK). Assuming you meanted to use  1 setgray to set white, then you 
need to consider whta happens if any marking operation intersects any 
marks already on the output. Those will then be overwritten with white 
(ie erased).

PostScript doesn't have any transparency (with the exception of 
overprint and masked images), there is no 'transparent' colour, so you 
can't set the current space to 'transparent' or 'non-marking'

Your best bet would probably be to translate the current point off the 
media so that the marks take place in user space that does not intersect 
the output.

Note also that the code above doesn't cater for images or shading 
patterns, both of which can define their own colour space and do not use 
setcolorspace to do so. So you would have to redefine the 'image' and 
'shfill' operators with code which investigates the colour space of the 
image or shading, and deals with those. This code is left as an exercise 
for the student....

Oh, you probably also need to think about DeviceN colour spaces, which 
can also contain spot colours.


Some professional PostScript RIPs are capable of doing all this for you, 
of course, you should probably check with your supplier.

It might help if you explained why you want to do this, rather than 
sending the PostScript back to the designer and telling them that if 
they don't want to have these colours output, they houldn't put them in 
the input.



			Ken

Back to comp.lang.postscript | Previous | NextPrevious in thread | Find similar


Thread

Omit a color MrDemmler <news@ademmler.com> - 2019-11-26 13:14 -0800
  Re: Omit a color MrDemmler <news@ademmler.com> - 2019-11-26 13:28 -0800
    Re: Omit a color ken <ken@spamcop.net> - 2019-11-27 08:31 +0000
      Re: Omit a color MrDemmler <news@ademmler.com> - 2019-11-27 09:25 -0800
        Re: Omit a color ken <ken@spamcop.net> - 2019-11-28 09:58 +0000
  Re: Omit a color ken <ken@spamcop.net> - 2019-11-27 08:26 +0000

csiph-web