Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_MAPTRIANGLE EXAMPLES
#4
John doesn't quite understand the concept of *simple* examples.

Let me give you the simple lowdown.  Wink

_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]

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.  Wink
Reply


Messages In This Thread
_MAPTRIANGLE EXAMPLES - by NakedApe - 01-23-2026, 02:45 AM
RE: _MAPTRIANGLE EXAMPLES - by Unseen Machine - 01-23-2026, 03:18 AM
RE: _MAPTRIANGLE EXAMPLES - by Unseen Machine - 01-23-2026, 04:37 AM
RE: _MAPTRIANGLE EXAMPLES - by SMcNeill - 01-23-2026, 05:29 AM
RE: _MAPTRIANGLE EXAMPLES - by bplus - 01-23-2026, 07:12 AM
RE: _MAPTRIANGLE EXAMPLES - by Magdha - 01-23-2026, 11:24 AM
RE: _MAPTRIANGLE EXAMPLES - by NakedApe - 01-23-2026, 02:35 PM
RE: _MAPTRIANGLE EXAMPLES - by bplus - 01-23-2026, 03:14 PM
RE: _MAPTRIANGLE EXAMPLES - by Petr - 01-23-2026, 08:13 PM
RE: _MAPTRIANGLE EXAMPLES - by ahenry3068 - 01-23-2026, 09:49 PM
RE: _MAPTRIANGLE EXAMPLES - by Unseen Machine - 01-23-2026, 10:05 PM
RE: _MAPTRIANGLE EXAMPLES - by ahenry3068 - 01-24-2026, 12:04 AM
RE: _MAPTRIANGLE EXAMPLES - by bplus - 01-24-2026, 12:57 AM
RE: _MAPTRIANGLE EXAMPLES - by ahenry3068 - 01-24-2026, 01:31 AM
RE: _MAPTRIANGLE EXAMPLES - by ahenry3068 - 01-25-2026, 10:30 AM
RE: _MAPTRIANGLE EXAMPLES - by NakedApe - 01-23-2026, 11:58 PM
RE: _MAPTRIANGLE EXAMPLES - by bplus - 01-24-2026, 03:06 AM
RE: _MAPTRIANGLE EXAMPLES - by Unseen Machine - 01-24-2026, 03:47 AM
RE: _MAPTRIANGLE EXAMPLES - by bplus - 01-24-2026, 03:52 AM
RE: _MAPTRIANGLE EXAMPLES - by bplus - 01-24-2026, 04:09 PM
RE: _MAPTRIANGLE EXAMPLES - by NakedApe - 01-24-2026, 05:00 PM
RE: _MAPTRIANGLE EXAMPLES - by bplus - 01-25-2026, 10:40 AM
RE: _MAPTRIANGLE EXAMPLES - by ahenry3068 - 01-25-2026, 05:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  A Question About _MAPTRIANGLE Magdha 2 388 11-02-2025, 11:37 AM
Last Post: Magdha
  Using _MapTriangle in Small Virtual Screens NakedApe 7 863 07-05-2025, 11:54 AM
Last Post: SMcNeill
  Does _MapTriangle work in a user defined Window? bplus 12 2,249 02-16-2024, 01:40 AM
Last Post: bplus
  _MAPTRIANGLE face culling RokCoder 0 459 01-10-2023, 07:29 PM
Last Post: RokCoder
Music does anyone have any examples of a simple MIDI recorder or digital audio overdubber? madscijr 9 2,031 07-29-2022, 05:13 PM
Last Post: madscijr

Forum Jump:


Users browsing this thread: 1 Guest(s)