“One of the effects of the rapid spread of higher education has been to equip people to criticise and question almost everything. Some of them seem to have stopped there instead of going on to the next stage which is to arrive at new beliefs or to reaffirm old ones.”

— Margaret Thatcher, 1968

3D cheesecake 16

Maybe I’ll catch up on names on Memorial Day. Non-traditional, I know, but…


Thanko: “what a loser!”

One thing that struck me as I browsed the many goofy products that Thanko sells is the hint of sneering contempt in a lot of their product photography:

For instance, The Lonely Guy Wine Chiller:

And the Fat Slob Food Warmer:

Compare and contrast to The Dorkiest Umbrella Ever, where the guy can’t help but look ridiculous but is out doing something, and the girl actually looks kinda cute in it:

Now, it’s possible I’m reading too much into it. The “fat slob” model shows up in a lot of product photos and videos, and seems to be comfortable with how he’s used, but marketing pictures tell a story, and these stories show how the company views the customer. Add a girl to the wine-chiller photo, and Our Hero would be having a successful date; add some more guys to the food-warmer pic and put a nice spread of finger foods on it, and Our Hero would be hosting a Superbowl party.

PDF::Cairo unleashed!

On Github now, and up for review on PrePAN.

I made sure to install it and run the examples at least once on a different OS. 😁


Looks like if I mix Image::CairoSVG with the Recording surface support I added recently, I can get most simple SVG files to render correctly. It’s pretty simple-minded, not supporting text or filters, but I can live with that. And there’s not much to it, so I could enhance it and send a pull request.

There’s an app for that…

Man, Obama must be kicking himself for not having thought of this one

Epicycles: poster-making

So, as I prepare to inflict PDF::Cairo on the world, I’ve been sensibilizing the documentation and adding example code. My latest effort was dusting off my 15-year-old Traveller sector map generator and cleaning up the hex-grid calculations to use my Box library and the regular-polygon method I recently added. Works great.

Then I had an idea for Yet Another Epicycle: tiling a large image across multiple pages. I did this by hand in the original sec2pdf script, splitting sector maps across 4 or 16 pages, but it would be cool to render the entire sector once and then simply ‘cut out’ the pieces I need for each page. It would also get rid of a lot of special-case code for handling things that are partially outside of the current page.

I tried it out by hand, and it worked great. I drew a big box on a recording surface that was 17x22, and replayed it four times onto 8.5x11 pages with different offsets. Not lightning fast, since you end up rendering the entire drawing N+1 times, but it worked.

For that very simple example.

Unfortunately, it looks like there’s internal state that doesn’t get reset completely, so that when I integrated it into the module and told it to make a really big hex grid, only the first replay was 100% successful. The rest were incomplete (one row/column of hexes, with no text labels). It didn’t matter what order I replayed them in.

Cairo apparently has scripting surfaces and proxy surfaces in recent versions, but no one has updated the Perl module to expose those, and I’m not sure they’d help (scripting surfaces are basically a debugging tool that writes to disk and gets replayed with a standalone CLI tool).

I still want to do it, so I may simply add a simple-minded recording of my API calls and do a high-level replay. Even more overhead than using a recording surface (especially for things like loading fonts and images), but then I’ll know it can be replayed more than once.

Meanwhile, the recording()/replay() methods work at least once, so I’m leaving them in for now.


Wow, that was an easy fix. After walking away for a few hours, I went back and added a single cairo_surface_flush() right before each set_source_surface() call. Renders perfectly, as many times as I want. See?; I just need to tweak the clipping regions a bit, to capture the overlap between pages.

Performance is actually pretty good, now that I have something to measure: it took only 28% longer to generate the drawing and replay it four times on different pages. Output size was 146% larger than generating the same drawing on a single large sheet, but that’s a small price to pay for the convenience.

If I were really going to revive sec2pdf (and I might, but not this weekend!), what I’d do to get the most efficient output is use a recording to draw all of the sector-wide elements (regional borders, X-boat routes, etc) and replay them onto the individual pages, after drawing each page’s grid but before adding text and system data. That would significantly reduce the amount of wasted drawing outside each page’s boundaries, and only repeat the elements that might appear on multiple pages.

Almost to the weekend…

This is how I felt when we were going up inside Himeji Castle. Except there were no signs saying how many flights of stairs were left…

裏口 = rear entrance
ガンバレ!! = GO FOR IT!!
もう一息 = just a little more effort


No relation to him, this Yanni (王馨瑶) is a popular model and actress from Guangdong.

And a real cutie, yep.