SyntaxBomb - Indie Coders

Languages & Coding => Others => Topic started by: bplus on November 15, 2019, 03:42:38 AM

Title: Paint Image (QB64)
Post by: bplus on November 15, 2019, 03:42:38 AM
Here is something I came up with today for PAINTing images, improved upon by Steve at QB64.org so can be used (with caution when only a few colors) for all SCREEN modes:
Code: [Select]
SUB paintImage (x, y, Border~&, destHandle&, imageHandle&)
    d = _DEST: s = _SOURCE
    _DEST destHandle&
    PAINT (x, y), _RGB(119, 24, 49), Border~&
    FOR y = 0 TO _HEIGHT(destHandle&)
        FOR x = 0 TO _WIDTH(destHandle&)
            _SOURCE destHandle&
            IF POINT(x, y) = _RGB(119, 24, 49) THEN
                _SOURCE imageHandle&
                PSET (x, y), POINT(x MOD _WIDTH(imageHandle&), y MOD _HEIGHT(imageHandle&))
            END IF
        NEXT
    NEXT
    _DEST d: _SOURCE s
END SUB

Some screen shots testing and demo of sub and attach source code for demos:

SimplePortal 2.3.6 © 2008-2014, SimplePortal