# Transformations

[ Back ]

This is not the place to explain the details of image transformations. If you haven't used such things before, you should try to think of it as if
every transformation changes the coordinate system in which an image is drawn. Usually, the coordinate system has its origo at the top left
corner of the window. When the x coordinate increases you move right, and when the y coordinate increases you move towards the bottom. The transformation commands change the origo and these directions.

## Sub routines

draw image image_id

translate x#, y#

scale sx#, sy#

rotate a#

clear transformation

push transformation

pop transformation

### draw image *image_id*

Draw image *image_id* centered using the current transformation matrix..

### translate *tx#, ty#*

Translate *tx* pixels in the x direction and *ty* pixels in the y direction.

### scale *sx#, sy#*

Scale the x direction by *sx* and the y direction by *sy*.

### rotate *a#*

Rotate directions with *a* degrees/radians.

### clear transformation

Clear the transformation. After calling this, origo will be at the top left corner of the window, right will be right and down will be down.

### push transformation

Push the current transformation matrix to the stack. For every push you make, you must later call pop transformation, or you'll get a memory leak.

### pop transformation

Pop transformation matrix from the stack.

[ Back ]