All of this functionality is very closely related to the PDF/Postscript imaging model which is also used by macOS. There’s a lot of really good explanation and analysis available, because the model is quite mature (Postscript dates back to the mid-80s).