Implementing Transform

We can now start to code. First we add the transformation matrix to context.graphics. As the context is becoming larger and larger, we profit to remove it from the rpn function and create an own class it. All but trivial manipulations of the context will be delegated to the context. We must also adapt postScriptEditor and profit to move the canvas above, as the console output gets longer.

Javascript Editor

We add the operators that work with the matrix

Javascript Editor

And we must now integrate transform in all operators that may manipulate user space coordinates.

Javascript Editor

Let's see.

Javascript Editor

Seems to work, but it looks like we have a problem with scanFill. The rest of the T on the left is appearing on the right. We fix that next chapter.

The codebase has now 1540 lines ps20240728.js

My Journey to PostScript