Pushes the current transformation matrix onto the matrix stack. Understanding PpushMatrix and PpopMatrix requires understanding the concept of a matrix stack. The PpushMatrix function saves the current coordinate system to the stack and PpopMatrix restores the prior coordinate system. PpushMatrix and PpopMatrix are used in conjuction with the other transformation functions and may be nested to control the scope of the transformations.

Link to original Processing doc

PpushMatrix is available since version 1.0.0.

See also



// @preview image 100 100 '2D3' PGraphics 200 Pbackground //light gray 255 Pfill 0 0 50 50 Prect //white rectangle PpushMatrix //save default and start a new transformation. 30 20 Ptranslate 0 Pfill 0 0 50 50 Prect //black rectangle PpopMatrix //restore transformation 100 Pfill 15 10 50 50 Prect //gray rectangle Pencode