A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Ideas for getting color pixels

  1. #1
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385

    Ideas for getting color pixels

    I have a flash project that I am currently loading images into a dynamic textbox using HTML tags based on an XML file. Now my question is... Would it be possible while the XML is being parsed and the images generated to grab the pixel data from say the left side of the image(orginal image is 250 x 200 and I want to grab the left side 100px) in order to determine to make the text color black or white (ex: black text will be wrote overtop image if the image is a light color and white text if image is a dark color).

    Hopefully that made sense, if you need more explaining ask and I will reply

  2. #2
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    Anyone?

  3. #3
    GameBalance
    Join Date
    Apr 2005
    Location
    russia
    Posts
    62
    oh what do u mean? u want to load part of image?
    www.gamebalance.com -my site
    Snake Classic - my new game
    - Arseniy Shklyaev

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Well you can't grab the pixel data until the images are loaded, but once the images are loaded in you could capture them into a BitmapData object and then evaluate the pixels to determine what color the text should be. Seems like overkill unless you have a lot of images you need to load in, but it is possible, yes.

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    i agree with rdoyle720. It's a bit overkill. Plus it's not because you've got some dark pixels on top left that the whole image is dark?
    You already enter info via xml that someone must write somewhere anyway, why not add an attribute 'tint' that would determine the color of your text.

    gparis

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center