类 Avif


  • public class Avif
    extends java.lang.Object
    AVIF解码工具类
    • 嵌套类概要

      嵌套类 
      修饰符和类型 说明
      static class  Avif.AvifFrame
      动图解码一帧返回内容 包括位图和延时
    • 字段概要

      字段 
      修饰符和类型 字段 说明
      static int AVIF_HEADER_SIZE  
    • 构造器概要

      构造器 
      构造器 说明
      Avif()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static com.tencent.libqcloudavif.AvifImage animationDecodeFrame​(com.tencent.libqcloudavif.AvifDecoder decoder, long bytesLength, int index)
      通过解码器解码其中一帧(需要提前创建AvifDecoder)
      static Avif.AvifFrame animationDecodeFrame​(com.tencent.libqcloudavif.AvifDecoder decoder, long bytesLength, int index, android.graphics.Bitmap bitmap)
      通过解码器解码其中一帧(需要提前创建AvifDecoder)
      static android.graphics.Bitmap decode​(byte[] bytes)
      原图解码
      static android.graphics.Bitmap decode​(byte[] bytes, int dstWidth)
      宽度等比解码
      static android.graphics.Bitmap decode​(byte[] bytes, int x, int y, int width, int height, int inSampleSize)
      区域缩放解码
      static android.graphics.Bitmap decode​(byte[] bytes, int dstWidth, android.graphics.Bitmap bitmap, com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool bitmapPool)
      宽度等比解码
      static android.graphics.Bitmap decode​(byte[] bytes, int dstWidth, com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool bitmapPool)
      宽度等比解码
      static android.graphics.Bitmap decode​(com.tencent.libqcloudavif.AvifDecoder decoder, int dstWidth, long dataSize, android.graphics.Bitmap bitmap, com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool bitmapPool)
      宽度等比解码
      static Avif.AvifFrame decodeAnimationFrame​(byte[] bytes, int index)
      解码动图某一帧
      static Avif.AvifFrame decodeAnimationFrame​(byte[] bytes, int index, android.graphics.Bitmap bitmap)
      解码动图某一帧
      static android.graphics.Bitmap decodeRegion​(com.tencent.libqcloudavif.AvifDecoder decoder, long bytesLength, int x, int y, int width, int height, int inSampleSize)
      局部解码(需要提前创建AvifDecoder并nextImage)
      static com.tencent.libqcloudavif.AvifDecoder getAvifDecoder​(byte[] buffer)  
      static com.tencent.libqcloudavif.AvifDecoder getAvifDecoder​(java.nio.ByteBuffer source)  
      static android.graphics.Point getDecoderWH​(byte[] buffer)  
      static boolean isAvif​(byte[] buffer)  
      static boolean isAvif​(java.io.InputStream source, com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool byteArrayPool)  
      static boolean isAvif​(java.nio.ByteBuffer source)  
      static boolean isAvis​(byte[] buffer)  
      static boolean isAvis​(java.io.InputStream source, com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool byteArrayPool)  
      static boolean isAvis​(java.nio.ByteBuffer source)  
      static android.graphics.Point proportionalScaling​(int imageWidth, int imageHeight, int dstWidth)
      根据原图宽高和目标宽度 计算目标高度
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • AVIF_HEADER_SIZE

        public static final int AVIF_HEADER_SIZE
        另请参阅:
        常量字段值
    • 构造器详细资料

      • Avif

        public Avif()
    • 方法详细资料

      • decode

        public static android.graphics.Bitmap decode​(@NonNull
                                                     byte[] bytes)
        原图解码
        参数:
        bytes - 图片的字节数组
        返回:
        结果bitmap
      • decode

        public static android.graphics.Bitmap decode​(@NonNull
                                                     byte[] bytes,
                                                     int dstWidth)
        宽度等比解码
        参数:
        bytes - 图片的字节数组
        dstWidth - 解码目标宽度(仅支持等比缩小)
        返回:
        结果bitmap
      • decode

        public static android.graphics.Bitmap decode​(@NonNull
                                                     byte[] bytes,
                                                     int dstWidth,
                                                     @NonNull
                                                     com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool bitmapPool)
        宽度等比解码
        参数:
        bytes - 图片的字节数组
        dstWidth - 解码目标宽度(仅支持等比缩小)
        bitmapPool - 用于获取bitmap的bitmapPool
        返回:
        结果bitmap
      • decode

        public static android.graphics.Bitmap decode​(@NonNull
                                                     byte[] bytes,
                                                     int dstWidth,
                                                     @Nullable
                                                     android.graphics.Bitmap bitmap,
                                                     @Nullable
                                                     com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool bitmapPool)
        宽度等比解码
        参数:
        bytes - 图片的字节数组
        dstWidth - 解码目标宽度(仅支持等比缩小)
        bitmap - 解码到该位图(也可以传空 将会生成一个新的位图)
        bitmapPool - 用于获取bitmap的bitmapPool
        返回:
        结果bitmap
      • decode

        public static android.graphics.Bitmap decode​(byte[] bytes,
                                                     int x,
                                                     int y,
                                                     int width,
                                                     int height,
                                                     int inSampleSize)
        区域缩放解码
        参数:
        bytes - 图片的字节数组
        x - 区域左上角x坐标
        y - 区域左上角y坐标
        width - 区域宽度
        height - 区域高度
        inSampleSize - 缩放比, 大于1的时候才生效,小于等于1的情况下不作缩放
        返回:
        结果bitmap
      • proportionalScaling

        public static android.graphics.Point proportionalScaling​(int imageWidth,
                                                                 int imageHeight,
                                                                 int dstWidth)
        根据原图宽高和目标宽度 计算目标高度
        参数:
        imageWidth - 原图宽度
        imageHeight - 原图高度
        dstWidth - 目标宽度
        返回:
        目标宽高
      • decode

        public static android.graphics.Bitmap decode​(@NonNull
                                                     com.tencent.libqcloudavif.AvifDecoder decoder,
                                                     int dstWidth,
                                                     long dataSize,
                                                     @Nullable
                                                     android.graphics.Bitmap bitmap,
                                                     @Nullable
                                                     com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool bitmapPool)
        宽度等比解码
        参数:
        decoder - avif解码器实例
        dstWidth - 解码目标宽度(仅支持等比缩小)
        dataSize - 需要解码的数据大小
        bitmap - 解码到该位图(也可以传空 将会生成一个新的位图)
        bitmapPool - 用于获取bitmap的bitmapPool
        返回:
        结果bitmap
      • animationDecodeFrame

        public static Avif.AvifFrame animationDecodeFrame​(@NonNull
                                                          com.tencent.libqcloudavif.AvifDecoder decoder,
                                                          long bytesLength,
                                                          int index,
                                                          @Nullable
                                                          android.graphics.Bitmap bitmap)
        通过解码器解码其中一帧(需要提前创建AvifDecoder)
        参数:
        decoder - 解码器(提前创建AvifDecoder)
        bytesLength - 需要解码的数据长度
        index - 帧索引
        bitmap - 解码到该位图(也可以传空 将会生成一个新的位图在TpgFrame中返回)
        返回:
        动图解码一帧返回内容 包括位图和延时
      • animationDecodeFrame

        public static com.tencent.libqcloudavif.AvifImage animationDecodeFrame​(@NonNull
                                                                               com.tencent.libqcloudavif.AvifDecoder decoder,
                                                                               long bytesLength,
                                                                               int index)
        通过解码器解码其中一帧(需要提前创建AvifDecoder)
        参数:
        decoder - 解码器(提前创建AvifDecoder)
        bytesLength - 需要解码的数据长度
        index - 帧索引
        返回:
        动图解码一帧返回内容 包括位图和延时
      • decodeAnimationFrame

        public static Avif.AvifFrame decodeAnimationFrame​(@NonNull
                                                          byte[] bytes,
                                                          int index)
        解码动图某一帧
        参数:
        bytes - 需要解码的数据(字节数组)
        index - 帧索引
        返回:
        动图解码一帧返回内容 包括位图和延时
      • decodeAnimationFrame

        public static Avif.AvifFrame decodeAnimationFrame​(@NonNull
                                                          byte[] bytes,
                                                          int index,
                                                          @Nullable
                                                          android.graphics.Bitmap bitmap)
        解码动图某一帧
        参数:
        bytes - 需要解码的数据(字节数组)
        index - 帧索引
        bitmap - 解码到该位图(也可以传空 将会生成一个新的位图在TpgFrame中返回)
        返回:
        动图解码一帧返回内容 包括位图和延时
      • decodeRegion

        public static android.graphics.Bitmap decodeRegion​(@NonNull
                                                           com.tencent.libqcloudavif.AvifDecoder decoder,
                                                           long bytesLength,
                                                           int x,
                                                           int y,
                                                           int width,
                                                           int height,
                                                           int inSampleSize)
        局部解码(需要提前创建AvifDecoder并nextImage)
        参数:
        decoder - 解码器(提前创建AvifDecoder并nextImage)
        bytesLength - 需要解码的数据长度
        x - 区域左上角x坐标
        y - 区域左上角y坐标
        width - 区域宽度
        height - 区域高度
        inSampleSize - 缩放比, 大于1的时候才生效,小于等于1的情况下不作缩放
        返回:
        解码位图
      • isAvif

        public static boolean isAvif​(byte[] buffer)
      • isAvif

        public static boolean isAvif​(@NonNull
                                     java.io.InputStream source,
                                     @NonNull
                                     com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool byteArrayPool)
      • isAvif

        public static boolean isAvif​(@NonNull
                                     java.nio.ByteBuffer source)
      • isAvis

        public static boolean isAvis​(byte[] buffer)
      • isAvis

        public static boolean isAvis​(@NonNull
                                     java.io.InputStream source,
                                     @NonNull
                                     com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool byteArrayPool)
      • isAvis

        public static boolean isAvis​(@NonNull
                                     java.nio.ByteBuffer source)
      • getAvifDecoder

        public static com.tencent.libqcloudavif.AvifDecoder getAvifDecoder​(byte[] buffer)
      • getAvifDecoder

        public static com.tencent.libqcloudavif.AvifDecoder getAvifDecoder​(@NonNull
                                                                           java.nio.ByteBuffer source)
      • getDecoderWH

        public static android.graphics.Point getDecoderWH​(byte[] buffer)