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

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

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

AffineTransform.getDeterminant介绍

暂无

代码示例

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

/**
 * Calculated the subsampling frequency for a given PDImage based on the current transformation
 * and its calculated transform
 *
 * @param pdImage PDImage to be drawn
 * @param at Transform that will be applied to the image when drawing
 * @return The rounded-down ratio of image pixels to drawn pixels. Returned value will always be
 * >=1.
 */
private int getSubsampling(PDImage pdImage, AffineTransform at)
{
  // calculate subsampling according to the resulting image size
  double scale = Math.abs(at.getDeterminant() * xform.getDeterminant());
  int subsampling = (int) Math.floor(Math.sqrt(pdImage.getWidth() * pdImage.getHeight() / scale));
  if (subsampling > 8)
  {
    subsampling = 8;
  }
  if (subsampling < 1)
  {
    subsampling = 1;
  }
  if (subsampling > pdImage.getWidth() || subsampling > pdImage.getHeight())
  {
    // For very small images it is possible that the subsampling would imply 0 size.
    // To avoid problems, the subsampling is set to no less than the smallest dimension.
    subsampling = Math.min(pdImage.getWidth(), pdImage.getHeight());
  }
  return subsampling;
}

代码示例来源:origin: lbalazscs/Pixelitor

public int compare(ImageInstruction i1, ImageInstruction i2) {
      if(i1.isFirstFrame && i2.isFirstFrame==false)
        return 1;
      if(i2.isFirstFrame && i1.isFirstFrame==false)
        return -1;
      
      double d1 = i1.transform.getDeterminant();
      double d2 = i2.transform.getDeterminant();
      return Double.compare(d1, d2);
//            if(d1<d2) {
//                return -1;
//            }
//            return 1;
    }

代码示例来源:origin: net.sf.jung/jung-visualization

/**
 * @return the transform's overall scale magnitude
 */
public double getScale() {
    return Math.sqrt(transform.getDeterminant());
}

代码示例来源:origin: bcdev/beam

@Override
public boolean validatePage() {
  try {
    return createTransform().getDeterminant() != 0.0;
  } catch (Exception ignore) {
    return false;
  }
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public boolean validatePage() {
  try {
    return createTransform().getDeterminant() != 0.0;
  } catch (Exception ignore) {
    return false;
  }
}

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

public void updateMatrix(AffineTransform at) {
    prevScale  = (float)Math.sqrt(at.getDeterminant());
    prevTransX = (float)at.getTranslateX();
    prevTransY = (float)at.getTranslateY();
  }
}

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

/**
 * <b>DOM</b>: Implements {@link SVGSVGElement#getCurrentView()}.
 */
public float getCurrentScale() {
  AffineTransform scrnTrans = getSVGContext().getScreenTransform();
  if (scrnTrans != null) {
    return (float)Math.sqrt(scrnTrans.getDeterminant());
  }
  return 1;
}

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

public void updateMatrix(AffineTransform at) {
    prevScale  = (float)Math.sqrt(at.getDeterminant());
    prevTransX = (float)at.getTranslateX();
    prevTransY = (float)at.getTranslateY();
  }
}

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

/**
 * <b>DOM</b>: Implements {@link SVGSVGElement#getCurrentView()}.
 */
public float getCurrentScale() {
  AffineTransform scrnTrans = getSVGContext().getScreenTransform();
  if (scrnTrans != null) {
    return (float)Math.sqrt(scrnTrans.getDeterminant());
  }
  return 1;
}

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

public void updateMatrix(AffineTransform at) {
    prevScale  = (float)Math.sqrt(at.getDeterminant());
    prevTransX = (float)at.getTranslateX();
    prevTransY = (float)at.getTranslateY();
  }
}

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

/**
 * <b>DOM</b>: Implements {@link SVGSVGElement#getCurrentView()}.
 */
public float getCurrentScale() {
  AffineTransform scrnTrans = getSVGContext().getScreenTransform();
  if (scrnTrans != null) {
    return (float)Math.sqrt(scrnTrans.getDeterminant());
  }
  return 1;
}

代码示例来源:origin: com.itextpdf/itextpdf

