Ooops
August 15, 2020, 02:05:48 AM

Author Topic: Paint Image (QB64)  (Read 461 times)

Offline bplus

  • Full Member
  • ***
  • Posts: 139
Paint Image (QB64)
« 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