SAVESPRITE or GRABSPRITE bug?

Previous topic - Next topic

AndyH

I'm drawing a rectangle using the transparent colour and then drawing a sprite inside that.

I'm then using GRABSPRITE followed by SAVESPRITE but I get a line of pixels at the top and left of the image that are slightly off the transparent color (255,0,128).  Here's an example:



Found the problem is if I draw at 0,0 and grab from there.  If I draw at 3,3 (away from the top left) and then grab from this position the lines disappear.  Can this be fixed at all?


Another odd thing, I can change what the transparent color is when I use LOADSPRITE or GRABSPRITE with the SETTRANSPARENCY command but there something odd is going on which I can't put my finger on.  

Here's some examples with SAVESPRITE and using a different transparent colour:


This one is where I set the transparency color to 0,0,10 and the color used in the DRAWRECT the same.
-

This one is where I set the transparency color to 0,0,128 and the color used in the DRAWRECT the same.
-

This one is a bit odd.  Set the color to 215,0,128 and my sprite when loaded back in does not suffer the border at the top and left like issue #1 reported above.  However, if I put SETTRANSPARENCY RGB(255,0,128) after I have done GRABSPRITE'd and SAVESPRITE and LOADSPRITE, I get the border problem as described in issue #1.  The help file for SETTRANSPARENCY says that this command should only affect the LOADSPRITE and GRABSPRITE.  So perhaps there is a bug with this too?  I'm getting so many different results it is hard to see what is actually happening.

Kitty Hello

OK, it might be fixed in the next version (5.173), if not, please send me a working project to test it.

AndyH

I'll put together a small example file for the grabsprite problem.  If you draw it at position 0,0 then grab using a transparent colour, you get this line.  If you draw it at 3,3 (but make sure your transparent colour extends from 0,0) the problem goes away.

Also found another (unrelated) bug with certain sized sprites when using Polyvector putting a very thin box in the colour of the transparent colour around the outer edge so will combine the two for you to take a look at.

AndyH

Had trouble replicating both issues outside of my project.  I'll keep an eye on it for now and will post anything if it comes up again.

For the transparency I'm drawing and grabbing away from the edge of the screen, that has solved the issue for me, although grabbing from the edge of the screen in a separate project didn't exhibit the different colour on the top/left edges.

For the Poly line issue, again could get it to do it in a separate project, but solved by bringing my TX and TY co-ordinates in by 0.01.  No noticeable difference to the end image.

Kitty Hello

Right. You should specify 0.5 as the left/top pixels, then your texture mapping is right in the center of that pixel. Same for the bottom/right edge: Use width-.5, height-.5.

AndyH