Menu

#1 Fix zoom/resize code

open
prince
None
7
2010-10-18
2010-04-29
No

The zoom/resize code is a necessity and I cannot figure out how to make it work at all. What I have is most likely completely wrong.

Discussion

  • Kyle Flanigan

    Kyle Flanigan - 2010-04-29
    • assigned_to: nobody --> codistmonk
     
  • Codist Monk

    Codist Monk - 2010-04-29
    • status: open --> closed
     
  • Kyle Flanigan

    Kyle Flanigan - 2010-05-01
    • assigned_to: codistmonk --> nobody
    • priority: 9 --> 8
    • labels: 1394636 -->
    • status: closed --> open
     
  • Kyle Flanigan

    Kyle Flanigan - 2010-05-16
    • priority: 8 --> 7
     
  • Kyle Flanigan

    Kyle Flanigan - 2010-05-16

    The objects need to be able to be dragged outside of the layeredPane and back in again. A temporary fix being not allowing the objects to move completely outside of the jLayeredPane.

     
  • Kyle Flanigan

    Kyle Flanigan - 2010-09-11
    • assigned_to: nobody --> sghalib
     
  • prince

    prince - 2010-10-18

    I will work on it.

     
  • prince

    prince - 2010-10-18
    • assigned_to: sghalib --> arkadyz
     
  • prince

    prince - 2010-10-18

    What we have now, I don't understand (as user) how does it work.

    I think follows should be done:

    1. Add combo of percentage at the top, so user will be able to select exact zoom he wants. Changing value of this combo will change value of zoomSlider and vice-versa.

    2. All graphic objects will be redrawn to the new size after changing value of percentage (it may be reached by using scale() function of Graphics class).

    3. During save/print, the coordinates of objects should be recalculated to zoom = 100% before actual save/print.

    4. During load, all objects should be drawn according to the currently selected zoom.

    What do you think ?

     
  • Kyle Flanigan

    Kyle Flanigan - 2010-10-18

    I agree with all of the above. The difficulties lie in resizing text though. Also line size will be tricky to get right, especially if it is only 1 px wide.

     
  • prince

    prince - 2010-10-22

    I am looking at the current implementation more carefully, and see that the implementation is correct from mathematic point of view:

    All objects are drawn inside buffered image, which has the fixed size. After it, the buffered image is drawn on the slide itself in the way it will take the whole area of the slide. Size of area of the slide is depend on the selected zoom.

    ==========================================================
    I will try following:
    Buffered image will always have the same size as slide itself and use bufferGraphics.scale(....) before drawing objects.

     
  • prince

    prince - 2010-10-23

    The idea to replace size of BufferedImage was not successful. I got out-of-memory excetion during continues movig value of zoomSlider.

    I used following code in Slide.applyZoom():

    AffineTransform tx = AffineTransform.getScaleInstance(this.getZoom(), this.getZoom());

    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);

    this.buffer = op.filter( this.buffer, null);
    this.bufferGraphics = this.buffer.createGraphics();

    I also tried to used the commented piece of code (which actually makes the same) and got the same result: out-of-memory exception.

    Do you have other ideas ?

     
  • prince

    prince - 2010-10-23

    The other detail I see: during increase zoom, the figures moves into right-down direction, which may mislead the user. If user, for example, drew rectancle in the middle, he may suppose the rectangle will stay at the middle (with changed size of course).

    This happens because the left-top point of slide is fixed corresponding to the slides frame. We should try to make central point fixed. Is it possible to set left-top point to have negative coordinates ?

     
  • Kyle Flanigan

    Kyle Flanigan - 2010-10-26

    really this doesn't need to be done in the main program. Just one time before the slideshow is run.

     
  • prince

    prince - 2010-10-27

    I think you didn't understand me or I didn't understand you. I am talking about user moves slides resizer (at the right bottom to change zoom.

    How it is connected to slideshow ?

     
  • Kyle Flanigan

    Kyle Flanigan - 2010-10-28

    Well the code to resize when the slider is moved should be the same as the code that resizes the slide for slideShow. However with all that is going on with the slide in MainFrame (layout manager, different listeners etc.) it might be easier to get the code working for resizing to the slideshow first then implementing it to the slider action event.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.