Results 1 to 2 of 2
  1. #1
    Sir_Mark is offline Member
    Join Date
    Apr 2011
    Rep Power

    Question Image browser with pan-and-zoom effect

    Hi everyone,

    I want to make an image browser similar to eog, geeqie or glslideshow on Linux. In addition It needs to implement a pan-and-zoom effect (in other words: Ken Burns effect).

    However, I heard that you can't write program like that in Java due to its low-effectiveness. The application should run smoothly on Intel Atom platform with image resolution of 1024x768 pix.

    I don't know the newest innovation in Java so maybe You know about some libraries that can be effective enough in such situation?

    Here you have an applet with the mentioned effect: ZoomPan applet

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Rep Power


    Applets are written in Java, so clearly, if it can be done in an applet with adequate performance, then it can be done in Java with adequate performance.

    What you're trying to do is really not all that complicated.

    Create a new class that extends JComponent, and have it implement MouseListener and MouseMotionListener. In the 'paintComponent class, you will call 'drawImage' on the graphics context using one of the versions that allows for rescaling and cropping. The amount you will rescale and crop will depend on your current x and y offsets and scale factors, which are calculated based on the mouse operations.

    Each time you process a mouse event and alter the offsets or scale factors, call 'repaint'.

    Alternately, you could apply an AffineTransform to the graphics context, but that will scale everything you may decide to draw on top of the image later on (which may or may not be what you want).

Similar Threads

  1. Replies: 26
    Last Post: 07-06-2011, 09:20 PM
  2. Replies: 13
    Last Post: 08-30-2010, 08:55 PM
  3. How to Zoom in and Zoom out TYPE_USHORT_565_RGB image
    By Santhoshkumarp in forum AWT / Swing
    Replies: 0
    Last Post: 08-07-2010, 03:39 PM
  4. How to create a Warhol effect in an image.
    By racewithferrari in forum New To Java
    Replies: 12
    Last Post: 04-14-2010, 02:54 AM
  5. Java Zoom in and Zoom out?
    By ps20090 in forum Java Applets
    Replies: 2
    Last Post: 09-18-2009, 01:04 PM

Tags for this Thread

Posting Permissions

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