-
1. Re: How to do multi-stage blending
lrosenth Jun 19, 2014 3:25 PM (in response to JPT78151361)You are correct that because of the use of a Union, what you want to accomplish will require that you "segment" your object. This is because you are thinking about transparency as a simple "bitmap" - but that's not the model used by modern graphic systems.
-
2. Re: How to do multi-stage blending
JPT78151361 Jun 20, 2014 12:45 AM (in response to lrosenth)Thank you for the confirmation.
Does the model used by modern graphic systems support some other method of vectorised erase?
Just out of pure curiosity: how does the reader / printer implement transparency groups without some sort of intermediary bitmapped buffer?
On OpenGL I would antialiase in the fragment shader, use the depth buffer to avoid artifacts on the edges and use a frame buffer object to implement transparency groups.
-
3. Re: How to do multi-stage blending
Test Screen Name Jun 20, 2014 12:52 AM (in response to JPT78151361)An implementation is not mandated to use bitmap buffering at any point. It can implement other ways. There is no way to erase in the object model, a deliberate omission to allow flexibility of implementation.
If thinking PDF must be passed through a bitmap buffer your view is (understandably) narrow. PDFs are not always rendered to a bitmap as their final result. For example they might be converted to another graphics format, where retaining as much vector information as possible is desirable.
-
4. Re: How to do multi-stage blending
JPT78151361 Jun 20, 2014 12:56 AM (in response to Test Screen Name)Ah - this makes sence. Thank you.
-
5. Re: How to do multi-stage blending
lrosenth Jun 20, 2014 1:50 AM (in response to JPT78151361)What you can do to "erase" is clip. (obviously it's not really erasing but hiding), but has the same visual.
-
6. Re: How to do multi-stage blending
JPT78151361 Jun 20, 2014 2:08 AM (in response to lrosenth)I'll investigate...
If I understand clipping correctly, you set up a clipping shape / object,
and then draw over it. The object you're drawing will then be clipped by
the clipping mask. Do I understand correctly?
I'm writing a gerber to pdf converter. They have an object called an
aperture, which can be drawn by a series of draw / erase cycles. The order
matters, 'cause you can't erase what hasn't been drawn yet, and you can
draw over a previously erased portion.
If you want a ring with a cross over it, you draw a big circle, erase a
smaller circle, and then draw the two lines.
After creating this aperture you can draw the result onto the
artwork-in-progress either positive (draw as is) or negative (erase / make
a hole). The latter I implement as drawing in white, but I cannot use that
trick for the apertures.
-
7. Re: How to do multi-stage blending
lrosenth Jun 20, 2014 4:06 AM (in response to JPT78151361)You set up a clipping path and then whatever you draw after clipped to the shape of that path. The clipping path can be defined by either other paths or text shapes. This is a "hard" clip/mask operation, in that things are either IN or OUT (on/off). If you want to get fancy, you can use a transparency mask (called a SoftMask) where things can be partially in/out.
This aperture definitely appears to assume a raster-based output where you can erase. (consider a printer where such a thing is impossible). Since they assume a raster anyway, I would probably consider rasterizing it yourself and then putting the raster results into the PDF. Obviously you lose resolution independence but not sure how important that is. The alternative would be to do path based operations to compute the final path(s) to be rendered and then put that into the PDF. You can use some of the well know "polygon clipping" solutions for such a task.
Drawing in white is a bad idea since it assumes that the final output will be drawn on a white background - which isn't always the case. PDF assumes a transparent (or really, nothing drawn) background so if you were to use white - you'd get white and not "nothing".
-
8. Re: How to do multi-stage blending
JPT78151361 Jun 20, 2014 4:59 AM (in response to lrosenth)I want to avoid rasterising because I want to end up with a nice and neat
PDF that I can embed in a LaTeX document. For any practical PCB (printed
circuit board), the Gerber is rasterised to at least 1200 dpi (often 2400
dpi) in order to obtain adequate resolution on small features. For a PCB
that is A4 in size, that is quite a large picture, even after PNG
compression.
I could of course rasterise only the apertures (which are generally small
compared to the PCB), but I prefer a more elegant solution.
I like the clipping idea. I can draw the aperture primitives front to
back: augment the clipping structure for "clear" primitives and draw the
"dark" primitives using this structure. If I cannot augment clipping
structures on the fly, I can always generate multiple clipping structures
and use the correct one for each "dark" stage.
For the moment, I can live with drawing in white because I'll generally
print the PDF onto a white background. Even when printing to a
transparency, the printer assumes a white page and will only deposit black
ink where I want it. It would be nice to render the different copper
layers as different coloured transparent layers on top of each other, in
which case I would need to generate proper holes, but this would be a
future feature of my converter...
-
9. Re: How to do multi-stage blending
JPT78151361 Jun 20, 2014 5:46 AM (in response to JPT78151361)Clipping paths work perfectly -- thank you.
-
10. Re: How to do multi-stage blending
lrosenth Jun 20, 2014 6:16 AM (in response to JPT78151361)My pleasure - glad to hear it's working!
-
11. Re: How to do multi-stage blending
JPT78151361 Jun 20, 2014 6:43 AM (in response to lrosenth)Just for interest sake: my output PDF can be found at https://drive.google.com/file/d/0Bzxt3kuNPaEccU8wSlkzQVpJWW8/edit?usp=sharing
The aperture in question is object 11, line 170. As well as objects 12 and 13, but they are simply modifications of the same aperture (I left the apertures uncompressed for easy debugging).
The Gerber draws a large circle and then erases a smaller circle and two lines.
-
12. Re: How to do multi-stage blending
lrosenth Jun 20, 2014 7:01 AM (in response to JPT78151361)Looks great!



