Results 1 to 9 of 9
  1. #1
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default Setting the contrast / Darkening images.

    I finally found a great way that I want to use for adding nighttime to my game.
    Unfortunately, I could only find how to change the contrast / darken a bufferedImage, I'd like to do it with an ImageIcon / Icon if possible.
    Works fine with doing it with an "Image" as well.

    Thanks,
    Ah
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default Re: Setting the contrast / Darkening images.

    Have a look at the ImageIO class and the ImageIcon class and you'll see the difference between an Image and an Icon.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default Re: Setting the contrast / Darkening images.

    It does'nt matter because I have both an Image array & an Icon array holding the same images.
    The Images are made into Icons.
    So, anyway. Is it possible to change the contrast / darken the Images or the Icons?
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: Setting the contrast / Darkening images.

    I have both an Image array & an Icon array holding the same images.
    No you don't. An Icon array can hold Icons, not Images.

    What result did you get when you changed the brightness of an image (BufferedImage) that belongs to an ImageIcon?

    db

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default Re: Setting the contrast / Darkening images.

    Quote Originally Posted by Alerhau View Post
    It does'nt matter because I have both an Image array & an Icon array holding the same images.
    What a waste of space; just because you don't know how to handle Icons and Images is no excuse to produce crappy software.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default Re: Setting the contrast / Darkening images.

    Jos,
    I know exactly how to handle Icons & Images,
    First I am creating Images which I am cutting into different parts like a texture pack.

    Then I am changing them into Icons.
    Everything is done my a for loop.

    It takes up 7 rows of my code,
    I would not call it a waste of space.

    Kind,
    Regards Ah

    Btw, you should ask me before telling me that my code is bad.
    In order to know that my code is bad, you have to see it.
    Now,
    Learn from this & help me with my question.
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

  7. #7
    liluma's Avatar
    liluma is offline Member
    Join Date
    May 2011
    Location
    belgium
    Posts
    50
    Rep Power
    0

    Default Re: Setting the contrast / Darkening images.

    think he didn't meant that your code will not work... but just isn't memory efficient...
    so just useing more memory then needed...

    ps why not use those bufferedImages class then? since that class has the method?

  8. #8
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default Re: Setting the contrast / Darkening images.

    The problem is that I am not familiar at all with the bufferedImages.
    I've tried to read it up, but I did'nt really get it to work.

    Thanks,
    Ah

    Btw,
    I will read the API for it and see if I can find anything of interrest.
    If you guys have ay tips for it, then please tell me.
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

  9. #9
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default Re: Setting the contrast / Darkening images.

    This time I think that I'll actually need the code for it.

    Thanks,
    Ah
    Currently Developing a Game Called Loaie, You Can Download It From "The Loaie Website".

Similar Threads

  1. Replies: 0
    Last Post: 12-16-2010, 05:14 PM
  2. Replies: 4
    Last Post: 12-16-2010, 04:32 PM
  3. Auto contrast and auto brightness
    By oxxxis in forum Java 2D
    Replies: 0
    Last Post: 01-21-2010, 08:32 PM
  4. Setting the DSN
    By tim in forum JDBC
    Replies: 1
    Last Post: 02-14-2008, 09:55 PM
  5. Help with setting up please
    By BlitzA in forum New To Java
    Replies: 6
    Last Post: 12-29-2007, 12:54 PM

Posting Permissions

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