01-23-2026, 05:29 AM
John doesn't quite understand the concept of *simple* examples.
Let me give you the simple lowdown.
_PUTIMAGE takes 4 points and moves a rectangle around on your screen.
_PUTIMAGE (left, top) - (right, bottom) <-- see how this makes a rectangle for us? It just cuts a plain and normal rectangle chunk out of the screen and moves it.
So how does _MAPTRIANGLE work?
It just takes three points for the end pieces of the triangle, cuts a triangle out of something, and then lets us move it.
So we can use _Maptriangle to mimic _PUTIMAGE easily enough! (Just imagine a diagonal in that rectangle and now you can see the two triangles.)
![[Image: Diagonal-one-way.jpg]](https://weallsew.com/wp-content/uploads/sites/4/2017/06/Diagonal-one-way.jpg)
The advantage to this? You don't have to put it back to the screen in the same square shape! Let's move that top left point further left 40 pixels. Move the top right point left 40 pixels as well. And PRESTO!!
See how much more flexible that is? You can't get a rectangle and put a rectangle and do something like that! But we're getting a triangle and putting a triangle, so all we have to do is adjust those 3 points and we can shape and rotate and move that image however we desire.
You're looking at something that can do everything that _PUTIMAGE can do, but which can *ALSO* do a whole lot more!!
This is how we rotate and spin and skew and slant and do all those other little things that simply working with square images wouldn't do for us at all.
Let me give you the simple lowdown.

_PUTIMAGE takes 4 points and moves a rectangle around on your screen.
_PUTIMAGE (left, top) - (right, bottom) <-- see how this makes a rectangle for us? It just cuts a plain and normal rectangle chunk out of the screen and moves it.
So how does _MAPTRIANGLE work?
It just takes three points for the end pieces of the triangle, cuts a triangle out of something, and then lets us move it.
So we can use _Maptriangle to mimic _PUTIMAGE easily enough! (Just imagine a diagonal in that rectangle and now you can see the two triangles.)
![[Image: Diagonal-one-way.jpg]](https://weallsew.com/wp-content/uploads/sites/4/2017/06/Diagonal-one-way.jpg)
Code: (Select All)
Screen _NewImage(800, 600, 32)
$Color:32
aImage = _NewImage(100, 100, 32) 'just a 100x100 image
_Dest aImage
Cls , SkyBlue
Color , 0
Print "Hello World"
Print "This is Steve being Steve"
_Dest 0
_PutImage (100, 100)-(200, 200), aImage 'see the rectangle?
_MapTriangle (0, 0)-(100, 0)-(0, 100), aImage To(300, 100)-(400, 100)-(300, 200), 0 'see my two triangles?
_MapTriangle (100, 0)-(0, 100)-(100, 100), aImage To(500, 100)-(400, 200)-(500, 200), 0
The advantage to this? You don't have to put it back to the screen in the same square shape! Let's move that top left point further left 40 pixels. Move the top right point left 40 pixels as well. And PRESTO!!
Code: (Select All)
Screen _NewImage(800, 600, 32)
$Color:32
aImage = _NewImage(100, 100, 32) 'just a 100x100 image
_Dest aImage
Cls , SkyBlue
Color , 0
Print "Hello World"
Print "This is Steve being Steve"
_Dest 0
_PutImage (100, 100)-(200, 200), aImage 'see the rectangle?
_MapTriangle (0, 0)-(100, 0)-(0, 100), aImage To(300, 100)-(400, 100)-(300, 200), 0 'see my two triangles?
_MapTriangle (100, 0)-(0, 100)-(100, 100), aImage To(500, 100)-(400, 200)-(500, 200), 0
_MapTriangle (0, 0)-(100, 0)-(0, 100), aImage To(300 - 40, 300)-(400 - 40, 300)-(300, 400), 0 'and see me put my triangles together,
_MapTriangle (100, 0)-(0, 100)-(100, 100), aImage To(400 - 40, 300)-(300, 400)-(400, 400), 0 'but I've shifted them left here to slant them?
See how much more flexible that is? You can't get a rectangle and put a rectangle and do something like that! But we're getting a triangle and putting a triangle, so all we have to do is adjust those 3 points and we can shape and rotate and move that image however we desire.
You're looking at something that can do everything that _PUTIMAGE can do, but which can *ALSO* do a whole lot more!!
This is how we rotate and spin and skew and slant and do all those other little things that simply working with square images wouldn't do for us at all.

