本文整理汇总了Java中java.awt.image.BufferedImage.copyData方法的典型用法代码示例。如果您正苦于以下问题:Java BufferedImage.copyData方法的具体用法?Java BufferedImage.copyData怎么用?Java BufferedImage.copyData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.BufferedImage
的用法示例。
在下文中一共展示了BufferedImage.copyData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyImage
import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
* we don't want to alter original image (actually converted image)
* since we need this each time for reference
* @param coverImage original carrier/cover image
* @return a copy of supplied image
*/
public BufferedImage copyImage(BufferedImage coverImage) {
ColorModel colorModel = coverImage.getColorModel();
boolean isAlphaPremultiplied = coverImage.isAlphaPremultiplied();
WritableRaster raster = coverImage.copyData(null);
BufferedImage newImage = new BufferedImage(colorModel, raster,
isAlphaPremultiplied, null);
return newImage;
}
示例2: deepCopy
import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
* Make a copy of the {@code BufferedImage} object.
* @param image the provided image.
* @return copy of the provided image.
*/
static BufferedImage deepCopy( BufferedImage image ) {
ColorModel cm = image.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
WritableRaster raster = image.copyData( null);
return new BufferedImage( cm, raster, isAlphaPremultiplied, null);
}
示例3: changeColourMap
import java.awt.image.BufferedImage; //导入方法依赖的package包/类
public BufferedImage changeColourMap(BufferedImage userSpaceImage,
IndexColorModel customIndexColorModel) {
ColorModel originalCM = userSpaceImage.getColorModel();
if (originalCM instanceof IndexColorModel) {
boolean isAlphaPremultiplied = userSpaceImage.isAlphaPremultiplied();
WritableRaster raster = userSpaceImage.copyData(null);
BufferedImage newImage = new BufferedImage(customIndexColorModel,
raster, isAlphaPremultiplied, null);
return newImage;
} else {
return null;
}
}
示例4: copyImage
import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
* Convenience method for copying an image without passing in an image to
* copy to.
*
* @param source the image to copy
* @return the copied image
*/
public static BufferedImage copyImage(final Image source) {
if (source instanceof BufferedImage) {
BufferedImage bi = ((BufferedImage)source);
if (BufferedImage.TYPE_INT_RGB == bi.getType()) {
ColorModel cm = bi.getColorModel();
return new BufferedImage(cm, bi.copyData(null), cm.isAlphaPremultiplied(), null);
}
}
BufferedImage copy = new BufferedImage(source.getWidth(null), source.getHeight(null), BufferedImage.TYPE_INT_RGB);
copyImage(source, copy);
return copy;
}
示例5: deepCopy
import java.awt.image.BufferedImage; //导入方法依赖的package包/类
private static BufferedImage deepCopy(BufferedImage bi)
{
ColorModel cm = bi.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
WritableRaster raster = bi.copyData(null);
return new BufferedImage(cm, raster, isAlphaPremultiplied, null);
}
示例6: deepCopy
import java.awt.image.BufferedImage; //导入方法依赖的package包/类
private static BufferedImage deepCopy(BufferedImage bi) {
ColorModel cm = bi.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
WritableRaster raster = bi.copyData(null);
return new BufferedImage(cm, raster, isAlphaPremultiplied, null)
.getSubimage(0, 0, bi.getWidth(), bi.getHeight());
}
示例7: deepCopy
import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
* Create a duplicate of a BufferedImage.
* @param bi
* @return the copied image.
*/
private static BufferedImage deepCopy(BufferedImage bi) {
ColorModel cm = bi.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
WritableRaster raster = bi.copyData(null);
return new BufferedImage(cm, raster, isAlphaPremultiplied, null);
}
示例8: deepCopy
import java.awt.image.BufferedImage; //导入方法依赖的package包/类
public static BufferedImage deepCopy(BufferedImage img) {
ColorModel cm = img.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
WritableRaster raster = img.copyData(null);
return new BufferedImage(cm, raster, isAlphaPremultiplied, null);
}
示例9: deepCopy
import java.awt.image.BufferedImage; //导入方法依赖的package包/类
static BufferedImage deepCopy(BufferedImage bi) {
ColorModel cm = bi.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
WritableRaster raster = bi.copyData(null);
return new BufferedImage(cm, raster, isAlphaPremultiplied, null);
}