java.awt.Dimension#clone ( )源码实例Demo

下面列出了java.awt.Dimension#clone ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jenetics   文件: EngineParam.java
private EngineParam(
	final int populationSize,
	final int tournamentSize,
	final float mutationRate,
	final float mutationMultitude,
	final int polygonLength,
	final int polygonCount,
	final Dimension referenceImageSize
) {
	_populationSize = populationSize;
	_tournamentSize = tournamentSize;
	_mutationRate = mutationRate;
	_mutationMultitude = mutationMultitude;
	_polygonLength = polygonLength;
	_polygonCount = polygonCount;
	_referenceImageSize = (Dimension)referenceImageSize.clone();
}
 
源代码2 项目: jclic   文件: ActiveBagContentControlPanel.java
private boolean shaperEditBtnActionPerformed() {
  if (abc == null)
    return false;
  AbstractBox bx = parent.abcpp.getAbstractBox(visualIndex);
  Dimension d = new Dimension((int) bx.getWidth(), (int) bx.getHeight());
  Dimension dBak = (Dimension) d.clone();
  Shaper sh = abc.shaper.edit(this, options, d, abc.img, bx.getBoxBaseResolve());
  if (sh == null)
    return false;
  abc.setShaper(sh);
  abc.ncw = Math.max(1, sh.getNumColumns());
  abc.nch = Math.max(1, sh.getNumRows());
  nColsEdit.setValue(abc.ncw);
  nRowsEdit.setValue(abc.nch);
  abc.checkCells();

  if (!dBak.equals(d)) {
    abc.w = d.width / abc.ncw;
    abc.h = d.height / abc.nch;
  }
  return true;
}
 
源代码3 项目: jdk1.8-source-analysis   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码4 项目: dragonwell8_jdk   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码5 项目: TencentKona-8   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码6 项目: jdk8u60   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码7 项目: JDKSourceCode1.8   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码8 项目: openjdk-jdk8u   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码10 项目: Bytecoder   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the {@code getWidth} and
 * {@code getHeight} methods on {@code ImageReader} are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * {@code ImageReader.getAspectRatio}.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an {@code UnsupportedOperationException} will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * {@code null} for {@code size}.
 *
 * @param size a {@code Dimension} indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码11 项目: openjdk-jdk9   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the {@code getWidth} and
 * {@code getHeight} methods on {@code ImageReader} are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * {@code ImageReader.getAspectRatio}.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an {@code UnsupportedOperationException} will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * {@code null} for {@code size}.
 *
 * @param size a {@code Dimension} indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码12 项目: jdk8u-jdk   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码13 项目: Java8CN   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码14 项目: hottub   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码15 项目: openjdk-8-source   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码16 项目: openjdk-8   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码17 项目: jdk8u_jdk   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码18 项目: jdk8u-jdk   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码19 项目: jdk8u-dev-jdk   文件: ImageReadParam.java
/**
 * If the image is able to be rendered at an arbitrary size, sets
 * the source width and height to the supplied values.  Note that
 * the values returned from the <code>getWidth</code> and
 * <code>getHeight</code> methods on <code>ImageReader</code> are
 * not affected by this method; they will continue to return the
 * default size for the image.  Similarly, if the image is also
 * tiled the tile width and height are given in terms of the default
 * size.
 *
 * <p> Typically, the width and height should be chosen such that
 * the ratio of width to height closely approximates the aspect
 * ratio of the image, as returned from
 * <code>ImageReader.getAspectRatio</code>.
 *
 * <p> If this plug-in does not allow the rendering size to be
 * set, an <code>UnsupportedOperationException</code> will be
 * thrown.
 *
 * <p> To remove the render size setting, pass in a value of
 * <code>null</code> for <code>size</code>.
 *
 * @param size a <code>Dimension</code> indicating the desired
 * width and height.
 *
 * @exception IllegalArgumentException if either the width or the
 * height is negative or 0.
 * @exception UnsupportedOperationException if image resizing
 * is not supported by this plug-in.
 *
 * @see #getSourceRenderSize
 * @see ImageReader#getWidth
 * @see ImageReader#getHeight
 * @see ImageReader#getAspectRatio
 */
public void setSourceRenderSize(Dimension size)
    throws UnsupportedOperationException {
    if (!canSetSourceRenderSize()) {
        throw new UnsupportedOperationException
            ("Can't set source render size!");
    }

    if (size == null) {
        this.sourceRenderSize = null;
    } else {
        if (size.width <= 0 || size.height <= 0) {
            throw new IllegalArgumentException("width or height <= 0!");
        }
        this.sourceRenderSize = (Dimension)size.clone();
    }
}
 
源代码20 项目: pumpernickel   文件: GifWriter.java
/**
 * Constructs a <code>GifWriter</code> with a global color table.
 * 
 * @param out
 *            the output stream to write to. This object will <i>not</i>
 *            close the output stream when it is finished.
 * @param size
 *            the bounds of this animation. Images larger than this value
 *            will be cut off. (Images smaller than this value will have
 *            dead space surrounding them.)
 * @param globalColorModel
 *            a byte-based <code>IndexColorModel</code> to use as a global
 *            color palette.
 * @param loopCount
 *            how many times this GIF file should loop. If this is zero (or
 *            negative), then this GIF will not loop. If this is greater
 *            than 65535, then this GIF will loop forever.
 * @param backgroundColorIndex
 *            the index in the global color table to use as a background
 *            color
 * @param customEncoder
 *            an optional encoder. If null (which is encouraged), then
 *            <code>GifEncoderFactory.get().createEncoder()</code> is used.
 * @throws IOException
 *             if the underlying <code>OutputStream</code> has trouble
 *             writing any of the GIF header information.
 */
public GifWriter(OutputStream out, Dimension size,
		IndexColorModel globalColorModel, int loopCount,
		int backgroundColorIndex, GifEncoder customEncoder)
		throws IOException {
	this.out = out;
	this.size = (Dimension) size.clone();
	this.backgroundColorIndex = backgroundColorIndex;
	encoder = customEncoder == null ? GifEncoderFactory.get()
			.createEncoder() : customEncoder;
	this.globalColorModel = globalColorModel;
	writeHeader(loopCount);
}