I need to map an integer to a Color. Help!

Hello,
I am trying to map an integer to a colour. I have tried using the Color(int rgb) constructor but it just seems to give random colours (at least I can't see how they're generated). My aim is write a function, pass a number (between 1 and 10, for example) in and return a colour which takes into account the whole colour spectrum. I can get a spectrum of 2 colours but not 3.
Any help would be greatly appreciated.
Thanks.

i'll explain in example of setting pixel color in buffered image:
BufferedImage ex = new Buff...
ex.SetRGB(10,10,0x00FF0000);
this is color value : 0x00FF0000 - it is RED color :)
firstly: 00 are for alpha
then: FF are for RED
then: 00 are for GREEN
then: 00 are for BLUE
now we know that if we take for example getRGB of some pixel we get some 23742873 blah blah... so you have to make some logical operation to get proper RGB values:
(1635281 & 0x00FF0000) = RED color value
(1635281 & 0x0000FF00) = GREEN color value
(1635281 & 0x000000FF) = BLUE color value
of course if i am not mistaken :P and correct me if i am wrong

Similar Messages

  • JSF/ADF - Referencing a Map with Integer keys

    I'm generating several ADF input text boxes from a HashMap using Java code in my managed bean. The Map contains Integer keys and String values. Each input text corresponds to a key/value pair.
    I'm trying to build a string to bind the text box to the String object, but I'm struggling with the EL syntax for Maps. I know a Map with String keys would look like this:
    #{bean.object.map['stringKey']}
    But is it possible to specify a non-String key?
    Thank you.

    Hi,
    why don't you try it ? My assumption is that yes, it
    will work because Integer objects have a toString()
    method
    FrankI'm building the binding string in my bean, so Integer's value is inserted, resulting in:
    #{bean.object.map[1]}
    I don't believe the EL supports this for Maps. At least I wasn't able to get it to work. I also tried:
    #{bean.object.map['1']}
    This suggest a string '1' which isn't right either. My guess is that it isn't possible, but I'm hoping someone can prove me wrong.
    From searching the forum I've read that calling processUpdates() might eliminate the need for the ValueBinding step, but I'm not sure. If I called:
    component.setValue(myString);
    Then processUpdates() on each component after the form submit, would this get the its text back to the bean object? If so, could the code go in the form's save action method?
    Thanks.

  • I need to map my garden.  I need to draw it to scale and locate plants ties to a list of plants.

    I need to map my garden.  I need to draw it to scale and locate plants that ties to a list of plant names.

    A quick google search for gardening apps gave a surprisingly large number of hits. I saw at least three distinct garden planner apps (from $2 to $10) without half trying. These are mostly for iOS - iPad and/or iPhone - though there may be equivalents for Mac OS.
    I suggest you hit the app store and start doing some searches. I suspect you'll find something appealing fairly quickly.

  • As per requirement I need to map Char as KF

    Dear Experts,
    As per requirement I need to map Char as KF
    Char data type Char but need to KF Number
    Please Guide me
    Regards,
    JK

    Dear Rajendra,
    Thanku
    But as per our client requirement char value 1,5,25, show in  report Max ,Min and Avg 
    Please guide me
    Regards,
    Jk

  • Is there a need to map fileds in tranformations?

    Hi All,
    I have few fields in source maktx,maktg  that defined as nav attributes in bi for 0materail.
    To get data to this fields in report is there a need to map the source fields to 0material in tranforamations?

    Hi,
    You need not to map attributes of the master data in teh transformation. Just mark the chracteristic 0Material as Master data and do the master data load for the chracteristic before doing the transaction data load. You will get the desired result.
    Also remember to do the attribute change run of the master data if any aggregate is created over it in the infoprovider i.e. cube.
    Navesh

  • I lost my iPhone, but it's been more than 24 hours so iCloud won't let me see the last known location of the device, and i need the map of it's last know location to find the phone, how do i get the map of it's last known location?

    I lost my iPhone, but it's been more than 24 hours so iCloud won't let me see the last known location of the device, and i need the map of it's last know location to find the phone, how do i get the map of it's last known location?

    It's not likely to re-connect to a network lying on the ground somewhere and getting rained on, it would be really great if I could see that map again so I could use it's last known location to find it.  Kind of pointless to have a 24 hr killswitch deadline.  If I had known I would have taken a screen-shot while I still had access to the information.  Since I lost the phone at Canada's Wonderland (which is now closed for the season) I don't have access to the location where I lost the phone (under a roller-coaster probably), and so I wanted to send the Lost And Found people a screen-shot of it's last known location, but I guess I can't do that now.  (Apple are big jerks)

  • What edition of Oracle DB do I need for Map Viewer 12c?

    Hi All,
    What edition of Oracle DB do I need for Map Viewer 12c?
    Thanks,

    What version of Oracle client do I need for a machine with Windows 8?
    Windows 8 doesn't require ANY version of Oracle client!
    Most installations of Windows 8 never install Oracle client and they have never had any problem except the large set of problems that come included with the OS itself (bugs).
    So you clearly need to explain what PROBLEM you are trying to solve.
    Then we can help you find the best way to solve it. For example you could download and use the free Oracle Sql Developer and just use JDBC to connect to your databases. Then you don't need an Oracle client at all.

  • Apache Compilation Problem: makes pointer from integer without a cast -HELP

    Every time I try to compile apache with ssl I get this error message below. I'm pulling my hair out over it! I've installed current versions of gcc, libgcc, glib, make, m4, & flex.. which havent helped. I am running Solaris 9 sparc.
    I'm honestly baffled by this error and have found no help on the web. Does anyone know what I need to do in order to fix this? Any specific libraries I need to install etc??
    <apache compiles up to this point>
    gcc -c -I../../os/unix -I../../include -DSOLARIS2=290 -DMOD_SSL=208116 -DEAPI -DUSE_EXPAT -I../../lib/expat-lite `../../apaci` -fPIC -DSHARED_MODULE -DSSL_COMPAT -DSSL_ENGINE -I/tmp/web/sweeney/Third_Party/apache/openssl-0.9.7d/include -DMOD_SSL_VERSION=\"2.8.16\" ssl_expr_scan.c && mv ssl_expr_scan.o ssl_expr_scan.lo
    lex.ssl_expr_yy.c:1900: parse error before numeric constant
    lex.ssl_expr_yy.c: In function `ssl_expr_yy_scan_string':
    lex.ssl_expr_yy.c:1901: number of arguments doesn't match prototype
    lex.ssl_expr_yy.c:293: prototype declaration
    lex.ssl_expr_yy.c:1903: warning: passing arg 1 of `strlen' makes pointer from integer without a cast
    lex.ssl_expr_yy.c:1903: warning: passing arg 1 of `ssl_expr_yy_scan_bytes' makes pointer from integer without a cast
    make[4]: *** [ssl_expr_scan.lo] Error 1
    make[3]: *** [all] Error 1
    make[2]: *** [subdirs] Error 1
    make[2]: Leaving directory `/tmp/apache_1.3.29/src'
    make[1]: *** [build-std] Error 2
    make[1]: Leaving directory `/tmp//apache_1.3.29'
    make: *** [build] Error 2
    they key being, "makes pointer from integer without a cast"
    Help me Obi Wan Kenobi, you're my only hope! Thank you much!

    I retried, here is the screen output:
    util.c: In function `ap_find_token':
    util.c:1367: error: `test_char_table' undeclared (first use in this function)
    util.c:1367: error: (Each undeclared identifier is reported only once
    util.c:1367: error: for each function it appears in.)
    util.c:1367: error: `T_HTTP_TOKEN_STOP' undeclared (first use in this function)
    util.c: In function `ap_escape_logitem':
    util.c:1444: error: `test_char_table' undeclared (first use in this function)
    util.c:1444: error: `T_ESCAPE_LOGITEM' undeclared (first use in this function)
    util.c: In function `ap_escape_errorlog_item':
    util.c:1496: error: `test_char_table' undeclared (first use in this function)
    util.c:1496: error: `T_ESCAPE_LOGITEM' undeclared (first use in this function)
    util.c: In function `ap_escape_shell_cmd':
    util.c:1567: error: `test_char_table' undeclared (first use in this function)
    util.c:1567: error: `T_ESCAPE_SHELL_CMD' undeclared (first use in this function)
    util.c: In function `ap_escape_path_segment':
    util.c:1671: error: `test_char_table' undeclared (first use in this function)
    util.c:1671: error: `T_ESCAPE_PATH_SEGMENT' undeclared (first use in this function)
    util.c: In function `ap_os_escape_path':
    util.c:1700: error: `test_char_table' undeclared (first use in this function)
    util.c:1700: error: `T_OS_ESCAPE_PATH' undeclared (first use in this function)
    *** Error code 1
    make: Fatal error: Command failed for target `util.o'
    Current working directory /source/apache_1.3.33/src/main
    *** Error code 1
    make: Fatal error: Command failed for target `subdirs'
    Current working directory /source/apache_1.3.33/src
    *** Error code 1
    make: Fatal error: Command failed for target `build-std'
    Current working directory /source/apache_1.3.33/
    *** Error code 1
    make: Fatal error: Command failed for target `build'
    Current working directory /appl/apa_ssl/apache_1.3.33/src
    *** Error code 1
    make: Fatal error: Command failed for target `build-std'
    Current working directory /appl/apa_ssl/apache_1.3.33
    *** Error code 1
    make: Fatal error: Command failed for target `build'
    root@host #
    the include-line in util.c is:
    #include "test_char.h" (vi: line 43)
    file exists:
    -rw-r--r-- 1 root other 0 Nov 8 16:02 test_char.h
    but, as you can see, it is empty

  • I want to know that if i want to download facebook on my iphone 4 or any other apps then it ask me put my card details for payment. why is that. if they are free then why do i need to give my card details?please help me anyone.

    I want to know that if i want to download facebook on my iphone 4 or any other apps then it ask me put my card details for payment. why is that. if they are free then why do i need to give my card details?please help me anyone.

    Just select no credit card as outlined here:
    http://support.apple.com/kb/ht2534

  • My ipad mini does not restart when i press and hold the home and power buttons for a minute or more. what do i do? i really need to access some information on it. please help.

    my ipad mini does not restart when i press and hold the home and power buttons for a minute or more. what do i do? i really need to access some information on it. please help.

    You need to connect to iTunes and restore.
    iOS: Not responding or does not turn on
    You may need to put the device into recovery mode, this is covered in the link on this page.
    Did you back up the device?

  • I cannot download free apps on my iphone/ipad. I get a notice to input my credit card info, which i should not need to do enter for free apps. please help

    i cannot download free apps via the App Store...i get an error message that asks me to enter my credit card information... i wish not to enter my credit card info until i want to purchase something, and to download free apps, i do not believe i should need to enter credit card info.
    Please help me correct my Apple ID account so that i can download free apps.
    thank you so much

    This user, mountaingoatgirl, explains how to get a None option in your account details in the iTunes app on a Mac or PC. -
    https://discussions.apple.com/message/24907941

  • Help! I just put a US sim card (i am from Canada) and got a monthly pre paid plan, and when I went to restore the iphone, it didn't work. I can't find backup that i did right before the sim was changed. I really need the info that was there! Please help..

    Help! I just purchased a US sim card/monthly pre-paid plan (i am from Canada) as I am travelling in the states for a month, and when I went to restore the iphone, it didn't work. I can't find backup that i did right before the sim was changed. I really need the info that was there! Please help..

    Hold on,
    Have you talked to your carrier to confirm the unlock?
    What was the procedure you did to unlock the phone?
    Standard unlocking procedure once processed by the carrier:
    Backup in iTunes
    Erase the phone (ignore restore terminology here)
    Plug the phone to the computer and then launch iTunes
    Wait for unlock notification.
    Restore the backup.

  • My location services is already on as well as with my facebook apps, but still i am unable to check in. what's wrong? even with my maps, it always say location unavailable. help please.

    my location services is already on as well as with my facebook apps, but still i am unable to check in. what's wrong? even with my maps, it always say location unavailable. help please.

    - The iPod uses the location of a nerby or connected router to determine it location based on a database of routers and their location. It appears that the routers near y are not in Appl'es database.  As of yet, nobody here seems to know how to get routers added to the database.
    - If you go to Strtbucks. McDonalds or another networks does the location show in the Maps app?

  • I have a macbook thats running lion, and i want to take an iso i have on the mac and put it on my pc, i know i need to reformat it to work on macs, but i need to put it on a pc, please help!

    i have a macbook thats running lion, and i want to take an iso i have on the mac and put it on my pc, i know i need to reformat it to work on macs, but i need to put it on a pc, please help!

    Creative Cloud Help | Creative Cloud / Common Questions
    "Can I use the software I download from Creative Cloud on more than one machine?
    Yes. Creative Cloud desktop applications can be downloaded and installed on multiple computers, regardless of operating system. However, activation is limited to two machines per individual associated with the membership. See the terms of use for more information. Learn how to deactivate a Creative Cloud license on a machine."

  • HT201210 i try to do several times... to recovery my ipad 2 wifi...but it gone off mode..what i must do.. i'm  university student ..i need my ipad for tomorrow lecture..please help me

    i try to do several times... to recovery my ipad 2 wifi...but it gone off mode..what i must do.. i'm  university student ..i need my ipad for tomorrow lecture..please help me

    What version of ios do you have?
    See Texas Mac Man's write up here.
    My iPad won't connect to my home wifi - even though it has previously worked fine.  It says it is unable to connect? - any ideas

Maybe you are looking for