01-04-2026, 09:09 PM
WOOHOO!!!
fw = _FontWidth: fh = _FontHeight
't = _NewImage(120, 120, 32) ' Using a larger image source prevents the image from stretching in _PutImage. ???
t = _NewImage(16, 16, 32)
Rem Screen t ' Remark or remove this line and Sleep: Screen 0 to hide image creation.
_Dest t
' Draw a triangle.
a = 6: c = 0: w = a * 2: h = a
For i = 0 To 6
Line (a, c)-(a + i * 2, c)
a = a - 1
c = c + 1
Next
tri& = _CopyImage(t, 33)
Rem Sleep: Screen 0 ' Remark or remove this line and Screen t to hide image creation.
_Dest 0
_FreeImage t
col = 32: row = 5: BarLength = 8
Locate row, col + 2: Print "__________Row"; row
Locate row + 8, col + 2: Print "__________Row"; row + 8
Locate row + 1, col
For j = 1 To BarLength
Locate , col: Print Chr$(219)
Next
sx1 = col * fw - fw - 2: sy1 = fh \ 2 - 2
sx2 = sx1 + c * 2 * fw: sy2 = sy1 + i * fh + 3
TopTriangle = row * fh - fh ' 1st num is row in Screen 0.
xfactor = fh * (i - 1) - TopTriangle
BottomTriangle = BarLength * fh - fh \ 2 + 2
Do
_Limit 30
_PutImage (sx1, sy1 + TopTriangle), tri&, 0, (0, 0)-(w, h)
_PutImage (sx1, sy2 - xfactor + BottomTriangle), tri&, 0, (0, h)-(w, 0) ' Invert image.
Loop
Mark figured out a solution using Step that worked with both _NewImage sizes, although in one a pixel was missing, but that just takes fiddling more with the variables. Since I haven't figured out the mechanics of step yet, I just decided to apply Steve and Mark's reasoning to what I do know, and got lucky!
My initial approach, which I've used without problems on non-inverted hardware images, needed to be modified because I thought to flip the image I needed to include both the source and destination values. Like Mark stated, I made the destination part too big! Since I'm not changing (stretching) the image, I just eliminated that part in the first (non-inverted) image and for the inversion method I just swapped sy1 to sy2, as before, but... and here's the magic... made the destination left-bottom to right-top. In other words, read it upside down.
+1 to Steve for the image size stretching info, which, and correct me if I missed something, I believe only applies to cases where we stretch the destination box.
+2 to Mark for catching the destination box problem and coding an alternative step method!
Pete
Code: (Select All)
Width 80, 25: _Font 16
fw = _FontWidth: fh = _FontHeight
't = _NewImage(120, 120, 32) ' Using a larger image source prevents the image from stretching in _PutImage. ???
t = _NewImage(16, 16, 32)
Rem Screen t ' Remark or remove this line and Sleep: Screen 0 to hide image creation.
_Dest t
' Draw a triangle.
a = 6: c = 0: w = a * 2: h = a
For i = 0 To 6
Line (a, c)-(a + i * 2, c)
a = a - 1
c = c + 1
Next
tri& = _CopyImage(t, 33)
Rem Sleep: Screen 0 ' Remark or remove this line and Screen t to hide image creation.
_Dest 0
_FreeImage t
col = 32: row = 5: BarLength = 8
Locate row, col + 2: Print "__________Row"; row
Locate row + 8, col + 2: Print "__________Row"; row + 8
Locate row + 1, col
For j = 1 To BarLength
Locate , col: Print Chr$(219)
Next
sx1 = col * fw - fw - 2: sy1 = fh \ 2 - 2
sx2 = sx1 + c * 2 * fw: sy2 = sy1 + i * fh + 3
TopTriangle = row * fh - fh ' 1st num is row in Screen 0.
xfactor = fh * (i - 1) - TopTriangle
BottomTriangle = BarLength * fh - fh \ 2 + 2
Do
_Limit 30
_PutImage (sx1, sy1 + TopTriangle), tri&, 0, (0, 0)-(w, h)
_PutImage (sx1, sy2 - xfactor + BottomTriangle), tri&, 0, (0, h)-(w, 0) ' Invert image.
Loop
Mark figured out a solution using Step that worked with both _NewImage sizes, although in one a pixel was missing, but that just takes fiddling more with the variables. Since I haven't figured out the mechanics of step yet, I just decided to apply Steve and Mark's reasoning to what I do know, and got lucky!
My initial approach, which I've used without problems on non-inverted hardware images, needed to be modified because I thought to flip the image I needed to include both the source and destination values. Like Mark stated, I made the destination part too big! Since I'm not changing (stretching) the image, I just eliminated that part in the first (non-inverted) image and for the inversion method I just swapped sy1 to sy2, as before, but... and here's the magic... made the destination left-bottom to right-top. In other words, read it upside down.
+1 to Steve for the image size stretching info, which, and correct me if I missed something, I believe only applies to cases where we stretch the destination box.
+2 to Mark for catching the destination box problem and coding an alternative step method!
Pete
Shoot first and shoot people who ask questions, later.

