Author Topic: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]  (Read 8962 times)

0 Members and 1 Guest are viewing this topic.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
okay part one. Im trying to write a little program to rip the Tile sprites from an image for WarCraft 1. and I'm using PUT with the XOR option to eliminate duplicate tiles(cause when you XOR a sprite over the same sprite all the pixels are set to 0 and the image erases) however it seems that _PUTIMAGE can not see an image that has been PUT with the XOR option(or PRESET too)
here is the code, it has other issues but they are mine and caused by not being finished yet and not QB64s.
Code: QB64: [Select]
  1. map& = _LOADIMAGE("warmap01error.png", 32)
  2. tile& = _NEWIMAGE(640, 480, 32)
  3. Zoom& = _NEWIMAGE(128, 128, 32)
  4.  
  5. SCREEN _NEWIMAGE(1024, 480, 32)
  6. DIM SHARED mapval(64, 64) AS SINGLE, temp(1032) AS LONG
  7. 'KILL "debug.txt"
  8. 'OPEN "debug.txt" FOR BINARY AS #1
  9.  
  10. FOR Y%% = 0 TO 7
  11.  LINE (0, 400)-(1023, 415), _RGB32(0, 0, 0), BF
  12.  _PUTIMAGE (0, 400), map&, _DISPLAY, (0, 0 + 16 * Y%%)-(1023, 15 + 16 * Y%%)
  13.  
  14.  FOR X%% = 0 TO 63
  15.   'debug information
  16.   LOCATE 10, 1: PRINT peices%; X%%; Y%%
  17.  
  18.   'clear and display progress area
  19.   LINE (0, 416)-(1023, 431), _RGB(0, 0, 0), BF
  20.   LINE (0 + 16 * X%%, 416)-(15 + 16 * X%%, 431), _RGB32(200, 200, 15), BF
  21.  
  22.   _SOURCE map& 'get next test peice
  23.   GET (0 + (X%% * 16), 0 + (Y%% * 16))-(15 + (X%% * 16), 15 + (Y%% * 16)), temp()
  24.   'clear test area
  25.   LINE (300, 180)-(336, 216), _RGB32(0, 0, 0), BF
  26.   'put test peice for reference
  27.   PUT (320, 180), temp()
  28.  
  29.  
  30.   IF peices% = 0 THEN
  31.    'the first peice put straight to packlayer
  32.    _DEST tile&
  33.    PUT (0 + tx%% * 16, 0 + ty%% * 16), temp()
  34.    tx%% = tx%% + 1: peices% = 1
  35.    IF tx%% = 40 THEN ty%% = ty%% + 1: tx%% = 0
  36.   ELSE
  37.    'test the peice placing 2 copies of each found tile and XOR the test peice
  38.    ' over to see if it erases
  39.    px%% = 0: py%% = 0
  40.  
  41.    FOR i% = 0 TO peices%
  42.     LOCATE 11, 1: PRINT i%, px%%, py%%
  43.     'clear test area
  44.     LINE (300, 200)-(336, 216), _RGB32(0, 0, 0), BF
  45.  
  46.     'current check image
  47.     LINE (299, 199)-(316, 216), _RGB32(255, 255, 0), B
  48.     _PUTIMAGE (300, 200), tile&, _DISPLAY, (0 + px%% * 16, 0 + py%% * 16)-(15 + px%% * 16, 15 + py%% * 16)
  49.     'place the test copy
  50.     LINE (319, 199)-(336, 216), _RGB32(RND * 255, 255, RND * 255), B
  51.     _PUTIMAGE (320, 200), tile&, _DISPLAY, (0 + px%% * 16, 0 + py%% * 16)-(15 + px%% * 16, 15 + py%% * 16)
  52.  
  53.     'put the tile to check over the test copy with XOR
  54.     PUT (320, 200), temp(), XOR
  55.     'zoom in on that area
  56.     _DEST Zoom&
  57.     LINE (0, 0)-(127, 127), _RGB32(0, 0, 0), BF 'clear zoom layer
  58.     _PUTIMAGE (0, 0), _DISPLAY, Zoom&, (299, 200)-(336, 215) 'put test area in zoom layer
  59.     _PUTIMAGE (0, 0)-(128, 64), Zoom&, _DISPLAY, (0, 0)-(37, 15) 'put enlarged image back on display
  60.  
  61.     'get the test copy to see if it was erased
  62.     GET (320, 200)-(335, 215), temp(257)
  63.     IF TileCount2 <> 0 THEN 'peice did not match
  64.      LOCATE 12, 1: PRINT TileCount2
  65.      _DELAY 2.5
  66.      '     SLEEP
  67.  
  68.      _DEST tile&
  69.      PUT (0 + tx%% * 16, 0 + ty%% * 16), temp()
  70.      tx%% = tx%% + 1: peices% = peices% + 1
  71.      IF tx%% = 40 THEN ty%% = ty%% + 1: tx%% = 0
  72.      _DEST _DISPLAY
  73.      i% = peices% + 1
  74.     END IF
  75.    NEXT i%
  76.   END IF
  77.   _DELAY .005
  78.   IF INKEY$ = CHR$(27) THEN Y%% = 65: X%% = 65
  79.   px%% = px%% + 1
  80.   IF px%% = 40 THEN py%% = py%% + 1: px%% = 0
  81.  
  82.  NEXT X%%
  83. NEXT Y%%
  84. 'CLS
  85. '_PUTIMAGE , tile&, _DISPLAY
  86.  
  87. FUNCTION TileCount
  88.  FOR i% = 1 TO 255
  89.   ' V! = V! + temp(i%)
  90.   r~%% = _RED(temp(i%))
  91.   g~%% = _GREEN(temp(i%))
  92.   b~%% = _BLUE(temp(i%))
  93.   v& = v& + (r~%% + b~%% + g~%%)
  94.  NEXT i%
  95.  TileCount = v&
  96.  
  97. FUNCTION TileCount2
  98.  FOR i% = 258 TO 513
  99.   ' V! = V! + temp(i%)
  100.   r~%% = _RED(temp(i%))
  101.   g~%% = _GREEN(temp(i%))
  102.   b~%% = _BLUE(temp(i%))
  103.   v& = v& + (r~%% + b~%% + g~%%)
  104.  NEXT i%
  105.  TileCount2 = v&
  106.  
