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

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

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

AffineTransform.getShearX介绍

暂无

代码示例

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

writer.setValue(Double.toString(atx.getScaleX()));
writer.endNode();
writer.startNode("scaleY");
writer.setValue(Double.toString(atx.getScaleY()));
writer.endNode();
writer.startNode("shearX");
writer.setValue(Double.toString(atx.getShearX()));
writer.endNode();
writer.startNode("shearY");
writer.setValue(Double.toString(atx.getShearY()));
writer.endNode();
writer.startNode("translateX");

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

/**
 * Returns the magnitude of scale factor <var>x</var> by cancelling the effect of eventual flip
 * and rotation. This factor is calculated by <IMG
 * src="{@docRoot}/org/geotools/display/canvas/doc-files/scaleX0.png">.
 */
public static double getScaleX0(final AffineTransform tr) {
  final double scale = tr.getScaleX();
  final double shear = tr.getShearX();
  if (shear == 0) return Math.abs(scale); // Optimization for a very common case.
  if (scale == 0) return Math.abs(shear); // Not as common as above, but still common enough.
  return Math.hypot(scale, shear);
}

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

} else {
  AffineTransform tx = graphics.getTransform();
  if (Math.abs(tx.getShearX()) >= EPS || Math.abs(tx.getShearY()) > EPS) {
    graphics.fill(outline);
  } else {

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

private boolean allIdentities(List<AffineTransform> transform) {
  for (AffineTransform at : transform) {
    if (!(eqTol(at.getScaleX(), 1, EPS) && eqTol(at.getScaleY(), 1, EPS) &&
        eqTol(Math.abs(at.getShearX()), 0, EPS) && eqTol(Math.abs(at.getShearX()), 0, EPS) &&
        eqTol(Math.abs(at.getTranslateX()), 0, 0.5) && eqTol(Math.abs(at.getTranslateY()), 0, 0.5))) {
      return false;
    }
  }
  
  return true;
}

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

/**
 * Implements {@link SVGMatrix#setD(float)}.
 */
public void setD(float d) throws DOMException {
  AffineTransform at = getAffineTransform();
  at.setTransform(at.getScaleX(),
          at.getShearY(),
          at.getShearX(),
          d,
          at.getTranslateX(),
          at.getTranslateY());
}

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

/**
 * Implements {@link SVGMatrix#setA(float)}.
 */
public void setA(float a) throws DOMException {
  AffineTransform at = getAffineTransform();
  at.setTransform(a,
          at.getShearY(),
          at.getShearX(),
          at.getScaleY(),
          at.getTranslateX(),
          at.getTranslateY());
}

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

AffineTransform aTX = (AffineTransform) geometry.getGridToCRS();
writer.write("<geoTransform>");
writer.write("<scaleX>" + aTX.getScaleX() + "</scaleX>\n");
writer.write("<scaleY>" + aTX.getScaleY() + "</scaleY>\n");
writer.write("<shearX>" + aTX.getShearX() + "</shearX>\n");
writer.write("<shearY>" + aTX.getShearY() + "</shearY>\n");
writer.write("<translateX>" + aTX.getTranslateX() + "</translateX>\n");
writer.write("<translateY>" + aTX.getTranslateY() + "</translateY>\n");

代码示例来源:origin: it.geosolutions.jaiext.bandmerge/jt-bandmerge

private boolean allIdentities(List<AffineTransform> transform) {
  for (AffineTransform at : transform) {
    if (!(eqTol(at.getScaleX(), 1, EPS) && eqTol(at.getScaleY(), 1, EPS) &&
        eqTol(Math.abs(at.getShearX()), 0, EPS) && eqTol(Math.abs(at.getShearX()), 0, EPS) &&
        eqTol(Math.abs(at.getTranslateX()), 0, 0.5) && eqTol(Math.abs(at.getTranslateY()), 0, 0.5))) {
      return false;
    }
  }
  
  return true;
}

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

/**
 * Implements {@link SVGMatrix#setD(float)}.
 */
public void setD(float d) throws DOMException {
  AffineTransform at = getAffineTransform();
  at.setTransform(at.getScaleX(),
          at.getShearY(),
          at.getShearX(),
          d,
          at.getTranslateX(),
          at.getTranslateY());
}

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

/**
 * Implements {@link SVGMatrix#setA(float)}.
 */
public void setA(float a) throws DOMException {
  AffineTransform at = getAffineTransform();
  at.setTransform(a,
          at.getShearY(),
          at.getShearX(),
          at.getScaleY(),
          at.getTranslateX(),
          at.getTranslateY());
}

代码示例来源:origin: org.geotools/gt2-coverage

/**
 * Checks the transformation is a pure scale/translate instance (using a tolerance)
 * @param transform
 * @return
 */
protected final boolean isScaleTranslate(MathTransform transform) {
  if(!(transform instanceof AffineTransform))
    return false;
  AffineTransform at = (AffineTransform) transform;
  return at.getShearX() < EPS && at.getShearY() < EPS;
}

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

/** Gets the derivative of this transform at a point. */
@Override
public Matrix derivative(final Point2D point) {
  final AffineTransform tr = new AffineTransform();
  getAffineTransform(point.getX(), point.getY(), tr);
  return new Matrix2(
      tr.getScaleX(), tr.getShearX(),
      tr.getShearY(), tr.getScaleY());
}

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

/**
 * Implements {@link SVGMatrix#setB(float)}.
 */
public void setB(float b) throws DOMException {
  AffineTransform at = getAffineTransform();
  at.setTransform(at.getScaleX(),
          b,
          at.getShearX(),
          at.getScaleY(),
          at.getTranslateX(),
          at.getTranslateY());
}

代码示例来源:origin: org.geotools/gt2-coverage

/**
 * Checks the transformation is a pure scale/translate instance (using a
 * tolerance)
 * 
 * @param transform
 * @return
 */
protected final boolean isScaleTranslate(MathTransform transform) {
  if (!(transform instanceof AffineTransform))
    return false;
  AffineTransform at = (AffineTransform) transform;
  return at.getShearX() < EPS && at.getShearY() < EPS;
}

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

/**
 * @param ls
 * @param at
 * @param generalize
 * @param maxDistance
 */
public void init(LineString ls, AffineTransform at, boolean generalize, float maxDistance) {
  if (at == null) at = new AffineTransform();
  _init(ls, at, generalize, maxDistance);
  xScale =
      (float)
          Math.sqrt(
              (at.getScaleX() * at.getScaleX())
                  + (at.getShearX() * at.getShearX()));
  yScale =
      (float)
          Math.sqrt(
              (at.getScaleY() * at.getScaleY())
                  + (at.getShearY() * at.getShearY()));
}

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

/**
 * Implements {@link SVGMatrix#setB(float)}.
 */
public void setB(float b) throws DOMException {
  AffineTransform at = getAffineTransform();
  at.setTransform(at.getScaleX(),
          b,
          at.getShearX(),
          at.getScaleY(),
          at.getTranslateX(),
          at.getTranslateY());
}

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

/**
 * Creates a matrix with the same elements as the given AffineTransform.
 * @param at
 */
public Matrix(AffineTransform at)
{
  single = new float[DEFAULT_SINGLE.length];
  System.arraycopy(DEFAULT_SINGLE, 0, single, 0, DEFAULT_SINGLE.length);
  single[0] = (float)at.getScaleX();
  single[1] = (float)at.getShearY();
  single[3] = (float)at.getShearX();
  single[4] = (float)at.getScaleY();
  single[6] = (float)at.getTranslateX();
  single[7] = (float)at.getTranslateY();
}

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

/**
 * Set the values of the matrix from the AffineTransform.
 *
 * @param af The transform to get the values from.
 * @deprecated Use the {@link #Matrix(AffineTransform)} constructor instead.
 */
@Deprecated
public void setFromAffineTransform( AffineTransform af )
{
  single[0] = (float)af.getScaleX();
  single[1] = (float)af.getShearY();
  single[3] = (float)af.getShearX();
  single[4] = (float)af.getScaleY();
  single[6] = (float)af.getTranslateX();
  single[7] = (float)af.getTranslateY();
}

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

/**
 * Sets this matrix to the specified affine transform.
 *
 * @since 2.3
 */
public void setMatrix(final AffineTransform transform) {
  mat.a11 = transform.getScaleX();
  mat.a12 = transform.getShearX();
  mat.a13 = transform.getTranslateX();
  mat.a21 = transform.getShearY();
  mat.a22 = transform.getScaleY();
  mat.a23 = transform.getTranslateY();
  mat.a31 = 0;
  mat.a32 = 0;
  mat.a33 = 1;
}

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

/**
 * Returns {@code true} if this matrix is equals to the specified affine transform.
 *
 * @since 2.3
 */
public boolean equalsAffine(final AffineTransform transform) {
  return mat.a11 == transform.getScaleX()
      && mat.a12 == transform.getShearX()
      && mat.a13 == transform.getTranslateX()
      && mat.a21 == transform.getShearY()
      && mat.a22 == transform.getScaleY()
      && mat.a23 == transform.getTranslateY()
      && mat.a31 == 0
      && mat.a32 == 0
      && mat.a33 == 1;
}

相关文章