![]() |
|
_Putimage problem. - 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: _Putimage problem. (/showthread.php?tid=3591) Pages:
1
2
|
_Putimage problem. - Pete - 04-07-2025 Code: (Select All)
I should show 3 rectangular solid blocks. Red, Blue, and a Red and Blue combo. The combo is made by 'putting' the two already made hardware blocks together in t = _NewImage(50, 60, 32). The problem is, as coded, they are not getting put to that screen to copy into img3. I did try including the 't' handle as the destination in the _putimage statement, but I got an illegal handle error message, so I'm doing something wrong here. In otherwords: _PutImage (0, 0), img1, t is not usable. Pete RE: _Putimage problem. - hsiangch_ong - 04-07-2025 i had to change all the "33" into "32" to get this to work. because it also kept returning "error #5" on the first _putimage line inside the loop. i also had to put away the _dest 0 and create a 640x480 32-bit color screen before the loop. it has to have something to do with the hardware screen trick. RE: _Putimage problem. - bplus - 04-07-2025 Code: (Select All) Dim As Long t1, t2, t3, img1, img2, img3RE: _Putimage problem. - Pete - 04-07-2025 Yes, it's all hardware images. That's why 33 is needed. That is the handle of the hardware layer. img& = _copyimage(source, 33) copies the image from the current source (graphics screen 32) and saves it in memory as handle img&. What I'm wondering is if hardware images can be put to graphics screens. instead of just text screens. Pete RE: _Putimage problem. - bplus - 04-07-2025 Quote:What I'm wondering is if hardware images can be put to graphics screens. instead of just text screens. I think we just showed they cant. https://qb64phoenix.com/forum/showthread.php?tid=3591&pid=33333#pid33333 RE: _Putimage problem. - SMcNeill - 04-07-2025 You can't do what you're trying to do @Pete It's just not possible. Software images are for manipulation. Hardware images are *just* for display. Once they're created, that's it. They're immutable, unchangeable. All you can do with them after that is pop them up onto the hardware layer and display them. You can't just up and put them other places and use them in other images and such.... If you need to do that, stick to software and *ONLY* convert to hardware once you're finished with those software images. Quick and simple demo: Code: (Select All)
I made my 3 temp images. t(0 to 2) I colored them with the CLS statements. (no need for changing DEST with each) I put the two halves onto the larger t(2) image. (again, _PutImage does this without needing to set/change _DEST) Made of copy of all 3 images into the hardware img(0 to 2) and freed those temp images t(0 to 2) as they're *now* no longer needed. Displayed them on your SCREEN 0 hardware-only screen.
RE: _Putimage problem. - Pete - 04-07-2025 Ah, Mark has the code, which gives me my answer. We need to keep the image on the screen and copy that screen to the new screen. I was thinking that could be avoided because we already have the image in memory, but apparently, unless someone has a different method, that is just not the case. I saw what Mark did, then just retyped mine so I can get use to this method. Included in the below. I'll give a + 1 and +2 for the quick help on this one guys, THANKS! Pete Code: (Select All)
RE: _Putimage problem. - Pete - 04-07-2025 Thanks for the clarification, Steve. As long as it gets displayed to SCREEN 0, you gives a damn about graphics. Ouch! I know that was you, Bob! Canada really is just a stones throw away. Pete RE: _Putimage problem. - SMcNeill - 04-07-2025 I honestly think you'd be better off if you got used to working without making those changes to _DEST, @Pete It just keeps the code cleaner, shorter, and easier to read/edit, and gives you less places to screw up something on.
RE: _Putimage problem. - Pete - 04-07-2025 No, no, no! It's like Scotty on the Enterprise. You need to make MORE places to potentially screw things up. That way, if something doesn't work out, you have multiple excuses at your finger tips. "I don't know captain, it could be any one of a million things!" Otherwise, when there's practically no place to screw things up, and you screw things up anyway, you look like Clippy. Pete - You're Chevy Chase, and I'm not! |