October 20, 2021, 05:14:58

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

Offline bplus

  • Full Member
  • ***
  • Posts: 228
Paint Image (QB64)
« on: November 15, 2019, 03:42:38 »
Here is something I came up with today for PAINTing images, improved upon by Steve at 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
    _DEST d: _SOURCE s

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


SimplePortal 2.3.6 © 2008-2014, SimplePortal