Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2004

Tip: Looking for answers? Try searching our database.

scaling bufferedImage to fit Jpanel with indexcolormodel

Thread view: 
Abhi - 24 Dec 2004 12:30 GMT
Can anyone help me with this?

I have a JPanel with a corresponding BufferedImage of the same size
(w,h)

I also have a two dimensional float array representing an image that
I've realised using a BufferedImage of a different (and larger) size
(w',h'), with a custom IndexColorModel and a DataBuffer of type float
(which constitutes the raster).

How do I blit the larger image to the JPanel buffer (which will be
viewed on the screen). Graphics/Graphics2D.drawImage seems to use only
the default colormodels. I seem to be missing something in terms of
how to use drawImage correctly, or perhaps there's another way to do
this.

Essentially, I wish to draw the float array to the JPanel buffer, so
that when I change the float values, the buffer gets updated
automatically and I see the results on the screen by invoking the
paint method of the JPanel (as a changing image). Any help would be
greatly appreciated!

Abhi
Knute Johnson - 24 Dec 2004 18:24 GMT
> Can anyone help me with this?
>
[quoted text clipped - 19 lines]
>
> Abhi

Take a look at MemoryImageSource, I think that will do exactly what you
describe.

Signature

Knute Johnson
email s/nospam/knute/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.