Everybody's heard about the blurred
#14
Rhos filters a awesome!   I'd like to add them to my QuadDraw program, next time I update it.

After tinkering with my slow blur code, failing to make it faster, I experimented with layers of _PUTIMAGE images with transparency instead, bypassing the slow POINT/PSET every pixel.  Surprised it worked.  Not a Gaussian blur, but it looks kind of decent, and is almost instant.

- Dav

Code: (Select All)

SCREEN _NEWIMAGE(800, 600, 32)

FOR t = 1 TO 1000
    size = RND * 255
    x = RND * _WIDTH: y = RND * _HEIGHT
    LINE (x, y)-(x + size, y + size), _RGB(RND * 255, RND * 255, RND * 255), BF
NEXT
FOR t = 1 TO 50000
    PSET (RND * _WIDTH, RND * _HEIGHT), _RGB(RND * 255, RND * 255, RND * 255)
NEXT

PRINT "press a key to blur...";
SLEEP

BlurScreen 'a little blur...
BlurScreen '...a little more.

SUB BlurScreen
    odisp% = _AUTODISPLAY: _DISPLAY
    tmpback& = _COPYIMAGE(_DISPLAY)
    _SETALPHA 50, , tmpback&
    _PUTIMAGE (-1, 0), tmpback&: _PUTIMAGE (1, 0), tmpback&
    _PUTIMAGE (0, -1), tmpback&: _PUTIMAGE (0, 1), tmpback&
    _PUTIMAGE (-1, -1), tmpback&: _PUTIMAGE (1, -1), tmpback&
    _PUTIMAGE (-1, 1), tmpback&: _PUTIMAGE (1, 1), tmpback&
    _PUTIMAGE (0, 0), tmpback&
    _FREEIMAGE tmpback&
    IF odisp% = -1 THEN _AUTODISPLAY
END SUB

Find my programs here in Dav's QB64 Corner
Reply


Messages In This Thread
Everybody's heard about the blurred - by OldMoses - 07-26-2023, 01:32 AM
RE: Everybody's heard about the blurred - by Dav - 07-26-2023, 03:47 AM
RE: Everybody's heard about the blurred - by Dav - 07-26-2023, 06:24 PM
RE: Everybody's heard about the blurred - by Dav - 07-27-2023, 11:07 PM
RE: Everybody's heard about the blurred - by Dav - 07-28-2023, 10:19 PM



Users browsing this thread: 6 Guest(s)