DrawImage From Atlas

After one has a Asset data parsed one can use it to render to the screen. The drawImage function allows to draw sub section of an Image. Effectively it takes the image object, source x and y positions and supports the ability to take a few more parameters giving more control on one want the pixels on the screen. It also takes the source width and height parameters. Together they represent the x, y position of the chat in the Atlas as well as the width and the height of that chart in the Atlas. The destination x, y, width and height represent the position and the size that this small subsection of the atlas is going to be drawn to in the output Canvas. For example, one can set source x and source y to 2, 2. Width and height to 32,32. And draw to a position on canvas of 128, 128 by 64, 63. drawImage is smart enough to know that if the source, width and height do not match the destination width and height to properly scale the Image to match the desired output size. In most cases the source and destination width and height are the same size.

Edit tutorial

Comment on This Data Unit