
-----------------------------------
AlexH
Thu Dec 10, 2009 10:29 pm

Pic.Draw Transparency Pixel Glitch
-----------------------------------
What is it you are trying to achieve?
Create a sniper reticule that works on Mouse.Where


What is the problem you are having?
Transparency is glitching, certain pixels remain white.
http://i287.photobucket.com/albums/ll145/Freddyguy7/Screenshot2009-12-10at101710PM.png


Describe what you have tried to solve this problem
colourback (), bmp, 32bit, 24bit, 8bit, jpg, resolution settings, picMerge, picUnderMerge


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




View.Set ("Graphics,offscreenonly,position:center;center,nobuttonbar")

var x, y : int
var click : int := 0

var scope : int := Pic.FileNew ("Scope2.jpg")
scope := Pic.Scale (scope, 1500, 900)

loop
    Mouse.Where (x, y, click)
    delay (3)
    cls
    Draw.FillBox (0, 0, 100, 100, black)
    Draw.FillBox (100, 100, 200, 200, black)
    Draw.FillBox (200, 200, 300, 300, black)
    colourback (0)
    Pic.Draw (scope, x - 750, y - 450, picMerge)

    View.Update
end loop



Please specify what version of Turing you are using
4.1.1

-----------------------------------
AlexH
Thu Dec 10, 2009 10:36 pm

Re: Pic.Draw Transparency Pixel Glitch
-----------------------------------
Heres the image

-----------------------------------
Tony
Thu Dec 10, 2009 10:40 pm

RE:Pic.Draw Transparency Pixel Glitch
-----------------------------------
my guess is that Pic.Scale might be getting certain pixels to slightly change their colour; or you have colour distortion in the source image itself.

-----------------------------------
AlexH
Thu Dec 10, 2009 10:49 pm

RE:Pic.Draw Transparency Pixel Glitch
-----------------------------------
I tried removing pic.Scale and it just made the whole thing smaller (including the pixels). 
And I have redone the reticule multiple times, I am positive it is solid white.
Using photoshop I have tried saving it while the white circle part is transparent or solid white. Neither worked.


Could you try it. To see if it is just my computer?
I am running Turing on Crossover on a mac.

-----------------------------------
Tony
Thu Dec 10, 2009 11:07 pm

Re: RE:Pic.Draw Transparency Pixel Glitch
-----------------------------------
it just made the whole thing smaller (including the pixels).
Sounds like the problem is with the source image. JPEG is a compressed format and it has artifacts.

-----------------------------------
Euphoracle
Fri Dec 11, 2009 7:01 am

RE:Pic.Draw Transparency Pixel Glitch
-----------------------------------
Try this image and see if you have better luck.  I roughly recreated it in photoshop but did some tricky jpg compression so hopefully it doesn't distort the transparency part.  If it works, if you want, I can do it to match the same position/size/colour as the one you posted (after my calc exam).

http://csclub.uwaterloo.ca/~pgpaskar/picture/scope.jpg

-----------------------------------
AlexH
Fri Dec 11, 2009 4:31 pm

RE:Pic.Draw Transparency Pixel Glitch
-----------------------------------
I just jacked up the resolution to 3000 and the image size to 2000x1200. 
And it made it slightly better. It will work for now.

-----------------------------------
DtY
Fri Dec 11, 2009 4:51 pm

Re: RE:Pic.Draw Transparency Pixel Glitch
-----------------------------------
I roughly recreated it in photoshop but did some tricky jpg compressionJpeg doesn't support an alpha channel, it's for photographs.

-----------------------------------
Tony
Fri Dec 11, 2009 5:09 pm

RE:Pic.Draw Transparency Pixel Glitch
-----------------------------------
Turing's Transparency is based on a solid "transparent" colour, not alpha channel anyway.

But JPEG's lossy compression creates artifacts, see

http://en.wikipedia.org/wiki/Jpeg#Compression_ratio_and_artifacts

If you were to sample the "white pixels", you will see that they are not actually "white"

Large areas that become transparent are [254, 254, 254]. Most of the pixel artefacts are [253, 253, 253]

Some are [255, 253, 254].

-----------------------------------
Euphoracle
Fri Dec 11, 2009 10:23 pm

Re: RE:Pic.Draw Transparency Pixel Glitch
-----------------------------------
I roughly recreated it in photoshop but did some tricky jpg compressionJpeg doesn't support an alpha channel, it's for photographs.

Who said anything about an alpha channel?
