Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PCOPY use with hardware and software images
#4
(08-13-2024, 05:33 PM)DSMan195276 Wrote:
(08-13-2024, 05:25 PM)TerryRitchie Wrote: After thinking about this a while I believe it is due to the fact that pages above 0 do not retain the _RGBA(0,0,0,0) transparent color. I forgot that the hardware layer and software layer are completely independent of each other.
Yep, I was just about to respond with that Smile The `_PUTIMAGE` with hardware images doesn't care what the active or display page is, so even though your `PCOPY`s are wiping out the whole screen the hardware images still appear anyway when the screen gets rendered during `_Display`.

If you move one of the `_PutImage` calls with the hardware image out of the loop and just retain the `PCOPY` you can see that the page is actually blank.
Right, so if I'm understanding this correctly all screen pages are software only and a separate hardware layer is not created for each page. When I call _DISPLAY all hardware images are simply drawn to a single hardware layer over the software images due to the default _DISPLAYORDER _SOFTWARE, _HARDWARE.

I just reversed _DISPLAYORDER and indeed the software images now overwrite the hardware images.

Hmm... What would be cool is if I could somehow convert each of the screen pages that get drawn to a hardware image.

It doesn't appear that I can control the _CLEARCOLOR of any of the screen pages either. I was hoping to overlay screen pages to create a master display page.

Here's something strange though. Change the _DISPLAYORDER in line 35 below to _HARDWARE, _SOFTWARE and the magenta background disappears?

Code: (Select All)
CONST RED~& = _RGB32(255, 0, 0)
CONST GREEN~& = _RGB32(0, 255, 0)
CONST BLUE~& = _RGB32(0, 0, 255)

DIM RedSprite AS LONG '  software sprite
DIM GreenSprite AS LONG
DIM BlueSprite AS LONG
DIM HWRedSprite AS LONG ' hardware sprite
DIM HWGreenSprite AS LONG ' hardware sprite
DIM HWBlueSprite AS LONG ' hardware sprite

RedSprite = _NEWIMAGE(64, 64, 32) '        software sprite
GreenSprite = _NEWIMAGE(64, 64, 32) '        software sprite
BlueSprite = _NEWIMAGE(64, 64, 32) '        software sprite

_DEST RedSprite '                              draw on software sprite
CIRCLE (31, 31), 31, RED
PAINT (31, 31), RED, RED
HWRedSprite = _COPYIMAGE(RedSprite, 33) '      create hardware sprite

_DEST GreenSprite '                              draw on software sprite
CIRCLE (31, 31), 31, GREEN
PAINT (31, 31), GREEN, GREEN
HWGreenSprite = _COPYIMAGE(GreenSprite, 33) '      create hardware sprite

_DEST BlueSprite '                              draw on software sprite
CIRCLE (31, 31), 31, BLUE
PAINT (31, 31), BLUE, BLUE
HWBlueSprite = _COPYIMAGE(BlueSprite, 33) '      create hardware sprite


SCREEN _NEWIMAGE(640, 480, 32)
_MOUSEHIDE

_DISPLAYORDER _SOFTWARE , _HARDWARE '    reverse this and the magenta background disappears?

DO
    _LIMIT 30 '                          30 FPS

    SCREEN , , 1, 0 '                    active page 1, display page 0
    PAINT (0, 0), _RGB32(255, 0, 255)
    _CLEARCOLOR _RGB32(255, 0, 255)
    _PUTIMAGE (100, 100), RedSprite '    draw sprite on page 1
    PCOPY 1, 0 '                        copy page 1 to page 0

    SCREEN , , 2, 0 '                    active page 2, display page 0
    PAINT (0, 0), _RGB32(255, 0, 255)
    _CLEARCOLOR _RGB32(255, 0, 255)
    _PUTIMAGE (120, 120), GreenSprite '  draw sprite on page 2
    PCOPY 2, 0 '                        copy page 2 to page 0

    ' Page 2 above simply overwrites page 1

    SCREEN , , 3, 0 '                    active page 2, display page 0
    PAINT (0, 0), _RGB32(255, 0, 255)
    _CLEARCOLOR _RGB32(255, 0, 255)
    _PUTIMAGE (140, 140), BlueSprite '  draw sprite on page 3
    PCOPY 3, 0 '                        copy page 3 to page 0

    ' Page 3 above simply overwrites page 2


    WHILE _MOUSEINPUT: WEND

    SCREEN , , 0, 0 '                            active page 0, display page 0
    _PUTIMAGE (_MOUSEX, _MOUSEY), HWRedSprite '  draw hardware sprite

    _DISPLAY '                                  update screen with changes
LOOP UNTIL _KEYDOWN(27)
SYSTEM
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
RE: PCOPY use with hardware and software images - by TerryRitchie - 08-13-2024, 06:09 PM



Users browsing this thread: 1 Guest(s)