Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Creating an IndexColorModel with 8 Colours

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to make an IndexColorModel object with 8 colours: red, green, blue, cyan, magenta, yellow, white, black.

I think the constructor below is the one that I need, but I don't know how to continue. Any help is appreciated.



Thanks.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I take it that this is in continuation of https://coderanch.com/t/504019/GUI/java/Suggestions-colour-convertor-program and in response to my suggestion there.

Since you apparently didn't feel the need to acknowledge that the suggestion could be useful to you, I don't feel like guiding you further.

To the Bartenders: If you feel this is unduly harsh and violates the principles of BeNice, please feel free to remove it.
 
Mikpo Siru
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have updated the above mentioned thread.

The documentation gives these parameter descriptions:

The images that I want to represent using IndexColorModel will be user-selected, so the image dimensions are not fixed. If it makes things much simpler, I can restrict the user to selecting an image of a fixed format, such as only GIF or only JPEG.

The eight colours I want the IndexColorModel to have are: red, green, blue, cyan, magenta, yellow, white, black.

Could anyone please explain what the parameters mean in this case? Then I can try filling them in.

Thanks.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Snippets from the code I used for proof of concept:


 
Mikpo Siru
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! This was the main component in the converter program I was writing, so I have updated that thread: https://coderanch.com/t/504019/GUI/java/Suggestions-colour-convertor-program#2277917
 
reply
    Bookmark Topic Watch Topic
  • New Topic