本文整理汇总了Java中org.jcodec.scale.Transform类的典型用法代码示例。如果您正苦于以下问题:Java Transform类的具体用法?Java Transform怎么用?Java Transform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Transform类属于org.jcodec.scale包,在下文中一共展示了Transform类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toColorArray
import org.jcodec.scale.Transform; //导入依赖的package包/类
public static int[] toColorArray(Picture src){
if (src.getColor() != ColorSpace.RGB) {
Transform transform = ColorUtil.getTransform(src.getColor(), ColorSpace.RGB);
Picture rgb = Picture.create(src.getWidth(), src.getHeight(), ColorSpace.RGB, src.getCrop());
transform.transform(src, rgb);
src = rgb;
}
int[] _return = new int[src.getCroppedWidth() * src.getCroppedHeight()];
int[] data = src.getPlaneData(0);
for(int i = 0; i < _return.length; ++i){
_return[i] = ReadableRGBContainer.toIntColor(data[3*i + 2], data[3*i + 1], data[3*i]);
}
return _return;
}
示例2: toBufferedImage
import org.jcodec.scale.Transform; //导入依赖的package包/类
public static BufferedImage toBufferedImage(Picture src) {
if (src.getColor() != ColorSpace.RGB) {
Transform transform = ColorUtil.getTransform(src.getColor(), ColorSpace.RGB);
Picture rgb = Picture.create(src.getWidth(), src.getHeight(), ColorSpace.RGB, src.getCrop());
transform.transform(src, rgb);
src = rgb;
}
BufferedImage dst = new BufferedImage(src.getCroppedWidth(), src.getCroppedHeight(),
BufferedImage.TYPE_3BYTE_BGR);
if (src.getCrop() == null)
toBufferedImage(src, dst);
else
toBufferedImageCropped(src, dst);
return dst;
}
示例3: colorCvt
import org.jcodec.scale.Transform; //导入依赖的package包/类
private Picture colorCvt(Picture in) {
Picture out;
if (in.getColor() == YUV422_10) {
out = in;
} else {
Transform trans = ColorUtil.getTransform(in.getColor(), YUV422_10);
out = Picture.create(in.getWidth(), in.getHeight(), YUV422_10);
trans.transform(in, out);
}
return out;
}
示例4: fromBufferedImage
import org.jcodec.scale.Transform; //导入依赖的package包/类
public static Picture fromBufferedImage(BufferedImage src, ColorSpace tgtColor) {
Picture rgb = fromBufferedImage(src);
Transform tr = ColorUtil.getTransform(rgb.getColor(), tgtColor);
Picture res = Picture.create(rgb.getWidth(), rgb.getHeight(), tgtColor);
tr.transform(rgb, res);
return res;
}
示例5: savePictureAsPPM
import org.jcodec.scale.Transform; //导入依赖的package包/类
public static void savePictureAsPPM(Picture pic, File file) throws IOException {
Transform transform = ColorUtil.getTransform(pic.getColor(), ColorSpace.RGB);
Picture rgb = Picture.create(pic.getWidth(), pic.getHeight(), ColorSpace.RGB);
transform.transform(pic, rgb);
NIOUtils.writeTo(new PPMEncoder().encodeFrame(rgb), file);
}