private Stroke transformStroke(Stroke stroke) {
  if (!(stroke instanceof BasicStroke))
    return stroke;
  BasicStroke st = (BasicStroke)stroke;
  float scale = (float)Math.sqrt(Math.abs(transform.getDeterminant()));
  float dash[] = st.getDashArray();
  if (dash != null) {
    for (int k = 0; k < dash.length; ++k)
      dash[k] *= scale;
  }
  return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
}

代码示例来源:origin: com.github.librepdf/openpdf

private Stroke transformStroke(Stroke stroke) {
  if (!(stroke instanceof BasicStroke))
    return stroke;
  BasicStroke st = (BasicStroke)stroke;
  float scale = (float)Math.sqrt(Math.abs(transform.getDeterminant()));
  float[] dash = st.getDashArray();
  if (dash != null) {
    for (int k = 0; k < dash.length; ++k)
      dash[k] *= scale;
  }
  return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
}

代码示例来源:origin: org.docx4j/xhtmlrenderer

private Stroke transformStroke(Stroke stroke) {
  if (!(stroke instanceof BasicStroke))
    return stroke;
  BasicStroke st = (BasicStroke)stroke;
  float scale = (float)Math.sqrt(Math.abs(_transform.getDeterminant()));
  float dash[] = st.getDashArray();
  if (dash != null) {
    for (int k = 0; k < dash.length; ++k)
      dash[k] *= scale;
  }
  return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
}

代码示例来源:origin: org.xhtmlrenderer/core-renderer

private Stroke transformStroke(Stroke stroke) {
  if (!(stroke instanceof BasicStroke))
    return stroke;
  BasicStroke st = (BasicStroke)stroke;
  float scale = (float)Math.sqrt(Math.abs(_transform.getDeterminant()));
  float dash[] = st.getDashArray();
  if (dash != null) {
    for (int k = 0; k < dash.length; ++k)
      dash[k] *= scale;
  }
  return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

private Stroke transformStroke(Stroke stroke) {
  if (!(stroke instanceof BasicStroke))
    return stroke;
  BasicStroke st = (BasicStroke)stroke;
  float scale = (float)Math.sqrt(Math.abs(_transform.getDeterminant()));
  float dash[] = st.getDashArray();
  if (dash != null) {
    for (int k = 0; k < dash.length; ++k)
      dash[k] *= scale;
  }
  return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
}

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

private Stroke transformStroke(Stroke stroke) {
  if (!(stroke instanceof BasicStroke))
    return stroke;
  BasicStroke st = (BasicStroke)stroke;
  float scale = (float)Math.sqrt(Math.abs(transform.getDeterminant()));
  float dash[] = st.getDashArray();
  if (dash != null) {
    for (int k = 0; k < dash.length; ++k)
      dash[k] *= scale;
  }
  return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
}

代码示例来源:origin: danfickle/openhtmltopdf

private Stroke transformStroke(Stroke stroke) {
  if (!(stroke instanceof BasicStroke))
    return stroke;
  BasicStroke st = (BasicStroke) stroke;
  float scale = (float) Math.sqrt(Math.abs(_transform.getDeterminant()));
  float dash[] = st.getDashArray();
  if (dash != null) {
    for (int k = 0; k < dash.length; ++k)
      dash[k] *= scale;
  }
  return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase()
      * scale);
}

代码示例来源:origin: danfickle/openhtmltopdf

private Stroke transformStroke(Stroke stroke) {
  if (!(stroke instanceof BasicStroke))
    return stroke;
  BasicStroke st = (BasicStroke) stroke;
  float scale = (float) Math.sqrt(Math.abs(_transform.getDeterminant()));
  float dash[] = st.getDashArray();
  if (dash != null) {
    for (int k = 0; k < dash.length; ++k)
      dash[k] *= scale;
  }
  return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase()
      * scale);
}

代码示例来源:origin: org.xhtmlrenderer/flying-saucer-pdf-itext5

private Stroke transformStroke(Stroke stroke) {
  if (!(stroke instanceof BasicStroke))
    return stroke;
  BasicStroke st = (BasicStroke) stroke;
  float scale = (float) Math.sqrt(Math.abs(_transform.getDeterminant()));
  float dash[] = st.getDashArray();
  if (dash != null) {
    for (int k = 0; k < dash.length; ++k)
      dash[k] *= scale;
  }
  return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase()
      * scale);
}

相关文章