I need input on a possible bug in v3.5.0 - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: Chatting and Socializing (https://staging.qb64phoenix.com/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://staging.qb64phoenix.com/forumdisplay.php?fid=2) +--- Thread: I need input on a possible bug in v3.5.0 (/showthread.php?tid=1411) |
RE: I need input on a possible bug in v3.5.0 - TempodiBasic - 01-21-2023 @TerryRitchie Hi I'm very glad to say you... I have found the bug! Yes, IMHO if you change one line of your MakeMask routine, your tool works perfectly! Code: (Select All) cc~& = Point(10, 10) '_RGB32(255, 0, 255) ' set the color to be used as transparent We must take background/ transparent color from the image passed to the routine! Please take a try and you enjoy to see working your tool for detection! Thanks to Bplus for rising out this bug! We get another step toward a good tool! RE: I need input on a possible bug in v3.5.0 - bplus - 01-21-2023 Hi @TempodiBasic, Yeah I tried setting _Clearcolor after loading the images and got no improvements. Terry's code does stuff with "Mask" which required too much study by me. So I will try today and see what I can come up with independent of Terry code trouble is now I have mask stuck in my mind ;-)) It does look like you want x and y radius of object to minimize scanning though pixels. And isolating an object in an image is interesting problem in itself. PS Oh just saw 2nd post, I will check out! RE: I need input on a possible bug in v3.5.0 - SMcNeill - 01-21-2023 (01-20-2023, 11:25 PM)bplus Wrote: I just tried 2 Xmas Stars with Terry's code, looks like a complicated thing using a mask and requiring image object to fit exactly inside image width and height... I don't know. It didn't allow a simple substitution of images of 2 other objects. Damn might have to read the directions, all is lost ;-)) Run those images through a color detection routine... I'm getting a ton of colors in them! (all various shades of black, but colors nonetheless.) The red star is terrible with it. Was it converted from a jpg or something?? If I was going to check these 2 images for collision, I'd at least expect the backgrounds to be 0 alpha, to make the blending and checking considerably easier. RE: I need input on a possible bug in v3.5.0 - bplus - 01-21-2023 Got it working as TempodiBasic sorta said but the edge of the image is also colliding with the stationary object. Changed code to put center of image at mouse not top edge so can move over entire screen. The collision detection works when star touches star but also goes off as I said when border of mouse image touches stationary star. Working: Colliding with edge: For some reason that edge of image is not clean ie transparent like the rest of it is. Here is my code mods in zip pack. RE: I need input on a possible bug in v3.5.0 - TerryRitchie - 01-21-2023 (01-21-2023, 11:17 AM)TempodiBasic Wrote: @TerryRitchie Oh for goodness sake. I hard coded the transparent color for the example images instead having the routine detect the transparent color. Thanks for finding this. The code works for this example but will fail when images with differing transparent colors are used. Your catch will make this a true general use routine. I'll work on changing the code and upload the result here. RE: I need input on a possible bug in v3.5.0 - bplus - 01-21-2023 (01-21-2023, 03:53 PM)TerryRitchie Wrote:(01-21-2023, 11:17 AM)TempodiBasic Wrote: @TerryRitchie Even with that fix there is still a false positive collision detected when the image edge contacts the other image, modified code in zip for testing above. RE: I need input on a possible bug in v3.5.0 - SMcNeill - 01-21-2023 starRed and starBlue collision demo: Code: (Select All) SCREEN _NEWIMAGE(1280, 720, 32) I tweaked your stars to get rid of the black backgrounds. See how the above works for you. RE: I need input on a possible bug in v3.5.0 - TempodiBasic - 01-21-2023 @SMcNeill You have a good look...the images show some impurities... So no one background color! This following image of a red star has been made by Paint of Windows with one color for background and it works very well in the demo of Terry Ritchie for collision detected by mask. @Bplus + @TerryRitchie It is because what we see as one black background in the star's image is a not a pure (made by one color) background until the edges as already pointed out by Steve! I made another RedStarimage.png using Paint of Windows: I loaded RedStar.png , then I select a closer area around the star and I copied it. Then I made another image, background set to black by fillcolor tool of Paint and pasting the redStar in it. So it works well! RE: I need input on a possible bug in v3.5.0 - SMcNeill - 01-21-2023 @TempodiBasic My solution was simple -- I just filtered out anything that wasn't read or blue and turned them all transparent 0. RE: I need input on a possible bug in v3.5.0 - TempodiBasic - 01-21-2023 @Steve SMcNeill hi boy very good your MOD 1 you set one color for background of images 2 you use keyboard to move image, so it is possible to evaluate with more precision the sensibility of detection of collision 3 you speed up the operations of working and comparing the area of graphic images using _MEM functions one neo I must cancel "Z:\" from the path of images to be loaded :-P |