From 7b948d6c2752be20438021eca94b7a73a29fc319 Mon Sep 17 00:00:00 2001 From: Palle Klewitz Date: Sun, 7 Feb 2016 19:16:32 +0100 Subject: [PATCH] First Github release --- .gitignore | 23 ++ Mandelbrot2.xcodeproj/project.pbxproj | 165 +------- .../contents.xcworkspacedata | 2 +- Mandelbrot2/AnimationSetupViewController.h | 19 +- Mandelbrot2/AnimationSetupViewController.m | 34 +- Mandelbrot2/AppDelegate.h | 35 +- Mandelbrot2/AppDelegate.m | 111 +++++- Mandelbrot2/Base.lproj/Main.storyboard | 369 ++++++++++-------- Mandelbrot2/CLMandelbrotView.h | 39 +- Mandelbrot2/CLMandelbrotView.m | 301 +++++++------- Mandelbrot2/CVImageUtils.h | 22 -- Mandelbrot2/CVImageUtils.m | 49 --- Mandelbrot2/Info.plist | 8 +- .../MandelbrotControlPanelViewController.h | 43 ++ .../MandelbrotControlPanelViewController.m | 98 +++++ Mandelbrot2/MandelbrotRenderViewController.h | 22 +- Mandelbrot2/MandelbrotRenderViewController.m | 36 +- Mandelbrot2/MandelbrotRenderer.h | 23 +- Mandelbrot2/MandelbrotRenderer.m | 109 +++--- Mandelbrot2/UnifiedTitleBarWindowController.h | 21 +- Mandelbrot2/UnifiedTitleBarWindowController.m | 19 +- Mandelbrot2/de.lproj/Main.strings | 93 +++-- Mandelbrot2/en.lproj/Main.strings | 333 ++++++++++++++++ Mandelbrot2/kernels.cl | 250 +++++------- Mandelbrot2/main.m | 19 +- Mandelbrot2Tests/Info.plist | 24 -- Mandelbrot2Tests/Mandelbrot2Tests.m | 40 -- 27 files changed, 1424 insertions(+), 883 deletions(-) create mode 100644 .gitignore delete mode 100644 Mandelbrot2/CVImageUtils.h delete mode 100644 Mandelbrot2/CVImageUtils.m create mode 100644 Mandelbrot2/MandelbrotControlPanelViewController.h create mode 100644 Mandelbrot2/MandelbrotControlPanelViewController.m create mode 100644 Mandelbrot2/en.lproj/Main.strings delete mode 100644 Mandelbrot2Tests/Info.plist delete mode 100644 Mandelbrot2Tests/Mandelbrot2Tests.m diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e7ab489 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xccheckout +*.xcscmblueprint \ No newline at end of file diff --git a/Mandelbrot2.xcodeproj/project.pbxproj b/Mandelbrot2.xcodeproj/project.pbxproj index 4b1b882..1084e95 100644 --- a/Mandelbrot2.xcodeproj/project.pbxproj +++ b/Mandelbrot2.xcodeproj/project.pbxproj @@ -8,7 +8,7 @@ /* Begin PBXBuildFile section */ E64D57691B72E400006DF75A /* UnifiedTitleBarWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = E64D57681B72E400006DF75A /* UnifiedTitleBarWindowController.m */; }; - E6AADCA31B74592B006CE608 /* CVImageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = E6AADCA21B74592B006CE608 /* CVImageUtils.m */; }; + E64D6C8A1B7972C300FBA7B2 /* MandelbrotControlPanelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E64D6C891B7972C300FBA7B2 /* MandelbrotControlPanelViewController.m */; }; E6CE1F0E1B742DEB004B5DCC /* AnimationSetupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E6CE1F0D1B742DEB004B5DCC /* AnimationSetupViewController.m */; }; E6F918151B72FA8200EE5029 /* MandelbrotRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = E6F918141B72FA8200EE5029 /* MandelbrotRenderer.m */; }; E6FAF680199EED9A009792F6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FAF67F199EED9A009792F6 /* main.m */; }; @@ -16,7 +16,6 @@ E6FAF686199EED9A009792F6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FAF685199EED9A009792F6 /* AppDelegate.m */; }; E6FAF688199EED9A009792F6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E6FAF687199EED9A009792F6 /* Images.xcassets */; }; E6FAF68B199EED9A009792F6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E6FAF689199EED9A009792F6 /* Main.storyboard */; }; - E6FAF697199EED9A009792F6 /* Mandelbrot2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FAF696199EED9A009792F6 /* Mandelbrot2Tests.m */; }; E6FAF6A2199EEEAD009792F6 /* CLMandelbrotView.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FAF6A1199EEEAD009792F6 /* CLMandelbrotView.m */; }; E6FAF6A5199EEFC4009792F6 /* OpenCL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6FAF6A3199EEFC4009792F6 /* OpenCL.framework */; }; E6FAF6A6199EEFC4009792F6 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6FAF6A4199EEFC4009792F6 /* OpenGL.framework */; }; @@ -26,27 +25,19 @@ E6FAF6AF199EF7B0009792F6 /* kernels.cl in Sources */ = {isa = PBXBuildFile; fileRef = E6FAF6AE199EF7B0009792F6 /* kernels.cl */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - E6FAF691199EED9A009792F6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = E6FAF672199EED9A009792F6 /* Project object */; - proxyType = 1; - remoteGlobalIDString = E6FAF679199EED9A009792F6; - remoteInfo = Mandelbrot2; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ E64D57671B72E400006DF75A /* UnifiedTitleBarWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnifiedTitleBarWindowController.h; sourceTree = ""; }; E64D57681B72E400006DF75A /* UnifiedTitleBarWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UnifiedTitleBarWindowController.m; sourceTree = ""; }; - E6AADCA11B74592B006CE608 /* CVImageUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CVImageUtils.h; sourceTree = ""; }; - E6AADCA21B74592B006CE608 /* CVImageUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CVImageUtils.m; sourceTree = ""; }; + E64D6C881B7972C300FBA7B2 /* MandelbrotControlPanelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MandelbrotControlPanelViewController.h; sourceTree = ""; }; + E64D6C891B7972C300FBA7B2 /* MandelbrotControlPanelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MandelbrotControlPanelViewController.m; sourceTree = ""; }; + E656B76C1C67BCB100E39A99 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; + E656B76D1C67C13400E39A99 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = SOURCE_ROOT; }; E6AADCA41B74ECBB006CE608 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = ""; }; E6CE1F0C1B742DEB004B5DCC /* AnimationSetupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationSetupViewController.h; sourceTree = ""; }; E6CE1F0D1B742DEB004B5DCC /* AnimationSetupViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnimationSetupViewController.m; sourceTree = ""; }; E6F918131B72FA8200EE5029 /* MandelbrotRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MandelbrotRenderer.h; sourceTree = ""; }; E6F918141B72FA8200EE5029 /* MandelbrotRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MandelbrotRenderer.m; sourceTree = ""; }; - E6FAF67A199EED9A009792F6 /* Mandelbrot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mandelbrot.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E6FAF67A199EED9A009792F6 /* Mandelbrot2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mandelbrot2.app; sourceTree = BUILT_PRODUCTS_DIR; }; E6FAF67E199EED9A009792F6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E6FAF67F199EED9A009792F6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; E6FAF681199EED9A009792F6 /* MandelbrotRenderViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MandelbrotRenderViewController.h; sourceTree = ""; }; @@ -55,9 +46,6 @@ E6FAF685199EED9A009792F6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; E6FAF687199EED9A009792F6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; E6FAF68A199EED9A009792F6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - E6FAF690199EED9A009792F6 /* Mandelbrot2Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Mandelbrot2Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - E6FAF695199EED9A009792F6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E6FAF696199EED9A009792F6 /* Mandelbrot2Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Mandelbrot2Tests.m; sourceTree = ""; }; E6FAF6A0199EEEAD009792F6 /* CLMandelbrotView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLMandelbrotView.h; sourceTree = ""; }; E6FAF6A1199EEEAD009792F6 /* CLMandelbrotView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CLMandelbrotView.m; sourceTree = ""; }; E6FAF6A3199EEFC4009792F6 /* OpenCL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenCL.framework; path = System/Library/Frameworks/OpenCL.framework; sourceTree = SDKROOT; }; @@ -81,21 +69,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - E6FAF68D199EED9A009792F6 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ E6FAF671199EED9A009792F6 = { isa = PBXGroup; children = ( - E6FAF67C199EED9A009792F6 /* Mandelbrot2 */, - E6FAF693199EED9A009792F6 /* Mandelbrot2Tests */, + E656B76D1C67C13400E39A99 /* .gitignore */, + E6FAF67C199EED9A009792F6 /* Mandelbrot */, E6FAF6AB199EF000009792F6 /* Frameworks */, E6FAF67B199EED9A009792F6 /* Products */, ); @@ -104,17 +85,14 @@ E6FAF67B199EED9A009792F6 /* Products */ = { isa = PBXGroup; children = ( - E6FAF67A199EED9A009792F6 /* Mandelbrot.app */, - E6FAF690199EED9A009792F6 /* Mandelbrot2Tests.xctest */, + E6FAF67A199EED9A009792F6 /* Mandelbrot2.app */, ); name = Products; sourceTree = ""; }; - E6FAF67C199EED9A009792F6 /* Mandelbrot2 */ = { + E6FAF67C199EED9A009792F6 /* Mandelbrot */ = { isa = PBXGroup; children = ( - E6AADCA11B74592B006CE608 /* CVImageUtils.h */, - E6AADCA21B74592B006CE608 /* CVImageUtils.m */, E6FAF684199EED9A009792F6 /* AppDelegate.h */, E6FAF685199EED9A009792F6 /* AppDelegate.m */, E6FAF681199EED9A009792F6 /* MandelbrotRenderViewController.h */, @@ -125,12 +103,15 @@ E6F918141B72FA8200EE5029 /* MandelbrotRenderer.m */, E6FAF6AE199EF7B0009792F6 /* kernels.cl */, E6FAF689199EED9A009792F6 /* Main.storyboard */, + E64D6C881B7972C300FBA7B2 /* MandelbrotControlPanelViewController.h */, + E64D6C891B7972C300FBA7B2 /* MandelbrotControlPanelViewController.m */, E6CE1F0C1B742DEB004B5DCC /* AnimationSetupViewController.h */, E6CE1F0D1B742DEB004B5DCC /* AnimationSetupViewController.m */, E64D57671B72E400006DF75A /* UnifiedTitleBarWindowController.h */, E64D57681B72E400006DF75A /* UnifiedTitleBarWindowController.m */, E6FAF67D199EED9A009792F6 /* Supporting Files */, ); + name = Mandelbrot; path = Mandelbrot2; sourceTree = ""; }; @@ -144,23 +125,6 @@ name = "Supporting Files"; sourceTree = ""; }; - E6FAF693199EED9A009792F6 /* Mandelbrot2Tests */ = { - isa = PBXGroup; - children = ( - E6FAF696199EED9A009792F6 /* Mandelbrot2Tests.m */, - E6FAF694199EED9A009792F6 /* Supporting Files */, - ); - path = Mandelbrot2Tests; - sourceTree = ""; - }; - E6FAF694199EED9A009792F6 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - E6FAF695199EED9A009792F6 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; E6FAF6AB199EF000009792F6 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -191,27 +155,9 @@ ); name = Mandelbrot; productName = Mandelbrot2; - productReference = E6FAF67A199EED9A009792F6 /* Mandelbrot.app */; + productReference = E6FAF67A199EED9A009792F6 /* Mandelbrot2.app */; productType = "com.apple.product-type.application"; }; - E6FAF68F199EED9A009792F6 /* Mandelbrot2Tests */ = { - isa = PBXNativeTarget; - buildConfigurationList = E6FAF69D199EED9A009792F6 /* Build configuration list for PBXNativeTarget "Mandelbrot2Tests" */; - buildPhases = ( - E6FAF68C199EED9A009792F6 /* Sources */, - E6FAF68D199EED9A009792F6 /* Frameworks */, - E6FAF68E199EED9A009792F6 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - E6FAF692199EED9A009792F6 /* PBXTargetDependency */, - ); - name = Mandelbrot2Tests; - productName = Mandelbrot2Tests; - productReference = E6FAF690199EED9A009792F6 /* Mandelbrot2Tests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -224,10 +170,6 @@ E6FAF679199EED9A009792F6 = { CreatedOnToolsVersion = 6.0; }; - E6FAF68F199EED9A009792F6 = { - CreatedOnToolsVersion = 6.0; - TestTargetID = E6FAF679199EED9A009792F6; - }; }; }; buildConfigurationList = E6FAF675199EED9A009792F6 /* Build configuration list for PBXProject "Mandelbrot2" */; @@ -244,7 +186,6 @@ projectRoot = ""; targets = ( E6FAF679199EED9A009792F6 /* Mandelbrot */, - E6FAF68F199EED9A009792F6 /* Mandelbrot2Tests */, ); }; /* End PBXProject section */ @@ -259,13 +200,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - E6FAF68E199EED9A009792F6 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -296,35 +230,20 @@ E6FAF6AF199EF7B0009792F6 /* kernels.cl in Sources */, E6FAF680199EED9A009792F6 /* main.m in Sources */, E6FAF686199EED9A009792F6 /* AppDelegate.m in Sources */, + E64D6C8A1B7972C300FBA7B2 /* MandelbrotControlPanelViewController.m in Sources */, E6FAF6A2199EEEAD009792F6 /* CLMandelbrotView.m in Sources */, - E6AADCA31B74592B006CE608 /* CVImageUtils.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E6FAF68C199EED9A009792F6 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E6FAF697199EED9A009792F6 /* Mandelbrot2Tests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - E6FAF692199EED9A009792F6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = E6FAF679199EED9A009792F6 /* Mandelbrot */; - targetProxy = E6FAF691199EED9A009792F6 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ E6FAF689199EED9A009792F6 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( E6FAF68A199EED9A009792F6 /* Base */, E6AADCA41B74ECBB006CE608 /* de */, + E656B76C1C67BCB100E39A99 /* en */, ); name = Main.storyboard; sourceTree = ""; @@ -367,7 +286,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -397,13 +316,14 @@ ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = fast; 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; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; }; @@ -435,44 +355,6 @@ }; name = Release; }; - E6FAF69E199EED9A009792F6 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Mandelbrot2Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "PK.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Mandelbrot2.app/Contents/MacOS/Mandelbrot2"; - }; - name = Debug; - }; - E6FAF69F199EED9A009792F6 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - INFOPLIST_FILE = Mandelbrot2Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "PK.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Mandelbrot2.app/Contents/MacOS/Mandelbrot2"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -494,15 +376,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - E6FAF69D199EED9A009792F6 /* Build configuration list for PBXNativeTarget "Mandelbrot2Tests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E6FAF69E199EED9A009792F6 /* Debug */, - E6FAF69F199EED9A009792F6 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = E6FAF672199EED9A009792F6 /* Project object */; diff --git a/Mandelbrot2.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Mandelbrot2.xcodeproj/project.xcworkspace/contents.xcworkspacedata index e8cf91b..b874d79 100644 --- a/Mandelbrot2.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/Mandelbrot2.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -3,7 +3,7 @@ version = "1.0"> + name = "Mandelbrot2"> diff --git a/Mandelbrot2/AnimationSetupViewController.h b/Mandelbrot2/AnimationSetupViewController.h index 452b497..8310efa 100644 --- a/Mandelbrot2/AnimationSetupViewController.h +++ b/Mandelbrot2/AnimationSetupViewController.h @@ -3,7 +3,24 @@ // Mandelbrot2 // // Created by Palle Klewitz on 07.08.15. -// Copyright © 2015 Palle Klewitz. All rights reserved. +// Copyright © 2015 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // @import Cocoa; diff --git a/Mandelbrot2/AnimationSetupViewController.m b/Mandelbrot2/AnimationSetupViewController.m index 69bfd39..d67bece 100644 --- a/Mandelbrot2/AnimationSetupViewController.m +++ b/Mandelbrot2/AnimationSetupViewController.m @@ -3,7 +3,24 @@ // Mandelbrot2 // // Created by Palle Klewitz on 07.08.15. -// Copyright © 2015 Palle Klewitz. All rights reserved. +// Copyright © 2015 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // #import "AnimationSetupViewController.h" @@ -46,7 +63,7 @@ - (void)viewDidLoad - (IBAction)renderButtonClicked:(id)sender { - /*NSSavePanel *savePanel = [[NSSavePanel alloc] init]; + NSSavePanel *savePanel = [[NSSavePanel alloc] init]; savePanel.title = @"Save Animation"; savePanel.showsHiddenFiles = NO; savePanel.canCreateDirectories = YES; @@ -57,13 +74,12 @@ - (IBAction)renderButtonClicked:(id)sender { if (result == NSModalResponseOK) { - + _renderer = [[MandelbrotRenderer alloc] init]; + _renderer.delegate = self; + _renderer.targetFile = [NSURL URLWithString:@"file:///Users/Palle/Desktop/mandelbrotanim.mov"]; + [self startRendering]; } - }];*/ - _renderer = [[MandelbrotRenderer alloc] init]; - _renderer.delegate = self; - _renderer.targetFile = [NSURL URLWithString:@"file:///Users/Palle/Desktop/mandelbrotanim.mov"]; - [self startRendering]; + }]; } - (void) startRendering @@ -77,8 +93,6 @@ - (void) startRendering NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; formatter.numberStyle = NSNumberFormatterDecimalStyle; - NSLog(@"startX: %f", [formatter numberFromString:_txtStartPositionX.stringValue].doubleValue); - _renderer.startX = [formatter numberFromString:_txtStartPositionX.stringValue].doubleValue; _renderer.startY = [formatter numberFromString:_txtStartPositionY.stringValue].doubleValue; _renderer.startZoom = [formatter numberFromString:_txtStartZoom.stringValue].doubleValue; diff --git a/Mandelbrot2/AppDelegate.h b/Mandelbrot2/AppDelegate.h index 2aea432..b42f5c7 100644 --- a/Mandelbrot2/AppDelegate.h +++ b/Mandelbrot2/AppDelegate.h @@ -3,7 +3,24 @@ // Mandelbrot2 // // Created by Palle Klewitz on 16.08.14. -// Copyright (c) 2014 Palle Klewitz. All rights reserved. +// Copyright (c) 2014 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // @import Cocoa; @@ -11,10 +28,21 @@ #define CreateAnimationWindow @"CreateAnimationWindow" #define MandelbrotRenderWindow @"MandelbrotRenderWindow" +#define MandelbrotControlPanel @"MandelbrotControlPanel" @interface AppDelegate : NSObject +@property (nonatomic, strong) NSWindowController *mandelbrotRenderWindow; +@property (nonatomic, strong) NSWindowController *mandelbrotControlPanel; +@property (nonatomic, strong) NSWindowController *mandelbrotAnimationWindow; @property (nonatomic, weak) MandelbrotRenderViewController *mainViewController; +@property (weak) IBOutlet NSMenuItem *miIterationBasedColoring; +@property (weak) IBOutlet NSMenuItem *miZeroPointBasedColoring; +@property (weak) IBOutlet NSMenuItem *miCombinedColoring; +@property (weak) IBOutlet NSMenuItem *miLinearColoring; +@property (weak) IBOutlet NSMenuItem *miLogarithmicColoring; +@property (weak) IBOutlet NSMenuItem *miInverseColoring; +@property (weak) IBOutlet NSMenuItem *miRootColoring; - (IBAction)resetZoom:(id)sender; - (IBAction)zoomIn:(id)sender; @@ -34,5 +62,10 @@ - (IBAction)showRenderView:(id)sender; - (IBAction)showControlPanel:(id)sender; + +- (IBAction)setColorMode:(NSMenuItem *)sender; +- (IBAction)setColorScale:(NSMenuItem *)sender; +- (IBAction)setSmoothColor:(NSMenuItem *)sender; + @end diff --git a/Mandelbrot2/AppDelegate.m b/Mandelbrot2/AppDelegate.m index 85fd488..3334c33 100644 --- a/Mandelbrot2/AppDelegate.m +++ b/Mandelbrot2/AppDelegate.m @@ -3,11 +3,29 @@ // Mandelbrot2 // // Created by Palle Klewitz on 16.08.14. -// Copyright (c) 2014 Palle Klewitz. All rights reserved. +// Copyright (c) 2014 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // #import "AppDelegate.h" #import "MandelbrotRenderViewController.h" +#import "CLMandelbrotView.h" @interface AppDelegate () @@ -88,12 +106,101 @@ - (IBAction)showRenderView:(id)sender } else { - + _mandelbrotRenderWindow = [[NSStoryboard storyboardWithName:@"Main" bundle:nil] instantiateInitialController]; } } - (IBAction)showControlPanel:(id)sender { + [_mainViewController showControlPanel:sender]; +} + +- (IBAction)setColorMode:(NSMenuItem *)sender +{ + if (sender == _miIterationBasedColoring) + { + _miZeroPointBasedColoring.state = NSOffState; + _miZeroPointBasedColoring.enabled = YES; + _miCombinedColoring.state = NSOffState; + _miCombinedColoring.enabled = YES; + _miIterationBasedColoring.enabled = NO; + _mainViewController.mandelbrotView.color_mode = 0; + } + else if (sender == _miZeroPointBasedColoring) + { + _miIterationBasedColoring.state = NSOffState; + _miIterationBasedColoring.enabled = YES; + _miCombinedColoring.state = NSOffState; + _miCombinedColoring.enabled = YES; + _miZeroPointBasedColoring.enabled = NO; + _mainViewController.mandelbrotView.color_mode = 1; + } + else + { + _miIterationBasedColoring.state = NSOffState; + _miIterationBasedColoring.enabled = YES; + _miZeroPointBasedColoring.state = NSOffState; + _miZeroPointBasedColoring.enabled = YES; + _miCombinedColoring.enabled = NO; + _mainViewController.mandelbrotView.color_mode = 2; + } +} + +- (IBAction)setColorScale:(NSMenuItem *)sender +{ + if (sender == _miLinearColoring) + { + _miLogarithmicColoring.state = NSOffState; + _miRootColoring.state = NSOffState; + _miInverseColoring.state = NSOffState; + _miLogarithmicColoring.enabled = YES; + _miRootColoring.enabled = YES; + _miInverseColoring.enabled = YES; + _mainViewController.mandelbrotView.color_scale = 0; + } + else if (sender == _miLogarithmicColoring) + { + _miLinearColoring.state = NSOffState; + _miRootColoring.state = NSOffState; + _miInverseColoring.state = NSOffState; + _miLinearColoring.enabled = YES; + _miRootColoring.enabled = YES; + _miInverseColoring.enabled = YES; + _mainViewController.mandelbrotView.color_scale = 1; + + } + else if (sender == _miInverseColoring) + { + _miLinearColoring.state = NSOffState; + _miRootColoring.state = NSOffState; + _miLogarithmicColoring.state = NSOffState; + _miLinearColoring.enabled = YES; + _miRootColoring.enabled = YES; + _miLogarithmicColoring.enabled = YES; + _mainViewController.mandelbrotView.color_scale = 2; + } + else + { + _miLinearColoring.state = NSOffState; + _miInverseColoring.state = NSOffState; + _miLogarithmicColoring.state = NSOffState; + _miLinearColoring.enabled = YES; + _miInverseColoring.enabled = YES; + _miLogarithmicColoring.enabled = YES; + _mainViewController.mandelbrotView.color_scale = 3; + } + sender.state = NSOnState; + sender.enabled = NO; } + +- (IBAction)setSmoothColor:(NSMenuItem *)sender +{ + if (sender.state == NSOnState) + sender.state = NSOffState; + else + sender.state = NSOnState; + _mainViewController.mandelbrotView.smooth_coloring = sender.state == NSOnState; +} + @end diff --git a/Mandelbrot2/Base.lproj/Main.storyboard b/Mandelbrot2/Base.lproj/Main.storyboard index ecf1389..0766250 100644 --- a/Mandelbrot2/Base.lproj/Main.storyboard +++ b/Mandelbrot2/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -31,12 +31,12 @@ - + - + @@ -48,7 +48,7 @@ - + @@ -66,7 +66,6 @@ - @@ -75,7 +74,6 @@ - @@ -84,7 +82,6 @@ - @@ -96,7 +93,6 @@ - @@ -104,21 +100,19 @@ - + - - + - @@ -126,7 +120,6 @@ - @@ -136,21 +129,19 @@ - + - - + - @@ -158,7 +149,6 @@ - @@ -168,21 +158,19 @@ - + - - + - @@ -190,7 +178,6 @@ - @@ -200,21 +187,19 @@ - + - - + - @@ -222,7 +207,6 @@ - @@ -236,21 +220,19 @@ - + - - + - @@ -258,7 +240,6 @@ - @@ -268,21 +249,19 @@ - + - - + - @@ -290,7 +269,6 @@ - @@ -301,7 +279,6 @@ - @@ -329,21 +306,19 @@ - + - - + - @@ -351,7 +326,6 @@ - @@ -361,21 +335,19 @@ - + - - + - @@ -383,7 +355,6 @@ - @@ -393,21 +364,19 @@ - + - - + - @@ -415,7 +384,6 @@ - @@ -430,16 +398,14 @@ - - + - @@ -447,7 +413,6 @@ - @@ -461,21 +426,19 @@ - + - - + - @@ -483,7 +446,6 @@ - @@ -493,21 +455,19 @@ - + - - + - @@ -515,7 +475,6 @@ - @@ -526,7 +485,6 @@ - @@ -556,16 +514,14 @@ - - + - @@ -573,7 +529,6 @@ - @@ -588,16 +543,14 @@ - - + - @@ -605,7 +558,6 @@ - @@ -617,7 +569,6 @@ - @@ -654,7 +604,6 @@ - @@ -663,7 +612,6 @@ - @@ -672,7 +620,6 @@ - @@ -696,38 +643,36 @@ - + - + - + - + - + - + - - + + - - + - @@ -735,7 +680,9 @@ - + + + @@ -745,21 +692,19 @@ - - + + - - + - @@ -767,7 +712,9 @@ - + + + @@ -777,21 +724,19 @@ - - + + - - + - @@ -799,7 +744,9 @@ - + + + @@ -810,20 +757,18 @@ - + - - + - @@ -831,10 +776,10 @@ - + @@ -845,21 +790,19 @@ - - + + - - + - @@ -867,7 +810,9 @@ - + + + @@ -877,21 +822,22 @@ - - + + - - + - + + + @@ -899,7 +845,45 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -910,13 +894,14 @@ - + + @@ -925,6 +910,7 @@ + @@ -933,47 +919,38 @@ + - - - - - + @@ -984,7 +961,6 @@ - @@ -993,7 +969,6 @@ - @@ -1002,21 +977,21 @@ - - - - - - - - + + + + + + + + - + @@ -1028,7 +1003,7 @@ - + @@ -1226,6 +1201,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1256,14 +1294,14 @@ - - + + - - + + @@ -1296,7 +1334,17 @@ - + + + + + + + + + + + @@ -1314,7 +1362,6 @@ - @@ -1350,7 +1397,6 @@ - @@ -1359,7 +1405,6 @@ - diff --git a/Mandelbrot2/CLMandelbrotView.h b/Mandelbrot2/CLMandelbrotView.h index 9622931..1b436d9 100644 --- a/Mandelbrot2/CLMandelbrotView.h +++ b/Mandelbrot2/CLMandelbrotView.h @@ -3,16 +3,33 @@ // Mandelbrot2 // // Created by Palle Klewitz on 16.08.14. -// Copyright (c) 2014 Palle Klewitz. All rights reserved. +// Copyright (c) 2014 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#import +@import Cocoa; +@import QuartzCore; +@import CoreGraphics; #import #import #import #import -#import -#import @class CLMandelbrotView; @@ -22,6 +39,13 @@ @end +@protocol CLMandelbrotViewControlDelegate + +- (void) mandelbrotView:(nonnull CLMandelbrotView *) mandelbrotView didUpdateProgress:(nonnull NSProgress *) progress; +- (void) mandelbrotViewDidChangeSetup:(nonnull CLMandelbrotView *) mandelbrotView; + +@end + @interface CLMandelbrotView : NSOpenGLView { unsigned int width; @@ -32,6 +56,9 @@ unsigned int iterations; double color_shift; double color_factor; + unsigned char color_mode; + unsigned char color_scale; + unsigned char smooth_coloring; double zoom; double previewZoom; @@ -79,6 +106,10 @@ @property (nonatomic, readwrite) unsigned int iterations; @property (nonatomic, readwrite) double color_shift; @property (nonatomic, readwrite) double color_factor; +@property (nonatomic, readwrite) unsigned char color_mode; @property (weak, nonatomic, readwrite, nullable) id delegate; +@property (weak, nonatomic, readwrite, nullable) id progressDelegate; +@property (nonatomic, readwrite) unsigned char smooth_coloring; +@property (nonatomic, readwrite) unsigned char color_scale; @end diff --git a/Mandelbrot2/CLMandelbrotView.m b/Mandelbrot2/CLMandelbrotView.m index 3bbb42f..a44d66f 100644 --- a/Mandelbrot2/CLMandelbrotView.m +++ b/Mandelbrot2/CLMandelbrotView.m @@ -3,7 +3,24 @@ // Mandelbrot2 // // Created by Palle Klewitz on 16.08.14. -// Copyright (c) 2014 Palle Klewitz. All rights reserved. +// Copyright (c) 2014 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // #import "CLMandelbrotView.h" @@ -15,59 +32,11 @@ @implementation CLMandelbrotView #pragma mark - Tiling -/* - def spiral(X, Y): - x = y = 0 - dx = 0 - dy = -1 - for i in range(max(X, Y)**2): - if (-X/2 < x <= X/2) and (-Y/2 < y <= Y/2): - print (x, y) - # DO STUFF... - if x == y or (x < 0 and x == -y) or (x > 0 and x == 1-y): - dx, dy = -dy, dx - x, y = x+dx, y+dy - */ - cl_int2 NthTilePosition(unsigned int n, int tilesX, int tilesY) { n = tilesX * tilesY - 1 - n; - cl_int2 tilePosition; - /* - int x = 0; - int y = 0; - - int dx = 0; - int dy = -1; - - //int maxSQ = (int)MAX(tilesX, tilesY) * (int)MAX(tilesX, tilesY); - - //int tileNum = 0; - - for (unsigned int i = 0; i < n;) - { - if (-tilesX/2 < x && x <= tilesX/2 && -tilesY/2 < y && y <= tilesY/2) - { - i++; - } - if (x == y || (x < 0 && x == -y) || (x > 0 && x == 1-y)) - { - int cache = dx; - dx = -dy; - dy = cache; - } - if (i < n) - { - x += dx; - y += dy; - } - } - - tilePosition.x = MAX(MIN(x + tilesX / 2 - 1, tilesX - 1), 0); - tilePosition.y = MAX(MIN(y + tilesY / 2 - 1, tilesY - 1), 0); - */ tilePosition.x = n % tilesX; tilePosition.y = n / tilesX; return tilePosition; @@ -75,7 +44,7 @@ cl_int2 NthTilePosition(unsigned int n, int tilesX, int tilesY) cl_int2 NthTilePositionFromCenter(unsigned int n, int tilesX, int tilesY) { - cl_int2 tilePosition; + cl_int2 tilePosition = { .x = 0, .y = 0 }; int centerX = tilesX / 2; int centerY = tilesY / 2; @@ -163,6 +132,8 @@ - (void) initParameters color_shift = 2; color_factor = 16; renderID = 0; + smooth_coloring = 0; + color_scale = 0; devicePixelRatio = [self.window.screen backingScaleFactor]; _progress = [[NSProgress alloc] init]; } @@ -251,35 +222,48 @@ - (void) updateCL if(usePreview && !previewTextureAvailable) return; + [self.progressDelegate mandelbrotViewDidChangeSetup:self]; + dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{ double sizeX = 2.0 / zoom * width / height; double sizeY = 2.0 / zoom; - dispatch_async(cl_queue, - ^{ - cl_ndrange range = - { - 2, - {0,0}, - {previewWidth, previewHeight}, - {0, 0} - }; - mandelbrot_kernel(&range, previewImage, sizeX, sizeY, previewWidth, previewHeight, shift.x, shift.y, iterations, color_factor, color_shift); - dispatch_semaphore_signal(cl_block); - }); - dispatch_semaphore_wait(cl_block, DISPATCH_TIME_FOREVER); - dispatch_sync(dispatch_get_main_queue(), - ^{ - [self drawRect:self.frame]; - }); - if (usePreview) - updating = NO; + if (iterations <= 131072) + { + dispatch_async(cl_queue, + ^{ + cl_ndrange range = + { + 2, + {0,0}, + {previewWidth, previewHeight}, + {0, 0} + }; + mandelbrot_kernel(&range, previewImage, sizeX, sizeY, previewWidth, previewHeight, shift.x, shift.y, iterations, color_factor, color_shift, color_mode, smooth_coloring, color_scale); + dispatch_semaphore_signal(cl_block); + }); + dispatch_semaphore_wait(cl_block, DISPATCH_TIME_FOREVER); + dispatch_sync(dispatch_get_main_queue(), + ^{ + [self drawRect:self.frame]; + }); + if (usePreview) + updating = NO; + } if (!usePreview) { int baseTiles = 5; - if(iterations >= 32768) + if(iterations >= 4194304) + baseTiles = 240; + else if(iterations >= 1048576) + baseTiles = 150; + else if(iterations >= 524288) + baseTiles = 120; + else if(iterations >= 131072) + baseTiles = 90; + else if(iterations >= 32768) baseTiles = 60; else if(iterations >= 8192) baseTiles = 30; @@ -291,22 +275,35 @@ - (void) updateCL if (_optimizeSpeed) { baseTiles = 3; - if(iterations >= 32768) + if(iterations >= 4194304) + baseTiles = 150; + else if(iterations >= 1048576) + baseTiles = 90; + else if(iterations >= 524288) + baseTiles = 60; + else if(iterations >= 131072) baseTiles = 30; - else if(iterations >= 8192) + else if(iterations >= 32768) baseTiles = 20; - else if (iterations >= 4096) + else if(iterations >= 8192) baseTiles = 15; + else if (iterations >= 4096) + baseTiles = 10; else if (iterations >= 256) - baseTiles = 8; + baseTiles = 5; } int tilesX = (int)((double) baseTiles * width / height); int tilesY = baseTiles; - dispatch_sync(dispatch_get_main_queue(), ^{_progress.totalUnitCount = tilesX * tilesY;_progress.completedUnitCount = 0;}); + dispatch_sync(dispatch_get_main_queue(), + ^{ + _progress = [[NSProgress alloc] init]; + _progress.totalUnitCount = tilesX * tilesY; + _progress.completedUnitCount = 0; + }); - dispatch_async(cl_queue, + dispatch_sync(cl_queue, ^{ cl_ndrange range = { @@ -316,9 +313,9 @@ - (void) updateCL {0, 0} }; reset_kernel(&range, mainImage); - dispatch_semaphore_signal(cl_block); + //dispatch_semaphore_signal(cl_block); }); - dispatch_semaphore_wait(cl_block, DISPATCH_TIME_FOREVER); + //dispatch_semaphore_wait(cl_block, DISPATCH_TIME_FOREVER); mainTextureInvalid = NO; renderID++; @@ -334,7 +331,7 @@ - (void) updateCL cl_int2 tilePosition = NthTilePosition(j + i * tilesX, tilesX, tilesY); - dispatch_async(cl_queue, + dispatch_sync(cl_queue, ^{ size_t wgs; gcl_get_kernel_block_workgroup_info((__bridge void *)(mandelbrot_kernel), CL_KERNEL_WORK_GROUP_SIZE, sizeof(wgs), &wgs, NULL); @@ -345,16 +342,16 @@ - (void) updateCL {width / tilesX, height / tilesY}, {0, 0} }; - mandelbrot_kernel(&range, mainImage, sizeX, sizeY, width, height, shift.x, shift.y, iterations, color_factor, color_shift); - dispatch_semaphore_signal(cl_block); + mandelbrot_kernel(&range, mainImage, sizeX, sizeY, width, height, shift.x, shift.y, iterations, color_factor, color_shift, color_mode, smooth_coloring, color_scale); + //dispatch_semaphore_signal(cl_block); }); - dispatch_semaphore_wait(cl_block, DISPATCH_TIME_FOREVER); + //dispatch_semaphore_wait(cl_block, DISPATCH_TIME_FOREVER); dispatch_sync(dispatch_get_main_queue(), ^{ _progress.completedUnitCount++; - //NSLog(@"Progress: %@; %@", _progress.localizedDescription, _progress.localizedAdditionalDescription); - [self drawRect:self.frame]; + [_progressDelegate mandelbrotView:self didUpdateProgress:_progress]; + [self drawRect:self.bounds]; }); } } @@ -363,6 +360,11 @@ - (void) updateCL updating = NO; dispatch_sync(dispatch_get_main_queue(), ^{ + if (renderID == currentRenderID) + { + _progress.completedUnitCount = _progress.totalUnitCount; + [_progressDelegate mandelbrotView:self didUpdateProgress:_progress]; + } [self drawRect:self.frame]; }); if (renderID == currentRenderID) @@ -409,22 +411,22 @@ - (void)drawRect:(NSRect)dirtyRect if (relativeZoom < 32) { - double relativeShiftX = (shift.x - previewShift.x) * zoom * height / width; - double relativeShiftY = (shift.y - previewShift.y) * zoom; + double relativeShiftX = (previewShift.x - shift.x) * zoom * height / width; + double relativeShiftY = (previewShift.y - shift.y) * zoom; glBegin(GL_QUADS); { glTexCoord2d(0.0f, 0.0f); - glVertex2f(-1.0f * relativeZoom - relativeShiftX, -1.0f * relativeZoom - relativeShiftY); + glVertex2f(-1.0f * relativeZoom + relativeShiftX, -1.0f * relativeZoom + relativeShiftY); glTexCoord2d(1.0f, 0.0f); - glVertex2f(1.0f * relativeZoom - relativeShiftX, -1.0f * relativeZoom - relativeShiftY); + glVertex2f(1.0f * relativeZoom + relativeShiftX, -1.0f * relativeZoom + relativeShiftY); glTexCoord2d(1.0f, 1.0f); - glVertex2f(1.0f * relativeZoom - relativeShiftX, 1.0f * relativeZoom - relativeShiftY); + glVertex2f(1.0f * relativeZoom + relativeShiftX, 1.0f * relativeZoom + relativeShiftY); glTexCoord2d(0.0f, 1.0f); - glVertex2f(-1.0f * relativeZoom - relativeShiftX, 1.0f * relativeZoom - relativeShiftY); + glVertex2f(-1.0f * relativeZoom + relativeShiftX, 1.0f * relativeZoom + relativeShiftY); } glEnd(); } @@ -465,7 +467,7 @@ - (void)drawRect:(NSRect)dirtyRect glEnable(GL_TEXTURE_2D); } - glFlush(); + glFinish(); } #pragma mark - Window Events @@ -474,78 +476,30 @@ - (void)reshape { [super reshape]; - if (width == self.frame.size.width * devicePixelRatio && height == self.frame.size.height * devicePixelRatio) - return; - + renderID++; [self teardown]; + devicePixelRatio = [self.window.screen backingScaleFactor]; lastChangeTime = CACurrentMediaTime(); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - usleep(500000); + NSLog(@"change time delta: %f", CACurrentMediaTime() - lastChangeTime); if(CACurrentMediaTime() - lastChangeTime >= 0.5) { - dispatch_async(dispatch_get_main_queue(), - ^{ - [self.openGLContext makeCurrentContext]; - [self.openGLContext update]; - [self initCL]; - [self initPreviewTextureWithFactor:16]; - [self initMainTexture]; - glMatrixMode(GL_PROJECTION); - glViewport(0, 0, self.bounds.size.width * devicePixelRatio, self.bounds.size.height * devicePixelRatio); - glOrtho(-1, 1, -1, 1, -1, 1); - usePreview = NO; - if (!_disableAutomaticUpdates) - [self updateCL]; - }); + [self.openGLContext makeCurrentContext]; + [self.openGLContext update]; + [self initCL]; + [self initPreviewTextureWithFactor:16]; + [self initMainTexture]; + glMatrixMode(GL_PROJECTION); + glViewport(0, 0, self.bounds.size.width * devicePixelRatio, self.bounds.size.height * devicePixelRatio); + glOrtho(-1, 1, -1, 1, -1, 1); + usePreview = NO; + if (!_disableAutomaticUpdates) + [self updateCL]; } }); } -/* -- (void)mouseDown:(NSEvent *)theEvent -{ - [self.window makeFirstResponder:self]; - mouseDown = YES; -} - -- (void)mouseDragged:(NSEvent *)theEvent -{ - usePreview = YES; - shift.x -= theEvent.deltaX / self.bounds.size.height * 2.0 / zoom; - shift.y += theEvent.deltaY / self.bounds.size.height * 2.0 / zoom; - lastChangeTime = CACurrentMediaTime(); - if(!updating) - { - [self updateCL]; - } -} - -- (void)mouseUp:(NSEvent *)theEvent -{ - mouseDown = NO; - if(!scrolling) - usePreview = NO; - [self updateCL]; -} -*/ - -/* -- (void)scrollWheel:(NSEvent *)theEvent -{ - usePreview = YES; - scrolling = YES; - zoom += theEvent.deltaY * zoom * 0.01f; - lastChangeTime = CACurrentMediaTime(); - if(theEvent.momentumPhase == NSEventPhaseEnded) - { - scrolling = NO; - if(!mouseDown) - usePreview = NO; - } - [self updateCL]; -} -*/ #pragma mark - Control methods @@ -567,7 +521,7 @@ - (double)zoom - (void)setZoom:(double)newZoom { zoom = newZoom; - if(!updating && _disableAutomaticUpdates) + if(!(updating && usePreview) && !_disableAutomaticUpdates) [self updateCL]; } @@ -662,7 +616,6 @@ - (CGSize)textureSize - (cl_double2)shift { - NSLog(@"shift: x: %f; y: %f", shift.x, shift.y); return shift; } @@ -673,4 +626,40 @@ - (void)setShift:(cl_double2)newShift [self updateCL]; } +- (unsigned char)color_mode +{ + return color_mode; +} + +- (void)setColor_mode:(unsigned char)newMode +{ + color_mode = newMode; + if (!_disableAutomaticUpdates) + [self updateCL]; +} + +- (unsigned char)smooth_coloring +{ + return smooth_coloring; +} + +- (void)setSmooth_coloring:(unsigned char)newSmooth +{ + smooth_coloring = newSmooth; + if (!_disableAutomaticUpdates) + [self updateCL]; +} + +- (unsigned char)color_scale +{ + return color_scale; +} + +- (void)setColor_scale:(unsigned char)newScale +{ + color_scale = newScale; + if (!_disableAutomaticUpdates) + [self updateCL]; +} + @end diff --git a/Mandelbrot2/CVImageUtils.h b/Mandelbrot2/CVImageUtils.h deleted file mode 100644 index 698ac3d..0000000 --- a/Mandelbrot2/CVImageUtils.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// CVImageUtils.h -// Mandelbrot2 -// -// Created by Palle Klewitz on 07.08.15. -// Copyright © 2015 Palle Klewitz. All rights reserved. -// - -@import AVFoundation; -@import Foundation; - -@interface CVImageUtils : NSObject - -/** - Constructs a ``CMSampleBufferRef`` from the given ``CGImageRef`` - - @param image the ``CGImageRef`` to be turned into ``CMSampleBufferRef`` - @return the converted ``CMSampleBufferRef`` - */ -+ (CMSampleBufferRef)sampleBufferFromCGImage:(CGImageRef)image; -+ (CVPixelBufferRef)pixelBufferFromCGImage:(CGImageRef)image; -@end diff --git a/Mandelbrot2/CVImageUtils.m b/Mandelbrot2/CVImageUtils.m deleted file mode 100644 index d161c0d..0000000 --- a/Mandelbrot2/CVImageUtils.m +++ /dev/null @@ -1,49 +0,0 @@ -// -// CVImageUtils.m -// Mandelbrot2 -// -// Created by Palle Klewitz on 07.08.15. -// Copyright © 2015 Palle Klewitz. All rights reserved. -// - -#import "CVImageUtils.h" -@import AVFoundation; - -@implementation CVImageUtils - -+ (CVPixelBufferRef)pixelBufferFromCGImage:(CGImageRef)image -{ - CGSize frameSize = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image)); - NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey, [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey, nil]; - CVPixelBufferRef pxbuffer = NULL; - - CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, frameSize.width, frameSize.height, kCVPixelFormatType_32ARGB, (__bridge CFDictionaryRef)options, &pxbuffer); - NSParameterAssert(status == kCVReturnSuccess && pxbuffer != NULL); - - CVPixelBufferLockBaseAddress(pxbuffer, 0); - void *pxdata = CVPixelBufferGetBaseAddress(pxbuffer); - - CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(pxdata, frameSize.width, frameSize.height, 8, CVPixelBufferGetBytesPerRow(pxbuffer), rgbColorSpace, (CGBitmapInfo)kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedLast); - - CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image); - CGColorSpaceRelease(rgbColorSpace); - CGContextRelease(context); - - CVPixelBufferUnlockBaseAddress(pxbuffer, 0); - - return pxbuffer; -} - -+ (CMSampleBufferRef)sampleBufferFromCGImage:(CGImageRef)image -{ - CVPixelBufferRef pixelBuffer = [CVImageUtils pixelBufferFromCGImage:image]; - CMSampleBufferRef newSampleBuffer = NULL; - CMSampleTimingInfo timimgInfo = kCMTimingInfoInvalid; - CMVideoFormatDescriptionRef videoInfo; - CMVideoFormatDescriptionCreateForImageBuffer(NULL, pixelBuffer, &videoInfo); - CMSampleBufferCreateForImageBuffer(kCFAllocatorDefault, pixelBuffer, true, NULL, NULL, videoInfo, &timimgInfo, &newSampleBuffer); - - return newSampleBuffer; -} -@end \ No newline at end of file diff --git a/Mandelbrot2/Info.plist b/Mandelbrot2/Info.plist index 33c4f55..33039f8 100644 --- a/Mandelbrot2/Info.plist +++ b/Mandelbrot2/Info.plist @@ -21,13 +21,17 @@ CFBundleSignature ???? CFBundleVersion - 012A + 01E0 LSApplicationCategoryType public.app-category.education LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright - Copyright © 2014 Palle Klewitz. All rights reserved. + Copyright © 2014 - 2016 Palle Klewitz. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NSMainStoryboardFile Main NSPrincipalClass diff --git a/Mandelbrot2/MandelbrotControlPanelViewController.h b/Mandelbrot2/MandelbrotControlPanelViewController.h new file mode 100644 index 0000000..a267365 --- /dev/null +++ b/Mandelbrot2/MandelbrotControlPanelViewController.h @@ -0,0 +1,43 @@ +// +// MandelbrotControlPanelViewController.h +// Mandelbrot2 +// +// Created by Palle Klewitz on 11.08.15. +// Copyright © 2015 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +@import Cocoa; +#import "CLMandelbrotView.h" + +@interface MandelbrotControlPanelViewController : NSViewController + +@property (weak) IBOutlet NSTextField *txtPositionX; +@property (weak) IBOutlet NSTextField *txtPositionY; +@property (weak) IBOutlet NSTextField *txtZoom; +@property (weak) IBOutlet NSTextField *txtIterations; +@property (weak) IBOutlet NSTextField *txtColorFactor; +@property (weak) IBOutlet NSTextField *txtColorShift; +@property (weak) IBOutlet NSProgressIndicator *piRenderProgress; + + +- (IBAction)fastRenderingToggled:(NSButton *)sender; +- (IBAction)applySettings:(id)sender; + +@end diff --git a/Mandelbrot2/MandelbrotControlPanelViewController.m b/Mandelbrot2/MandelbrotControlPanelViewController.m new file mode 100644 index 0000000..cd88ae5 --- /dev/null +++ b/Mandelbrot2/MandelbrotControlPanelViewController.m @@ -0,0 +1,98 @@ +// +// MandelbrotControlPanelViewController.m +// Mandelbrot2 +// +// Created by Palle Klewitz on 11.08.15. +// Copyright © 2015 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "MandelbrotControlPanelViewController.h" +#import "AppDelegate.h" +#import "CLMandelbrotView.h" +#import "MandelbrotRenderViewController.h" + +@interface MandelbrotControlPanelViewController () + +@property (nonatomic, weak) CLMandelbrotView *mandelbrotView; + +@end + +@implementation MandelbrotControlPanelViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + AppDelegate *del = (AppDelegate *)([NSApplication sharedApplication].delegate); + _mandelbrotView = del.mainViewController.mandelbrotView; + del = nil; + + _mandelbrotView.progressDelegate = self; + + _txtPositionX.doubleValue = _mandelbrotView.shift.x; + _txtPositionY.doubleValue = _mandelbrotView.shift.y; + _txtZoom.doubleValue = _mandelbrotView.zoom; + _txtIterations.integerValue = _mandelbrotView.iterations; + _txtColorFactor.doubleValue = _mandelbrotView.color_factor; + _txtColorShift.doubleValue = _mandelbrotView.color_shift; +} + +- (IBAction)fastRenderingToggled:(NSButton *)sender +{ + _mandelbrotView.optimizeSpeed = sender.state == NSOnState; +} + +- (IBAction)applySettings:(id)sender +{ + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.numberStyle = NSNumberFormatterDecimalStyle; + + _mandelbrotView.disableAutomaticUpdates = YES; + + cl_double2 pos; + pos.x = [formatter numberFromString:_txtPositionX.stringValue].doubleValue; + pos.y = [formatter numberFromString:_txtPositionY.stringValue].doubleValue; + _mandelbrotView.shift = pos; + _mandelbrotView.zoom = [formatter numberFromString:_txtZoom.stringValue].doubleValue; + _mandelbrotView.iterations = [formatter numberFromString:_txtIterations.stringValue].unsignedIntValue; + _mandelbrotView.color_factor = [formatter numberFromString:_txtColorFactor.stringValue].doubleValue; + _mandelbrotView.color_shift = [formatter numberFromString:_txtColorShift.stringValue].doubleValue; + + [_mandelbrotView updateCL]; + _mandelbrotView.disableAutomaticUpdates = NO; +} + +- (void)mandelbrotView:(CLMandelbrotView *)mandelbrotView didUpdateProgress:(NSProgress *)progress +{ + _piRenderProgress.maxValue = progress.totalUnitCount; + _piRenderProgress.doubleValue = progress.completedUnitCount; +} + +- (void)mandelbrotViewDidChangeSetup:(CLMandelbrotView *)mandelbrotView +{ + _txtPositionX.doubleValue = _mandelbrotView.shift.x; + _txtPositionY.doubleValue = _mandelbrotView.shift.y; + _txtZoom.doubleValue = _mandelbrotView.zoom; + _txtIterations.integerValue = _mandelbrotView.iterations; + _txtColorFactor.doubleValue = _mandelbrotView.color_factor; + _txtColorShift.doubleValue = _mandelbrotView.color_shift; +} + +@end diff --git a/Mandelbrot2/MandelbrotRenderViewController.h b/Mandelbrot2/MandelbrotRenderViewController.h index a4fd081..f2bf6ec 100644 --- a/Mandelbrot2/MandelbrotRenderViewController.h +++ b/Mandelbrot2/MandelbrotRenderViewController.h @@ -3,7 +3,25 @@ // Mandelbrot2 // // Created by Palle Klewitz on 16.08.14. -// Copyright (c) 2014 Palle Klewitz. All rights +// Copyright (c) 2014 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// @import Cocoa; @class CLMandelbrotView; @@ -31,5 +49,7 @@ - (void)saveSnapshot:(id)sender; - (void)createAnimation:(id)sender; +- (void)showControlPanel:(id)sender; + @end diff --git a/Mandelbrot2/MandelbrotRenderViewController.m b/Mandelbrot2/MandelbrotRenderViewController.m index 7ccbc6e..40385b1 100644 --- a/Mandelbrot2/MandelbrotRenderViewController.m +++ b/Mandelbrot2/MandelbrotRenderViewController.m @@ -3,7 +3,24 @@ // Mandelbrot2 // // Created by Palle Klewitz on 16.08.14. -// Copyright (c) 2014 Palle Klewitz. All rights reserved. +// Copyright (c) 2014 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // #import "MandelbrotRenderViewController.h" @@ -19,8 +36,6 @@ @interface MandelbrotRenderViewController () @property (nonatomic) double referenceMagnification; @property (nonatomic) CGPoint referencePosition; -@property (nonatomic, strong) UnifiedTitleBarWindowController *animationWindow; - @end @implementation MandelbrotRenderViewController @@ -156,7 +171,6 @@ - (void)saveSnapshot:(id)sender NSAlert *alert = [[NSAlert alloc] init]; alert.messageText = @"Cannot Save Image"; [alert runModal]; - } } }]; @@ -164,8 +178,18 @@ - (void)saveSnapshot:(id)sender - (void)createAnimation:(id)sender { - _animationWindow = [self.storyboard instantiateControllerWithIdentifier:CreateAnimationWindow]; - [_animationWindow showWindow:_animationWindow.window]; + NSWindowController *animationWindowController = [self.storyboard instantiateControllerWithIdentifier:CreateAnimationWindow]; + [animationWindowController showWindow:animationWindowController.window]; + AppDelegate *appDel = [NSApplication sharedApplication].delegate; + appDel.mandelbrotAnimationWindow = animationWindowController; +} + +- (void)showControlPanel:(id)sender +{ + NSWindowController *controlPanelWindowController = [self.storyboard instantiateControllerWithIdentifier:MandelbrotControlPanel]; + [controlPanelWindowController showWindow:controlPanelWindowController.window]; + AppDelegate *appDel = [NSApplication sharedApplication].delegate; + appDel.mandelbrotControlPanel = controlPanelWindowController; } @end diff --git a/Mandelbrot2/MandelbrotRenderer.h b/Mandelbrot2/MandelbrotRenderer.h index 40ada32..a0c3a73 100644 --- a/Mandelbrot2/MandelbrotRenderer.h +++ b/Mandelbrot2/MandelbrotRenderer.h @@ -3,7 +3,24 @@ // Mandelbrot2 // // Created by Palle Klewitz on 06.08.15. -// Copyright © 2015 Palle Klewitz. All rights reserved. +// Copyright © 2015 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // @import Foundation; @@ -21,8 +38,8 @@ @interface MandelbrotRenderer : NSObject -@property (nonatomic, weak) CLMandelbrotView *mandelbrotView; -@property (nonatomic, weak) id delegate; +@property (nonatomic, weak, nullable) CLMandelbrotView *mandelbrotView; +@property (nonatomic, weak, nullable) id delegate; @property (nonatomic) double startX; @property (nonatomic) double startY; diff --git a/Mandelbrot2/MandelbrotRenderer.m b/Mandelbrot2/MandelbrotRenderer.m index b409950..15aa11f 100644 --- a/Mandelbrot2/MandelbrotRenderer.m +++ b/Mandelbrot2/MandelbrotRenderer.m @@ -3,13 +3,29 @@ // Mandelbrot2 // // Created by Palle Klewitz on 06.08.15. -// Copyright © 2015 Palle Klewitz. All rights reserved. +// Copyright © 2015 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // @import AVFoundation; #import "MandelbrotRenderer.h" #import "CLMandelbrotView.h" -#import "CVImageUtils.h" double AnimationValue(double start, double end, unsigned int frame, unsigned int totalFrames) { @@ -39,6 +55,30 @@ @interface MandelbrotRenderer () @implementation MandelbrotRenderer @synthesize progress = _progress; ++ (CVPixelBufferRef)pixelBufferFromCGImage:(CGImageRef)image +{ + CGSize frameSize = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image)); + NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey, [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey, nil]; + CVPixelBufferRef pxbuffer = NULL; + + CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, frameSize.width, frameSize.height, kCVPixelFormatType_32ARGB, (__bridge CFDictionaryRef)options, &pxbuffer); + assert(status == kCVReturnSuccess && pxbuffer != NULL); + + CVPixelBufferLockBaseAddress(pxbuffer, 0); + void *pxdata = CVPixelBufferGetBaseAddress(pxbuffer); + + CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(pxdata, frameSize.width, frameSize.height, 8, CVPixelBufferGetBytesPerRow(pxbuffer), rgbColorSpace, (CGBitmapInfo)kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedLast); + + CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image); + CGColorSpaceRelease(rgbColorSpace); + CGContextRelease(context); + + CVPixelBufferUnlockBaseAddress(pxbuffer, 0); + + return pxbuffer; +} + - (void)startRendering { _progress = [[NSProgress alloc] init]; @@ -56,14 +96,15 @@ - (void)startRendering return; } NSDictionary *videoSettings = @{ - AVVideoCodecKey : AVVideoCodecH264, - AVVideoWidthKey : @(self.mandelbrotView.textureSize.width), - AVVideoHeightKey : @(self.mandelbrotView.textureSize.height), - /*AVVideoCompressionPropertiesKey : @{ - AVVideoAverageBitRateKey : @(64*1000*1000), // 64 000 kbits/s + AVVideoCodecKey : AVVideoCodecH264, + AVVideoWidthKey : @(self.mandelbrotView.textureSize.width), + AVVideoHeightKey : @(self.mandelbrotView.textureSize.height), + AVVideoCompressionPropertiesKey : + @{ + AVVideoAverageBitRateKey : @(self.mandelbrotView.textureSize.width * self.mandelbrotView.textureSize.height * _frames_per_second * 2), // 64 000 kbits/s AVVideoProfileLevelKey : AVVideoProfileLevelH264HighAutoLevel, AVVideoMaxKeyFrameIntervalKey : @(1) - }*/ + } }; _input = [[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeVideo outputSettings:videoSettings]; @@ -109,7 +150,7 @@ - (void) renderLoop dispatch_sync(dispatch_get_main_queue(), ^{ NSBitmapImageRep *rep = [_mandelbrotView getShnapshot]; - pixelBuffer = [CVImageUtils pixelBufferFromCGImage:rep.CGImage]; + pixelBuffer = [MandelbrotRenderer pixelBufferFromCGImage:rep.CGImage]; }); while (!_adaptor.assetWriterInput.readyForMoreMediaData) @@ -135,11 +176,15 @@ - (void) applySettings shift.x = AnimationValue(_startX, _endX, _frame, totalFrames); shift.y = AnimationValue(_startY, _endY, _frame, totalFrames); - NSLog(@"startX=%f; endX=%f", _startX, _endX); + double startZoomLog = log2(_startZoom); + double endZoomLog = log2(_endZoom); + + double startIterationLog = log2(_startIterations); + double endIterationLog = log2(_endIterations); _mandelbrotView.shift = shift; - _mandelbrotView.zoom = AnimationValue(_startZoom, _endZoom, _frame, totalFrames); - _mandelbrotView.iterations = (unsigned int)AnimationValue(_startIterations, _endIterations, _frame, totalFrames); + _mandelbrotView.zoom = pow(2.0, AnimationValue(startZoomLog, endZoomLog, _frame, totalFrames)); + _mandelbrotView.iterations = (unsigned int)pow(2.0, AnimationValue(startIterationLog, endIterationLog, _frame, totalFrames)); _mandelbrotView.color_shift = AnimationValue(_startColorShift, _endColorShift, _frame, totalFrames); _mandelbrotView.color_factor = AnimationValue(_startColorFactor, _endColorFactor, _frame, totalFrames); [_mandelbrotView updateCL]; @@ -155,7 +200,6 @@ - (void)finishRendering [_writer finishWritingWithCompletionHandler: ^{ [_delegate didFinishRendering]; - NSLog(@"rendering completed"); }]; dispatch_async(dispatch_get_main_queue(), ^{ @@ -165,52 +209,13 @@ - (void)finishRendering - (void)mandelbrotViewDidFinishRendering:(nonnull CLMandelbrotView *)mandelbrotView { - //NSLog(@"MandelbrotView did finish rendering"); dispatch_semaphore_signal(_callback_semaphore); } -- (void) processFrame:(NSBitmapImageRep *) rep -{ - //NSData *bitmapData = [rep representationUsingType:NSPNGFileType properties:[[NSDictionary alloc] init]]; - //[bitmapData writeToURL:[NSURL URLWithString:@"file:///Users/Palle/Desktop/current.png"] atomically:YES]; - CVPixelBufferRef pixelBuffer = [self pixelBufferFromCGImage:rep.CGImage size:rep.size]; - NSLog(@"%p", pixelBuffer); - [_adaptor appendPixelBuffer:pixelBuffer withPresentationTime:CMTimeMake(_frame, _frames_per_second)]; - CVPixelBufferRelease(pixelBuffer); -} - - (void)setMandelbrotView:(CLMandelbrotView *)mandelbrotView { _mandelbrotView = mandelbrotView; _mandelbrotView.delegate = self; } -- (CVPixelBufferRef )pixelBufferFromCGImage:(CGImageRef)image size:(CGSize)size -{ - CVPixelBufferRef pxbuffer = NULL; - CVReturn status = CVPixelBufferPoolCreatePixelBuffer(kCFAllocatorDefault, _adaptor.pixelBufferPool, &pxbuffer); - - if (status != kCVReturnSuccess || pxbuffer == NULL) - { - NSLog(@"buffer not from pool"); - NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey, [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey, nil]; - CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, size.width, size.height, kCVPixelFormatType_32ARGB, (__bridge CFDictionaryRef) options, &pxbuffer); - NSParameterAssert(status == kCVReturnSuccess && pxbuffer != NULL); - } - - CVPixelBufferLockBaseAddress(pxbuffer, 0); - void *pxdata = CVPixelBufferGetBaseAddress(pxbuffer); - - CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(pxdata, size.width, size.height, 8, 4*size.width, rgbColorSpace, 2); - CGContextConcatCTM(context, CGAffineTransformMakeRotation(0)); - CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image); - CGColorSpaceRelease(rgbColorSpace); - CGContextRelease(context); - - CVPixelBufferUnlockBaseAddress(pxbuffer, 0); - - return pxbuffer; -} - @end diff --git a/Mandelbrot2/UnifiedTitleBarWindowController.h b/Mandelbrot2/UnifiedTitleBarWindowController.h index 8daf8a7..cedf33c 100644 --- a/Mandelbrot2/UnifiedTitleBarWindowController.h +++ b/Mandelbrot2/UnifiedTitleBarWindowController.h @@ -3,10 +3,27 @@ // Mandelbrot2 // // Created by Palle Klewitz on 06.08.15. -// Copyright © 2015 Palle Klewitz. All rights reserved. +// Copyright © 2015 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#import +@import Cocoa; @interface UnifiedTitleBarWindowController : NSWindowController diff --git a/Mandelbrot2/UnifiedTitleBarWindowController.m b/Mandelbrot2/UnifiedTitleBarWindowController.m index 4a493f1..f58fd6b 100644 --- a/Mandelbrot2/UnifiedTitleBarWindowController.m +++ b/Mandelbrot2/UnifiedTitleBarWindowController.m @@ -3,7 +3,24 @@ // Mandelbrot2 // // Created by Palle Klewitz on 06.08.15. -// Copyright © 2015 Palle Klewitz. All rights reserved. +// Copyright © 2015 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // #import "UnifiedTitleBarWindowController.h" diff --git a/Mandelbrot2/de.lproj/Main.strings b/Mandelbrot2/de.lproj/Main.strings index 00aa850..a4b2ed6 100644 --- a/Mandelbrot2/de.lproj/Main.strings +++ b/Mandelbrot2/de.lproj/Main.strings @@ -3,19 +3,19 @@ "0dS-Ab-aoG.title" = "Farbverschiebung"; /* Class = "NSMenuItem"; title = "Mandelbrot2"; ObjectID = "1Xt-HY-uBw"; */ -"1Xt-HY-uBw.title" = "Mandelbrot2"; +"1Xt-HY-uBw.title" = "Mandelbrot"; /* Class = "NSMenuItem"; title = "Increase Color Factor"; ObjectID = "4dw-ex-NEu"; */ -"4dw-ex-NEu.title" = "Increase Color Factor"; +"4dw-ex-NEu.title" = "Farbfaktor erhöhen"; /* Class = "NSMenuItem"; title = "Quit Mandelbrot2"; ObjectID = "4sb-4s-VLi"; */ -"4sb-4s-VLi.title" = "Quit Mandelbrot2"; +"4sb-4s-VLi.title" = "Mandelbrot beenden"; /* Class = "NSTextFieldCell"; title = "Zoom"; ObjectID = "5PI-cx-g3j"; */ "5PI-cx-g3j.title" = "Zoom"; /* Class = "NSMenuItem"; title = "About Mandelbrot2"; ObjectID = "5kV-Vb-QxS"; */ -"5kV-Vb-QxS.title" = "About Mandelbrot2"; +"5kV-Vb-QxS.title" = "Über Mandelbrot"; /* Class = "NSTextFieldCell"; title = "Y-Position"; ObjectID = "7KE-s3-Mkq"; */ "7KE-s3-Mkq.title" = "Y-Position"; @@ -27,34 +27,34 @@ "ATj-wZ-Wni.title" = "Ende"; /* Class = "NSMenu"; title = "Main Menu"; ObjectID = "AYu-sK-qS6"; */ -"AYu-sK-qS6.title" = "Main Menu"; +"AYu-sK-qS6.title" = "Hauptmenü"; /* Class = "NSMenuItem"; title = "Preferences…"; ObjectID = "BOF-NM-1cW"; */ -"BOF-NM-1cW.title" = "Preferences…"; +"BOF-NM-1cW.title" = "Einstellungen…"; /* Class = "NSMenuItem"; title = "Decrease Iterations"; ObjectID = "BTq-1J-d1S"; */ -"BTq-1J-d1S.title" = "Decrease Iterations"; +"BTq-1J-d1S.title" = "Iterationen verringern"; /* Class = "NSMenu"; title = "Help"; ObjectID = "F2S-fz-NVQ"; */ -"F2S-fz-NVQ.title" = "Help"; +"F2S-fz-NVQ.title" = "Hilfe"; /* Class = "NSMenu"; title = "File"; ObjectID = "F68-U4-c0h"; */ -"F68-U4-c0h.title" = "File"; +"F68-U4-c0h.title" = "Ablage"; /* Class = "NSMenuItem"; title = "Zoom Out"; ObjectID = "F9d-Y9-28C"; */ -"F9d-Y9-28C.title" = "Zoom Out"; +"F9d-Y9-28C.title" = "Herauszoomen"; /* Class = "NSMenuItem"; title = "Mandelbrot2 Help"; ObjectID = "FKE-Sm-Kum"; */ -"FKE-Sm-Kum.title" = "Mandelbrot2 Help"; +"FKE-Sm-Kum.title" = "Mandelbrot-Hilfe"; /* Class = "NSTextFieldCell"; title = "Farbverschiebung"; ObjectID = "FWP-nM-bcS"; */ "FWP-nM-bcS.title" = "Farbverschiebung"; /* Class = "NSMenuItem"; title = "View"; ObjectID = "H8h-7b-M4v"; */ -"H8h-7b-M4v.title" = "View"; +"H8h-7b-M4v.title" = "Ansicht"; /* Class = "NSMenu"; title = "View"; ObjectID = "HyV-fh-RgO"; */ -"HyV-fh-RgO.title" = "View"; +"HyV-fh-RgO.title" = "Ansicht"; /* Class = "NSWindow"; title = "Mandelbrot"; ObjectID = "IQv-IB-iLA"; */ "IQv-IB-iLA.title" = "Mandelbrot"; @@ -63,10 +63,10 @@ "KU5-lK-Hyc.title" = "X-Position"; /* Class = "NSMenuItem"; title = "Show All"; ObjectID = "Kd2-mp-pUS"; */ -"Kd2-mp-pUS.title" = "Show All"; +"Kd2-mp-pUS.title" = "Alles zeigen"; /* Class = "NSMenuItem"; title = "Bring All to Front"; ObjectID = "LE2-aR-0XJ"; */ -"LE2-aR-0XJ.title" = "Bring All to Front"; +"LE2-aR-0XJ.title" = "Alle nach vorne bringen"; /* Class = "NSTextFieldCell"; title = "Farbfaktor"; ObjectID = "Llc-hT-QzN"; */ "Llc-hT-QzN.title" = "Farbfaktor"; @@ -75,7 +75,7 @@ "NAh-Xn-hTn.title" = "Zoom"; /* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */ -"NMo-om-nkz.title" = "Services"; +"NMo-om-nkz.title" = "Dienste"; /* Class = "NSWindow"; title = "Animation erstellen"; ObjectID = "NWk-G4-Clr"; */ "NWk-G4-Clr.title" = "Animation erstellen"; @@ -84,10 +84,10 @@ "O76-7E-mK9.title" = "Videoeinstellungen"; /* Class = "NSMenuItem"; title = "Minimize"; ObjectID = "OY7-WF-poV"; */ -"OY7-WF-poV.title" = "Minimize"; +"OY7-WF-poV.title" = "Minimieren"; /* Class = "NSMenuItem"; title = "Hide Mandelbrot2"; ObjectID = "Olw-nP-bQN"; */ -"Olw-nP-bQN.title" = "Hide Mandelbrot2"; +"Olw-nP-bQN.title" = "Mandelbrot ausblenden"; /* Class = "NSButtonCell"; title = "Animation Rendern"; ObjectID = "Qzq-m7-VJa"; */ "Qzq-m7-VJa.title" = "Animation Rendern"; @@ -99,37 +99,62 @@ "SPE-1C-b2g.title" = "Y-Position"; /* Class = "NSMenu"; title = "Window"; ObjectID = "Td7-aD-5lo"; */ -"Td7-aD-5lo.title" = "Window"; +"Td7-aD-5lo.title" = "Fenster"; /* Class = "NSMenuItem"; title = "Hide Others"; ObjectID = "Vdr-fp-XzO"; */ -"Vdr-fp-XzO.title" = "Hide Others"; +"Vdr-fp-XzO.title" = "Andere ausblenden"; /* Class = "NSMenuItem"; title = "Shift Colors Forwards"; ObjectID = "ZvT-ld-bct"; */ -"ZvT-ld-bct.title" = "Shift Colors Forwards"; +"ZvT-ld-bct.title" = "Farbe vorwärts verschieben"; + +// +// Main.strings (German) +// Mandelbrot2 +// +// Created by Palle Klewitz on 07.08.15. +// Copyright © 2015 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// /* Class = "NSMenuItem"; title = "Shift Colors Backwards"; ObjectID = "a9W-SA-MV6"; */ -"a9W-SA-MV6.title" = "Shift Colors Backwards"; +"a9W-SA-MV6.title" = "Farbe rückwärts verschieben"; /* Class = "NSMenuItem"; title = "Window"; ObjectID = "aUF-d1-5bR"; */ -"aUF-d1-5bR.title" = "Window"; +"aUF-d1-5bR.title" = "Fenster"; /* Class = "NSMenuItem"; title = "Zoom In"; ObjectID = "aVY-Pv-3Yb"; */ -"aVY-Pv-3Yb.title" = "Zoom In"; +"aVY-Pv-3Yb.title" = "Hereinzoomen"; /* Class = "NSMenuItem"; title = "Decrease Color Factor"; ObjectID = "amn-YT-Xxh"; */ -"amn-YT-Xxh.title" = "Decrease Color Factor"; +"amn-YT-Xxh.title" = "Farbfaktor verringern"; /* Class = "NSMenuItem"; title = "Enter Full Screen"; ObjectID = "bOt-H1-584"; */ -"bOt-H1-584.title" = "Enter Full Screen"; +"bOt-H1-584.title" = "Vollbild"; /* Class = "NSMenuItem"; title = "Create Animation"; ObjectID = "dZW-XO-ysw"; */ -"dZW-XO-ysw.title" = "Create Animation"; +"dZW-XO-ysw.title" = "Animation erstellen""; /* Class = "NSTextFieldCell"; title = "X-Position"; ObjectID = "dcW-W8-ion"; */ "dcW-W8-ion.title" = "X-Position"; /* Class = "NSMenuItem"; title = "Close"; ObjectID = "hl1-W0-lGK"; */ -"hl1-W0-lGK.title" = "Close"; +"hl1-W0-lGK.title" = "Schliessen"; /* Class = "NSMenu"; title = "Services"; ObjectID = "hz9-B4-Xy5"; */ "hz9-B4-Xy5.title" = "Services"; @@ -141,7 +166,7 @@ "jFl-Ga-kaX.title" = "Länge"; /* Class = "NSMenuItem"; title = "File"; ObjectID = "m3n-Sr-ZO3"; */ -"m3n-Sr-ZO3.title" = "File"; +"m3n-Sr-ZO3.title" = "Ablage"; /* Class = "NSTextFieldCell"; title = "Start"; ObjectID = "mAe-24-hED"; */ "mAe-24-hED.title" = "Start"; @@ -150,22 +175,22 @@ "mW6-1w-uq2.title" = "Bilder pro Sekunde"; /* Class = "NSMenuItem"; title = "Save Snapshot"; ObjectID = "obQ-j2-bS0"; */ -"obQ-j2-bS0.title" = "Save Snapshot"; +"obQ-j2-bS0.title" = "Foto erstellen"; /* Class = "NSMenuItem"; title = "Original Size"; ObjectID = "oyW-hX-lN4"; */ -"oyW-hX-lN4.title" = "Original Size"; +"oyW-hX-lN4.title" = "Originalgröße"; /* Class = "NSMenuItem"; title = "Increase Iterations"; ObjectID = "pC0-mM-Pce"; */ -"pC0-mM-Pce.title" = "Increase Iterations"; +"pC0-mM-Pce.title" = "Iterationen erhöhen"; /* Class = "NSTextFieldCell"; title = "Iterationen"; ObjectID = "syy-QP-UrN"; */ "syy-QP-UrN.title" = "Iterationen"; /* Class = "NSMenu"; title = "Mandelbrot2"; ObjectID = "uQy-DD-JDr"; */ -"uQy-DD-JDr.title" = "Mandelbrot2"; +"uQy-DD-JDr.title" = "Mandelbrot"; /* Class = "NSMenuItem"; title = "Help"; ObjectID = "wpr-3q-Mcd"; */ -"wpr-3q-Mcd.title" = "Help"; +"wpr-3q-Mcd.title" = "Hilfe"; /* Class = "NSTextFieldCell"; title = "Iterationen"; ObjectID = "yg8-04-CRS"; */ "yg8-04-CRS.title" = "Iterationen"; diff --git a/Mandelbrot2/en.lproj/Main.strings b/Mandelbrot2/en.lproj/Main.strings new file mode 100644 index 0000000..013d8f0 --- /dev/null +++ b/Mandelbrot2/en.lproj/Main.strings @@ -0,0 +1,333 @@ +// +// Main.strings (English) +// Mandelbrot2 +// +// Created by Palle Klewitz on 07.02.2016. +// Copyright © 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +/* Class = "NSTextFieldCell"; title = "Farbverschiebung"; ObjectID = "0dS-Ab-aoG"; */ +"0dS-Ab-aoG.title" = "Color shift"; + +/* Class = "NSMenuItem"; title = "Mandelbrot2"; ObjectID = "1Xt-HY-uBw"; */ +"1Xt-HY-uBw.title" = "Mandelbrot"; + +/* Class = "NSMenuItem"; title = "Root"; ObjectID = "2oR-48-iIq"; */ +"2oR-48-iIq.title" = "Root"; + +/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "3zk-eI-o8f"; */ +"3zk-eI-o8f.title" = "Delete"; + +/* Class = "NSMenuItem"; title = "Jump to Selection"; ObjectID = "47i-fI-uIe"; */ +"47i-fI-uIe.title" = "Jump to Selection"; + +/* Class = "NSMenuItem"; title = "Increase Color Factor"; ObjectID = "4dw-ex-NEu"; */ +"4dw-ex-NEu.title" = "Increase Color Factor"; + +/* Class = "NSMenuItem"; title = "Quit Mandelbrot2"; ObjectID = "4sb-4s-VLi"; */ +"4sb-4s-VLi.title" = "Quit Mandelbrot"; + +/* Class = "NSTextFieldCell"; title = "Zoom"; ObjectID = "5PI-cx-g3j"; */ +"5PI-cx-g3j.title" = "Zoom"; + +/* Class = "NSMenuItem"; title = "About Mandelbrot2"; ObjectID = "5kV-Vb-QxS"; */ +"5kV-Vb-QxS.title" = "About Mandelbrot"; + +/* Class = "NSTextFieldCell"; title = "Y-Position"; ObjectID = "7KE-s3-Mkq"; */ +"7KE-s3-Mkq.title" = "Y-Position"; + +/* Class = "NSTextFieldCell"; title = "Y-Position"; ObjectID = "8jn-hW-guY"; */ +"8jn-hW-guY.title" = "Y-Position"; + +/* Class = "NSMenuItem"; title = "Logarithmisch"; ObjectID = "96i-DK-vXZ"; */ +"96i-DK-vXZ.title" = "Logarithmisch"; + +/* Class = "NSMenu"; title = "Find"; ObjectID = "9Tl-O2-ofC"; */ +"9Tl-O2-ofC.title" = "Find"; + +/* Class = "NSBox"; title = "Box"; ObjectID = "9cC-Hh-LNc"; */ +"9cC-Hh-LNc.title" = "Box"; + +/* Class = "NSTextFieldCell"; title = "Ende"; ObjectID = "ATj-wZ-Wni"; */ +"ATj-wZ-Wni.title" = "End"; + +/* Class = "NSMenu"; title = "Main Menu"; ObjectID = "AYu-sK-qS6"; */ +"AYu-sK-qS6.title" = "Main Menu"; + +/* Class = "NSWindow"; title = "Control Panel"; ObjectID = "Aqs-0Z-Fba"; */ +"Aqs-0Z-Fba.title" = "Control Panel"; + +/* Class = "NSMenuItem"; title = "Mandelbrot View"; ObjectID = "B1O-Bb-gdX"; */ +"B1O-Bb-gdX.title" = "Mandelbrot View"; + +/* Class = "NSMenuItem"; title = "Preferences…"; ObjectID = "BOF-NM-1cW"; */ +"BOF-NM-1cW.title" = "Preferences…"; + +/* Class = "NSMenuItem"; title = "Decrease Iterations"; ObjectID = "BTq-1J-d1S"; */ +"BTq-1J-d1S.title" = "Decrease Iterations"; + +/* Class = "NSMenu"; title = "Help"; ObjectID = "F2S-fz-NVQ"; */ +"F2S-fz-NVQ.title" = "Help"; + +/* Class = "NSMenu"; title = "File"; ObjectID = "F68-U4-c0h"; */ +"F68-U4-c0h.title" = "File"; + +/* Class = "NSMenuItem"; title = "Zoom Out"; ObjectID = "F9d-Y9-28C"; */ +"F9d-Y9-28C.title" = "Zoom Out"; + +/* Class = "NSMenuItem"; title = "Mandelbrot2 Help"; ObjectID = "FKE-Sm-Kum"; */ +"FKE-Sm-Kum.title" = "Mandelbrot Help"; + +/* Class = "NSTextFieldCell"; title = "Farbverschiebung"; ObjectID = "FWP-nM-bcS"; */ +"FWP-nM-bcS.title" = "Color shift"; + +/* Class = "NSMenuItem"; title = "Smooth Color"; ObjectID = "Gtz-ff-9QT"; */ +"Gtz-ff-9QT.title" = "Smooth Color"; + +/* Class = "NSMenuItem"; title = "View"; ObjectID = "H8h-7b-M4v"; */ +"H8h-7b-M4v.title" = "View"; + +/* Class = "NSButtonCell"; title = "Apply"; ObjectID = "HXB-8z-ryc"; */ +"HXB-8z-ryc.title" = "Apply"; + +/* Class = "NSMenu"; title = "View"; ObjectID = "HyV-fh-RgO"; */ +"HyV-fh-RgO.title" = "View"; + +/* Class = "NSMenuItem"; title = "Color Mode"; ObjectID = "IP8-Sg-jQi"; */ +"IP8-Sg-jQi.title" = "Color Mode"; + +/* Class = "NSWindow"; title = "Mandelbrot"; ObjectID = "IQv-IB-iLA"; */ +"IQv-IB-iLA.title" = "Mandelbrot"; + +/* Class = "NSMenuItem"; title = "Find…"; ObjectID = "IfU-2S-B68"; */ +"IfU-2S-B68.title" = "Find…"; + +/* Class = "NSMenuItem"; title = "Zero point coloring"; ObjectID = "Iog-MJ-PPs"; */ +"Iog-MJ-PPs.title" = "Zero point coloring"; + +/* Class = "NSMenu"; title = "Edit"; ObjectID = "Ixz-hM-O4q"; */ +"Ixz-hM-O4q.title" = "Edit"; + +/* Class = "NSMenuItem"; title = "Inverse"; ObjectID = "Jvk-q7-ehd"; */ +"Jvk-q7-ehd.title" = "Inverse"; + +/* Class = "NSTextFieldCell"; title = "X-Position"; ObjectID = "KU5-lK-Hyc"; */ +"KU5-lK-Hyc.title" = "X-Position"; + +/* Class = "NSMenuItem"; title = "Show All"; ObjectID = "Kd2-mp-pUS"; */ +"Kd2-mp-pUS.title" = "Show All"; + +/* Class = "NSMenuItem"; title = "Logarithmic"; ObjectID = "Kxe-ra-dLR"; */ +"Kxe-ra-dLR.title" = "Logarithmic"; + +/* Class = "NSMenuItem"; title = "Bring All to Front"; ObjectID = "LE2-aR-0XJ"; */ +"LE2-aR-0XJ.title" = "Bring All to Front"; + +/* Class = "NSTextFieldCell"; title = "Farbfaktor"; ObjectID = "Llc-hT-QzN"; */ +"Llc-hT-QzN.title" = "Color factor"; + +/* Class = "NSMenuItem"; title = "Edit"; ObjectID = "LmM-01-QvF"; */ +"LmM-01-QvF.title" = "Edit"; + +/* Class = "NSTextFieldCell"; title = "Zoom"; ObjectID = "NAh-Xn-hTn"; */ +"NAh-Xn-hTn.title" = "Zoom"; + +/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */ +"NMo-om-nkz.title" = "Services"; + +/* Class = "NSWindow"; title = "Animation erstellen"; ObjectID = "NWk-G4-Clr"; */ +"NWk-G4-Clr.title" = "Create animation"; + +/* Class = "NSTextFieldCell"; title = "Videoeinstellungen"; ObjectID = "O76-7E-mK9"; */ +"O76-7E-mK9.title" = "Video options"; + +/* Class = "NSMenuItem"; title = "Minimize"; ObjectID = "OY7-WF-poV"; */ +"OY7-WF-poV.title" = "Minimize"; + +/* Class = "NSMenuItem"; title = "Hide Mandelbrot2"; ObjectID = "Olw-nP-bQN"; */ +"Olw-nP-bQN.title" = "Hide Mandelbrot"; + +/* Class = "NSMenuItem"; title = "Linear"; ObjectID = "Qz0-Go-8WK"; */ +"Qz0-Go-8WK.title" = "Linear"; + +/* Class = "NSButtonCell"; title = "Animation Rendern"; ObjectID = "Qzq-m7-VJa"; */ +"Qzq-m7-VJa.title" = "Render animation"; + +/* Class = "NSMenuItem"; title = "Zoom"; ObjectID = "R4o-n2-Eq4"; */ +"R4o-n2-Eq4.title" = "Zoom"; + +/* Class = "NSMenuItem"; title = "Color Scale"; ObjectID = "REo-ie-xJf"; */ +"REo-ie-xJf.title" = "Color Scale"; + +/* Class = "NSMenu"; title = "Color Scale"; ObjectID = "RNM-xx-dKC"; */ +"RNM-xx-dKC.title" = "Color Scale"; + +/* Class = "NSMenu"; title = "Color Mode"; ObjectID = "SFD-hs-uFu"; */ +"SFD-hs-uFu.title" = "Color Mode"; + +/* Class = "NSTextFieldCell"; title = "Y-Position"; ObjectID = "SPE-1C-b2g"; */ +"SPE-1C-b2g.title" = "Y-Position"; + +/* Class = "NSMenuItem"; title = "Iteration coloring"; ObjectID = "TUF-aM-I98"; */ +"TUF-aM-I98.title" = "Iteration coloring"; + +/* Class = "NSMenu"; title = "Window"; ObjectID = "Td7-aD-5lo"; */ +"Td7-aD-5lo.title" = "Window"; + +/* Class = "NSMenuItem"; title = "Use Selection for Find"; ObjectID = "VCk-sd-hVM"; */ +"VCk-sd-hVM.title" = "Use Selection for Find"; + +/* Class = "NSMenuItem"; title = "Linear"; ObjectID = "VKk-aj-ShE"; */ +"VKk-aj-ShE.title" = "Linear"; + +/* Class = "NSMenuItem"; title = "Hide Others"; ObjectID = "Vdr-fp-XzO"; */ +"Vdr-fp-XzO.title" = "Hide Others"; + +/* Class = "NSMenuItem"; title = "Shift Colors Forwards"; ObjectID = "ZvT-ld-bct"; */ +"ZvT-ld-bct.title" = "Shift Colors Forwards"; + +/* Class = "NSMenuItem"; title = "Invers"; ObjectID = "a2s-tw-js2"; */ +"a2s-tw-js2.title" = "Inverse"; + +/* Class = "NSButton"; ibShadowedToolTip = "Increases Tile Size. May increase rendering speed but reduce responsiveness."; ObjectID = "a3C-fd-12t"; */ +"a3C-fd-12t.ibShadowedToolTip" = "Increases Tile Size. May increase rendering speed but reduce responsiveness."; + +/* Class = "NSMenuItem"; title = "Shift Colors Backwards"; ObjectID = "a9W-SA-MV6"; */ +"a9W-SA-MV6.title" = "Shift Colors Backwards"; + +/* Class = "NSMenuItem"; title = "Window"; ObjectID = "aUF-d1-5bR"; */ +"aUF-d1-5bR.title" = "Window"; + +/* Class = "NSMenuItem"; title = "Zoom In"; ObjectID = "aVY-Pv-3Yb"; */ +"aVY-Pv-3Yb.title" = "Zoom In"; + +/* Class = "NSMenuItem"; title = "Decrease Color Factor"; ObjectID = "amn-YT-Xxh"; */ +"amn-YT-Xxh.title" = "Decrease Color Factor"; + +/* Class = "NSMenuItem"; title = "Undo"; ObjectID = "auf-3W-Zia"; */ +"auf-3W-Zia.title" = "Undo"; + +/* Class = "NSMenuItem"; title = "Copy"; ObjectID = "aw6-Rx-8D5"; */ +"aw6-Rx-8D5.title" = "Copy"; + +/* Class = "NSMenuItem"; title = "Enter Full Screen"; ObjectID = "bOt-H1-584"; */ +"bOt-H1-584.title" = "Enter Full Screen"; + +/* Class = "NSMenuItem"; title = "Find"; ObjectID = "bgW-yE-dx4"; */ +"bgW-yE-dx4.title" = "Find"; + +/* Class = "NSMenuItem"; title = "Wurzel"; ObjectID = "cZI-IR-7Qz"; */ +"cZI-IR-7Qz.title" = "Root"; + +/* Class = "NSMenuItem"; title = "Cut"; ObjectID = "dU7-GH-08D"; */ +"dU7-GH-08D.title" = "Cut"; + +/* Class = "NSMenuItem"; title = "Create Animation"; ObjectID = "dZW-XO-ysw"; */ +"dZW-XO-ysw.title" = "Create Animation"; + +/* Class = "NSTextFieldCell"; title = "X-Position"; ObjectID = "dcW-W8-ion"; */ +"dcW-W8-ion.title" = "X-Position"; + +/* Class = "NSTextFieldCell"; title = "Zoom"; ObjectID = "eij-AU-qYJ"; */ +"eij-AU-qYJ.title" = "Zoom"; + +/* Class = "NSMenuItem"; title = "Close"; ObjectID = "hl1-W0-lGK"; */ +"hl1-W0-lGK.title" = "Close"; + +/* Class = "NSMenu"; title = "Services"; ObjectID = "hz9-B4-Xy5"; */ +"hz9-B4-Xy5.title" = "Services"; + +/* Class = "NSTextFieldCell"; title = "Farbfaktor"; ObjectID = "i9h-aa-hGH"; */ +"i9h-aa-hGH.title" = "Color factor"; + +/* Class = "NSTextFieldCell"; title = "Länge"; ObjectID = "jFl-Ga-kaX"; */ +"jFl-Ga-kaX.title" = "Length"; + +/* Class = "NSTextFieldCell"; title = "X-Position"; ObjectID = "jMT-Aw-mJC"; */ +"jMT-Aw-mJC.title" = "X-Position"; + +/* Class = "NSMenuItem"; title = "Paste"; ObjectID = "lWN-y5-0TT"; */ +"lWN-y5-0TT.title" = "Paste"; + +/* Class = "NSMenuItem"; title = "File"; ObjectID = "m3n-Sr-ZO3"; */ +"m3n-Sr-ZO3.title" = "File"; + +/* Class = "NSMenuItem"; title = "Redo"; ObjectID = "mAZ-zr-OMz"; */ +"mAZ-zr-OMz.title" = "Redo"; + +/* Class = "NSTextFieldCell"; title = "Start"; ObjectID = "mAe-24-hED"; */ +"mAe-24-hED.title" = "Start"; + +/* Class = "NSTextFieldCell"; title = "Bilder pro Sekunde"; ObjectID = "mW6-1w-uq2"; */ +"mW6-1w-uq2.title" = "Frames per second"; + +/* Class = "NSTextFieldCell"; title = "Farbskalierung"; ObjectID = "nSx-kb-kHm"; */ +"nSx-kb-kHm.title" = "Color scale"; + +/* Class = "NSTextFieldCell"; title = "Iterationen"; ObjectID = "npX-Fu-BjF"; */ +"npX-Fu-BjF.title" = "Iterations"; + +/* Class = "NSMenuItem"; title = "Save Snapshot"; ObjectID = "obQ-j2-bS0"; */ +"obQ-j2-bS0.title" = "Save Snapshot"; + +/* Class = "NSMenuItem"; title = "Original Size"; ObjectID = "oyW-hX-lN4"; */ +"oyW-hX-lN4.title" = "Original Size"; + +/* Class = "NSMenuItem"; title = "Increase Iterations"; ObjectID = "pC0-mM-Pce"; */ +"pC0-mM-Pce.title" = "Increase Iterations"; + +/* Class = "NSMenuItem"; title = "Combined"; ObjectID = "pUm-sm-A5U"; */ +"pUm-sm-A5U.title" = "Combined"; + +/* Class = "NSMenuItem"; title = "Select All"; ObjectID = "pX0-za-p6q"; */ +"pX0-za-p6q.title" = "Select All"; + +/* Class = "NSTextFieldCell"; title = "Farbfaktor"; ObjectID = "q6a-Do-GmV"; */ +"q6a-Do-GmV.title" = "Color factor"; + +/* Class = "NSMenuItem"; title = "Find and Replace…"; ObjectID = "ri8-vR-Mlf"; */ +"ri8-vR-Mlf.title" = "Find and Replace…"; + +/* Class = "NSTextFieldCell"; title = "Iterationen"; ObjectID = "syy-QP-UrN"; */ +"syy-QP-UrN.title" = "Iterations"; + +/* Class = "NSMenu"; title = "Mandelbrot2"; ObjectID = "uQy-DD-JDr"; */ +"uQy-DD-JDr.title" = "Mandelbrot"; + +/* Class = "NSTextFieldCell"; title = "Farbverschiebung"; ObjectID = "w9y-9X-nf1"; */ +"w9y-9X-nf1.title" = "Color shift"; + +/* Class = "NSMenuItem"; title = "Help"; ObjectID = "wpr-3q-Mcd"; */ +"wpr-3q-Mcd.title" = "Help"; + +/* Class = "NSMenuItem"; title = "Find Previous"; ObjectID = "wqz-Oj-acB"; */ +"wqz-Oj-acB.title" = "Find Previous"; + +/* Class = "NSTextFieldCell"; title = "Iterationen"; ObjectID = "yg8-04-CRS"; */ +"yg8-04-CRS.title" = "Iterations"; + +/* Class = "NSMenuItem"; title = "Find Next"; ObjectID = "z7G-LB-LmD"; */ +"z7G-LB-LmD.title" = "Find Next"; + +/* Class = "NSMenuItem"; title = "Control Panel"; ObjectID = "zQa-he-bXG"; */ +"zQa-he-bXG.title" = "Control Panel"; + +/* Class = "NSButtonCell"; title = "Fast Rendering"; ObjectID = "ztn-jv-h9B"; */ +"ztn-jv-h9B.title" = "Fast Rendering"; diff --git a/Mandelbrot2/kernels.cl b/Mandelbrot2/kernels.cl index 039efd9..69aede5 100644 --- a/Mandelbrot2/kernels.cl +++ b/Mandelbrot2/kernels.cl @@ -1,130 +1,37 @@ -#pragma OPENCL EXTENSION cl_khr_fp64 : enable - -//FLOAT128 LOW LEVEL MATH -/* -inline uint4 float128(double value) -{ - uint4 result = (uint4)(0); - double fractional; - result.x = (uint) modf(value, &fractional); - value = fractional * 4294967296.0; - result.y = (uint) modf(value, &fractional); - value = fractional * 4294967296.0; - result.z = (uint) modf(value, &fractional); - value = fractional * 4294967296.0; - result.w = (uint) modf(value, &fractional); - return result; -} -*/ -/* -// Increment U -inline uint4 inc128(uint4 u) -{ - // Compute all carries to add - int4 h = (u == (uint4)(0xFFFFFFFF)); // Note that == sets ALL bits if true [6.3.d] - uint4 c = (uint4)(h.y&h.z&h.w&1,h.z&h.w&1,h.w&1,1); - return u+c; -} - -// Return -U -inline uint4 neg128(uint4 u) -{ - return inc128(u ^ (uint4)(0xFFFFFFFF)); // (1 + ~U) is two's complement -} - -// Return U+V -inline uint4 add128(uint4 u,uint4 v) -{ - uint4 s = u+v; - uint4 h = (uint4)(s < u); - uint4 c1 = h.yzwx & (uint4)(1,1,1,0); // Carry from U+V - h = (uint4)(s == (uint4)(0xFFFFFFFF)); - uint4 c2 = (uint4)((c1.y|(c1.z&h.z))&h.y,c1.z&h.z,0,0); // Propagated carry - return s+c1+c2; -} - -// Return U<<1 -inline uint4 shl128(uint4 u) -{ - uint4 h = (u>>(uint4)(31)) & (uint4)(0,1,1,1); // Bits to move up - return (u<<(uint4)(1)) | h.yzwx; -} - -// Return U>>1 -inline uint4 shr128(uint4 u) -{ - uint4 h = (u<<(uint4)(31)) & (uint4)(0x80000000,0x80000000,0x80000000,0); // Bits to move down - return (u>>(uint4)(1)) | h.wxyz; -} - -// Return U*K. -// U MUST be positive. -inline uint4 mul128u(uint4 u,uint k) -{ - uint4 s1 = u * (uint4)(k); - uint4 s2 = (uint4)(mul_hi(u.y,k),mul_hi(u.z,k),mul_hi(u.w,k),0); - return add128(s1,s2); -} - -// Return U*V truncated to keep the position of the decimal point. -// U and V MUST be positive. -inline uint4 mulfpu(uint4 u,uint4 v) -{ - // Diagonal coefficients - uint4 s = (uint4)(u.x*v.x,mul_hi(u.y,v.y),u.y*v.y,mul_hi(u.z,v.z)); - // Off-diagonal - uint4 t1 = (uint4)(mul_hi(u.x,v.y),u.x*v.y,mul_hi(u.x,v.w),u.x*v.w); - uint4 t2 = (uint4)(mul_hi(v.x,u.y),v.x*u.y,mul_hi(v.x,u.w),v.x*u.w); - s = add128(s,add128(t1,t2)); - t1 = (uint4)(0,mul_hi(u.x,v.z),u.x*v.z,mul_hi(u.y,v.w)); - t2 = (uint4)(0,mul_hi(v.x,u.z),v.x*u.z,mul_hi(v.y,u.w)); - s = add128(s,add128(t1,t2)); - t1 = (uint4)(0,0,mul_hi(u.y,v.z),u.y*v.z); - t2 = (uint4)(0,0,mul_hi(v.y,u.z),v.y*u.z); - s = add128(s,add128(t1,t2)); - // Add 3 to compensate truncation - return add128(s,(uint4)(0,0,0,3)); -} - -// Return U*U truncated to keep the position of the decimal point. -// U MUST be positive. -inline uint4 sqrfpu(uint4 u) -{ - // Diagonal coefficients - uint4 s = (uint4)(u.x*u.x,mul_hi(u.y,u.y),u.y*u.y,mul_hi(u.z,u.z)); - // Off-diagonal - uint4 t = (uint4)(mul_hi(u.x,u.y),u.x*u.y,mul_hi(u.x,u.w),u.x*u.w); - s = add128(s,shl128(t)); - t = (uint4)(0,mul_hi(u.x,u.z),u.x*u.z,mul_hi(u.y,u.w)); - s = add128(s,shl128(t)); - t = (uint4)(0,0,mul_hi(u.y,u.z),u.y*u.z); - s = add128(s,shl128(t)); - // Add 3 to compensate truncation - return add128(s,(uint4)(0,0,0,3)); -} +// +// kernels.cl +// Mandelbrot2 +// +// Created by Palle Klewitz on 16.08.14. +// Copyright (c) 2014 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +#pragma OPENCL EXTENSION cl_khr_fp64 : enable -*/ typedef struct { double real; double imag; } cplx_double; -/* -typedef struct -{ - quad real; - quad imag; -} cplx_quad; -*/ -typedef struct -{ - uint4 real; - uint4 imag; -} cplx_float128; - -inline cplx_double cplx_sqare(cplx_double value) +inline cplx_double cplx_square(cplx_double value) { cplx_double result; result.real = value.real * value.real - value.imag * value.imag; @@ -132,14 +39,6 @@ inline cplx_double cplx_sqare(cplx_double value) return result; } -inline cplx_float128 cplx_sqare128(cplx_float128 value) -{ - cplx_float128 result; - result.real = add128(sqrfpu(value.real), neg128(sqrfpu(value.imag))); - result.imag = mulfpu(mulfpu((uint4)(2,0,0,0), value.real), value.imag); - return result; -} - inline cplx_double cplx_add(cplx_double v1, cplx_double v2) { v1.real += v2.real; @@ -147,76 +46,101 @@ inline cplx_double cplx_add(cplx_double v1, cplx_double v2) return v1; } -inline cplx_float128 cplx_add128(cplx_float128 v1, cplx_float128 v2) +inline cplx_double cplx_sub(cplx_double v1, cplx_double v2) { - v1.real = add128(v1.real, v2.real); - v1.imag = add128(v1.imag, v2.imag); - return v1; + v1.real -= v2.real; + v1.imag -= v2.imag; + return v2; } -inline double cplx_abs_squared(cplx_double value) +inline cplx_double cplx_mul(cplx_double v1, cplx_double v2) { - return value.real * value.real + value.imag * value.imag; + cplx_double result; + result.real = v1.real * v2.real - v1.imag * v2.imag; + result.imag = v1.real * v2.imag + v1.imag * v2.real; + return result; } -inline uint4 cplx_abs_squared128(cplx_float128 value) +inline cplx_double cplx_div(cplx_double v1, cplx_double v2) { - return add128(sqrfpu(value.real), sqrfpu(value.imag)); + cplx_double result; + double divisor = v2.real * v2.real + v2.imag * v2.imag; + result.real = (v1.real * v2.real + v1.imag * v2.imag) / divisor; + result.imag = (v1.imag * v2.real - v1.real * v2.imag) / divisor; + return result; } -inline float4 get_color(uint iteration, uint iterations, float factor, float shift) +inline double cplx_abs_squared(cplx_double value) { - float alpha = (float) iteration / iterations * 3.1415926536f * factor + shift; + return value.real * value.real + value.imag * value.imag; +} + +inline float4 get_color(uint iteration, uint iterations, float factor, float shift, cplx_double z, unsigned char color_scaling, unsigned char smooth_colors) +{ + float alpha; + if (smooth_colors) + alpha = (float) (iteration - native_log2(native_log((float)(cplx_abs_squared(z))))); + else + alpha = (float) iteration; + + if (color_scaling == 0) + alpha /= (float)iterations; + else if (color_scaling == 1) + alpha = native_log(alpha); + else if (color_scaling == 2) + alpha = 1.0f / (alpha + 1.0f); + else if (color_scaling == 3) + alpha = native_sqrt(alpha); + alpha *= 3.1415926536f * factor; + alpha += shift; float red = native_cos(alpha); float blue = native_sin(-alpha); float green = (red + blue) * 0.667f; return (float4)(red, green, blue, 1); } -kernel void mandelbrot(__write_only image2d_t output, const double sizeX, const double sizeY, const int image_width, const int image_height, const double shiftX, const double shiftY, const uint iterations, const float colorFactor, const float colorShift) + +kernel void mandelbrot(__write_only image2d_t output, const double sizeX, const double sizeY, const int image_width, const int image_height, const double shiftX, const double shiftY, const uint iterations, const float colorFactor, const float colorShift, unsigned char color_mode, unsigned char smooth_colors, unsigned char color_scaling) { int2 pixel = (int2)(get_global_id(0), get_global_id(1)); int2 size = (int2)(image_width, image_height); cplx_double position = {(double)pixel.x * sizeX / (double) size.x + shiftX - sizeX * 0.5, (double)pixel.y * sizeY / (double)size.y + shiftY - sizeY * 0.5}; cplx_double z = position; - float4 color = (float4)(0,0,0,1); + float4 color = (float4)(0,0,0,2); for (uint i = 0; i < iterations; i++) { - z = cplx_add(cplx_sqare(z), position); - if (cplx_abs_squared(z) > 4) + z = cplx_add(cplx_square(z), position); + if (cplx_abs_squared(z) > 4.0) { - color = get_color(i, iterations, colorFactor, colorShift); + if (color_mode != 1) + color = get_color(i, iterations, colorFactor, colorShift, z, color_scaling, smooth_colors); i = iterations; } } - write_imagef(output, pixel, color); -} -/* -kernel void mandelbrot128(__write_only image2d_t output, const double sizeX, const double sizeY, const int image_width, const int image_height, const double shiftX, const double shiftY, const uint iterations, const float colorFactor, const float colorShift) -{ - int2 pixel = (int2)(get_global_id(0), get_global_id(1)); - int2 size = (int2)(image_width, image_height); - cplx_float128 position = {float128((double)pixel.x * sizeX / (double) size.x + shiftX - sizeX * 0.5), float128((double)pixel.y * sizeY / (double)size.y + shiftY - sizeY * 0.5)}; - cplx_float128 z = position; - float4 color = (float4)(0,0,0,0); - for (uint i = 0; i < iterations; i++) + if (color_mode != 0) { - z = cplx_add128(cplx_sqare128(z), position); - if (cplx_abs_squared128(z).x > 4) + if (color.w == 2.0f) { - color = get_color(i, iterations, colorFactor, colorShift); - i = iterations; + float c = z.imag / z.real; + float r = atan(c) * 2; + float a = 1.0 / (native_sqrt((float)(cplx_abs_squared(z)) * 0.5f + 1.0f)); + + color.w = 1.0; + color.x = native_cos(r) * a; + color.y = native_sin(r) * a; + color.z = -native_cos(r) * a; } } + else + color.w = 1.0f; write_imagef(output, pixel, color); } -*/ + kernel void reset(__write_only image2d_t texture) { - float4 clear = (float4)(0); - int2 pixel = (int2)(get_global_id(0), get_global_id(1)); - write_imagef(texture, pixel, clear); - + float4 clear = (float4)(0); + int2 pixel = (int2)(get_global_id(0), get_global_id(1)); + write_imagef(texture, pixel, clear); + } - diff --git a/Mandelbrot2/main.m b/Mandelbrot2/main.m index 844ae19..e01a896 100644 --- a/Mandelbrot2/main.m +++ b/Mandelbrot2/main.m @@ -3,7 +3,24 @@ // Mandelbrot2 // // Created by Palle Klewitz on 16.08.14. -// Copyright (c) 2014 Palle Klewitz. All rights reserved. +// Copyright (c) 2014 - 2016 Palle Klewitz. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is furnished +// to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // #import diff --git a/Mandelbrot2Tests/Info.plist b/Mandelbrot2Tests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/Mandelbrot2Tests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Mandelbrot2Tests/Mandelbrot2Tests.m b/Mandelbrot2Tests/Mandelbrot2Tests.m deleted file mode 100644 index 26efaeb..0000000 --- a/Mandelbrot2Tests/Mandelbrot2Tests.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// Mandelbrot2Tests.m -// Mandelbrot2Tests -// -// Created by Palle Klewitz on 16.08.14. -// Copyright (c) 2014 Palle Klewitz. All rights reserved. -// - -#import -#import - -@interface Mandelbrot2Tests : XCTestCase - -@end - -@implementation Mandelbrot2Tests - -- (void)setUp { - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testExample { - // This is an example of a functional test case. - XCTAssert(YES, @"Pass"); -} - -- (void)testPerformanceExample { - // This is an example of a performance test case. - [self measureBlock:^{ - // Put the code you want to measure the time of here. - }]; -} - -@end