Add height, width, size and imageType attribute to Image class (#1548)

* Add height, width, size and imageType attribute to Image class
Close #1543 #1204 #1032

* Let ImageType enum code before the `Internals`, Also add @JvmStatic and OrNull version for match method

* Use runBIO and throws annotation for getImageInfo

* Add .kt suffix for MPP imagesImpl

* Return empty imageInfo for unsupported images

* Fix wrong file name

* apiDump

* Renaming MPP file instead of adding JvmName annotation

* Optimize readability and only use BIO at call-site

* Fix bug for detecting image type

* Detecting javax module for java 9+

* Clean up

* Disable some image types which not supported

* Use cross platform code to read images, readd support for apng

* Fix bug in reading image

* apiDump

* Fix bug in image reading and write unite test

* Fix wording

* Remove webp support and throws IllegalArgumentException for unsupported format

* Remove WEBP enum type

* Add unit test for unsupported image and correct comments

* Fix buffer input stream error when reading images

* Applying suggestions and fix jpg reading

* Add complete SOF decoding for jpg and clean up

* Caching jpg sof byte ranges

* Save `values()` as IMAGE_TYPE_ENUM_LIST for preventing clone operation

* Remove duplicated it
This commit is contained in:
sandtechnology
2021-09-16 04:38:59 +08:00
committed by GitHub
parent 75d0b66121
commit 4ce57f52a8
12 changed files with 528 additions and 49 deletions

View File

@@ -4297,10 +4297,14 @@ public abstract interface class net/mamoe/mirai/message/data/Image : net/mamoe/m
public static final field Key Lnet/mamoe/mirai/message/data/Image$Key;
public static final field SERIAL_NAME Ljava/lang/String;
public static fun fromId (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/Image;
public abstract fun getHeight ()I
public abstract fun getImageId ()Ljava/lang/String;
public static fun getImageIdRegex ()Lkotlin/text/Regex;
public static fun getImageResourceIdRegex1 ()Lkotlin/text/Regex;
public static fun getImageResourceIdRegex2 ()Lkotlin/text/Regex;
public abstract fun getImageType ()Lnet/mamoe/mirai/message/data/ImageType;
public abstract fun getSize ()J
public abstract fun getWidth ()I
public static fun queryUrl (Lnet/mamoe/mirai/message/data/Image;)Ljava/lang/String;
public static fun queryUrl (Lnet/mamoe/mirai/message/data/Image;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
@@ -4333,6 +4337,25 @@ public final class net/mamoe/mirai/message/data/Image$Serializer : kotlinx/seria
public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lnet/mamoe/mirai/message/data/Image;)V
}
public final class net/mamoe/mirai/message/data/ImageType : java/lang/Enum {
public static final field APNG Lnet/mamoe/mirai/message/data/ImageType;
public static final field BMP Lnet/mamoe/mirai/message/data/ImageType;
public static final field Companion Lnet/mamoe/mirai/message/data/ImageType$Companion;
public static final field GIF Lnet/mamoe/mirai/message/data/ImageType;
public static final field JPG Lnet/mamoe/mirai/message/data/ImageType;
public static final field PNG Lnet/mamoe/mirai/message/data/ImageType;
public static final field UNKNOWN Lnet/mamoe/mirai/message/data/ImageType;
public static final fun match (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType;
public static final fun matchOrNull (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType;
public static fun valueOf (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType;
public static fun values ()[Lnet/mamoe/mirai/message/data/ImageType;
}
public final class net/mamoe/mirai/message/data/ImageType$Companion {
public final fun match (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType;
public final fun matchOrNull (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType;
}
public final class net/mamoe/mirai/message/data/LightApp : net/mamoe/mirai/message/code/CodableMessage, net/mamoe/mirai/message/data/RichMessage {
public static final field Key Lnet/mamoe/mirai/message/data/LightApp$Key;
public static final field SERIAL_NAME Ljava/lang/String;