Author Topic: _DEST, _PUTIMAGE etc.  (Read 1343 times)

0 Members and 1 Guest are viewing this topic.

Offline krovit

  • Forum Regular
  • Posts: 179
_DEST, _PUTIMAGE etc.
« on: March 22, 2020, 12:35:24 pm »
A warm greeting to all of you,

With some QB64 commands I have problems. Maybe it's up to me... I can't understand them...
For example the management of _DEST destinations in combination with _PUTIMAGE.

These days I have taken over a Ritchie's library for the dropdown menu (a fixed idea of ​​mine... but strongly necessary) and I modified it a bit to adapt it to my needs.
It took a long time because, I think we will agree, changing the code of others is not easy.
I made the menu look a little more modern and current (in my opinion) and I would like to share it with you.
Nothing important, for heaven's sake... the bulk of the work is all by the author.

One of the changes introduced consists of one pixel line below the menu.
I don't know how to coordinate it with the rest of the code. In practice, when you deactivate the menu that disappears but she remains there in plain sight.

In truth I could also do without it... obviously there are other systems to restore the original screen, but the code would not be clean and there is this bug that annoys me a lot.

The library makes extensive use of _DEST and _PUTMAGE and as I said I can not fully understand the operation of these commands.

For example and to start could you complete this code?

Code: QB64: [Select]
  1.  
  2. 'one screen... _DEST etc.
  3.  
  4. for f=1 to 10: print f: next f
  5.  
  6.  
  7. 'another destination... _DEST etc.
  8.  
  9. for f=100 to 110: print f: next f
  10.  
  11.  
  12. 'now I would like to see the result in the first destination and then in the second
  13.  
  14.  


Thank You!



« Last Edit: March 22, 2020, 12:39:43 pm by krovit »
Nothing is easy, especially when it appears simple (and nothing could be as dangerous as trying to do good to others)

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
Re: _DEST, _PUTIMAGE etc.
« Reply #1 on: March 22, 2020, 12:43:01 pm »
Code: QB64: [Select]
  1.  
  2. 'one screen... _DEST etc.
  3. first = _NEWIMAGE(100, 200, 256)
  4. second = _NEWIMAGE(100, 200, 256)
  5.  
  6.  
  7. _DEST first
  8. FOR f = 1 TO 10: PRINT f: NEXT f
  9.  
  10. REM SLEEP: CLS 'without REM is then this screen black
  11.  
  12. 'another destination... _DEST etc.
  13.  
  14. _DEST second
  15. FOR f = 100 TO 110: PRINT f: NEXT f
  16.  
  17.  
  18. 'now I would like to see the result in the first destination and then in the second
  19.  
  20. SCREEN first
  21. SCREEN second
  22.  
  23.  

For reading pixel values (POINT) use _SOURCE so, as _DEST. Is possible reading other screen, than is visible and wrting to other screen than visible :)

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
Re: _DEST, _PUTIMAGE etc.
« Reply #2 on: March 22, 2020, 12:56:57 pm »
_DEST - What image\screen commands like PRINT, PSET, LINE, POINT, GET , and PUT work upon.

_PUTIMAGE (X_Destination, Y_Destination)-(To_X_Destination, To_Y_Destination), Source_Image, Destination_Image, (X_Source, Y_Source)-(To_X_Source, To_Y_Source)
    Works like Get and Put at the same time

This is a little more involved than your PRINT to 1 , Change , PRINT to 2, Show 1 then Show 2. but covers the same and shows _PUTIMAGE use.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 480, 32) 'Main screen
  2. A& = _NEWIMAGE(640, 480, 32) 'Secondary screen
  3.  
  4. LOCATE 1, 1 'you will see this right away...
  5. PRINT "You can see me right now!"
  6. LINE (50, 50)-STEP(49, 49), _RGB32(212, 64, 8), BF
  7.  
  8. LOCATE 20, 1
  9. PRINT "PRESS ANY KEY if you do NOT see a BIG colored circle"
  10.  
  11. _DEST A& 'set the destination for the following commands to Secondary screen
  12.  
  13. LOCATE 2, 2
  14. PRINT "YOU CAN NOT SEE ME UNTIL I HAVE BEEN COPIED BY _PUTIMAGE"
  15. CIRCLE (320, 240), 128, _RGB32(8, 212, 192)
  16. PAINT (320, 240), _RGB32(8, 212, 192)
  17.  
  18. _DEST _DISPLAY 'now set it to the main display agian
  19.  
  20.  
  21. _PUTIMAGE (0, 0)-STEP(639, 479), A&, _DISPLAY, (0, 0)-STEP(639, 479) 'copy the material from the Secondary display to the main.
  22.  
  23.  
Granted after becoming radioactive I only have a half-life!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
Re: _DEST, _PUTIMAGE etc.
« Reply #3 on: March 22, 2020, 01:21:06 pm »
Hi Krovit
here a good example posted by Steve https://www.qb64.org/forum/index.php?topic=2124.msg113664#msg113664
Programming isn't difficult, only it's  consuming time and coffee

Offline krovit

  • Forum Regular
  • Posts: 179
Re: _DEST, _PUTIMAGE etc.
« Reply #4 on: March 23, 2020, 04:11:31 am »
Thank you, Petr, Cobal e Tempodibasic, finally a little light...

The 3D reported, moreover, is a mine of information.

I have not yet managed to solve the problem (there must be something in my code that conflict with Ritchie's library for the dropdown menu, or vice versa). But the documentation is a good track. I'll see how to move forward.



____
Tempodibasic... I recommend, don't expose you.


Nothing is easy, especially when it appears simple (and nothing could be as dangerous as trying to do good to others)

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
Re: _DEST, _PUTIMAGE etc.
« Reply #5 on: March 23, 2020, 07:57:20 am »
thank's krovit
I'll say the same to you and I must say moreover that my life has done little changes because I already live among job, home and church. ;-)
What is different is the mask, the distance between persons, the absence of handshakes.
Programming isn't difficult, only it's  consuming time and coffee