There are two functions involved. The first isdogear_lower to create the main body of the document with the dogear gone, and the second is dogear_upper to create the corner folded over. The reason it comes in two parts is that thay you can layer the dogear over the contents over the lower portion, in case part of the contents is covered by the dogear.
This example constructs a 90x128 icon (because 1:sqrt(2) is the proportions of a A4 page). In this case our “base” document is antique white, you will probably want something spiffier for your icon theme. First the lower layer:
And now the upper layer
icomp ' page = crop(AntiqueWhite, 90, 128);
dogear_lower(page , 5, 8)' -o dogear_lower.png ![]()
We make the back slightly farker (that's the 0.9 multiply you see) so there is a touch of contrast between the back and the front. You could use a different technique, such as a contrasting broder, instead.
icomp ' page = crop(AntiqueWhite, 90, 128);
dogear_upper(page * 0.9, 5, 8)' -o dogear_upper.png ![]()
Finally, we put it all together with some content:
You can change the proportions of the dogear by changing the radius and tag arguemnts. It is important that the radius and tag arguments to the two dogear functions. The image arguments need to be closely related, as well.
icomp ' page = crop(AntiqueWhite, 90, 128);
l3 = dogear_lower(page, 5, 8);
l2 = scale_within(dragon.png , l3);
l1 = dogear_upper(page * 0.9, 5, 8);
l1 over (l2 over center l3)' -odogear_document.png ![]()
If you want the dogear on the other side, use the hflip function.