Java Code Examples for java.awt.geom.AffineTransform#setToShear()

The following examples show how to use java.awt.geom.AffineTransform#setToShear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FontPanel.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 2
Source File: FontPanel.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 3
Source File: FontPanel.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 4
Source File: FontPanel.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 5
Source File: FontPanel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 6
Source File: FontPanel.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 7
Source File: FontPanel.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 8
Source File: FontPanel.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 9
Source File: FontPanel.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 10
Source File: FontPanel.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 11
Source File: FontPanel.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 12
Source File: FontPanel.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 13
Source File: FontPanel.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private AffineTransform getAffineTransform( int transform ) {
        /// ABP
        AffineTransform at = new AffineTransform();
        switch ( transform )
        {
        case SCALE:
          at.setToScale( 1.5f, 1.5f ); break;
        case ROTATE:
          at.setToRotation( Math.PI / 6 ); break;
        case SHEAR:
          at.setToShear( 0.4f, 0 ); break;
        case NONE:
          break;
        default:
          //System.err.println( "Illegal G2 Transform Arg: " + transform);
          break;
        }

        return at;
}
 
Example 14
Source File: SVGElement.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
static public AffineTransform parseSingleTransform(final String val) throws SVGException {
	final Matcher matchWord = Pattern.compile("[-.\\w]+").matcher("");

	final AffineTransform retXform = new AffineTransform();

	matchWord.reset(val);
	if (!matchWord.find()) {
		// Return identity transformation if no data present (eg, empty string)
		return retXform;
	}

	final String function = matchWord.group().toLowerCase();

	final LinkedList<String> termList = new LinkedList<>();
	while (matchWord.find()) {
		termList.add(matchWord.group());
	}

	final double[] terms = new double[termList.size()];
	final Iterator<String> it = termList.iterator();
	int count = 0;
	while (it.hasNext()) {
		terms[count++] = XMLParseUtil.parseDouble(it.next());
	}

	// Calculate transformation
	if (function.equals("matrix")) {
		retXform.setTransform(terms[0], terms[1], terms[2], terms[3], terms[4], terms[5]);
	} else if (function.equals("translate")) {
		retXform.setToTranslation(terms[0], terms[1]);
	} else if (function.equals("scale")) {
		if (terms.length > 1) {
			retXform.setToScale(terms[0], terms[1]);
		} else {
			retXform.setToScale(terms[0], terms[0]);
		}
	} else if (function.equals("rotate")) {
		if (terms.length > 2) {
			retXform.setToRotation(Math.toRadians(terms[0]), terms[1], terms[2]);
		} else {
			retXform.setToRotation(Math.toRadians(terms[0]));
		}
	} else if (function.equals("skewx")) {
		retXform.setToShear(Math.toRadians(terms[0]), 0.0);
	} else if (function.equals("skewy")) {
		retXform.setToShear(0.0, Math.toRadians(terms[0]));
	} else {
		throw new SVGException("Unknown transform type");
	}

	return retXform;
}