commit 10987dd6bcc6986ea321eff75b37d4e8b48e966d Author: mac Date: Sat Oct 31 01:06:40 2026 +0800 baseline: preserve initial 大鱼调色 FxPlug Xcode project diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..32cad7b --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +.DS_Store +._* +xcuserdata/ +*.xcuserstate +DerivedData/ +build/ +*.app/ +*.zip +*.dmg +*.pkg +.env +*.p12 +*.p8 +*.key +__pycache__/ diff --git a/RECOVERY.md b/RECOVERY.md new file mode 100644 index 0000000..6093de6 --- /dev/null +++ b/RECOVERY.md @@ -0,0 +1,9 @@ +# 大鱼调色恢复说明 + +远程:https://dayu.media/git/dayu/dayu-color.git +分支:main。初始化基线保留原始 Xcode 模板,后续提交独立实现调色器。 + +工程:大鱼调色.xcodeproj;Wrapper Application / XPC Service;Xcode 27.1、FxPlug SDK 4.3.5、macOS、Metal。 +正式位置:/Library/Plug-Ins/FxPlug/大鱼调色.app;主 ID:com.dayu.color。 + +克隆后 `git switch --detach <完整提交SHA>` 恢复指定节点。证书、公证钥匙串及参考 LumiGrade 应用不纳入 Git。暂无 LFS 或子模块。 diff --git a/大鱼调色.xcodeproj/project.pbxproj b/大鱼调色.xcodeproj/project.pbxproj new file mode 100644 index 0000000..60be248 --- /dev/null +++ b/大鱼调色.xcodeproj/project.pbxproj @@ -0,0 +1,539 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 110; + objects = { + +/* Begin PBXBuildFile section */ + 04962E563095058F009952AA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04962E553095058F009952AA /* Cocoa.framework */; }; + 04962E5E3095058F009952AA /* 大鱼调色 XPC Service.pluginkit in Embed PlugIns */ = {isa = PBXBuildFile; fileRef = 04962E5D3095058F009952AA /* 大鱼调色 XPC Service.pluginkit */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 04962E623095058F009952AA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04962E613095058F009952AA /* Foundation.framework */; }; + 04962E643095058F009952AA /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04962E633095058F009952AA /* AppKit.framework */; }; + 04962E663095058F009952AA /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04962E653095058F009952AA /* Accelerate.framework */; }; + 04962E683095058F009952AA /* PluginManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04962E673095058F009952AA /* PluginManager.framework */; }; + 04962E6A3095058F009952AA /* FxPlug.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04962E693095058F009952AA /* FxPlug.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 04962E5F3095058F009952AA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 04962E4A3095058F009952AA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 04962E5C3095058F009952AA; + remoteInfo = "XPC Service"; + }; + 04962E6B3095058F009952AA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 04962E4A3095058F009952AA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 04962E5C3095058F009952AA; + remoteInfo = "XPC Service"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 04962E963095058F009952AA /* Embed PlugIns */ = { + isa = PBXCopyFilesBuildPhase; + dstPath = ""; + dstSubfolder = PlugIns; + files = ( + 04962E5E3095058F009952AA /* 大鱼调色 XPC Service.pluginkit in Embed PlugIns */, + ); + name = "Embed PlugIns"; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 04962E523095058F009952AA /* 大鱼调色.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "大鱼调色.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 04962E553095058F009952AA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 04962E5D3095058F009952AA /* 大鱼调色 XPC Service.pluginkit */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "大鱼调色 XPC Service.pluginkit"; sourceTree = BUILT_PRODUCTS_DIR; }; + 04962E613095058F009952AA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 04962E633095058F009952AA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 04962E653095058F009952AA /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; + 04962E673095058F009952AA /* PluginManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PluginManager.framework; path = Library/Frameworks/../../../../../../Library/Developer/Frameworks/PluginManager.framework; sourceTree = DEVELOPER_DIR; }; + 04962E693095058F009952AA /* FxPlug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FxPlug.framework; path = Library/Frameworks/../../../../../../Library/Developer/Frameworks/FxPlug.framework; sourceTree = DEVELOPER_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 04962E923095058F009952AA /* Exceptions for "大鱼调色" folder in "Wrapper Application" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + "/Localized: Plugin/InfoPlist.strings", + "/Localized: Plugin/Localizable.strings", + "Plugin/____PlugIn.m", + Plugin/Info.plist, + Plugin/main.m, + Plugin/MetalDeviceCache.m, + Plugin/TileableRemoteBrightness.metal, + "Wrapper Application/Info.plist", + ); + target = 04962E513095058F009952AA /* Wrapper Application */; + }; + 04962E9A3095058F009952AA /* Exceptions for "大鱼调色" folder in "XPC Service" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + "/Localized: Wrapper Application/Credits.rtf", + "/Localized: Wrapper Application/InfoPlist.strings", + "/Localized: Wrapper Application/MainMenu.xib", + Plugin/Info.plist, + "Wrapper Application/AppDelegate.m", + "Wrapper Application/Info.plist", + "Wrapper Application/main.m", + ); + target = 04962E5C3095058F009952AA /* XPC Service */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 04962E6D3095058F009952AA /* 大鱼调色 */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 04962E923095058F009952AA /* Exceptions for "大鱼调色" folder in "Wrapper Application" target */, + 04962E9A3095058F009952AA /* Exceptions for "大鱼调色" folder in "XPC Service" target */, + ); + path = "大鱼调色"; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 04962E4F3095058F009952AA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + files = ( + 04962E563095058F009952AA /* Cocoa.framework in Frameworks */, + ); + }; + 04962E583095058F009952AA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + files = ( + 04962E663095058F009952AA /* Accelerate.framework in Frameworks */, + 04962E683095058F009952AA /* PluginManager.framework in Frameworks */, + 04962E623095058F009952AA /* Foundation.framework in Frameworks */, + 04962E643095058F009952AA /* AppKit.framework in Frameworks */, + 04962E6A3095058F009952AA /* FxPlug.framework in Frameworks */, + ); + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 04962E493095058F009952AA = { + isa = PBXGroup; + children = ( + 04962E6D3095058F009952AA /* 大鱼调色 */, + 04962E543095058F009952AA /* Frameworks */, + 04962E533095058F009952AA /* Products */, + ); + sourceTree = ""; + }; + 04962E533095058F009952AA /* Products */ = { + isa = PBXGroup; + children = ( + 04962E523095058F009952AA /* 大鱼调色.app */, + 04962E5D3095058F009952AA /* 大鱼调色 XPC Service.pluginkit */, + ); + name = Products; + sourceTree = ""; + }; + 04962E543095058F009952AA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 04962E553095058F009952AA /* Cocoa.framework */, + 04962E613095058F009952AA /* Foundation.framework */, + 04962E633095058F009952AA /* AppKit.framework */, + 04962E653095058F009952AA /* Accelerate.framework */, + 04962E673095058F009952AA /* PluginManager.framework */, + 04962E693095058F009952AA /* FxPlug.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 04962E513095058F009952AA /* Wrapper Application */ = { + isa = PBXNativeTarget; + buildConfigurationList = 04962E973095058F009952AA /* Build configuration list for PBXNativeTarget "Wrapper Application" */; + buildPhases = ( + 04962E4E3095058F009952AA /* Sources */, + 04962E4F3095058F009952AA /* Frameworks */, + 04962E503095058F009952AA /* Resources */, + 04962E963095058F009952AA /* Embed PlugIns */, + ); + buildRules = ( + ); + dependencies = ( + 04962E603095058F009952AA /* PBXTargetDependency */, + 04962E6C3095058F009952AA /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 04962E6D3095058F009952AA /* 大鱼调色 */, + ); + name = "Wrapper Application"; + productName = "Wrapper Application"; + productReference = 04962E523095058F009952AA /* 大鱼调色.app */; + productType = "com.apple.product-type.application"; + }; + 04962E5C3095058F009952AA /* XPC Service */ = { + isa = PBXNativeTarget; + buildConfigurationList = 04962E933095058F009952AA /* Build configuration list for PBXNativeTarget "XPC Service" */; + buildPhases = ( + 04962E573095058F009952AA /* Sources */, + 04962E583095058F009952AA /* Frameworks */, + 04962E593095058F009952AA /* Resources */, + 04962E5A3095058F009952AA /* Copy and Code Sign FxPlug.framework */, + 04962E5B3095058F009952AA /* Copy and Code Sign PluginManager.framework */, + ); + buildRules = ( + ); + fileSystemSynchronizedGroups = ( + 04962E6D3095058F009952AA /* 大鱼调色 */, + ); + name = "XPC Service"; + productName = "XPC Service"; + productReference = 04962E5D3095058F009952AA /* 大鱼调色 XPC Service.pluginkit */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 04962E4A3095058F009952AA /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 2710; + TargetAttributes = { + 04962E513095058F009952AA = { + CreatedOnToolsVersion = 27.1; + }; + 04962E5C3095058F009952AA = { + CreatedOnToolsVersion = 27.1; + }; + }; + }; + buildConfigurationList = 04962E4D3095058F009952AA /* Build configuration list for PBXProject "大鱼调色" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 04962E493095058F009952AA; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 04962E533095058F009952AA /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 04962E513095058F009952AA /* Wrapper Application */, + 04962E5C3095058F009952AA /* XPC Service */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 04962E503095058F009952AA /* Resources */ = { + isa = PBXResourcesBuildPhase; + files = ( + ); + }; + 04962E593095058F009952AA /* Resources */ = { + isa = PBXResourcesBuildPhase; + files = ( + ); + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 04962E5A3095058F009952AA /* Copy and Code Sign FxPlug.framework */ = { + isa = PBXShellScriptBuildPhase; + name = "Copy and Code Sign FxPlug.framework"; + shellPath = /bin/sh; + shellScript = ( + "mkdir -p \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"", + "rsync --archive --links --whole-file --no-owner --no-group --checksum --exclude='Headers' \"/Library/Developer/Frameworks/FxPlug.framework/\" \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FxPlug.framework/\"", + "if [ \"$?\" -ne 0 ]; then echo \"error: rsync failed; couldn't embed FxPlug.framework\"; exit 1; fi", + "codesign --force --timestamp --options runtime --sign \"${CODE_SIGN_IDENTITY}\" \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/FxPlug.framework\"", + ); + showEnvVarsInLog = 0; + }; + 04962E5B3095058F009952AA /* Copy and Code Sign PluginManager.framework */ = { + isa = PBXShellScriptBuildPhase; + name = "Copy and Code Sign PluginManager.framework"; + shellPath = /bin/sh; + shellScript = ( + "mkdir -p \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"", + "rsync --archive --links --whole-file --no-owner --no-group --checksum --exclude='Headers' \"/Library/Developer/Frameworks/PluginManager.framework/\" \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PluginManager.framework/\"", + "if [ \"$?\" -ne 0 ]; then echo \"error: rsync failed; couldn't embed PluginManager.framework\"; exit 1; fi", + "codesign --force --timestamp --options runtime --sign \"${CODE_SIGN_IDENTITY}\" \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/PluginManager.framework\"", + "", + ); + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 04962E4E3095058F009952AA /* Sources */ = { + isa = PBXSourcesBuildPhase; + files = ( + ); + }; + 04962E573095058F009952AA /* Sources */ = { + isa = PBXSourcesBuildPhase; + files = ( + ); + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 04962E603095058F009952AA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 04962E5C3095058F009952AA /* XPC Service */; + targetProxy = 04962E5F3095058F009952AA /* PBXContainerItemProxy */; + }; + 04962E6C3095058F009952AA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 04962E5C3095058F009952AA /* XPC Service */; + targetProxy = 04962E6B3095058F009952AA /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 04962E943095058F009952AA /* Debug configuration for PBXNativeTarget "XPC Service" */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = B3W25FX5H5; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + INFOPLIST_FILE = "大鱼调色/Plugin/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@loader_path/../Frameworks", + ); + MACH_O_TYPE = mh_execute; + MACOSX_DEPLOYMENT_TARGET = 14.6; + PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "大鱼调色 $(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "大鱼调色/Plugin/XPC Service-Bridging-Header.h"; + WRAPPER_EXTENSION = pluginkit; + }; + name = Debug; + }; + 04962E953095058F009952AA /* Release configuration for PBXNativeTarget "XPC Service" */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = B3W25FX5H5; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + INFOPLIST_FILE = "大鱼调色/Plugin/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@loader_path/../Frameworks", + ); + MACH_O_TYPE = mh_execute; + MACOSX_DEPLOYMENT_TARGET = 14.6; + PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "大鱼调色 $(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "大鱼调色/Plugin/XPC Service-Bridging-Header.h"; + WRAPPER_EXTENSION = pluginkit; + }; + name = Release; + }; + 04962E983095058F009952AA /* Debug configuration for PBXNativeTarget "Wrapper Application" */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "大鱼调色/Wrapper Application/SandboxEntitlements.entitlements"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = B3W25FX5H5; + ENABLE_HARDENED_RUNTIME = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + INFOPLIST_FILE = "大鱼调色/Wrapper Application/Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 14.6; + PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "大鱼调色"; + SWIFT_OBJC_BRIDGING_HEADER = "大鱼调色/Wrapper Application/Wrapper Application-Bridging-Header.h"; + }; + name = Debug; + }; + 04962E993095058F009952AA /* Release configuration for PBXNativeTarget "Wrapper Application" */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "大鱼调色/Wrapper Application/SandboxEntitlements.entitlements"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = B3W25FX5H5; + ENABLE_HARDENED_RUNTIME = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + INFOPLIST_FILE = "大鱼调色/Wrapper Application/Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 14.6; + PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "大鱼调色"; + SWIFT_OBJC_BRIDGING_HEADER = "大鱼调色/Wrapper Application/Wrapper Application-Bridging-Header.h"; + }; + name = Release; + }; + 04962E9B3095058F009952AA /* Debug configuration for PBXProject "大鱼调色" */ = { + isa = XCBuildConfiguration; + buildSettings = { + ADDITIONAL_SDKS = /Library/Developer/SDKs/FxPlug.sdk; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = B3W25FX5H5; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + FRAMEWORK_SEARCH_PATHS = ( + /Library/Frameworks, + "$(inherited)", + ); + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 27.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_VERSION = 5; + }; + name = Debug; + }; + 04962E9C3095058F009952AA /* Release configuration for PBXProject "大鱼调色" */ = { + isa = XCBuildConfiguration; + buildSettings = { + ADDITIONAL_SDKS = /Library/Developer/SDKs/FxPlug.sdk; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = B3W25FX5H5; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + FRAMEWORK_SEARCH_PATHS = ( + /Library/Frameworks, + "$(inherited)", + ); + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 27.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_VERSION = 5; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 04962E4D3095058F009952AA /* Build configuration list for PBXProject "大鱼调色" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 04962E9B3095058F009952AA /* Debug configuration for PBXProject "大鱼调色" */, + 04962E9C3095058F009952AA /* Release configuration for PBXProject "大鱼调色" */, + ); + defaultConfigurationName = Release; + }; + 04962E933095058F009952AA /* Build configuration list for PBXNativeTarget "XPC Service" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 04962E943095058F009952AA /* Debug configuration for PBXNativeTarget "XPC Service" */, + 04962E953095058F009952AA /* Release configuration for PBXNativeTarget "XPC Service" */, + ); + defaultConfigurationName = Release; + }; + 04962E973095058F009952AA /* Build configuration list for PBXNativeTarget "Wrapper Application" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 04962E983095058F009952AA /* Debug configuration for PBXNativeTarget "Wrapper Application" */, + 04962E993095058F009952AA /* Release configuration for PBXNativeTarget "Wrapper Application" */, + ); + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 04962E4A3095058F009952AA /* Project object */; + validationLevel = 1; +} diff --git a/大鱼调色.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/大鱼调色.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/大鱼调色.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist new file mode 100644 index 0000000..a616c8f --- /dev/null +++ b/大鱼调色/Plugin/Info.plist @@ -0,0 +1,92 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + ____XPCService + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + NSHumanReadableCopyright + + PlugInKit + + Attributes + + com.apple.protocol + FxPlug + com.apple.version + 1.1 + + PrincipalClass + FxPrincipal + Protocol + PROXPCProtocol + Subsystems + + NSViewService_PKSubsystem + + + ProPlugDictionaryVersion + 1.0 + ProPlugDynamicRegistration + + ProPlugPlugInGroupList + + + groupName + 大鱼调色 Group + uuid + 19E2727A-6BCD-4656-B270-7E2BF482A692 + + + ProPlugPlugInList + + + className + ____PlugIn + displayName + ____::FxPlug Name + group + 19E2727A-6BCD-4656-B270-7E2BF482A692 + infoString + ____::FxPlug Description + protocolNames + + FxFilter + + uuid + 1C17B73B-F229-4C09-A434-EAF6DFF5F22A + version + 1.0 + + + XPCService + + ServiceType + Application + JoinExistingSession + + RunLoopType + _NSApplicationMain + _AdditionalSubServices + + viewbridge + + + + + diff --git a/大鱼调色/Plugin/MetalDeviceCache.h b/大鱼调色/Plugin/MetalDeviceCache.h new file mode 100644 index 0000000..45ab3c3 --- /dev/null +++ b/大鱼调色/Plugin/MetalDeviceCache.h @@ -0,0 +1,28 @@ +// +// MetalDeviceCache.h +// 大鱼调色 +// +// Created by mac on 2026/10/31. +// + +#import +#import + +@class MetalDeviceCacheItem; + +@interface MetalDeviceCache : NSObject +{ + NSMutableArray* deviceCaches; +} + ++ (MetalDeviceCache*)deviceCache; ++ (MTLPixelFormat)MTLPixelFormatForImageTile:(FxImageTile*)imageTile; + +- (id)deviceWithRegistryID:(uint64_t)registryID; +- (id)pipelineStateWithRegistryID:(uint64_t)registryID + pixelFormat:(MTLPixelFormat)pixFormat; +- (id)commandQueueWithRegistryID:(uint64_t)registryID + pixelFormat:(MTLPixelFormat)pixFormat; +- (void)returnCommandQueueToCache:(id)commandQueue; + +@end diff --git a/大鱼调色/Plugin/MetalDeviceCache.m b/大鱼调色/Plugin/MetalDeviceCache.m new file mode 100644 index 0000000..b686fc4 --- /dev/null +++ b/大鱼调色/Plugin/MetalDeviceCache.m @@ -0,0 +1,339 @@ +// +// MetalDeviceCache.m +// 大鱼调色 +// +// Created by mac on 2026/10/31. +// + +#import "MetalDeviceCache.h" + +const NSUInteger kMaxCommandQueues = 5; +static NSString* kKey_InUse = @"InUse"; +static NSString* kKey_CommandQueue = @"CommandQueue"; + +static MetalDeviceCache* gDeviceCache = nil; + +@interface MetalDeviceCacheItem : NSObject + +@property (readonly) id gpuDevice; +@property (readonly) id pipelineState; +@property (retain) NSMutableArray* commandQueueCache; +@property (readonly) NSLock* commandQueueCacheLock; +@property (readonly) MTLPixelFormat pixelFormat; + +- (instancetype)initWithDevice:(id)device + pixelFormat:(MTLPixelFormat)pixFormat; +- (id)getNextFreeCommandQueue; +- (void)returnCommandQueue:(id)commandQueue; +- (BOOL)containsCommandQueue:(id)commandQueue; + +@end + +@implementation MetalDeviceCacheItem + +- (instancetype)initWithDevice:(id)device + pixelFormat:(MTLPixelFormat)pixFormat; +{ + self = [super init]; + + if (self != nil) + { + _gpuDevice = [device retain]; + + _commandQueueCache = [[NSMutableArray alloc] initWithCapacity:kMaxCommandQueues]; + for (NSUInteger i = 0; (_commandQueueCache != nil) && (i < kMaxCommandQueues); i++) + { + NSMutableDictionary* commandDict = [NSMutableDictionary dictionary]; + [commandDict setObject:[NSNumber numberWithBool:NO] + forKey:kKey_InUse]; + + id commandQueue = [_gpuDevice newCommandQueue]; + [commandDict setObject:commandQueue + forKey:kKey_CommandQueue]; + + [_commandQueueCache addObject:commandDict]; + } + + // Load all the shader files with a .metal file extension in the project + id defaultLibrary = [[_gpuDevice newDefaultLibrary] autorelease]; + + // Load the vertex function from the library + id vertexFunction = [[defaultLibrary newFunctionWithName:@"vertexShader"] autorelease]; + + // Load the fragment function from the library + id fragmentFunction = [[defaultLibrary newFunctionWithName:@"fragmentShader"] autorelease]; + + // Configure a pipeline descriptor that is used to create a pipeline state + MTLRenderPipelineDescriptor *pipelineStateDescriptor = [[[MTLRenderPipelineDescriptor alloc] init] autorelease]; + pipelineStateDescriptor.label = @"Simple Pipeline"; + pipelineStateDescriptor.vertexFunction = vertexFunction; + pipelineStateDescriptor.fragmentFunction = fragmentFunction; + pipelineStateDescriptor.colorAttachments[0].pixelFormat = pixFormat; + _pixelFormat = pixFormat; + + NSError* error = nil; + _pipelineState = [_gpuDevice newRenderPipelineStateWithDescriptor:pipelineStateDescriptor + error:&error]; + if (error != nil) + { + NSLog (@"Error generating brightness pipeline state: %@", error); + } + + if (_commandQueueCache != nil) + { + _commandQueueCacheLock = [[NSLock alloc] init]; + } + + if ((_gpuDevice == nil) || (_commandQueueCache == nil) || (_commandQueueCacheLock == nil) || + (_pipelineState == nil)) + { + [self release]; + self = nil; + } + } + + return self; +} + +- (void)dealloc +{ + [_gpuDevice release]; + [_commandQueueCache release]; + [_commandQueueCacheLock release]; + [_pipelineState release]; + + [super dealloc]; +} + +- (id)getNextFreeCommandQueue +{ + id result = nil; + + [_commandQueueCacheLock lock]; + NSUInteger index = 0; + while ((result == nil) && (index < kMaxCommandQueues)) + { + NSMutableDictionary* nextCommandQueue = [_commandQueueCache objectAtIndex:index]; + NSNumber* inUse = [nextCommandQueue objectForKey:kKey_InUse]; + if (![inUse boolValue]) + { + [nextCommandQueue setObject:[NSNumber numberWithBool:YES] + forKey:kKey_InUse]; + result = [nextCommandQueue objectForKey:kKey_CommandQueue]; + } + index++; + } + [_commandQueueCacheLock unlock]; + + return result; +} + +- (void)returnCommandQueue:(id)commandQueue +{ + [_commandQueueCacheLock lock]; + + BOOL found = false; + NSUInteger index = 0; + while ((!found) && (index < kMaxCommandQueues)) + { + NSMutableDictionary* nextCommandQueuDict = [_commandQueueCache objectAtIndex:index]; + id nextCommandQueue = [nextCommandQueuDict objectForKey:kKey_CommandQueue]; + if (nextCommandQueue == commandQueue) + { + found = YES; + [nextCommandQueuDict setObject:[NSNumber numberWithBool:NO] + forKey:kKey_InUse]; + } + index++; + } + + [_commandQueueCacheLock unlock]; +} + +- (BOOL)containsCommandQueue:(id)commandQueue +{ + BOOL found = NO; + NSUInteger index = 0; + while ((!found) && (index < kMaxCommandQueues)) + { + NSMutableDictionary* nextCommandQueuDict = [_commandQueueCache objectAtIndex:index]; + id nextCommandQueue = [nextCommandQueuDict objectForKey:kKey_CommandQueue]; + if (nextCommandQueue == commandQueue) + { + found = YES; + } + index++; + } + + return found; +} + +@end + +@implementation MetalDeviceCache + ++ (MTLPixelFormat)MTLPixelFormatForImageTile:(FxImageTile*)imageTile +{ + MTLPixelFormat result = MTLPixelFormatRGBA16Float; + + switch (imageTile.ioSurface.pixelFormat) + { + case kCVPixelFormatType_128RGBAFloat: + result = MTLPixelFormatRGBA32Float; + break; + + case kCVPixelFormatType_32BGRA: + result = MTLPixelFormatBGRA8Unorm; + break; + + default: + break; + } + + return result; +} + ++ (MetalDeviceCache*)deviceCache; +{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + gDeviceCache = [[MetalDeviceCache alloc] init]; + }); + + return gDeviceCache; +} + +- (instancetype)init +{ + self = [super init]; + + if (self != nil) + { + NSArray>* devices = MTLCopyAllDevices(); + + deviceCaches = [[NSMutableArray alloc] initWithCapacity:devices.count]; + + for (id nextDevice in devices) + { + MetalDeviceCacheItem* newCacheItem = [[[MetalDeviceCacheItem alloc] initWithDevice:nextDevice + pixelFormat:MTLPixelFormatRGBA16Float] + autorelease]; + [deviceCaches addObject:newCacheItem]; + } + + [devices release]; + } + + return self; +} + +- (void)dealloc +{ + [deviceCaches release]; + + [super dealloc]; +} + +- (id)deviceWithRegistryID:(uint64_t)registryID +{ + for (MetalDeviceCacheItem* nextCacheItem in deviceCaches) + { + if (nextCacheItem.gpuDevice.registryID == registryID) + { + return nextCacheItem.gpuDevice; + } + } + + return nil; +} + +- (id)pipelineStateWithRegistryID:(uint64_t)registryID + pixelFormat:(MTLPixelFormat)pixFormat +{ + for (MetalDeviceCacheItem* nextCacheItem in deviceCaches) + { + if ((nextCacheItem.gpuDevice.registryID == registryID) && + (nextCacheItem.pixelFormat == pixFormat)) + { + return nextCacheItem.pipelineState; + } + } + // Didn't find one, so create one with the right settings + NSArray>* devices = MTLCopyAllDevices(); + id device = nil; + for (id nextDevice in devices) + { + if (nextDevice.registryID == registryID) + { + device = nextDevice; + } + } + + id result = nil; + if (device != nil) + { + MetalDeviceCacheItem* newCacheItem = [[[MetalDeviceCacheItem alloc] initWithDevice:device + pixelFormat:pixFormat] + autorelease]; + if (newCacheItem != nil) + { + [deviceCaches addObject:newCacheItem]; + result = newCacheItem.pipelineState; + } + } + [devices release]; + return result; +} + +- (id)commandQueueWithRegistryID:(uint64_t)registryID + pixelFormat:(MTLPixelFormat)pixFormat; +{ + for (MetalDeviceCacheItem* nextCacheItem in deviceCaches) + { + if ((nextCacheItem.gpuDevice.registryID == registryID) && + (nextCacheItem.pixelFormat == pixFormat)) + { + return [nextCacheItem getNextFreeCommandQueue]; + } + } + + // Didn't find one, so create one with the right settings + NSArray>* devices = MTLCopyAllDevices(); + id device = nil; + for (id nextDevice in devices) + { + if (nextDevice.registryID == registryID) + { + device = nextDevice; + } + } + + id result = nil; + if (device != nil) + { + MetalDeviceCacheItem* newCacheItem = [[[MetalDeviceCacheItem alloc] initWithDevice:device + pixelFormat:pixFormat] + autorelease]; + if (newCacheItem != nil) + { + [deviceCaches addObject:newCacheItem]; + result = [newCacheItem getNextFreeCommandQueue]; + } + } + [devices release]; + return result; +} + +- (void)returnCommandQueueToCache:(id)commandQueue; +{ + for (MetalDeviceCacheItem* nextCacheItem in deviceCaches) + { + if ([nextCacheItem containsCommandQueue:commandQueue]) + { + [nextCacheItem returnCommandQueue:commandQueue]; + break; + } + } +} + +@end diff --git a/大鱼调色/Plugin/TileableRemoteBrightness.metal b/大鱼调色/Plugin/TileableRemoteBrightness.metal new file mode 100644 index 0000000..5393149 --- /dev/null +++ b/大鱼调色/Plugin/TileableRemoteBrightness.metal @@ -0,0 +1,83 @@ +// +// TileableRemoteBrightness.metal +// 大鱼调色 +// +// Created by mac on 2026/10/31. +// + +#include +#include + +using namespace metal; + +#include "TileableRemoteBrightnessShaderTypes.h" + +typedef struct +{ + // The [[position]] attribute of this member indicates that this value is the clip space + // position of the vertex when this structure is returned from the vertex function + float4 clipSpacePosition [[position]]; + + // Since this member does not have a special attribute, the rasterizer interpolates + // its value with the values of the other triangle vertices and then passes + // the interpolated value to the fragment shader for each fragment in the triangle + float2 textureCoordinate; + +} RasterizerData; + +vertex RasterizerData +vertexShader(uint vertexID [[vertex_id]], + constant Vertex2D *vertexArray [[buffer(BVI_Vertices)]], + constant vector_uint2 *viewportSizePointer [[buffer(BVI_ViewportSize)]]) +{ + RasterizerData out; + + // Index into our array of positions to get the current vertex + // Our positions are specified in pixel dimensions (i.e. a value of 100 is 100 pixels from + // the origin) + float2 pixelSpacePosition = vertexArray[vertexID].position.xy; + + // Get the size of the drawable so that we can convert to normalized device coordinates, + float2 viewportSize = float2(*viewportSizePointer); + + // The output position of every vertex shader is in clip space (also known as normalized device + // coordinate space, or NDC). A value of (-1.0, -1.0) in clip-space represents the + // lower-left corner of the viewport whereas (1.0, 1.0) represents the upper-right corner of + // the viewport. + + // In order to convert from positions in pixel space to positions in clip space we divide the + // pixel coordinates by half the size of the viewport. + out.clipSpacePosition.xy = pixelSpacePosition / (viewportSize / 2.0); + + // Set the z component of our clip space position 0 (since we're only rendering in + // 2-Dimensions for this sample) + out.clipSpacePosition.z = 0.0; + + // Set the w component to 1.0 since we don't need a perspective divide, which is also not + // necessary when rendering in 2-Dimensions + out.clipSpacePosition.w = 1.0; + + // Pass our input textureCoordinate straight to our output RasterizerData. This value will be + // interpolated with the other textureCoordinate values in the vertices that make up the + // triangle. + out.textureCoordinate = vertexArray[vertexID].textureCoordinate; + + return out; +} + +// Fragment function +fragment float4 fragmentShader(RasterizerData in [[stage_in]], + texture2d colorTexture [[ texture(BTI_InputImage) ]], + constant float* brightness [[ buffer(BFI_Brightness) ]]) +{ + constexpr sampler textureSampler (mag_filter::linear, + min_filter::linear); + + // Sample the texture to obtain a color + half4 colorSample = colorTexture.sample(textureSampler, in.textureCoordinate); + const half hBrightness = static_cast(*brightness); + colorSample.rgb = colorSample.rgb * hBrightness; + + // We return the color of the texture + return float4(colorSample); +} diff --git a/大鱼调色/Plugin/TileableRemoteBrightnessShaderTypes.h b/大鱼调色/Plugin/TileableRemoteBrightnessShaderTypes.h new file mode 100644 index 0000000..5bc047c --- /dev/null +++ b/大鱼调色/Plugin/TileableRemoteBrightnessShaderTypes.h @@ -0,0 +1,32 @@ +// +// TileableRemoteBrightnessShaderTypes.h +// 大鱼调色 +// +// Created by mac on 2026/10/31. +// + +#ifndef TileableRemoteBrightnessShaderTypes_h +#define TileableRemoteBrightnessShaderTypes_h + +#import + +typedef enum BrightnessVertexInputIndex { + BVI_Vertices = 0, + BVI_ViewportSize = 1 +} BrightnessVertexInputIndex; + +typedef enum BrightnessTextureIndex { + BTI_InputImage = 0 +} BrightnessTextureIndex; + +typedef enum BrightnessFragmentIndex { + BFI_Brightness = 0 +} BrightnessFragmentIndex; + +typedef struct Vertex2D { + vector_float2 position; + vector_float2 textureCoordinate; +} Vertex2D; + + +#endif /* TileableRemoteBrightnessShaderTypes_h */ diff --git a/大鱼调色/Plugin/____PlugIn.h b/大鱼调色/Plugin/____PlugIn.h new file mode 100644 index 0000000..aedf6b4 --- /dev/null +++ b/大鱼调色/Plugin/____PlugIn.h @@ -0,0 +1,8 @@ +//___FILEHEADER___ + +#import +#import + +@interface ___PACKAGENAMEASIDENTIFIER___PlugIn : NSObject +@property (assign) id apiManager; +@end diff --git a/大鱼调色/Plugin/____PlugIn.m b/大鱼调色/Plugin/____PlugIn.m new file mode 100644 index 0000000..d302bc8 --- /dev/null +++ b/大鱼调色/Plugin/____PlugIn.m @@ -0,0 +1,315 @@ +//___FILEHEADER___ + +#import "___PACKAGENAMEASIDENTIFIER___PlugIn.h" +#import +#import "TileableRemoteBrightnessShaderTypes.h" +#import "MetalDeviceCache.h" + +@implementation ___PACKAGENAMEASIDENTIFIER___PlugIn + +//--------------------------------------------------------- +// initWithAPIManager: +// +// This method is called when a plug-in is first loaded, and +// is a good point to conduct any checks for anti-piracy or +// system compatibility. Returning NULL means that a plug-in +// chooses not to be accessible for some reason. +//--------------------------------------------------------- + +- (nullable instancetype)initWithAPIManager:(id)newApiManager; +{ + self = [super init]; + if (self != nil) + { + _apiManager = newApiManager; + } + return self; +} + +//--------------------------------------------------------- +// properties +// +// This method should return an NSDictionary defining the +// properties of the effect. +//--------------------------------------------------------- + +- (BOOL)properties:(NSDictionary * _Nonnull *)properties + error:(NSError * _Nullable *)error +{ + *properties = @{ + kFxPropertyKey_MayRemapTime : [NSNumber numberWithBool:NO], + kFxPropertyKey_PixelTransformSupport : [NSNumber numberWithInt:kFxPixelTransform_ScaleTranslate], + kFxPropertyKey_VariesWhenParamsAreStatic : [NSNumber numberWithBool:NO] + }; + + return YES; +} + +//--------------------------------------------------------- +// addParametersWithError +// +// This method is where a plug-in defines its list of parameters. +//--------------------------------------------------------- + +- (BOOL)addParametersWithError:(NSError**)error +{ + id paramAPI = [_apiManager apiForProtocol:@protocol(FxParameterCreationAPI_v5)]; + if (paramAPI == nil) + { + NSDictionary* userInfo = @{ + NSLocalizedDescriptionKey : @"Unable to obtain an FxPlug API Object" + }; + if (error != NULL) + *error = [NSError errorWithDomain:FxPlugErrorDomain + code:kFxError_APIUnavailable + userInfo:userInfo]; + + return NO; + } + + if (![paramAPI addFloatSliderWithName:@"Brightness" + parameterID:1 + defaultValue:1.0 + parameterMin:0.0 + parameterMax:100.0 + sliderMin:0.0 + sliderMax:10.0 + delta:0.1 + parameterFlags:kFxParameterFlag_DEFAULT]) + { + NSDictionary* userInfo = @{ + NSLocalizedDescriptionKey : @"Unable to add brightness slider" + }; + if (error != NULL) + *error = [NSError errorWithDomain:FxPlugErrorDomain + code:kFxError_InvalidParameter + userInfo:userInfo]; + + return NO; + } + + return YES; +} + +//--------------------------------------------------------- +// pluginState:atTime:quality:error +// +// Your plug-in should get its parameter values, do any calculations it needs to +// from those values, and package up the result to be used later with rendering. +// The host application will call this method before rendering. The +// FxParameterRetrievalAPI* is valid during this call. Use it to get the values of +// your plug-in's parameters, then put those values or the results of any calculations +// you need to do with those parameters to render into an NSData that you return +// to the host application. The host will pass it back to you during subsequent calls. +// Do not re-use the NSData; always create a new one as this method may be called +// on multiple threads at the same time. +//--------------------------------------------------------- + +- (BOOL)pluginState:(NSData**)pluginState + atTime:(CMTime)renderTime + quality:(FxQuality)qualityLevel + error:(NSError**)error +{ + BOOL succeeded = NO; + id paramGetAPI = [_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]; + if (paramGetAPI != nil) + { + double brightness = 1.0; + [paramGetAPI getFloatValue:&brightness + fromParameter:1 + atTime:renderTime]; + + *pluginState = [NSData dataWithBytes:&brightness + length:sizeof(brightness)]; + + if (*pluginState != nil) + { + succeeded = YES; + } + } + else + { + if (error != NULL) + *error = [NSError errorWithDomain:FxPlugErrorDomain + code:kFxError_ThirdPartyDeveloperStart + 20 + userInfo:@{ + NSLocalizedDescriptionKey : + @"Unable to retrieve FxParameterRetrievalAPI_v6 in \ + [-pluginStateAtTime:]" }]; + } + + return succeeded; +} + +//--------------------------------------------------------- +// destinationImageRect:sourceImages:destinationImage:pluginState:atTime:error +// +// This method will calculate the rectangular bounds of the output +// image given the various inputs and plug-in state +// at the given render time. +// It will pass in an array of images, the plug-in state +// returned from your plug-in's -pluginStateAtTime:error: method, +// and the render time. +//--------------------------------------------------------- + +- (BOOL)destinationImageRect:(FxRect *)destinationImageRect + sourceImages:(NSArray *)sourceImages + destinationImage:(nonnull FxImageTile *)destinationImage + pluginState:(NSData *)pluginState + atTime:(CMTime)renderTime + error:(NSError * _Nullable *)outError +{ + if (sourceImages.count < 1) + { + NSLog (@"No inputImages list"); + return NO; + } + + // In the case of a filter that only changed RGB values, + // the output rect is the same as the input rect. + *destinationImageRect = sourceImages [ 0 ].imagePixelBounds; + + return YES; + +} + +//--------------------------------------------------------- +// sourceTileRect:sourceImageIndex:sourceImages:destinationTileRect:destinationImage:pluginState:atTime:error +// +// Calculate tile of the source image we need +// to render the given output tile. +//--------------------------------------------------------- + +- (BOOL)sourceTileRect:(FxRect *)sourceTileRect + sourceImageIndex:(NSUInteger)sourceImageIndex + sourceImages:(NSArray *)sourceImages + destinationTileRect:(FxRect)destinationTileRect + destinationImage:(FxImageTile *)destinationImage + pluginState:(NSData *)pluginState + atTime:(CMTime)renderTime + error:(NSError * _Nullable *)outError +{ + // Since this is a color-only filter, the input tile will be the same size as the output tile + *sourceTileRect = destinationTileRect; + + return YES; +} + +//--------------------------------------------------------- +// renderDestinationImage:sourceImages:pluginState:atTime:error: +// +// The host will call this method when it wants your plug-in to render an image +// tile of the output image. It will pass in each of the input tiles needed as well +// as the plug-in state needed for the calculations. Your plug-in should do all its +// rendering in this method. It should not attempt to use the FxParameterRetrievalAPI* +// object as it is invalid at this time. Note that this method will be called on +// multiple threads at the same time. +//--------------------------------------------------------- + +- (BOOL)renderDestinationImage:(FxImageTile *)destinationImage + sourceImages:(NSArray *)sourceImages + pluginState:(NSData *)pluginState + atTime:(CMTime)renderTime + error:(NSError * _Nullable *)outError +{ + if ((pluginState == nil) || (sourceImages [ 0 ].ioSurface == nil) || (destinationImage.ioSurface == nil)) + { + NSDictionary* userInfo = @{ + NSLocalizedDescriptionKey : @"Invalid plugin state received from host" + }; + if (outError != NULL) + *outError = [NSError errorWithDomain:FxPlugErrorDomain + code:kFxError_InvalidParameter + userInfo:userInfo]; + return NO; + } + + // This is where you would access parameter values and other info about the source tile + // from the pluginState. + double brightness = 0.0; + [pluginState getBytes:&brightness + length:sizeof(brightness)]; + + // Set up the renderer, in this case we are using Metal. + + MetalDeviceCache* deviceCache = [MetalDeviceCache deviceCache]; + MTLPixelFormat pixelFormat = [MetalDeviceCache MTLPixelFormatForImageTile:destinationImage]; + id commandQueue = [deviceCache commandQueueWithRegistryID:sourceImages[0].deviceRegistryID + pixelFormat:pixelFormat]; + if (commandQueue == nil) + { + return NO; + } + + id commandBuffer = [commandQueue commandBuffer]; + commandBuffer.label = @"DynamicRegXPC Command Buffer"; + [commandBuffer enqueue]; + + id inputTexture = [sourceImages[0] metalTextureForDevice:[deviceCache deviceWithRegistryID:sourceImages[0].deviceRegistryID]]; + id outputTexture = [destinationImage metalTextureForDevice:[deviceCache deviceWithRegistryID:destinationImage.deviceRegistryID]]; + + MTLRenderPassColorAttachmentDescriptor* colorAttachmentDescriptor = [[MTLRenderPassColorAttachmentDescriptor alloc] init]; + colorAttachmentDescriptor.texture = outputTexture; + colorAttachmentDescriptor.clearColor = MTLClearColorMake(1.0, 0.5, 0.0, 1.0); + colorAttachmentDescriptor.loadAction = MTLLoadActionClear; + MTLRenderPassDescriptor* renderPassDescriptor = [MTLRenderPassDescriptor renderPassDescriptor]; + renderPassDescriptor.colorAttachments [ 0 ] = colorAttachmentDescriptor; + id commandEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor]; + + // Rendering + float outputWidth = (float)(destinationImage.tilePixelBounds.right - destinationImage.tilePixelBounds.left); + float outputHeight = (float)(destinationImage.tilePixelBounds.top - destinationImage.tilePixelBounds.bottom); + Vertex2D vertices[] = { + { { outputWidth / 2.0, -outputHeight / 2.0 }, { 1.0, 1.0 } }, + { { -outputWidth / 2.0, -outputHeight / 2.0 }, { 0.0, 1.0 } }, + { { outputWidth / 2.0, outputHeight / 2.0 }, { 1.0, 0.0 } }, + { { -outputWidth / 2.0, outputHeight / 2.0 }, { 0.0, 0.0 } } + }; + + MTLViewport viewport = { + 0, 0, outputWidth, outputHeight, -1.0, 1.0 + }; + [commandEncoder setViewport:viewport]; + + id pipelineState = [deviceCache pipelineStateWithRegistryID:sourceImages[0].deviceRegistryID + pixelFormat:pixelFormat]; + [commandEncoder setRenderPipelineState:pipelineState]; + + [commandEncoder setVertexBytes:vertices + length:sizeof(vertices) + atIndex:BVI_Vertices]; + + simd_uint2 viewportSize = { + (unsigned int)(outputWidth), + (unsigned int)(outputHeight) + }; + [commandEncoder setVertexBytes:&viewportSize + length:sizeof(viewportSize) + atIndex:BVI_ViewportSize]; + + [commandEncoder setFragmentTexture:inputTexture + atIndex:BTI_InputImage]; + + float fragmentBrightness = (float)brightness; + [commandEncoder setFragmentBytes:&fragmentBrightness + length:sizeof(fragmentBrightness) + atIndex:BFI_Brightness]; + + [commandEncoder drawPrimitives:MTLPrimitiveTypeTriangleStrip + vertexStart:0 + vertexCount:4]; + + [commandEncoder endEncoding]; + [commandBuffer commit]; + + [commandBuffer waitUntilCompleted]; + + [colorAttachmentDescriptor release]; + + [deviceCache returnCommandQueueToCache:commandQueue]; + + return YES; + +} + +@end diff --git a/大鱼调色/Plugin/en.lproj/InfoPlist.strings b/大鱼调色/Plugin/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..750eeb6 --- /dev/null +++ b/大鱼调色/Plugin/en.lproj/InfoPlist.strings @@ -0,0 +1,3 @@ +/* Localized versions of Info.plist keys */ + +"____::FxPlug Name" = "大鱼调色"; diff --git a/大鱼调色/Plugin/en.lproj/Localizable.strings b/大鱼调色/Plugin/en.lproj/Localizable.strings new file mode 100644 index 0000000..0493986 --- /dev/null +++ b/大鱼调色/Plugin/en.lproj/Localizable.strings @@ -0,0 +1,4 @@ +/* Localized versions of Info.plist keys */ + +"____::FxPlug Description" = "A helpful description of\nwhat this plugin does."; + diff --git a/大鱼调色/Plugin/main.m b/大鱼调色/Plugin/main.m new file mode 100644 index 0000000..34d50d3 --- /dev/null +++ b/大鱼调色/Plugin/main.m @@ -0,0 +1,6 @@ +#import + +int main(int argc, const char *argv[]) +{ + [FxPrincipal startServicePrincipal]; +} diff --git a/大鱼调色/Wrapper Application/AppDelegate.h b/大鱼调色/Wrapper Application/AppDelegate.h new file mode 100644 index 0000000..ab3caf2 --- /dev/null +++ b/大鱼调色/Wrapper Application/AppDelegate.h @@ -0,0 +1,13 @@ +// +// AppDelegate.h +// 大鱼调色 +// +// Created by mac on 2026/10/31. +// + +#import + +@interface AppDelegate : NSObject + +@end + diff --git a/大鱼调色/Wrapper Application/AppDelegate.m b/大鱼调色/Wrapper Application/AppDelegate.m new file mode 100644 index 0000000..a8057a7 --- /dev/null +++ b/大鱼调色/Wrapper Application/AppDelegate.m @@ -0,0 +1,27 @@ +// +// AppDelegate.m +// 大鱼调色 +// +// Created by mac on 2026/10/31. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@property (weak) IBOutlet NSWindow *window; +@end + +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +} + + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + + +@end diff --git a/大鱼调色/Wrapper Application/Base.lproj/MainMenu.xib b/大鱼调色/Wrapper Application/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..fcd15a1 --- /dev/null +++ b/大鱼调色/Wrapper Application/Base.lproj/MainMenu.xib @@ -0,0 +1,693 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist new file mode 100644 index 0000000..32d5337 --- /dev/null +++ b/大鱼调色/Wrapper Application/Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + + LSApplicationCategoryType + public.app-category.video + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/大鱼调色/Wrapper Application/SandboxEntitlements.entitlements b/大鱼调色/Wrapper Application/SandboxEntitlements.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/大鱼调色/Wrapper Application/SandboxEntitlements.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/大鱼调色/Wrapper Application/en.lproj/Credits.rtf b/大鱼调色/Wrapper Application/en.lproj/Credits.rtf new file mode 100644 index 0000000..da779d0 --- /dev/null +++ b/大鱼调色/Wrapper Application/en.lproj/Credits.rtf @@ -0,0 +1,8 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1228 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\vieww9600\viewh8400\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 +Text here +\f0\fs24 \cf0 \ +} \ No newline at end of file diff --git a/大鱼调色/Wrapper Application/en.lproj/InfoPlist.strings b/大鱼调色/Wrapper Application/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..e69de29 diff --git a/大鱼调色/Wrapper Application/main.m b/大鱼调色/Wrapper Application/main.m new file mode 100644 index 0000000..99ad438 --- /dev/null +++ b/大鱼调色/Wrapper Application/main.m @@ -0,0 +1,7 @@ + +#import + +int main(int argc, const char * argv[]) +{ + return NSApplicationMain(argc, argv); +}