• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

setBrightness

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

i have an image stored in an ImageIcon. i am trying to set the brightness using a slider. i have found a few tutorials that use the setBrightness function but this is used on an ImageDisplay object. is there anyway to get a setBrightness function on the ImageIcon or anyway to convert the ImageIcon into an ImageDisplay and then set the brightness and convert it back to an ImageIcon.

thanks
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never heard of ImageDisplay -- it's not in the J2SE. What package is it in? Anyway, have you done the 2D API tutorial:

http://java.sun.com/docs/books/tutorial/2d/index.html

The section on filtering may give you ideas.
 
conor murphy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

i have a program called JAI tutor. it is a tutorial on how to use the JAI api and it uses ImageDisplay. i havent been able to find anything on it though.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by conor murphy:

i have a program called JAI tutor.



Oh, JAI. It's on my list of things to learn, but until now everything I've needed to do with images I've been able to do with J2SE (the 2D API).
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

It's on my list of things to learn


I think it's dead. It hasn't progressed significantly in years, and now being hosted at dev.java.net, I don't expect Sun to release anything beyond 1.1.x.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:

I think it's dead.



As useful as the 2D API of the J2SE is, there are times you need to go beyond it, for example, when working with large images. Is there another Java library that's being promoted for advanced graphics?
 
conor murphy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ive got to use the JAI library for an assignment at uni. they told us we are not allowed to use anything else excpet the JAI library. i found a way to do it using lookups but i dont really understand how it works so i dont want to use it if i cant tell what it does

here is the code anyway. maybe someone has seen this code before and can explain what is happening

// Brightness processor
public void processBrightContrast(int ipParam, Image pImage){

Image mImage = pImage;
//Create parameter block
ParameterBlock mPB = new ParameterBlock();
//Add image source to parameter block
mPB.addSource(mImage );

byte lutData[];
lutData = new byte[256];
for(int j = 0; j < 256; j++)
lutData[j] = clampByte(j + ipParam);

LookupTableJAI mLookup = new LookupTableJAI(lutData);

mPB.add(mLookup );
RenderedOp mRenOp;

// Process the brightness/ darkness
mRenOp= JAI.create("lookup", mPB, null);
return mRenOp.getAsBufferedImage();
}


private final byte clampByte(int i)
{
if(i > 255)
return -1;
if(i < 0)
return 0;
else
return (byte)i;
}

thanks
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is there another Java library that's being promoted for advanced graphics?



JOGL/OpenGL (also on dev.java.net) is progressing nicely, although it's more a replacement for Java3D -which is also dead- than JAI I think. I like ImageJ, since it's also a ready-to-use application, but it doesn't come close to JAI in terms of general functionality. It does have some amazing plugins contributed by other people, though.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic