A faster way to scale images?
#6
(02-13-2023, 12:10 PM)johannhowitzer Wrote: It also introduces a limitation, since it means the source coordinates can't be used, meaning hardware images can only be drawn in entirety, not pieces of them
at a time.

You can draw pieces of a hardware image onto the display.  Let me give a very simple demo:

Code: (Select All)
SCREEN _NEWIMAGE(800, 600, 32)
RANDOMIZE TIMER
FOR i = 1 TO 100
    LINE (RND * _WIDTH, RND * _HEIGHT)-(RND * _WIDTH, RND * _HEIGHT), _RGB32(RND * 256, RND * 256, RND * 256), BF
NEXT

hw = _COPYIMAGE(0, 33)
CLS , 0

x = RND * _WIDTH
y = RND * _HEIGHT
xMove = RND * 3 - 2
yMove = RND * 3 - 2

xsize = 400
ysize = 300
sizechange = 1
_DISPLAYORDER _HARDWARE
DO
    _PUTIMAGE (x, y)-(xsize, ysize), hw, , (x, y)-(xsize, ysize)
    _DISPLAY
    _LIMIT 120
    x = x + xMove
    y = y + yMove
    xsize = xsize + sizechange
    ysize = ysize + sizechange
    IF x < 0 OR x > _WIDTH THEN xMove = -xMove
    IF y < 0 OR y > _HEIGHT THEN yMove = -yMove
    IF ysize < 0 OR ysize > _WIDTH THEN sizechange = -sizechange
LOOP UNTIL _KEYHIT
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 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: 6 Guest(s)