Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Everybody's heard about the blurred
#18
(07-28-2023, 12:44 PM)euklides Wrote: Second line put ...
Randomize Timer
... so to have changing pictures...

I didn't because I could test _PUTIMAGE placements easier with the screen looking the same each time.  But here it is in, and I made this a blur defined area routine now. 

Sometimes this program will hang up on me when closing the window by the mouse (X), I will have to use task kill to close it.

- Dav

Code: (Select All)

'==============
'BLURSCREEN.BAS
'==============
'Blurs area of screen
'Coded by Dav, JULY/2023

Randomize Timer
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

Do
    BlurScreen 100, 100, _Width - 100, _Height - 100
    'put a line around it, just for show
    Line (100, 100)-(_Width - 100, _Height - 100), _RGBA(0, 0, 0, 2), B
    _Limit 30
Loop Until InKey$ <> ""


Sub BlurScreen (x1, y1, x2, y2)

    odisp% = _AutoDisplay: _Display
    currentscreen& = _CopyImage(_Display)

    'get defined area of screen to image, make it semi-transparent
    tmpback& = _NewImage(Abs(x2 - x1) + 1, Abs(y2 - y1) + 1, 32) 'make image
    _PutImage , currentscreen&, tmpback&, (x1, y1)-(x2, y2) 'copy area to image
    _SetAlpha 50, , tmpback&

    _PutImage (x1 - 1, y1), tmpback&: _PutImage (x1 + 1, y1), tmpback&
    _PutImage (x1, y1 - 1), tmpback&: _PutImage (x1, y1 + 1), tmpback&
    _PutImage (x1 - 1, y1 - 1), tmpback&: _PutImage (x1 + 1, y1 - 1), tmpback&
    _PutImage (x1 - 1, y1 + 1), tmpback&: _PutImage (x1 + 1, y1 + 1), tmpback&
    _PutImage (x1, y1), tmpback&
    _Display

    _FreeImage tmpback& 
    _FreeImage currentscreen&

    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: 1 Guest(s)