Introduction to PDF Color: Fun with tiling Patterns

Introduction to PDF Color: Fun with tiling Patterns

For today’s episode, We have old-time Ducky (from the silent-era before the talkies nearly ruined everything by revealing that Ducky’s voice actually squeaked).

ducky_GrayScale_recombined1

Actually, this is the same old Ducky, rendered to grayscale, split apart by gray-scale level, vectorized with POTrace, and then recombined. We are going to use this PDF to demonstrate some other ways to make shades of gray; this time using tiling Patterns. The key to this is this illusion:

0OpticalIllusions14

In this illusion we have a gray background upon which are white lines and black lines; in the square delineated with the black lines we see a darker gray than the outer square with its white lines, hence the illusion. But if you think of this printed on paper, gray is essentially created by varying the density of ink in an area, so if this illusion were printed on paper, your eyes would correctly be reporting that the inner square has a higher ink density than the area around it.

So now, what we are going to do with old-time Ducky is replace the deviceGray fills with tiling patterns whose content fills the tile with roughly the same amount of (black) ink as an entirely gray tile.

In this first variation, we are going to create a pattern of lines, varying the line width to control how much black will be in the tile.

The result (click to see full-size):

ducky_grayscale_recombined_mod11

In this next variation, instead of using straight lines, we are going to draw sawtoothed lines.

ducky_grayscale_recombined_mod21

And finally, instead of lines, we’ll draw rectangles to fill the tile area:

ducky_grayscale_recombined_mod51

The code for replacing  DeviceGray fills with Pattern fills is basically the same:

Note that this code takes advantage that the recombined color shapes are all grouped together by color value, so it starts a new pattern when the grayscale color value changes.  If this assumption does not apply, then you would want another method of re-using  patterns for a given color value.

Start your free evaluation of Adobe PDF Library today.

Leave a Reply

Your email address will not be published. Required fields are marked *