当前位置: 首页>>代码示例>>Java>>正文


Java GifDecoder.STATUS_OK属性代码示例

本文整理汇总了Java中com.bumptech.glide.gifdecoder.GifDecoder.STATUS_OK属性的典型用法代码示例。如果您正苦于以下问题:Java GifDecoder.STATUS_OK属性的具体用法?Java GifDecoder.STATUS_OK怎么用?Java GifDecoder.STATUS_OK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.bumptech.glide.gifdecoder.GifDecoder的用法示例。


在下文中一共展示了GifDecoder.STATUS_OK属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

private GifTextureResource decode(byte[] data, int width, int height, GifHeaderParser parser, GifDecoder decoder) {
	final GifHeader header = parser.parseHeader();
	if (header.getNumFrames() <= 0 || header.getStatus() != GifDecoder.STATUS_OK) {
		// If we couldn't decode the GIF, we will end up with a frame count of 0.
		return null;
	}

	Bitmap firstFrame = decodeFirstFrame(decoder, header, data);
	if (firstFrame == null) {
		return null;
	}

	Transformation<Bitmap> unitTransformation = UnitTransformation.get();

	GifTexture gifDrawable = new GifTexture(context, provider, bitmapPool, unitTransformation, width, height,
			header, data, firstFrame);

	return new GifTextureResource(gifDrawable);
}
 
开发者ID:ericleong,项目名称:tumblr3d,代码行数:19,代码来源:GifResourceDecoder.java

示例2: decode

private GifDrawableResource decode(ByteBuffer byteBuffer, int width, int height,
    GifHeaderParser parser) {
  long startTime = LogTime.getLogTime();
  final GifHeader header = parser.parseHeader();
  if (header.getNumFrames() <= 0 || header.getStatus() != GifDecoder.STATUS_OK) {
    // If we couldn't decode the GIF, we will end up with a frame count of 0.
    return null;
  }


  int sampleSize = getSampleSize(header, width, height);
  GifDecoder gifDecoder = gifDecoderFactory.build(provider, header, byteBuffer, sampleSize);
  gifDecoder.advance();
  Bitmap firstFrame = gifDecoder.getNextFrame();
  if (firstFrame == null) {
    return null;
  }

  Transformation<Bitmap> unitTransformation = UnitTransformation.get();

  GifDrawable gifDrawable =
      new GifDrawable(context, gifDecoder, bitmapPool, unitTransformation, width, height,
          firstFrame);

  if (Log.isLoggable(TAG, Log.VERBOSE)) {
    Log.v(TAG, "Decoded GIF from stream in " + LogTime.getElapsedMillis(startTime));
  }

  return new GifDrawableResource(gifDrawable);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:ByteBufferGifDecoder.java

示例3: decode

private GifDrawableResource decode(
    ByteBuffer byteBuffer, int width, int height, GifHeaderParser parser, Options options) {
  long startTime = LogTime.getLogTime();
  final GifHeader header = parser.parseHeader();
  if (header.getNumFrames() <= 0 || header.getStatus() != GifDecoder.STATUS_OK) {
    // If we couldn't decode the GIF, we will end up with a frame count of 0.
    return null;
  }

  Bitmap.Config config = options.get(GifOptions.DECODE_FORMAT) == DecodeFormat.PREFER_RGB_565
      ? Bitmap.Config.RGB_565 : Bitmap.Config.ARGB_8888;

  int sampleSize = getSampleSize(header, width, height);
  GifDecoder gifDecoder = gifDecoderFactory.build(provider, header, byteBuffer, sampleSize);
  gifDecoder.setDefaultBitmapConfig(config);
  gifDecoder.advance();
  Bitmap firstFrame = gifDecoder.getNextFrame();
  if (firstFrame == null) {
    return null;
  }

  Transformation<Bitmap> unitTransformation = UnitTransformation.get();

  GifDrawable gifDrawable =
      new GifDrawable(context, gifDecoder, unitTransformation, width, height, firstFrame);

  if (Log.isLoggable(TAG, Log.VERBOSE)) {
    Log.v(TAG, "Decoded GIF from stream in " + LogTime.getElapsedMillis(startTime));
  }

  return new GifDrawableResource(gifDrawable);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:ByteBufferGifDecoder.java


注:本文中的com.bumptech.glide.gifdecoder.GifDecoder.STATUS_OK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。