文件
dayu-color/大鱼调色/Plugin/DYLUTLibrary.h
T

72 行
3.8 KiB
Objective-C
原始文件 Blame 文件历史

此文件含有模棱两可的 Unicode 字符
此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。
#import <AppKit/AppKit.h>
#ifdef __cplusplus
#include <vector>
#endif
NS_ASSUME_NONNULL_BEGIN
/// Immutable decoded contents. A retained snapshot survives preview-cache
/// eviction and does not consult the source file while a frame is rendered.
@interface DYLUTPreparedTable : NSObject
@property(nonatomic,readonly) NSUInteger dimension;
@property(nonatomic,readonly,copy) NSString *path;
@property(nonatomic,readonly,copy) NSString *revision;
- (const float *)rgbaValues;
@end
/// Synchronous worker-only entry; do not call it from an inspector action.
FOUNDATION_EXPORT DYLUTPreparedTable * _Nullable DYLUTReadPreparedTable(NSString *path,
NSProgress * _Nullable progress, NSError * _Nullable * _Nullable error);
#ifdef __cplusplus
/// Same red-fastest 3D Cube table and DOMAIN resampling used by the renderer.
/// Output is cleared on failure. Built-in .dylut tables are also supported.
FOUNDATION_EXPORT BOOL DYLUTReadCube(NSString *path, std::vector<float>& values,
NSUInteger& dimension, NSError * _Nullable * _Nullable error);
#endif
/// Parse/warm the shared table cache off the UI thread. Completion is always on
/// the main queue; cancel suppresses application of the result.
FOUNDATION_EXPORT NSProgress *DYLUTPrepareAsync(NSString *path,
void (^completion)(NSError * _Nullable error));
/// Float RGBA in display-encoded RGB, matching the renderer's 320×180 preview.
/// Empty path means identity. Alpha is preserved; invalid samples become clear.
FOUNDATION_EXPORT NSData * _Nullable DYLUTTransformRGBA(NSData *sourceRGBA,
NSUInteger width, NSUInteger height, NSString * _Nullable path, NSError * _Nullable * _Nullable error);
/// Uses sourceRGBA when supplied. Otherwise draws an authored neutral test chart.
/// The bitmap is safe to prepare on the browser's background preview queue.
FOUNDATION_EXPORT NSImage * _Nullable DYLUTThumbnail(NSString * _Nullable path,
NSData * _Nullable sourceRGBA, NSUInteger sourceWidth, NSUInteger sourceHeight,
NSSize outputSize, NSError * _Nullable * _Nullable error);
@interface DYLUTLibrary : NSObject
@property(nonatomic,readonly,copy) NSURL *rootURL;
/// Each item has name (without extension), path, relativeFolder, relativePath.
@property(nonatomic,readonly,copy) NSArray<NSDictionary<NSString *,NSString *> *> *entries;
/// Relative folder names, including the root empty string; sorted naturally.
@property(nonatomic,readonly,copy) NSArray<NSString *> *folders;
@property(nonatomic,readonly,copy) NSSet<NSString *> *favoritePaths;
+ (NSURL *)defaultRootURL;
- (instancetype)init;
- (instancetype)initWithRootURL:(NSURL *)rootURL NS_DESIGNATED_INITIALIZER;
/// Does not follow symbolic links or create a missing root directory.
- (BOOL)reload:(NSError * _Nullable * _Nullable)error;
/// Background file work is serialized separately from the short snapshot lock.
/// The returned progress supports cancellation and per-file status; callbacks
/// always run on the main queue. Existing snapshots remain readable meanwhile.
- (NSProgress *)reloadAsync:(void (^)(NSError * _Nullable error))completion;
- (NSProgress *)importURLsAsync:(NSArray<NSURL *> *)urls
completion:(void (^)(NSArray<NSDictionary *> * _Nullable imported, NSError * _Nullable error))completion;
/// Copies Cube files (recursing into folders) into the library. No existing file
/// is replaced. Names receive numeric suffixes on collision. Source data stays put.
/// Returns imported entry dictionaries, or nil on preflight/copy failure.
- (NSArray<NSDictionary<NSString *,NSString *> *> * _Nullable)importURLs:(NSArray<NSURL *> *)urls
error:(NSError * _Nullable * _Nullable)error;
- (BOOL)isFavoritePath:(NSString *)path;
- (BOOL)setFavorite:(BOOL)favorite forPath:(NSString *)path error:(NSError * _Nullable * _Nullable)error;
@end
NS_ASSUME_NONNULL_END