PixmapVolatileImage.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:jvm-stm 作者:
@Override
public BufferedImage getSnapshot()
{
  // TODO: Support non-24-bit resolutions.
  int w = pixmap.width;
  int h = pixmap.height;
  ZPixmap zpixmap = (ZPixmap) pixmap.image(0, 0, w, h, 0xffffffff,
                                           Image.Format.ZPIXMAP);
  DataBuffer buffer = new ZPixmapDataBuffer(zpixmap);
  SampleModel sm = new ComponentSampleModel(DataBuffer.TYPE_BYTE, w, h, 4,
                                            w * 4,
                                            new int[]{0, 1, 2, 3 });
  ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
  ColorModel cm = new ComponentColorModel(cs, true, false,
                                          Transparency.OPAQUE,
                                          DataBuffer.TYPE_BYTE);
  WritableRaster raster = Raster.createWritableRaster(sm, buffer,
                                                      new Point(0, 0));
  return new BufferedImage(cm, raster, false, null);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号