Posts: 2,910
Threads: 305
Joined: Apr 2022
Reputation:
167
Code: (Select All)
Dim As Long t, img1, img2, img3
t = _NewImage(50, 30, 32)
_Dest t
Line (0, 0)-(50, 30), _RGB32(255, 0, 0), BF
img1 = _CopyImage(t, 33)
_FreeImage t
t = _NewImage(50, 30, 32)
_Dest t
Line (0, 0)-(50, 30), _RGB32(0, 0, 255), BF
img2 = _CopyImage(t, 33)
_FreeImage t
t = _NewImage(50, 60, 32)
_Dest t
_PutImage (0, 0), img1 ' How do I code this and the line below it to get it 'put' to t = _NewImage(50, 60, 32) <-----------------
_PutImage (0, 31), img2
img3 = _CopyImage(t, 33)
_FreeImage t
_Dest 0
_DisplayOrder _Hardware
Do
_Limit 30
_PutImage (0, 0), img1
_PutImage (100, 0), img2
_PutImage (200, 0), img3
_Display
Loop Until Len(InKey$)
System
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
Posts: 188
Threads: 14
Joined: May 2024
Reputation:
20
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.
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
04-07-2025, 12:54 AM
(This post was last modified: 04-07-2025, 12:55 AM by bplus.)
Code: (Select All) Dim As Long t1, t2, t3, img1, img2, img3
t1 = _NewImage(50, 30, 32)
_Dest t1
Line (0, 0)-(50, 30), _RGB32(255, 0, 0), BF
img1 = _CopyImage(t1, 33)
t2 = _NewImage(50, 30, 32)
_Dest t2
Line (0, 0)-(50, 30), _RGB32(0, 0, 255), BF
img2 = _CopyImage(t2, 33)
t3 = _NewImage(50, 60, 32)
_Dest t3
_PutImage (0, 0), t1 ' How do I code this and the line below it to get it 'put' to t = _NewImage(50, 60, 32) <-----------------
_PutImage (0, 31), t2
img3 = _CopyImage(t3, 33)
_FreeImage t1: _FreeImage t2: _FreeImage t3
_Dest 0
_DisplayOrder _Hardware
Do
_Limit 30
_PutImage (0, 0), img1
_PutImage (100, 0), img2
_PutImage (200, 0), img3
_Display
Loop Until Len(InKey$)
System
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 2,910
Threads: 305
Joined: Apr 2022
Reputation:
167
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
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
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...3#pid33333
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 3,447
Threads: 376
Joined: Apr 2022
Reputation:
345
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)
Dim As Long t(2), img(2)
t(0) = _NewImage(50, 30, 32): t(1) = _NewImage(50, 30, 32): t(2) = _NewImage(50, 60, 32)
Cls , _RGB32(255, 0, 0), t(0)
Cls , _RGB32(0, 0, 255), t(1)
_PutImage (0, 0), t(0), t(2): _PutImage (0, 30), t(1), t(2)
For i = 0 To 2: img(i) = _CopyImage(t(i), 33): _FreeImage (t(i)): Next
_DisplayOrder _Hardware
Do
_Limit 30
_PutImage (0, 0), img(0)
_PutImage (100, 0), img(1)
_PutImage (200, 0), img(2)
_Display
Loop Until Len(InKey$)
System
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.
Posts: 2,910
Threads: 305
Joined: Apr 2022
Reputation:
167
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)
Dim As Long t1, t2, t3, img1, img2, img3
t1 = _NewImage(50, 30, 32)
_Dest t1
Line (0, 0)-(50, 30), _RGB32(255, 0, 0), BF
img1 = _CopyImage(t1, 33)
t2 = _NewImage(50, 30, 32)
_Dest t2
Line (0, 0)-(50, 30), _RGB32(0, 0, 255), BF
img2 = _CopyImage(t2, 33)
t3 = _NewImage(50, 60, 32)
_Dest t3
_PutImage (0, 0), t1
_PutImage (0, 30), t2
img3 = _CopyImage(t3, 33)
_FreeImage t1: _FreeImage t2: _FreeImage t3
_Dest 0
_DisplayOrder _Hardware
Do
_Limit 30
_PutImage (0, 0), img1
_PutImage (100, 0), img2
_PutImage (200, 0), img3
_Display
Loop Until Len(InKey$)
System
Posts: 2,910
Threads: 305
Joined: Apr 2022
Reputation:
167
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
Posts: 3,447
Threads: 376
Joined: Apr 2022
Reputation:
345
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.
Posts: 2,910
Threads: 305
Joined: Apr 2022
Reputation:
167
04-07-2025, 04:27 PM
(This post was last modified: 12-04-2025, 04:06 PM by Pete.)
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!
|