Results 1 to 8 of 8

Thread: Colour for Transperant Pixels?

                  
   
  1. #1
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    84

    Default Colour for Transperant Pixels?

    Trying to do pixel perfect collision at the moment but hit a brick wall. What colour is returned using this function:
    Code:
    color = image:pixel(0, 0)
    if the pixel is transperant? So far I have established that it isn't 0 or the colour that I set to be transperant in the image (ie (255, 0, 255) ) and I can't even get the RGB values to be printed out on the screen from the 'colour' I do get.

  2. #2
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    33
    Posts
    832
    Rep Power
    91

    Default

    is it even possible to make a transparent pixel using RGB? i know that 0,0,0 would be black and 255,255,255 is white. and all of the combos between are colors. I don't think you can make pixels transparent. Ic ould just be talking out of my bum here tho.
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

  3. #3
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    84

    Default

    When you create a PNG/GIF file in 256 colour, you can tell the image editing program to say, "Any pixel THIS colour, will be transperant". The Luaplayer image loader will obtain this information when it parses the image.

    My problem is: What 'colour value' is returned when imageixel(x, y) is used when the pixel is transperant.

  4. #4
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    33
    Posts
    832
    Rep Power
    91

    Default

    hmm, thats a thinker. it should be 255,255,255 right? but you said it wasn't
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

  5. #5
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    84

    Default

    (255, 255, 255) is white. I have also tried checking against 'nil' but that doesn't work either.

    It is returning something but I cant tell or access the information I need.

    edit: Nevermind, I was just misunderstanding the documentation. Fixed now .

  6. #6
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    33
    Posts
    832
    Rep Power
    91

    Default

    ok. i knew that 255 255 255 was white, and if you had set the pixel to be transparent as white, then that should have been it. just throwing out ideas.
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

  7. #7
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    84

    Default

    I found that 'color' uses RGBA rather then RGB, so I just checked against the 'a' / alpha value.

    Side note: I use bright pink for transpency . The least likely to be used as a real colour :P

  8. #8
    DCEmu Coder MasterChafed's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Age
    33
    Posts
    832
    Rep Power
    91

    Default

    smart, i always use white :P glad u figured it out.
    http://one.revver.com/watch/170516
    http://one.revver.com/watch/167200

    Please click the links above to watch my stick figure animations,
    and please, if you have the time, click the ads at the end to earn me some money.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •