java.awt.geom.AffineTransform.getShearInstance()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(215)

本文整理了Java中java.awt.geom.AffineTransform.getShearInstance()方法的一些代码示例,展示了AffineTransform.getShearInstance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AffineTransform.getShearInstance()方法的具体详情如下:
包路径:java.awt.geom.AffineTransform
类名称:AffineTransform
方法名:getShearInstance

AffineTransform.getShearInstance介绍

暂无

代码示例

代码示例来源:origin: plantuml/plantuml

private static AffineTransformation createSimple(String value) {
  Matcher m = rotate.matcher(StringUtils.trin(value));
  if (m.find()) {
    final double angle = Double.parseDouble(m.group(1));
    return new AffineTransformation(AffineTransform.getRotateInstance(angle * Math.PI / 180.0));
  }
  m = shear.matcher(value);
  if (m.find()) {
    final double shx = Double.parseDouble(m.group(1));
    final double shy = Double.parseDouble(m.group(2));
    return new AffineTransformation(AffineTransform.getShearInstance(shx, shy));
  }
  m = translate.matcher(value);
  if (m.find()) {
    final double tx = Double.parseDouble(m.group(1));
    final double ty = Double.parseDouble(m.group(2));
    return new AffineTransformation(AffineTransform.getTranslateInstance(tx, ty));
  }
  m = scale.matcher(value);
  if (m.find()) {
    final double scalex = Double.parseDouble(m.group(1));
    final double scaley = Double.parseDouble(m.group(2));
    return new AffineTransformation(AffineTransform.getScaleInstance(scalex, scaley));
  }
  m = color.matcher(value);
  if (m.find()) {
    return new AffineTransformation(new AffineTransform());
  }
  return null;
}

代码示例来源:origin: haraldk/TwelveMonkeys

@Test
public void testGetBounds2DRaster() {
  AffineTransform shearInstance = AffineTransform.getShearInstance(33.77, 77.33);
  RasterOp original = new java.awt.image.AffineTransformOp(shearInstance, null);
  RasterOp fallback = new com.twelvemonkeys.image.AffineTransformOp(shearInstance, null);
  BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  assertEquals(original.getBounds2D(image.getRaster()), fallback.getBounds2D(image.getRaster()));
}

代码示例来源:origin: eseifert/vectorgraphics2d

public ShearCommand(double shearX, double shearY) {
  super(AffineTransform.getShearInstance(shearX, shearY));
  this.shearX = shearX;
  this.shearY = shearY;
}

代码示例来源:origin: haraldk/TwelveMonkeys

@Test
public void testGetBounds2D() {
  AffineTransform shearInstance = AffineTransform.getShearInstance(33.77, 77.33);
  BufferedImageOp original = new java.awt.image.AffineTransformOp(shearInstance, null);
  BufferedImageOp fallback = new com.twelvemonkeys.image.AffineTransformOp(shearInstance, null);
  BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  assertEquals(original.getBounds2D(image), fallback.getBounds2D(image));
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * <b>DOM</b>: Implements {@link SVGTransform#setSkewX(float)}.
 */
public void setSkewX(float angle) {
  type = SVG_TRANSFORM_SKEWX;
  affineTransform =
    AffineTransform.getShearInstance(Math.tan(Math.toRadians(angle)),
                     0.0);
  this.angle = angle;
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
   * <b>DOM</b>: Implements {@link SVGTransform#setSkewY(float)}.
   */
  public void setSkewY(float angle) {
    type = SVG_TRANSFORM_SKEWY;
    affineTransform =
      AffineTransform.getShearInstance(0.0,
                       Math.tan(Math.toRadians(angle)));
    this.angle = angle;
  }
}

代码示例来源:origin: apache/batik

/**
   * <b>DOM</b>: Implements {@link SVGTransform#setSkewY(float)}.
   */
  public void setSkewY(float angle) {
    type = SVG_TRANSFORM_SKEWY;
    affineTransform =
      AffineTransform.getShearInstance(0.0,
                       Math.tan(Math.toRadians(angle)));
    this.angle = angle;
  }
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Implements {@link TransformListHandler#skewY(float)}.
 */
public void skewY(float sky) throws ParseException {
  affineTransform.concatenate
    (AffineTransform.getShearInstance(0, Math.tan( Math.toRadians( sky ) )));
}

代码示例来源:origin: org.apache.xmlgraphics/batik-parser

/**
 * Implements {@link TransformListHandler#skewX(float)}.
 */
public void skewX(float skx) throws ParseException {
  affineTransform.concatenate
    (AffineTransform.getShearInstance(Math.tan( Math.toRadians( skx ) ), 0));
}

代码示例来源:origin: apache/batik

/**
 * Implements {@link TransformListHandler#skewY(float)}.
 */
public void skewY(float sky) throws ParseException {
  affineTransform.concatenate
    (AffineTransform.getShearInstance(0, Math.tan( Math.toRadians( sky ) )));
}

代码示例来源:origin: org.apache.xmlgraphics/batik-parser

/**
 * Implements {@link TransformListHandler#skewY(float)}.
 */
public void skewY(float sky) throws ParseException {
  affineTransform.concatenate
    (AffineTransform.getShearInstance(0, Math.tan( Math.toRadians( sky ) )));
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Implements {@link TransformListHandler#skewX(float)}.
 */
public void skewX(float skx) throws ParseException {
  affineTransform.concatenate
    (AffineTransform.getShearInstance(Math.tan( Math.toRadians( skx ) ), 0));
}

代码示例来源:origin: apache/fop

/** {@inheritDoc} */
public void skewY(float sky) throws ParseException {
  this.transforms.add(
    AffineTransform.getShearInstance(0, Math.tan(Math.toRadians(sky))));
}

代码示例来源:origin: net.sf.ingenias/editor

/**
 * Concatenates the current EpsGraphics2D Transform with a shearing
 * transform.
 */
public void shear(double shx, double shy) {
  transform(AffineTransform.getShearInstance(shx, shy));
}

代码示例来源:origin: net.sourceforge.htmlunit/htmlunit

/**
 * SkewY.
 *
 * @param svgMatrix the input
 * @param angle the skew angle
 * @return the new matrix
 */
public SvgMatrix skewY(final SvgMatrix svgMatrix, final double angle) {
  final AffineTransform tr = toAffineTransform(svgMatrix);
  tr.concatenate(AffineTransform.getShearInstance(0, Math.tan(Math.toRadians(angle))));
  return toSvgMatrix(tr);
}

代码示例来源:origin: net.sourceforge.htmlunit/htmlunit

/**
 * SkewX.
 *
 * @param svgMatrix the input
 * @param angle the skew angle
 * @return the new matrix
 */
public SvgMatrix skewX(final SvgMatrix svgMatrix, final double angle) {
  final AffineTransform tr = toAffineTransform(svgMatrix);
  tr.concatenate(AffineTransform.getShearInstance(Math.tan(Math.toRadians(angle)), 0));
  return toSvgMatrix(tr);
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Implements {@link SVGMatrix#skewX(float)}.
 */
public SVGMatrix skewX(float angleDeg) {
  AffineTransform tr = (AffineTransform)getAffineTransform().clone();
  tr.concatenate
    (AffineTransform.getShearInstance( Math.tan( Math.toRadians( angleDeg )), 0));
  return new SVGOMMatrix(tr);
}

代码示例来源:origin: geosolutions-it/jai-ext

@Test
public void testExtendedWithIdentityTransform() {
  assertBandMergeImplementation(AffineTransform.getScaleInstance(1 + 1e-12, 1 + 1e-12), BandMergeOpImage.class);
  assertBandMergeImplementation(AffineTransform.getScaleInstance(1 + 1e-6, 1 + 1e-6), ExtendedBandMergeOpImage.class);
  assertBandMergeImplementation(AffineTransform.getShearInstance(1e-12, 1e-12), BandMergeOpImage.class);
  assertBandMergeImplementation(AffineTransform.getShearInstance(1e-6, 1e-6), ExtendedBandMergeOpImage.class);
  assertBandMergeImplementation(AffineTransform.getTranslateInstance(1e-12, 1e-12), BandMergeOpImage.class);
  assertBandMergeImplementation(AffineTransform.getTranslateInstance(0.6, 0.6), ExtendedBandMergeOpImage.class);
}

代码示例来源:origin: com.twelvemonkeys.common/common-image

@Test
public void testGetBounds2DRaster() {
  AffineTransform shearInstance = AffineTransform.getShearInstance(33.77, 77.33);
  RasterOp original = new java.awt.image.AffineTransformOp(shearInstance, null);
  RasterOp fallback = new com.twelvemonkeys.image.AffineTransformOp(shearInstance, null);
  BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  assertEquals(original.getBounds2D(image.getRaster()), fallback.getBounds2D(image.getRaster()));
}

代码示例来源:origin: com.twelvemonkeys.common/common-image

@Test
public void testGetBounds2D() {
  AffineTransform shearInstance = AffineTransform.getShearInstance(33.77, 77.33);
  BufferedImageOp original = new java.awt.image.AffineTransformOp(shearInstance, null);
  BufferedImageOp fallback = new com.twelvemonkeys.image.AffineTransformOp(shearInstance, null);
  BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  assertEquals(original.getBounds2D(image), fallback.getBounds2D(image));
}

相关文章