PCOPY use with hardware and software images - 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: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: PCOPY use with hardware and software images (/showthread.php?tid=2930) |
PCOPY use with hardware and software images - TerryRitchie - 08-13-2024 I'm adding image layers to the library I'm working on. At first I was going to create an image array of multiple screens, draw each individual image to its designated screen (layer) then combine the images together. TYPE TYPE_SCREENDB Image AS LONG ClearColor AS _UNSINGED LONG ... ... Yada, yada yada .... END TYPE REDIM ScreenDB(0) AS TYPE_SCREENDB But I got to thinking, QB64 already does all the heavy lifting through the PCOPY statement. So I wrote the little test program below to see how this would work and to my my surprise hardware and software images are preserved and copied ... with a few quirks I'm having a hard time wrapping my head around. On line 17 I draw a software sprite onto page 0 (the display page). Why is that image not preserved in the loop that follows? On lines 37 and 38 I draw another software sprite onto page 0 which works. However, if I move these two lines of code to just under the _LIMIT 30 statement the image no longer appears. At first I thought that perhaps pages 1 and 2 (and above) were not retaining the default _RGBA(0,0,0,0) transparent black color. But that can't be the case since line 30, PCOPY 2,0 , does not wipe out the previous PCOPY 1,0 in line 26 above it. Does anyone have any insight as to why software images are not persisting as they should? Code: (Select All)
RE: PCOPY use with hardware and software images - TerryRitchie - 08-13-2024 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. RE: PCOPY use with hardware and software images - DSMan195276 - 08-13-2024 (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 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. RE: PCOPY use with hardware and software images - TerryRitchie - 08-13-2024 (08-13-2024, 05:33 PM)DSMan195276 Wrote: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.(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 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`. 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)
RE: PCOPY use with hardware and software images - TerryRitchie - 08-13-2024 Ok, more thinking. I could make this work if each screen page would retain alpha transparency information. The problem with a change like that would probably make a lot of legacy code that uses PCOPY have very strange results. Oh well, looks like I'm back to manipulating individual images and overlaying them as needed. RE: PCOPY use with hardware and software images - Pete - 08-13-2024 Hey Terry, Late to the party, because I'm finalizing a 4,000 sq ft roofing project. Just past final inspection, now. I see you've made your decision on how to proceed, but just food for thought, if you want to preserve that initial image, you'd have to PCOPY it to page 2. Here is a more simplified SCREEN 0 text example... Code: (Select All)
Pete RE: PCOPY use with hardware and software images - TerryRitchie - 08-13-2024 (08-13-2024, 07:17 PM)Pete Wrote: Hey Terry,Yep, I was playing around with that same thing. I decided without screen pages being able to preserve alpha transparency it's going to be next to impossible to use PCOPY to implement layers the way I need. At first I was just attaching a layer value to sprites then going through the sprite array looking for layer 8, draw first, layer 7, draw next, layer 6 ... this required too much overhead. I then decided just to make individual images to draw the sprites to and then at the end combine them into one image. Sped things up greatly. That's what got me thinking about PCOPY and how I could possibly use that instead. I thought that maybe each screen page also had it's own hardware layer as well ... until I came to my senses. RE: PCOPY use with hardware and software images - Pete - 08-13-2024 Agreed. With PCOPY and graphics you are flipping the entire screen, which is considerably more overhead than working with _PUTIMAGE and a portion of the screen. I learned this while working with a bird image for the Harris / Walz campaign. I wanted to use PCOPY, but I couldn't get it flipping them the bird as fast and frequent as was necessary. Pete |