Package java.awt.geom

Examples of java.awt.geom.Area.transform()


        //workout transformation for the image
        AffineTransform image_at =new AffineTransform(Trm[0][0]*scale,-Trm[0][1]*scale,-Trm[1][0]*scale,Trm[1][1]*scale,0,0);
       
        //apply it to the shape first so we can align
        Area r =new Area(new Rectangle(0,0,w,h));
        r.transform(image_at);
       
        //make sure it fits onto image (must start at 0,0)
        ny = r.getBounds2D().getY();
        nx = r.getBounds2D().getX();
        image_at =new AffineTransform(Trm[0][0]*scale,-Trm[0][1]*scale,-Trm[1][0]*scale,Trm[1][1]*scale,-nx,-ny);
 
View Full Code Here


            //workout transformation for the image
            AffineTransform image_at =new AffineTransform(Trm[0][0]*scale,Trm[0][1]*scale,Trm[1][0]*scale,Trm[1][1]*scale,0,0);

            //apply it to the shape first so we can align
            Area r =new Area(new Rectangle(0,0,w,h));
            r.transform(image_at);

            //make sure it fits onto image (must start at 0,0)
            double ny = r.getBounds2D().getY();
            double nx = r.getBounds2D().getX();

View Full Code Here

    Area final_clip = (Area) current_shape.clone();

    //if not working at 72 dpi, alter clip to fit
    if(scale!=1){
      AffineTransform af=AffineTransform.getScaleInstance(scale,scale);
      final_clip.transform(af);
    }

    //actual size so we can trap any rounding error
    int image_w = current_image.getWidth();
    int image_h = current_image.getHeight();
View Full Code Here

    double d_y = (image_h - shape_h);
    AffineTransform upside_down = new AffineTransform();
    upside_down.translate(-shape_x, -shape_y); //center
    upside_down.scale(1, -1); //reflect in x axis
    upside_down.translate(shape_x, - (shape_y + shape_h));
    final_clip.transform(upside_down);

    //line up to shape
    AffineTransform align_clip = new AffineTransform();

    //if not working at 72 dpi, alter clip to fit
View Full Code Here

    //line up to shape
    AffineTransform align_clip = new AffineTransform();

    //if not working at 72 dpi, alter clip to fit
    align_clip.translate(-i_x*scale, (i_y*scale) + d_y);
    final_clip.transform(align_clip);

    //co-ords of transformed shape
    //reset sizes to remove area clipped
    double x = final_clip.getBounds2D().getX();
    double y = final_clip.getBounds2D().getY();
View Full Code Here

                                    if(glyph.getShape()!=null){

                                        Area glyphShape=(Area) (glyph.getShape()).clone();

                                        glyphShape.transform(at);

                                        if(glyphShape.getBounds().getWidth()>0 &&
                                                glyphShape.getBounds().getHeight()>0){

                                            gs.addClip(glyphShape);
View Full Code Here


                    Area glyphShape=(Area) glyph.clone();

                    //we need to apply to make it all work
                    glyphShape.transform(glyphAt);

                    //if its already generated we just need to move it
                    if(renderDirectly){
                        AffineTransform at2 =AffineTransform.getTranslateInstance(displayTrm[2][0],(displayTrm[2][1]));
                        glyphShape.transform(at2);
View Full Code Here

                    glyphShape.transform(glyphAt);

                    //if its already generated we just need to move it
                    if(renderDirectly){
                        AffineTransform at2 =AffineTransform.getTranslateInstance(displayTrm[2][0],(displayTrm[2][1]));
                        glyphShape.transform(at2);
                    }

                    gs.addClip(glyphShape);

                    current.drawClip(gs,null,false);
View Full Code Here

            Area clipShape = gs.getClippingShape();
            if(clipShape!=null) {

                //scale if needed
                if(scaling!=1)
                    clipShape.transform(AffineTransform.getScaleInstance(scaling, scaling));

                clip=clipShape.getBounds();

            }
            boolean applyClip=false;
View Full Code Here

                    //ensure inside box
          if(glyphX<0){
            glyphX=-glyphX;
            at =AffineTransform.getTranslateInstance(glyphX*2,0);
            transformedGlyph2.transform(at);
            //x=-glyphX*2;
          }

          double glyphWidth=gv1.getVisualBounds().getWidth()+(glyphX*2);
          double scaleFactor=currentWidth/glyphWidth;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.