the image is linked below(warmap01error.png) along with a descriptive image of the output screen.

now part Two, I have been working on this code in QB64 version 20171106/82 so I downloaded the 'stable' release off the .org page  20180202/85 and ... it wont work! it will not load the PNG image but it does load the BMP version I have.(I made the PNG so that it would be a smaller upload here, I mainly work with BMP and PCX{yeah I know! I'm OLD okay}) now I have this code and images in there own folder to keep the QB64 folder clean so this stuff is not within the QB64 folder ,is this an issue now?

just out of curiosity why can is there no posting to the BUGs section?
Granted after becoming radioactive I only have a half-life!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #1 on: August 16, 2018, 02:07:33 pm »
Hello. Actually, I did not understand exactly what the program was supposed to do. Smaller could not do that anymore? :-D Maybe, but I say maybe, it's using _DISPLAY. I have not seen that yet. When you import SCREEN NEWIMAGE, the link to it is _DEST 0. When you enter it as M& = _NEWIMAGE: SCREEN M&, the link then is  _DEST M& So the combination of _DEST _DISPLAY, that's new to me. Maybe it may be, but I have not seen it yet. I would rather put DEST 0, because at the beginning is NEWIMAGE without a pointer. GET and PUT work properly on automatic control screens, so if you use _DISPLAY, first cancel it using _AUTODISPLAY. Or, just use _PUTIMAGE instead of GET / PUT, it's much faster. And you use _DISPLAY in _PUTIMAGE in target place? Really, this i am not seen yet. (Dont know if it is correct or not)

But maybe I'm not right.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #2 on: August 16, 2018, 02:31:07 pm »
So i test it, _DEST and _DISPLAY return the same values...

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #3 on: August 16, 2018, 03:06:08 pm »
Sorry for previous post...
Code: QB64: [Select]
  1. map& = _LOADIMAGE("warmap01error.png", 32)
  2. tile& = _NEWIMAGE(640, 480, 32)
  3. Zoom& = _NEWIMAGE(128, 128, 32)
  4.  
  5. SCREEN _NEWIMAGE(1024, 480, 32)
  6. DIM SHARED mapval(64, 64) AS SINGLE, temp(1032) AS LONG
  7. 'KILL "debug.txt"
  8. 'OPEN "debug.txt" FOR BINARY AS #1
  9.  
  10. FOR Y%% = 0 TO 7
  11.     LINE (0, 400)-(1023, 415), _RGB32(0, 0, 0), BF
  12.     _PUTIMAGE (0, 400), map&, _DISPLAY, (0, 0 + 16 * Y%%)-(1023, 15 + 16 * Y%%)
  13.  
  14.     FOR X%% = 0 TO 63
  15.         'debug information
  16.         LOCATE 10, 1: PRINT peices%; X%%; Y%%
  17.  
  18.         'clear and display progress area
  19.         LINE (0, 416)-(1023, 431), _RGB(0, 0, 0), BF
  20.         LINE (0 + 16 * X%%, 416)-(15 + 16 * X%%, 431), _RGB32(200, 200, 15), BF
  21.  
  22.         _SOURCE map& 'get next test peice
  23.         GET (0 + (X%% * 16), 0 + (Y%% * 16))-(15 + (X%% * 16), 15 + (Y%% * 16)), temp&()
  24.         'clear test area
  25.         LINE (300, 180)-(336, 216), _RGB32(0, 0, 0), BF
  26.         'put test peice for reference
  27.         PUT (320, 180), temp&()
  28.  
  29.  
  30.         IF peices% = 0 THEN
  31.             'the first peice put straight to packlayer
  32.             _DEST tile&
  33.             PUT (0 + tx%% * 16, 0 + ty%% * 16), temp&()
  34.             tx%% = tx%% + 1: peices% = 1
  35.             IF tx%% = 40 THEN ty%% = ty%% + 1: tx%% = 0
  36.             _DEST 0
  37.         ELSE
  38.             'test the peice placing 2 copies of each found tile and XOR the test peice
  39.             ' over to see if it erases
  40.             px%% = 0: py%% = 0
  41.  
  42.             FOR i% = 0 TO peices%
  43.                 LOCATE 11, 1: PRINT i%, px%%, py%%
  44.                 'clear test area
  45.                 LINE (300, 200)-(336, 216), _RGB32(0, 0, 0), BF
  46.  
  47.                 'current check image
  48.                 LINE (299, 199)-(316, 216), _RGB32(255, 255, 0), B
  49.                 _PUTIMAGE (300, 200), tile&, _DISPLAY, (0 + px%% * 16, 0 + py%% * 16)-(15 + px%% * 16, 15 + py%% * 16)
  50.                 'place the test copy
  51.                 LINE (319, 199)-(336, 216), _RGB32(RND * 255, 255, RND * 255), B
  52.                 _PUTIMAGE (320, 200), tile&, _DISPLAY, (0 + px%% * 16, 0 + py%% * 16)-(15 + px%% * 16, 15 + py%% * 16)
  53.  
  54.                 'put the tile to check over the test copy with XOR
  55.                 PUT (320, 200), temp(), XOR
  56.                 'zoom in on that area
  57.  
  58.                 v& = _NEWIMAGE(38, 16, 32)
  59.                 _DEST v&
  60.                 PUT (0, 0), temp&()
  61.  
  62.                 _PUTIMAGE (0, 0)-(127, 127), v&, Zoom&, (0, 0)-(37, 15)
  63.                 _DEST 0
  64.                 _FREEIMAGE v&
  65.                 _PUTIMAGE (0, 0), Zoom&, 0, (0, 0)-(127, 127) 'put test area in zoom layer
  66.                 '               _PUTIMAGE (0, 0)-(128, 64), Zoom&, _DISPLAY, (0, 0)-(37, 15) 'put enlarged image back on display
  67.  
  68.                 _SOURCE _DISPLAY
  69.                 'get the test copy to see if it was erased
  70.                 GET (320, 200)-(335, 215), temp(257)
  71.                 IF TileCount2 <> 0 THEN 'peice did not match
  72.                     LOCATE 12, 1: PRINT TileCount2
  73.                     _DELAY 2.5
  74.                     '     SLEEP
  75.  
  76.                     _DEST tile&
  77.                     PUT (0 + tx%% * 16, 0 + ty%% * 16), temp()
  78.                     tx%% = tx%% + 1: peices% = peices% + 1
  79.                     IF tx%% = 40 THEN ty%% = ty%% + 1: tx%% = 0
  80.                     _DEST _DISPLAY
  81.                     i% = peices% + 1
  82.                 END IF
  83.             NEXT i%
  84.         END IF
  85.         _DELAY .005
  86.         IF INKEY$ = CHR$(27) THEN Y%% = 65: X%% = 65
  87.         px%% = px%% + 1
  88.         IF px%% = 40 THEN py%% = py%% + 1: px%% = 0
  89.  
  90.     NEXT X%%
  91. NEXT Y%%
  92. 'CLS
  93. '_PUTIMAGE , tile&, _DISPLAY
  94.  
  95. FUNCTION TileCount
  96.     FOR i% = 1 TO 255
  97.         ' V! = V! + temp(i%)
  98.         r~%% = _RED(temp(i%))
  99.         g~%% = _GREEN(temp(i%))
  100.         b~%% = _BLUE(temp(i%))
  101.         v& = v& + (r~%% + b~%% + g~%%)
  102.     NEXT i%
  103.     TileCount = v&
  104.  
  105. FUNCTION TileCount2
  106.     FOR i% = 258 TO 513
  107.         ' V! = V! + temp(i%)
  108.         r~%% = _RED(temp(i%))
  109.         g~%% = _GREEN(temp(i%))
  110.         b~%% = _BLUE(temp(i%))
  111.         v& = v& + (r~%% + b~%% + g~%%)
  112.     NEXT i%
  113.     TileCount2 = v&
  114.  
  115.  

FellippeHeitor

  • Guest
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #4 on: August 16, 2018, 03:47:11 pm »
Two initial questions:

1- You guys sure that mixing GET/PUT and 32bit mode and _PUTIMAGE is the best approach?

2- if you really are sure, then are  you sure  that temp&() array is big enough for 64x64 32bit image data?


Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #5 on: August 16, 2018, 03:56:52 pm »
Ou yes! I did not notice it. Of course, 4 bytes per pixel in 32 bit mode .... And what you say for this use  _DISPLAY?

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #6 on: August 16, 2018, 03:59:59 pm »
Question:  Is it an issue with color values and XOR?

 LINE (0, 400)-(1023, 415), _RGB32(0, 0, 0), BF

The color here is 255 Alpha(&HFF000000), so is NOT &H00000000, and that could be the source of your issue.

I'd suggest trying:

_DONTBLEND
 LINE (0, 400)-(1023, 415), _RGBA32(0, 0, 0,0), BF
_BLEND

Clear that section of screen with a 0 RGBA (clear) box instead of a 0 RBG (black) color box.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #7 on: August 16, 2018, 04:08:55 pm »
With _DONTBLEND and transparent color instead of black color, see if this isn't what you'd expect:

Code: QB64: [Select]
  1. map& = _LOADIMAGE("warmap01error.png", 32)
  2. tile& = _NEWIMAGE(640, 480, 32)
  3. Zoom& = _NEWIMAGE(128, 128, 32)
  4.  
  5. SCREEN _NEWIMAGE(1024, 480, 32)
  6. DIM SHARED mapval(64, 64) AS SINGLE, temp(1032) AS LONG
  7. 'KILL "debug.txt"
  8. 'OPEN "debug.txt" FOR BINARY AS #1
  9. FOR Y%% = 0 TO 7
  10.     LINE (0, 400)-(1023, 415), 0, BF
  11.     _PUTIMAGE (0, 400), map&, _DISPLAY, (0, 0 + 16 * Y%%)-(1023, 15 + 16 * Y%%)
  12.  
  13.     FOR X%% = 0 TO 63
  14.         'debug information
  15.         LOCATE 10, 1: PRINT peices%; X%%; Y%%
  16.  
  17.         'clear and display progress area
  18.  
  19.         LINE (0, 416)-(1023, 431), 0, BF
  20.         LINE (0 + 16 * X%%, 416)-(15 + 16 * X%%, 431), _RGB32(200, 200, 15), BF
  21.  
  22.         _SOURCE map& 'get next test peice
  23.         GET (0 + (X%% * 16), 0 + (Y%% * 16))-(15 + (X%% * 16), 15 + (Y%% * 16)), temp()
  24.         'clear test area
  25.         LINE (300, 180)-(336, 216), 0, BF
  26.         'put test peice for reference
  27.         PUT (320, 180), temp()
  28.  
  29.  
  30.         IF peices% = 0 THEN
  31.             'the first peice put straight to packlayer
  32.             _DEST tile&
  33.             PUT (0 + tx%% * 16, 0 + ty%% * 16), temp()
  34.             tx%% = tx%% + 1: peices% = 1
  35.             IF tx%% = 40 THEN ty%% = ty%% + 1: tx%% = 0
  36.             _DEST _DISPLAY
  37.         ELSE
  38.             'test the peice placing 2 copies of each found tile and XOR the test peice
  39.             ' over to see if it erases
  40.             px%% = 0: py%% = 0
  41.  
  42.             FOR i% = 0 TO peices%
  43.                 LOCATE 11, 1: PRINT i%, px%%, py%%
  44.                 'clear test area
  45.                 LINE (300, 200)-(336, 216), 0, BF
  46.  
  47.                 'current check image
  48.                 LINE (299, 199)-(316, 216), _RGB32(255, 255, 0), B
  49.                 _PUTIMAGE (300, 200), tile&, _DISPLAY, (0 + px%% * 16, 0 + py%% * 16)-(15 + px%% * 16, 15 + py%% * 16)
  50.                 'place the test copy
  51.                 LINE (319, 199)-(336, 216), _RGB32(RND * 255, 255, RND * 255), B
  52.                 _PUTIMAGE (320, 200), tile&, _DISPLAY, (0 + px%% * 16, 0 + py%% * 16)-(15 + px%% * 16, 15 + py%% * 16)
  53.  
  54.                 'put the tile to check over the test copy with XOR
  55.                 PUT (320, 200), temp(), XOR
  56.                 'zoom in on that area
  57.                 _DEST Zoom&
  58.                 LINE (0, 0)-(127, 127), 0, BF 'clear zoom layer
  59.                 _DEST _DISPLAY
  60.                 _PUTIMAGE (0, 0), _DISPLAY, Zoom&, (299, 200)-(336, 215) 'put test area in zoom layer
  61.                 _PUTIMAGE (0, 0)-(128, 64), Zoom&, _DISPLAY, (0, 0)-(37, 15) 'put enlarged image back on display
  62.  
  63.                 _SOURCE _DISPLAY
  64.                 'get the test copy to see if it was erased
  65.                 GET (320, 200)-(335, 215), temp(257)
  66.                 IF TileCount2 <> 0 THEN 'peice did not match
  67.                     LOCATE 12, 1: PRINT TileCount2
  68.                     _DELAY 2.5
  69.                     '     SLEEP
  70.  
  71.                     _DEST tile&
  72.                     PUT (0 + tx%% * 16, 0 + ty%% * 16), temp()
  73.                     tx%% = tx%% + 1: peices% = peices% + 1
  74.                     IF tx%% = 40 THEN ty%% = ty%% + 1: tx%% = 0
  75.                     _DEST _DISPLAY
  76.                     i% = peices% + 1
  77.                 END IF
  78.             NEXT i%
  79.         END IF
  80.         _DELAY .005
  81.         IF INKEY$ = CHR$(27) THEN Y%% = 65: X%% = 65
  82.         px%% = px%% + 1
  83.         IF px%% = 40 THEN py%% = py%% + 1: px%% = 0
  84.  
  85.     NEXT X%%
  86. NEXT Y%%
  87. 'CLS
  88. '_PUTIMAGE , tile&, _DISPLAY
  89.  
  90. FUNCTION TileCount
  91.     FOR i% = 1 TO 255
  92.         ' V! = V! + temp(i%)
  93.         r~%% = _RED(temp(i%))
  94.         g~%% = _GREEN(temp(i%))
  95.         b~%% = _BLUE(temp(i%))
  96.         v& = v& + (r~%% + b~%% + g~%%)
  97.     NEXT i%
  98.     TileCount = v&
  99.  
  100. FUNCTION TileCount2
  101.     FOR i% = 258 TO 513
  102.         ' V! = V! + temp(i%)
  103.         r~%% = _RED(temp(i%))
  104.         g~%% = _GREEN(temp(i%))
  105.         b~%% = _BLUE(temp(i%))
  106.         v& = v& + (r~%% + b~%% + g~%%)
  107.     NEXT i%
  108.     TileCount2 = v&
  109.  
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #8 on: August 16, 2018, 04:27:04 pm »
Two initial questions:

1- You guys sure that mixing GET/PUT and 32bit mode and _PUTIMAGE is the best approach?

2- if you really are sure, then are  you sure  that temp&() array is big enough for 64x64 32bit image data?

1- the array is set with LONG(technically is should be _UNSIGNED but it works as is) so it should be storing the 32bit color values correctly with GET\PUT and when placed(PUT) they appear normally.

2- TEMP() only needs to store a 16x16 pixel area so its more than big enough at 1024 (16x16=256)

3- The issue is why doesn't _PUTIMAGE see the area that is in the right hand box when PUT is used with XOR? there are some green pixels left but _PUTIMAGE doesn't show them in the zoomed area in the top left corner of the screen, it just shows an empty space between the two light colored lines. the lines randomly change color as it progresses so I could tell that it was actually updating and not just displaying the same image over and over.

SO why does _PUTIMAGE not see the pixels that are lit green in that space after PUT is used with the XOR option. if PUT is used normally or with the PSET option _PUTIMAGE shows the correct pixels.

4- you forgot about part 2, why wouldn't the current 'stable' build load the PNG?

none of this affects my programs final function this is just cosmetic, but it could show a potential problem with _putimage if someone is porting some really old qb45 game that uses XOR(and PRESET) option to QB64. (as putimage doesn't support the PUT options as per the wiki, and nor can you _putimage from and to the same layer)
« Last Edit: August 16, 2018, 04:41:58 pm by Cobalt »
Granted after becoming radioactive I only have a half-life!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #9 on: August 16, 2018, 04:33:18 pm »
With _DONTBLEND and transparent color instead of black color, see if this isn't what you'd expect:

that is what I expected to see, but why wasn't working without _DONTBLEND? why couldn't _PUTIMAGE see those pixels without it?

Question:  Is it an issue with color values and XOR?

 LINE (0, 400)-(1023, 415), _RGB32(0, 0, 0), BF

actually I missed that, that should be causing me a problem else where(that clears the progress marker area) oddly it was working normaly so I missed that I used 0 instead of _RGB32(0,0,0)!
« Last Edit: August 16, 2018, 04:37:03 pm by Cobalt »
Granted after becoming radioactive I only have a half-life!

FellippeHeitor

  • Guest
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #10 on: August 16, 2018, 04:40:00 pm »
4- you forgot about part 2, why wouldn't the current 'stable' build load the PNG?
There has been an image library replacement recently. Please check if the development build will load your png before we can discuss it further.

Let's just remember that stable means that no significative bugs were found up until the moment we tagged it 'stable', but that, of course, doesn't equal "bug free", as no one here would be that pretentious.
« Last Edit: August 16, 2018, 04:41:26 pm by FellippeHeitor »

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #11 on: August 16, 2018, 04:45:04 pm »
4- you forgot about part 2, why wouldn't the current 'stable' build load the PNG?
There has been an image library replacement recently. Please check if the development build will load your png before we can discuss it further.

Gotcha, trying that now..

sure enough the latest DB works fine.
« Last Edit: August 16, 2018, 05:48:18 pm by Cobalt »
Granted after becoming radioactive I only have a half-life!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #12 on: August 16, 2018, 04:58:34 pm »
With _DONTBLEND and transparent color instead of black color, see if this isn't what you'd expect:

that is what I expected to see, but why wasn't working without _DONTBLEND? why couldn't _PUTIMAGE see those pixels without it?

It's not a PUTIMAGE issue, but the XOR issue.   You weren't comparing against COLOR 0, you were comparing against COLOR &HFF000000.

LINE draws on the screen. 
LINE _RGB(0,0,0) draws a BLACK color box on the screen.   
LINE _RGBA(0,0,0,0) blends a 0 alpha BLACK box on the screen.

Only by using _DONTBLEND will you actually draw that  LINE _RGBA(0,0,0,0) box onto the screen, rather than blending it into the background.

You basically need 0 as your color value for XOR to work as you were intending, and instead you were clearing the screen with a shade of black.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #13 on: August 16, 2018, 05:57:23 pm »
It's not a PUTIMAGE issue, but the XOR issue.   You weren't comparing against COLOR 0, you were comparing against COLOR &HFF000000.

LINE draws on the screen. 
LINE _RGB(0,0,0) draws a BLACK color box on the screen.   
LINE _RGBA(0,0,0,0) blends a 0 alpha BLACK box on the screen.

Only by using _DONTBLEND will you actually draw that  LINE _RGBA(0,0,0,0) box onto the screen, rather than blending it into the background.

You basically need 0 as your color value for XOR to work as you were intending, and instead you were clearing the screen with a shade of black.

I think I understand... maybe.
so if I filled the screen with tiles using: PUT(x,y),a(),XOR
and tried to copy that to another image: _PUTIMAGE (0,0), _DISPLAY, Other&, (0,0)-(640,400)
Other& would remain blank because of the way XOR places the pixel color value?

I guess because I can visually see the pixels in the original location but not in the _PUTIMAGE location is what is got me confused. doesn't putimage just copy the memory area for that image handle and pop it in to the other image handle memory location?
Granted after becoming radioactive I only have a half-life!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Issue with _PUTIMAGE and XOR plus issue loading PNG files [FIXED]
« Reply #14 on: August 16, 2018, 06:15:32 pm »
I'm thinking it's basically this line:


                'put the tile to check over the test copy with XOR
                PUT (320, 200), temp(), XOR
                'zoom in on that area

The XOR here fails to behave as you'd expect and turns the screen segment black.

******************

Question:


                'get the test copy to see if it was erased
                GET (320, 200)-(335, 215), temp(257)


In the above, shouldn't you GET temp()?  Why get temp(257)?   What am I missing here?

https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!