QB64 Phoenix Edition
Stupid graphics experiment - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7)
+---- Thread: Stupid graphics experiment (/showthread.php?tid=1489)



Stupid graphics experiment - mnrvovrfc - 02-20-2023

I failed to come up with a quick example for the new third parameter of _LOADIMAGE(), didn't pay attention that the string is supposed to be just like one that could be loaded from JPEG, PNG, PCX etc. graphics file format. Enjoy this, it's my first successful experiment ever with _MEMCOPY. A good improvement is to change the palette, either as greyscale or along a cool gradient.

Code: (Select All)
'by mnrvovrfc 20-Feb-2023
DIM a$, b AS STRING * 256000
DIM AS INTEGER v, i, j
DIM AS LONG ascr, ctop, cbot
DIM amem AS _MEM, bmem AS _MEM

SCREEN _NEWIMAGE(640, 400, 256)
PRINT "Building screen, please wait..."

ctop = 1
cbot = 640 * 399 + 1
a$ = SPACE$(640)
b = SPACE$(256000)
FOR j = 1 TO 200
    FOR i = 1 TO 640
        IF i MOD 2 = 0 THEN
            MID$(a$, i, 1) = CHR$(150 + v + (i MOD 56))
        ELSE
            MID$(a$, i, 1) = CHR$(v + (i MOD 16))
        END IF
    NEXT
    MID$(b, ctop, 640) = a$
    MID$(b, cbot, 640) = a$
    ctop = ctop + 640
    cbot = cbot - 640
    v = v + 1
    IF v >= 50 THEN v = 0
NEXT

bmem = _MEM(b)
ascr = _COPYIMAGE(0)
amem = _MEMIMAGE(ascr)
_MEMCOPY bmem, bmem.OFFSET, bmem.SIZE TO amem, amem.OFFSET
_MEMFREE bmem
SCREEN ascr
SLEEP
SCREEN 0
_MEMFREE amem
SYSTEM



RE: Stupid graphics experiment - mnrvovrfc - 02-20-2023

Here is one possibility:

Code: (Select All)
'The next line is duplicated from the code above. Insert the other three lines into the code above.
b = SPACE$(256000)
FOR j = 0 TO 255
    _PALETTECOLOR j, _RGB32(j, j, j)
NEXT