An excellent platform independent vector drawing gift for you!
Home | Products | Download | Documentations | Order Now | Contact |  
 
FAQs
Quick Install
Developer Guide
ScreenShots
Award
 
    Java.net
    AbleStable
    Softpedia
    FreeTrialSoft
    FreshMeat
    Download32
    More...
  Developer Guide(Batch scaling) - JFImagine.com

[Prior]   [Top]   [Next]

6. Batch scaling shapes


        Batch scaling your shapes when needed.

    Although you can zoom in/zoom out all shapes anytime, but actually you may want to resize all the shapes as a specified x coordinate scale or y coordinate one. You may want to batch scale these all shapes under different x and y coordinates scale percentage. But how you can do this?

    Now we added a new scaleBy method for all AbstractShapes and its subclasses.

         Sample codes of a batch scaling.

public void scaleCurrentLayer(double xScale, double yScale){

//set a base point to up-left corner
JFPoint basePoint =new JFPoint(0,0);

//scale all shapes in current layer.
JFLayer layer =getDrawCanvas().getDrawPage().getCurrentLayer();
Iterator it =layer.getShapeList().getList().iterator();
while (it!=null && it.hasNext()){
AbstractShape shape=(AbstractShape)it.next();
shape.scaleBy(basePoint,xScale,yScale);
}

         Screenshot of this sample.

    Now you can take a look at the effects of this batch scaling method.

   

(Scale percentages for demonstration)

(Batch scaling, x=100%, y=150%)

 

        To get full source code of this sample.

    You can download the full sample source code package here. Then open the file at sample4/Sample4.java for detail informations.

 

[Prior]   [Top]   [Next]   [Top]   [Next]