Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_Putimage problem.
#1
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
Reply
#2
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.
Reply
#3
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
Reply
#4
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
Reply
#5
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
Reply
#6
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.  Big Grin
Reply
#7
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
Reply
#8
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
Reply
#9
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. Tongue
Reply
#10
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. Big Grin

Pete

 - You're Chevy Chase, and I'm not!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I'm looking for suggestions to solve the problem! Petr 10 649 02-05-2026, 04:56 PM
Last Post: ahenry3068
  Nth problem with hardware images Ikerkaz 9 470 01-23-2026, 02:58 PM
Last Post: bplus
  _Putimage Question. Pete 11 671 01-04-2026, 09:33 PM
Last Post: Pete
  Install problem...... jssantoro 6 380 12-17-2025, 08:31 PM
Last Post: madscijr
  _putimage (Solved) Pete 0 216 11-16-2025, 06:48 AM
Last Post: Pete

Forum Jump:


Users browsing this thread: