Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Pic.Draw Transparency Pixel Glitch
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
AlexH




PostPosted: Thu Dec 10, 2009 10:29 pm   Post subject: 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.
Posted Image, might have been reduced in size. Click Image to view fullscreen.


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)
<Answer Here>

Turing:


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
Sponsor
Sponsor
Sponsor
sponsor
AlexH




PostPosted: Thu Dec 10, 2009 10:36 pm   Post subject: Re: Pic.Draw Transparency Pixel Glitch

Heres the image


Scope2.jpg
 Description:
 Filesize:  52.33 KB
 Viewed:  77 Time(s)

Scope2.jpg


Tony




PostPosted: Thu Dec 10, 2009 10:40 pm   Post subject: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
AlexH




PostPosted: Thu Dec 10, 2009 10:49 pm   Post subject: 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




PostPosted: Thu Dec 10, 2009 11:07 pm   Post subject: Re: RE:Pic.Draw Transparency Pixel Glitch

AlexH @ Thu Dec 10, 2009 10:49 pm wrote:
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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Euphoracle




PostPosted: Fri Dec 11, 2009 7:01 am   Post subject: 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).

Posted Image, might have been reduced in size. Click Image to view fullscreen.
AlexH




PostPosted: Fri Dec 11, 2009 4:31 pm   Post subject: 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




PostPosted: Fri Dec 11, 2009 4:51 pm   Post subject: Re: RE:Pic.Draw Transparency Pixel Glitch

Euphoracle @ Fri Dec 11, 2009 7:01 am wrote:
I roughly recreated it in photoshop but did some tricky jpg compression
Jpeg doesn't support an alpha channel, it's for photographs.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Dec 11, 2009 5:09 pm   Post subject: 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].
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Euphoracle




PostPosted: Fri Dec 11, 2009 10:23 pm   Post subject: Re: RE:Pic.Draw Transparency Pixel Glitch

DtY @ Fri Dec 11, 2009 4:51 pm wrote:
Euphoracle @ Fri Dec 11, 2009 7:01 am wrote:
I roughly recreated it in photoshop but did some tricky jpg compression
Jpeg doesn't support an alpha channel, it's for photographs.


Who said anything about an alpha channel?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: