NSData(FWAnimated)

@interface NSData (FWAnimated)

/// 获取图片数据的格式,未知格式返回FWImageFormatUndefined
+ (FWImageFormat)fw_imageFormatForImageData:(nullable NSData *)data NS_REFINED_FOR_SWIFT;

/// 图片格式转化为UTType,未知格式返回kUTTypeImage
+ (nonnull CFStringRef)fw_UTTypeFromImageFormat:(FWImageFormat)format CF_RETURNS_NOT_RETAINED NS_REFINED_FOR_SWIFT;

/// UTType转化为图片格式,未知格式返回FWImageFormatUndefined
+ (FWImageFormat)fw_imageFormatFromUTType:(nonnull CFStringRef)uttype NS_REFINED_FOR_SWIFT;

/// 图片格式转化为mimeType,未知格式返回application/octet-stream
+ (NSString *)fw_mimeTypeFromImageFormat:(FWImageFormat)format NS_REFINED_FOR_SWIFT;

/// 文件后缀转化为mimeType,未知后缀返回application/octet-stream
+ (NSString *)fw_mimeTypeFromExtension:(NSString *)extension NS_REFINED_FOR_SWIFT;

/// 图片数据编码为base64字符串,可直接用于H5显示等,字符串格式:data:image/png;base64,数据
+ (nullable NSString *)fw_base64StringForImageData:(nullable NSData *)data NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 获取图片数据的格式,未知格式返回FWImageFormatUndefined

    Declaration

    Objective-C

    + (FWImageFormat)fw_imageFormatForImageData:(nullable NSData *)data;
  • 图片格式转化为UTType,未知格式返回kUTTypeImage

    Declaration

    Objective-C

    + (nonnull CFStringRef)fw_UTTypeFromImageFormat:(FWImageFormat)format;
  • UTType转化为图片格式,未知格式返回FWImageFormatUndefined

    Declaration

    Objective-C

    + (FWImageFormat)fw_imageFormatFromUTType:(nonnull CFStringRef)uttype;
  • 图片格式转化为mimeType,未知格式返回application/octet-stream

    Declaration

    Objective-C

    + (nonnull NSString *)fw_mimeTypeFromImageFormat:(FWImageFormat)format;
  • 文件后缀转化为mimeType,未知后缀返回application/octet-stream

    Declaration

    Objective-C

    + (nonnull NSString *)fw_mimeTypeFromExtension:(nonnull NSString *)extension;
  • 图片数据编码为base64字符串,可直接用于H5显示等,字符串格式:data:image/png;base64,数据

    Declaration

    Objective-C

    + (nullable NSString *)fw_base64StringForImageData:(nullable NSData *)data;