I decided instead of making and placing two hardware accelerated up and down triangles to a Screen 0 routine, I'd just make one, pointing up, then draw a bar, and place it on top of the bar. So now I just invert it and place the inverted image at the bottom of the bar. Since I will need to change the coordinates in the routine, I needed to make some algorithms to handle those changes. Now all of that went smoothly, because I started out using a 120, 120 , 32 _NewImage screen with the triangle in the upper left corner. So after I finished, I thought I'd see what would happen if I reduced the size of the _NewImage screen to approximately the size of the triangle image. Well, here is the results...
Note: Press a key after the tiny image screen pops up to continue the routine.
This is the SAME except for using a larger _NewImage screen, and works as intended. Again, press a key after SLEEP.
So we get two BIG ASCII triangles in the first code! Well, I know _PutImage has a stretch feature, and apparently I triggered it, which probably has something to do with not directing the code to identify both the source and destination coordinates, but I'm a bit lost here on how to accomplish this, if that's the situation.
Now if you change the _NewImage size as remarked or just RUN THE SECOND CODE, you would get what I intended. The same output, but with the triangles UNSTRETCHED.
So it works for me when I use the larger source screen, but I figure why pass on the chance to learn something about the _PutImage properties and uses from those who regularly work in graphics.
Pete
Note: Press a key after the tiny image screen pops up to continue the routine.
Code: (Select All)
Width 80, 25: _Font 16
fw = _FontWidth: fh = _FontHeight
t = _NewImage(fw * 2, fh, 32) ' INCREASE _NEWIMAGE SCREEN SIZE TO SHRINK TRIANGLE TO: t = _NewImage(120, 120, 32)
Rem t = _NewImage(120, 120, 32)
Screen t ' Remark or remove this line and Sleep: Screen 0 to hide image creation.
_Dest t
' Draw a triangle.
a = 6: c = 0
For i = 0 To 6
Line (a, c)-(a + i * 2, c)
a = a - 1
c = c + 1
Next
tri& = _CopyImage(t, 33)
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
Do
_Limit 30
_PutImage (sx1, sy1 + TopTriangle)-(sx2, sy2 + TopTriangle), tri&
_PutImage (sx1, sy2 - xfactor + BottomTriangle)-(sx2, sy1 - xfactor + BottomTriangle), tri& ' Invert image.
Loop
This is the SAME except for using a larger _NewImage screen, and works as intended. Again, press a key after SLEEP.
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. ???
Screen t ' Remark or remove this line and Sleep: Screen 0 to hide image creation.
_Dest t
' Draw a triangle.
a = 6: c = 0
For i = 0 To 6
Line (a, c)-(a + i * 2, c)
a = a - 1
c = c + 1
Next
tri& = _CopyImage(t, 33)
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
Do
_Limit 30
_PutImage (sx1, sy1 + TopTriangle)-(sx2, sy2 + TopTriangle), tri&
_PutImage (sx1, sy2 - xfactor + BottomTriangle)-(sx2, sy1 - xfactor + BottomTriangle), tri& ' Invert image.
Loop
So we get two BIG ASCII triangles in the first code! Well, I know _PutImage has a stretch feature, and apparently I triggered it, which probably has something to do with not directing the code to identify both the source and destination coordinates, but I'm a bit lost here on how to accomplish this, if that's the situation.
Now if you change the _NewImage size as remarked or just RUN THE SECOND CODE, you would get what I intended. The same output, but with the triangles UNSTRETCHED.
So it works for me when I use the larger source screen, but I figure why pass on the chance to learn something about the _PutImage properties and uses from those who regularly work in graphics.
Pete

