![]() |
Tuya iOS Smart Life App SDK 5.15.0
|
#import <ThingEncryptImageCoder.h>
Class Methods | |
(nullable instancetype) | + decoderWithData:scale: |
(nullable instancetype) | + decoderWithData:scale: |
(nullable instancetype) | + decoderWithData:scale: |
(nullable instancetype) | + decoderWithData:scale: |
Properties | |
NSData * | data |
Image data. More... | |
ThingEncryptImageType | type |
Image data type. More... | |
CGFloat | scale |
Image scale. More... | |
NSUInteger | frameCount |
Image frame count. More... | |
NSUInteger | loopCount |
Image loop count, 0 means infinite. More... | |
NSUInteger | width |
Image canvas width. More... | |
NSUInteger | height |
Image canvas height. More... | |
BOOL | finalized |
An image decoder to decode image data.
@discussion This class supports decoding animated WebP, APNG, GIF and system image format such as PNG, JPG, JP2, BMP, TIFF, PIC, ICNS and ICO. It can be used to decode complete image data, or to decode incremental image data during image download. This class is thread-safe.
Example:
Decode single image: NSData *data = [NSData dataWithContentOfFile:"/tmp/image.webp"]; ThingImageDecoder *decoder = [ThingImageDecoder decoderWithData:data scale:2.0]; UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;
Decode image during download: NSMutableData *data = [NSMutableData new]; ThingImageDecoder *decoder = [[ThingImageDecoder alloc] initWithScale:2.0]; while(newDataArrived) { [data appendData:newData]; [decoder updateData:data final:NO]; if (decoder.frameCount > 0) { UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image; progressive display... } } [decoder updateData:data final:YES]; UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image; final display...
Definition at line 107 of file ThingEncryptImageCoder.h.
+ (nullable instancetype) decoderWithData: | (NSData *) | data | |
scale: | (CGFloat) | scale | |
Convenience method to create a decoder with specified data.
data | Image data. |
scale | Image's scale. |
+ (nullable instancetype) decoderWithData: | (NSData *) | data | |
scale: | (CGFloat) | scale | |
Convenience method to create a decoder with specified data.
data | Image data. |
scale | Image's scale. |
+ (nullable instancetype) decoderWithData: | (NSData *) | data | |
scale: | (CGFloat) | scale | |
Convenience method to create a decoder with specified data.
data | Image data. |
scale | Image's scale. |
+ (nullable instancetype) decoderWithData: | (NSData *) | data | |
scale: | (CGFloat) | scale | |
Convenience method to create a decoder with specified data.
data | Image data. |
scale | Image's scale. |
- (nullable ThingEncryptImageFrame *) frameAtIndex: | (NSUInteger) | index | |
decodeForDisplay: | (BOOL) | decodeForDisplay | |
Decodes and returns a frame from a specified index.
index | Frame image index (zero-based). |
decodeForDisplay | Whether decode the image to memory bitmap for display. If NO, it will try to returns the original frame data without blend. |
- (nullable ThingEncryptImageFrame *) frameAtIndex: | (NSUInteger) | index | |
decodeForDisplay: | (BOOL) | decodeForDisplay | |
Decodes and returns a frame from a specified index.
index | Frame image index (zero-based). |
decodeForDisplay | Whether decode the image to memory bitmap for display. If NO, it will try to returns the original frame data without blend. |
- (nullable ThingEncryptImageFrame *) frameAtIndex: | (NSUInteger) | index | |
decodeForDisplay: | (BOOL) | decodeForDisplay | |
Decodes and returns a frame from a specified index.
index | Frame image index (zero-based). |
decodeForDisplay | Whether decode the image to memory bitmap for display. If NO, it will try to returns the original frame data without blend. |
- (nullable ThingEncryptImageFrame *) frameAtIndex: | (NSUInteger) | index | |
decodeForDisplay: | (BOOL) | decodeForDisplay | |
Decodes and returns a frame from a specified index.
index | Frame image index (zero-based). |
decodeForDisplay | Whether decode the image to memory bitmap for display. If NO, it will try to returns the original frame data without blend. |
- (NSTimeInterval) frameDurationAtIndex: | (NSUInteger) | index |
Returns the frame duration from a specified index.
index | Frame image (zero-based). |
- (NSTimeInterval) frameDurationAtIndex: | (NSUInteger) | index |
Returns the frame duration from a specified index.
index | Frame image (zero-based). |
- (NSTimeInterval) frameDurationAtIndex: | (NSUInteger) | index |
Returns the frame duration from a specified index.
index | Frame image (zero-based). |
- (NSTimeInterval) frameDurationAtIndex: | (NSUInteger) | index |
Returns the frame duration from a specified index.
index | Frame image (zero-based). |
- (nullable NSDictionary *) framePropertiesAtIndex: | (NSUInteger) | index |
Returns the frame's properties. See "CGImageProperties.h" in ImageIO.framework for more information.
index | Frame image index (zero-based). |
- (nullable NSDictionary *) framePropertiesAtIndex: | (NSUInteger) | index |
Returns the frame's properties. See "CGImageProperties.h" in ImageIO.framework for more information.
index | Frame image index (zero-based). |
- (nullable NSDictionary *) framePropertiesAtIndex: | (NSUInteger) | index |
Returns the frame's properties. See "CGImageProperties.h" in ImageIO.framework for more information.
index | Frame image index (zero-based). |
- (nullable NSDictionary *) framePropertiesAtIndex: | (NSUInteger) | index |
Returns the frame's properties. See "CGImageProperties.h" in ImageIO.framework for more information.
index | Frame image index (zero-based). |
- (nullable NSDictionary *) imageProperties |
Returns the image's properties. See "CGImageProperties.h" in ImageIO.framework for more information.
- (nullable NSDictionary *) imageProperties |
Returns the image's properties. See "CGImageProperties.h" in ImageIO.framework for more information.
- (nullable NSDictionary *) imageProperties |
Returns the image's properties. See "CGImageProperties.h" in ImageIO.framework for more information.
- (nullable NSDictionary *) imageProperties |
Returns the image's properties. See "CGImageProperties.h" in ImageIO.framework for more information.
- (instancetype) initWithScale: | (CGFloat) | NS_DESIGNATED_INITIALIZER |
Creates an image decoder.
scale | Image's scale. |
- (instancetype) initWithScale: | (CGFloat) | NS_DESIGNATED_INITIALIZER |
Creates an image decoder.
scale | Image's scale. |
- (instancetype) initWithScale: | (CGFloat) | NS_DESIGNATED_INITIALIZER |
Creates an image decoder.
scale | Image's scale. |
- (instancetype) initWithScale: | (CGFloat) | NS_DESIGNATED_INITIALIZER |
Creates an image decoder.
scale | Image's scale. |
- (BOOL) updateData: | (nullable NSData *) | data | |
final: | (BOOL) | final | |
Updates the incremental image with new data.
@discussion You can use this method to decode progressive/interlaced/baseline image when you do not have the complete image data. The data
was retained by decoder, you should not modify the data in other thread during decoding.
data | The data to add to the image decoder. Each time you call this function, the 'data' parameter must contain all of the image file data accumulated so far. |
final | A value that specifies whether the data is the final set. Pass YES if it is, NO otherwise. When the data is already finalized, you can not update the data anymore. |
- (BOOL) updateData: | (nullable NSData *) | data | |
final: | (BOOL) | final | |
Updates the incremental image with new data.
@discussion You can use this method to decode progressive/interlaced/baseline image when you do not have the complete image data. The data
was retained by decoder, you should not modify the data in other thread during decoding.
data | The data to add to the image decoder. Each time you call this function, the 'data' parameter must contain all of the image file data accumulated so far. |
final | A value that specifies whether the data is the final set. Pass YES if it is, NO otherwise. When the data is already finalized, you can not update the data anymore. |
- (BOOL) updateData: | (nullable NSData *) | data | |
final: | (BOOL) | final | |
Updates the incremental image with new data.
@discussion You can use this method to decode progressive/interlaced/baseline image when you do not have the complete image data. The data
was retained by decoder, you should not modify the data in other thread during decoding.
data | The data to add to the image decoder. Each time you call this function, the 'data' parameter must contain all of the image file data accumulated so far. |
final | A value that specifies whether the data is the final set. Pass YES if it is, NO otherwise. When the data is already finalized, you can not update the data anymore. |
- (BOOL) updateData: | (nullable NSData *) | data | |
final: | (BOOL) | final | |
Updates the incremental image with new data.
@discussion You can use this method to decode progressive/interlaced/baseline image when you do not have the complete image data. The data
was retained by decoder, you should not modify the data in other thread during decoding.
data | The data to add to the image decoder. Each time you call this function, the 'data' parameter must contain all of the image file data accumulated so far. |
final | A value that specifies whether the data is the final set. Pass YES if it is, NO otherwise. When the data is already finalized, you can not update the data anymore. |
|
readnonatomicassign |
Image data.
Definition at line 109 of file ThingEncryptImageCoder.h.
|
readnonatomicassign |
Definition at line 116 of file ThingEncryptImageCoder.h.
|
readnonatomicassign |
Image frame count.
Definition at line 112 of file ThingEncryptImageCoder.h.
|
readnonatomicassign |
Image canvas height.
Definition at line 115 of file ThingEncryptImageCoder.h.
|
readnonatomicassign |
Image loop count, 0 means infinite.
Definition at line 113 of file ThingEncryptImageCoder.h.
|
readnonatomicassign |
Image scale.
Definition at line 111 of file ThingEncryptImageCoder.h.
|
readnonatomicassign |
Image data type.
Definition at line 110 of file ThingEncryptImageCoder.h.
|
readnonatomicassign |
Image canvas width.
Definition at line 114 of file ThingEncryptImageCoder.h.