Merge pull request #3547 from dreampiggy/doc/update_api_document

Update some comments to allows SwiftDocC generate better page
This commit is contained in:
DreamPiggy 2023-06-04 14:02:00 +08:00 committed by GitHub
commit 90aa750c92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 0 deletions

View File

@ -107,8 +107,26 @@
// By default, animated image frames are returned by decoding just in time without keeping into memory. But you can choose to preload them into memory as well, See the description in `SDAnimatedImage` protocol.
// After preloaded, there is no huge difference on performance between this and UIImage's `animatedImageWithImages:duration:`. But UIImage's animation have some issues such like blanking and pausing during segue when using in `UIImageView`. It's recommend to use only if need.
/**
Pre-load all animated image frame into memory. Then later frame image request can directly return the frame for index without decoding.
This method may be called on background thread.
@note If one image instance is shared by lots of imageViews, the CPU performance for large animated image will drop down because the request frame index will be random (not in order) and the decoder should take extra effort to keep it re-entrant. You can use this to reduce CPU usage if need. Attention this will consume more memory usage.
*/
- (void)preloadAllFrames;
/**
Unload all animated image frame from memory if are already pre-loaded. Then later frame image request need decoding. You can use this to free up the memory usage if need.
*/
- (void)unloadAllFrames;
/**
Returns a Boolean value indicating whether all animated image frames are already pre-loaded into memory.
*/
@property (nonatomic, assign, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded;
/**
Return the animated image coder if the image is created with `initWithAnimatedCoder:scale:` method.
@note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding.
*/
@property (nonatomic, strong, readonly, nullable) id<SDAnimatedImageCoder> animatedCoder;
@end

View File

@ -10,6 +10,7 @@
#import "SDWebImageCompat.h"
#import "SDImageCoder.h"
/// Animated image playback mode
typedef NS_ENUM(NSUInteger, SDAnimatedImagePlaybackMode) {
/**
* From first to last frame and stop or next loop.

View File

@ -17,11 +17,17 @@
For others (macOS/watchOS or iOS/tvOS 10-), these method use the `SDImageGraphics.h` to implements the same behavior (but without dynamic bitmap support)
*/
/// A closure for drawing an image.
typedef void (^SDGraphicsImageDrawingActions)(CGContextRef _Nonnull context);
/// Constants that specify the color range of the image renderer context.
typedef NS_ENUM(NSInteger, SDGraphicsImageRendererFormatRange) {
/// The image renderer context doesnt specify a color range.
SDGraphicsImageRendererFormatRangeUnspecified = -1,
/// The system automatically chooses the image renderer contexts pixel format according to the color range of its content.
SDGraphicsImageRendererFormatRangeAutomatic = 0,
/// The image renderer context supports wide color.
SDGraphicsImageRendererFormatRangeExtended,
/// The image renderer context doesnt support extended colors.
SDGraphicsImageRendererFormatRangeStandard
};

View File

@ -10,6 +10,7 @@
#import "SDWebImageCompat.h"
#import "SDImageFrame.h"
/// The options controls how we force pre-draw the image (to avoid lazy-decoding). Which need OS's framework compatibility
typedef NS_ENUM(NSUInteger, SDImageCoderDecodeSolution) {
/// automatically choose the solution based on image format, hardware, OS version. This keep balance for compatibility and performance. Default after SDWebImage 5.13.0
SDImageCoderDecodeSolutionAutomatic,

View File

@ -130,6 +130,7 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
* (from 5.16.0) This will actually translate to use context option `SDWebImageContextImageScaleDownLimitBytes`, which check and calculate the thumbnail pixel size occupied small than limit bytes (including animated image)
* (from 5.5.0) This flags effect the progressive and animated images as well
* @note If you need detail controls, it's better to use context option `imageScaleDownBytes` instead.
* @warning This does not effect the cache key. So which means, this will effect the global cache even next time you query without this option. Pay attention when you use this on global options (It's always recommended to use request-level option for different pipeline)
*/
SDWebImageScaleDownLargeImages = 1 << 11,
@ -302,6 +303,7 @@ FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageT
4. Else, use the full pixel decoding (small than limit bytes)
5. Whatever result, this does not effect the animated/static behavior of image. So even if you set `limitBytes = 1 && frameCount = 100`, we will stll create animated image with each frame `1x1` pixel size.
@note This option has higher priority than `.imageThumbnailPixelSize`
@warning This does not effect the cache key. So which means, this will effect the global cache even next time you query without this option. Pay attention when you use this on global options (It's always recommended to use request-level option for different pipeline)
*/
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageScaleDownLimitBytes;

View File

@ -95,9 +95,13 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
SDWebImageDownloaderMatchAnimatedImageClass = 1 << 12,
};
/// Posed when URLSessionTask started (`resume` called))
FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStartNotification;
/// Posed when URLSessionTask get HTTP response (`didReceiveResponse:completionHandler:` called)
FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadReceiveResponseNotification;
/// Posed when URLSessionTask stoped (`didCompleteWithError:` with error or `cancel` called)
FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStopNotification;
/// Posed when URLSessionTask finished with success (`didCompleteWithError:` without error)
FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadFinishNotification;
typedef SDImageLoaderProgressBlock SDWebImageDownloaderProgressBlock;

View File

@ -9,6 +9,7 @@
#import "SDWebImageCompat.h"
/// An error domain represent SDWebImage loading system with custom codes
FOUNDATION_EXPORT NSErrorDomain const _Nonnull SDWebImageErrorDomain;
/// The response instance for invalid download response (NSURLResponse *)

View File

@ -8,9 +8,13 @@
#import "SDWebImageCompat.h"
/// The scale mode to apply when image drawing on a container with different sizes.
typedef NS_ENUM(NSUInteger, SDImageScaleMode) {
/// The option to scale the content to fit the size of itself by changing the aspect ratio of the content if necessary.
SDImageScaleModeFill = 0,
/// The option to scale the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the views bounds is transparent.
SDImageScaleModeAspectFit = 1,
/// The option to scale the content to fill the size of the view. Some portion of the content may be clipped to fill the views bounds.
SDImageScaleModeAspectFill = 2
};