QuadDraw revisited - drawing program work in progress
#26
I guess it is a blur, @triggered.  I'm new at this filter stuff so I'm just learning what is what.  The first website I was learning filter code from called that antialias so it stuck in my mind, but blur is what it is called.  I was reading up on gaussian blur this morninng, gonna try to do that, and a 'median' filter too. 

This program is the perfect chance for me to learn about filters.  Here's the beginning of a filter list, if anything looks wrong I'd appreciate you pointing it out...

Code: (Select All)
SUB Negative
    _TITLE "Negative..."
    _DISPLAY
    FOR x = 0 TO _WIDTH - 200
        FOR y = 0 TO _HEIGHT
            p~& = POINT(x, y)
            PSET (x, y), _RGB(255 - _RED32(p~&), 255 - _GREEN32(p~&), 255 - _BLUE32(p~&))
        NEXT
    NEXT
END SUB

SUB Darken
    _TITLE "Darken..."
    _DISPLAY
    FOR x = 0 TO _WIDTH - 200
        FOR y = 0 TO _HEIGHT
            p~& = POINT(x, y)
            PSET (x, y), _RGB(_RED32(p~&) - 2, _GREEN32(p~&) - 2, _BLUE32(p~&) - 2)
        NEXT
    NEXT
END SUB

SUB Greyscale
    _TITLE "Greyscale..."
    _DISPLAY
    FOR x = 0 TO _WIDTH - 200
        FOR y = 0 TO _HEIGHT
            p~& = POINT(x, y)
            g = (_RED32(p~&) + _BLUE32(p~&) + _GREEN(p~&)) / 3
            PSET (x, y), _RGB(g, g, g)
        NEXT
    NEXT
END SUB

SUB Smooth
    _TITLE "Antialiasing...*cough* ... I mean blur...."
    _DISPLAY
    LINE (_WIDTH - 200, 0)-(_WIDTH - 200, _HEIGHT), _RGB(255, 255, 255), B
    FOR x = 0 TO _WIDTH - 201
        FOR y = 0 TO _HEIGHT - 1
            p1~& = POINT(x, y)
            p2~& = POINT(x + 1, y)
            p3~& = POINT(x, y + 1)
            p4~& = POINT(x + 1, y + 1)
            p5~& = POINT(x - 1, y)
            p6~& = POINT(x, y - 1)
            p7~& = POINT(x - 1, y - 1)
            p8~& = POINT(x - 1, y + 1)
            p9~& = POINT(x + 1, y - 1)
            r = _RED32(p1~&) + _RED32(p2~&) + _RED32(p3~&) + _RED32(p4~&) + _RED32(p5~&) + _RED32(p6~&) + _RED32(p7~&) + _RED32(p8~&) + _RED32(p9~&)
            g = _GREEN32(p1~&) + _GREEN32(p2~&) + _GREEN32(p3~&) + _GREEN32(p4~&) + _GREEN32(p5~&) + _GREEN32(p6~&) + _GREEN32(p7~&) + _GREEN32(p8~&) + _GREEN32(p9~&)
            b = _BLUE32(p1~&) + _BLUE32(p2~&) + _BLUE32(p3~&) + _BLUE32(p4~&) + _BLUE32(p5~&) + _BLUE32(p6~&) + _BLUE32(p7~&) + _BLUE32(p8~&) + _BLUE32(p9~&)
            PSET (x, y), _RGB(r / 9, g / 9, b / 9)
        NEXT
    NEXT
END SUB

SUB Noise
    _TITLE "Noise..."
    _DISPLAY
    FOR s = 0 TO _WIDTH * 10
        x = RND * (_WIDTH - 199)
        y = RND * _HEIGHT
        PSET (x, y), _RGB(RND * 255, RND * 255, RND * 255)
    NEXT
END SUB

Find my programs here in Dav's QB64 Corner
Reply


Messages In This Thread
RE: QuadDraw revisited - drawing program work in progress - by Dav - 06-04-2022, 07:23 PM



Users browsing this thread: 7 Guest(s)