A faster way to scale images?
#8
Okay, something is greatly confusing me here, very strange behavior since I've started using
hardware images.  I'm getting black screens a lot where it seems like I shouldn't, and PUTIMAGE
correctly placed the hardware image on the image surface set by SCREEN, not the one set by DEST
afterward.

After the header, I have this:

Code: (Select All)
screen scaled_screen(option_window_size)
dest full_screen

if debug_mode = true then
  set_font f_kharon, left_align, full_screen
  glass_fonts "Any key to start level editor, N to start game normally", 50, 50
  display_screen
  do
      limit 60
      k$ = inkey$
  loop while k$ = ""
  if lcase$(k$) <> "n" then edit_stage
end if


So that's a SCREEN statement, DEST after, then in the conditional, a display_screen call.
Now here's display_screen:

Code: (Select All)
sub display_screen

preserve& = dest
dest scaled_screen(option_window_size)
print preserve&, dest: display: sleep

hardware_image = copyimage(full_screen, 33)
putimage(0, 0)-((screenw * option_window_size) - 1, (screenh * option_window_size) - 1), hardware_image
display
freeimage hardware_image

dest preserve&

end sub


That PRINT statement is me trying to see the values of those two handles.  So before the call, SCREEN
is set to scaled_screen(option_window_size), and then in the routine, DEST is set to the same.
Then a PRINT statement is used, DISPLAY, then SLEEP.

I get a black screen.

To make things even more mysterious, if I change display_screen to this, eliminating four lines:

Code: (Select All)
sub display_screen

hardware_image = copyimage(full_screen, 33)
putimage(0, 0)-((screenw * option_window_size) - 1, (screenh * option_window_size) - 1), hardware_image
display
freeimage hardware_image

end sub


...Then PUTIMAGE *still* draws visibly, which means it's drawing to scaled_screen(option_window_size),
despite DEST having been set to full_screen!  This version of display_screen *should* result in a black
screen, but isn't.  It seems like PUTIMAGE is using the current graphics surface used by SCREEN, rather
than paying any attention to DEST.  But PRINT also seems to be ignoring DEST, but also not drawing
to the SCREEN surface.  I have no idea where that's drawing.  SLEEP isn't the culprit, when I replace it
with a DO: DISPLAY: LOOP, I get the same result.

What's going on here?
Reply


Messages In This Thread
A faster way to scale images? - by johannhowitzer - 01-31-2023, 02:14 PM
RE: A faster way to scale images? - by SMcNeill - 01-31-2023, 02:46 PM
RE: A faster way to scale images? - by SMcNeill - 02-01-2023, 02:07 PM
RE: A faster way to scale images? - by SMcNeill - 02-13-2023, 01:30 PM
RE: A faster way to scale images? - by johannhowitzer - 02-15-2023, 02:02 PM
RE: A faster way to scale images? - by SMcNeill - 02-15-2023, 05:27 PM
RE: A faster way to scale images? - by SMcNeill - 02-16-2023, 07:39 PM



Users browsing this thread: 8 Guest(s)