├── .github └── workflows │ ├── compilation-check.yml │ └── publish.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── build.gradle.kts ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── graphics-build-logic ├── build.gradle.kts ├── settings.gradle.kts └── src │ └── main │ └── kotlin │ ├── android-app-convention.gradle.kts │ ├── android-base-convention.gradle.kts │ ├── android-library-convention.gradle.kts │ ├── android-publication-convention.gradle.kts │ ├── detekt-convention.gradle.kts │ ├── javadoc-stub-convention.gradle.kts │ ├── multiplatform-library-convention.gradle.kts │ └── publication-convention.gradle.kts ├── graphics ├── build.gradle.kts └── src │ ├── androidMain │ └── kotlin │ │ └── dev │ │ └── icerock │ │ └── moko │ │ └── graphics │ │ └── ColorExt.kt │ ├── commonMain │ └── kotlin │ │ └── dev │ │ └── icerock │ │ └── moko │ │ └── graphics │ │ ├── Color.kt │ │ └── ColorHEX.kt │ ├── iosMain │ └── kotlin │ │ └── dev │ │ └── icerock │ │ └── moko │ │ └── graphics │ │ └── ColorExt.kt │ └── macosMain │ └── kotlin │ └── dev │ └── icerock │ └── moko │ └── graphics │ └── ColorExt.kt ├── img └── logo.png ├── sample ├── android-app │ ├── build.gradle.kts │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── icerockdev │ │ │ └── MainActivity.kt │ │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ └── values │ │ └── strings.xml ├── gradlew ├── ios-app │ ├── Podfile │ ├── Podfile.lock │ ├── TestProj.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── TestProj.xcworkspace │ │ └── contents.xcworkspacedata │ └── src │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── Resources │ │ └── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ └── TestViewController.swift ├── macos-app │ ├── Podfile │ ├── Podfile.lock │ ├── macos-app.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── macos-app.xcworkspace │ │ └── contents.xcworkspacedata │ └── macos-app │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Base.lproj │ │ └── Main.storyboard │ │ ├── ContentView.swift │ │ ├── Info.plist │ │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ │ └── macos_app.entitlements └── mpp-library │ ├── MultiPlatformLibrary.podspec │ ├── build.gradle.kts │ └── src │ ├── commonMain │ └── kotlin │ │ └── com │ │ └── icerockdev │ │ └── library │ │ └── GraphicsTest.kt │ └── commonTest │ └── kotlin │ └── com │ └── icerockdev │ └── library │ └── GraphicsTests.kt └── settings.gradle.kts /.github/workflows/compilation-check.yml: -------------------------------------------------------------------------------- 1 | name: KMP library compilation check 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | - develop 8 | 9 | jobs: 10 | build: 11 | runs-on: ${{ matrix.os }} 12 | strategy: 13 | matrix: 14 | os: [macos-latest, windows-latest, ubuntu-latest] 15 | steps: 16 | - uses: actions/checkout@v1 17 | - name: Set up JDK 17 18 | uses: actions/setup-java@v1 19 | with: 20 | java-version: 17 21 | - name: Check build 22 | run: ./gradlew detektWithoutTests build publishToMavenLocal 23 | - name: Check unit tests 24 | run: ./gradlew test 25 | - name: Install pods 26 | run: cd sample/ios-app && pod install 27 | if: matrix.os == 'macOS-latest' 28 | - name: Check iOS 29 | run: cd sample/ios-app && set -o pipefail && xcodebuild -scheme TestProj -workspace TestProj.xcworkspace -configuration Debug -sdk iphonesimulator -arch x86_64 build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty 30 | if: matrix.os == 'macOS-latest' -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Create release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: 'Version' 8 | default: '0.1.0' 9 | required: true 10 | jobs: 11 | publish: 12 | name: Publish library at mavenCentral 13 | runs-on: ${{ matrix.os }} 14 | env: 15 | OSSRH_USER: ${{ secrets.OSSRH_USER }} 16 | OSSRH_KEY: ${{ secrets.OSSRH_KEY }} 17 | SIGNING_KEY_ID: ${{ secrets.SIGNING_KEYID }} 18 | SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} 19 | SIGNING_KEY: ${{ secrets.GPG_KEY_CONTENTS }} 20 | strategy: 21 | matrix: 22 | os: [macos-latest, windows-latest, ubuntu-latest] 23 | steps: 24 | - uses: actions/checkout@v1 25 | - name: Set up JDK 17 26 | uses: actions/setup-java@v1 27 | with: 28 | java-version: 17 29 | - name: Publish 30 | run: ./gradlew publish -DIS_MAIN_HOST=${{ matrix.os == 'ubuntu-latest' }} 31 | release: 32 | name: Create release 33 | needs: publish 34 | runs-on: ubuntu-latest 35 | steps: 36 | - name: Create Release 37 | id: create_release 38 | uses: actions/create-release@v1 39 | env: 40 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 41 | with: 42 | commitish: ${{ github.ref }} 43 | tag_name: release/${{ github.event.inputs.version }} 44 | release_name: ${{ github.event.inputs.version }} 45 | body: "Will be filled later" 46 | draft: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .settings 3 | .project 4 | .classpath 5 | .vscode 6 | .idea 7 | build 8 | *.iml 9 | Pods 10 | xcuserdata 11 | local.properties 12 | local.gradle 13 | kotlin-js-store/ 14 | .kotlin -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Do’s and Don’ts 2 | 3 | * **Search tickets before you file a new one.** Add to tickets if you have new information about the issue. 4 | * **Keep tickets short but sweet.** Make sure you include all the context needed to solve the issue. Don't overdo it. Great tickets allow us to focus on solving problems instead of discussing them. 5 | * **Take care of your ticket.** When you spend time to report a ticket with care we'll enjoy fixing it for you. 6 | * **Use [GitHub-flavored Markdown](https://help.github.com/articles/markdown-basics/).** Especially put code blocks and console outputs in backticks (```` ``` ````). That increases the readability. Bonus points for applying the appropriate syntax highlighting. 7 | 8 | ## Bug Reports 9 | 10 | In short, since you are most likely a developer, provide a ticket that you _yourself_ would _like_ to receive. 11 | 12 | First check if you are using the latest library version and Kotlin version before filing a ticket. 13 | 14 | Please include steps to reproduce and _all_ other relevant information, including any other relevant dependency and version information. 15 | 16 | ## Feature Requests 17 | 18 | Please try to be precise about the proposed outcome of the feature and how it 19 | would related to existing features. 20 | 21 | 22 | ## Pull Requests 23 | 24 | We **love** pull requests! 25 | 26 | All contributions _will_ be licensed under the Apache 2 license. 27 | 28 | Code/comments should adhere to the following rules: 29 | 30 | * Names should be descriptive and concise. 31 | * Use four spaces and no tabs. 32 | * Remember that source code usually gets written once and read often: ensure 33 | the reader doesn't have to make guesses. Make sure that the purpose and inner 34 | logic are either obvious to a reasonably skilled professional, or add a 35 | comment that explains it. 36 | * Please add a detailed description. 37 | 38 | If you consistently contribute improvements and/or bug fixes, we're happy to make you a maintainer. -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![moko-graphics](img/logo.png) 2 | [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/dev.icerock.moko/graphics) ](https://repo1.maven.org/maven2/dev/icerock/moko/graphics) ![kotlin-version](https://kotlin-version.aws.icerock.dev/kotlin-version?group=dev.icerock.moko&name=graphics) 3 | 4 | # Mobile Kotlin graphics 5 | This is a Kotlin Multiplatform library that provides graphics primitives to common code. 6 | 7 | ## Table of Contents 8 | - [Features](#features) 9 | - [Requirements](#requirements) 10 | - [Installation](#installation) 11 | - [Usage](#usage) 12 | - [Samples](#samples) 13 | - [Set Up Locally](#set-up-locally) 14 | - [Contributing](#contributing) 15 | - [License](#license) 16 | 17 | ## Features 18 | - **Color** converting according to the platform-side requirements (argb/rgba); 19 | - All Kotlin Multiplatform targets support. 20 | 21 | ## Requirements 22 | - Gradle version 6.8+ 23 | - Android API 16+ 24 | - iOS version 11.0+ 25 | 26 | ## Installation 27 | root build.gradle 28 | ```groovy 29 | allprojects { 30 | repositories { 31 | mavenCentral() 32 | } 33 | } 34 | ``` 35 | 36 | project build.gradle 37 | ```groovy 38 | dependencies { 39 | commonMainApi("dev.icerock.moko:graphics:0.10.1") 40 | } 41 | ``` 42 | 43 | ## Usage 44 | ### Color 45 | ```kotlin 46 | val red = Color( 47 | red = 0xFF, 48 | green = 0x00, 49 | blue = 0x00, 50 | alpha = 0xFF 51 | ) 52 | 53 | val rgba: Long = red.rgba 54 | val argb: Long = red.argb // android compatible 55 | ``` 56 | 57 | ## Samples 58 | Please see more examples in the [sample directory](sample). 59 | 60 | ## Set Up Locally 61 | - The [graphics directory](graphics) contains the `graphics` library; 62 | - The [sample directory](sample) contains sample apps for Android and iOS; plus the mpp-library connected to the apps; 63 | 64 | ## Contributing 65 | All development (both new features and bug fixes) is performed in the `develop` branch. This way `master` always contains the sources of the most recently released version. Please send PRs with bug fixes to the `develop` branch. Documentation fixes in the markdown files are an exception to this rule. They are updated directly in `master`. 66 | 67 | The `develop` branch is pushed to `master` on release. 68 | 69 | For more details on contributing please see the [contributing guide](CONTRIBUTING.md). 70 | 71 | ## License 72 | 73 | Copyright 2019 IceRock MAG Inc. 74 | 75 | Licensed under the Apache License, Version 2.0 (the "License"); 76 | you may not use this file except in compliance with the License. 77 | You may obtain a copy of the License at 78 | 79 | http://www.apache.org/licenses/LICENSE-2.0 80 | 81 | Unless required by applicable law or agreed to in writing, software 82 | distributed under the License is distributed on an "AS IS" BASIS, 83 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 84 | See the License for the specific language governing permissions and 85 | limitations under the License. 86 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget 2 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile 3 | 4 | /* 5 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 6 | */ 7 | buildscript { 8 | repositories { 9 | mavenCentral() 10 | google() 11 | gradlePluginPortal() 12 | } 13 | dependencies { 14 | classpath(":graphics-build-logic") 15 | } 16 | } 17 | 18 | allprojects { 19 | plugins.withId("org.gradle.maven-publish") { 20 | group = "dev.icerock.moko" 21 | version = libs.versions.mokoGraphicsVersion.get() 22 | } 23 | tasks.withType { 24 | compilerOptions.jvmTarget = JvmTarget.JVM_1_8 25 | } 26 | 27 | // fix Reason: Task ':graphics:publishJsPublicationToOSSRHRepository' uses this output of task ':graphics:signAndroidDebugPublication' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. 28 | val signingTasks = tasks.withType() 29 | tasks.withType().configureEach { 30 | dependsOn(signingTasks) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4096m 2 | org.gradle.configureondemand=false 3 | org.gradle.parallel=true 4 | 5 | kotlin.code.style=official 6 | 7 | kotlin.mpp.stability.nowarn=true 8 | kotlin.js.yarn=false 9 | 10 | android.useAndroidX=true 11 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | androidAppCompatVersion = "1.6.1" 3 | androidAnnotationVersion = "1.8.0" 4 | mokoGraphicsVersion = "0.10.1" 5 | 6 | [libraries] 7 | appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidAppCompatVersion" } 8 | annotation = { module = "androidx.annotation:annotation", version.ref = "androidAnnotationVersion" } 9 | mokoGraphics = { module = "dev.icerock.moko:graphics", version.ref = "mokoGraphicsVersion" } 10 | kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-graphics/c0e7ef83a243d17772a89be732ef64fb3463ed82/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /graphics-build-logic/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | google() 8 | 9 | gradlePluginPortal() 10 | } 11 | 12 | dependencies { 13 | api("dev.icerock:mobile-multiplatform:0.14.2") 14 | api("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0") 15 | api("com.android.tools.build:gradle:8.2.2") 16 | api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.6") 17 | } 18 | -------------------------------------------------------------------------------- /graphics-build-logic/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "graphics-build-logic" 2 | -------------------------------------------------------------------------------- /graphics-build-logic/src/main/kotlin/android-app-convention.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | plugins { 6 | id("com.android.application") 7 | id("android-base-convention") 8 | id("kotlin-android") 9 | } 10 | 11 | android { 12 | buildTypes { 13 | getByName("release") { 14 | isMinifyEnabled = true 15 | proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") 16 | } 17 | getByName("debug") { 18 | isDebuggable = true 19 | applicationIdSuffix = ".debug" 20 | } 21 | } 22 | 23 | packaging { 24 | resources.excludes.add("META-INF/*.kotlin_module") 25 | resources.excludes.add("META-INF/AL2.0") 26 | resources.excludes.add("META-INF/LGPL2.1") 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /graphics-build-logic/src/main/kotlin/android-base-convention.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | import com.android.build.gradle.BaseExtension 6 | 7 | configure { 8 | compileSdkVersion(34) 9 | 10 | defaultConfig { 11 | minSdk = 16 12 | targetSdk = 34 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /graphics-build-logic/src/main/kotlin/android-library-convention.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | plugins { 6 | id("com.android.library") 7 | id("kotlin-android") 8 | id("android-base-convention") 9 | } 10 | 11 | android { 12 | sourceSets.all { java.srcDir("src/$name/kotlin") } 13 | } 14 | -------------------------------------------------------------------------------- /graphics-build-logic/src/main/kotlin/android-publication-convention.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | plugins { 6 | id("publication-convention") 7 | } 8 | 9 | afterEvaluate { 10 | publishing.publications { 11 | create("release", MavenPublication::class.java) { 12 | from(components.getByName("release")) 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /graphics-build-logic/src/main/kotlin/detekt-convention.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | import io.gitlab.arturbosch.detekt.Detekt 6 | 7 | plugins { 8 | id("io.gitlab.arturbosch.detekt") 9 | } 10 | 11 | tasks.register("detektWithoutTests") { 12 | group = "verification" 13 | dependsOn(tasks.withType().matching { it.name.contains("Test").not() }) 14 | } 15 | 16 | dependencies { 17 | "detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:1.22.0") 18 | } 19 | -------------------------------------------------------------------------------- /graphics-build-logic/src/main/kotlin/javadoc-stub-convention.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | plugins { 6 | id("org.gradle.maven-publish") 7 | } 8 | 9 | val javadocJar by tasks.registering(Jar::class) { 10 | archiveClassifier.set("javadoc") 11 | } 12 | 13 | publishing.publications.withType { 14 | // Stub javadoc.jar artifact 15 | artifact(javadocJar.get()) 16 | } 17 | -------------------------------------------------------------------------------- /graphics-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl 2 | 3 | /* 4 | * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 5 | */ 6 | 7 | plugins { 8 | id("com.android.library") 9 | id("org.jetbrains.kotlin.multiplatform") 10 | id("android-base-convention") 11 | id("dev.icerock.mobile.multiplatform.android-manifest") 12 | } 13 | 14 | kotlin { 15 | androidTarget { 16 | publishLibraryVariants("release", "debug") 17 | } 18 | iosX64() 19 | iosArm64() 20 | iosSimulatorArm64() 21 | macosX64() 22 | macosArm64() 23 | tvosX64() 24 | tvosArm64() 25 | tvosSimulatorArm64() 26 | watchosX64() 27 | watchosArm32() 28 | watchosArm64() 29 | watchosSimulatorArm64() 30 | jvm() 31 | js(IR) { 32 | nodejs() 33 | browser() 34 | } 35 | linuxArm64() 36 | linuxX64() 37 | mingwX64() 38 | @OptIn(ExperimentalWasmDsl::class) 39 | wasmJs { 40 | nodejs() 41 | browser() 42 | } 43 | applyDefaultHierarchyTemplate() 44 | } -------------------------------------------------------------------------------- /graphics-build-logic/src/main/kotlin/publication-convention.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | import java.util.Base64 6 | 7 | plugins { 8 | id("javadoc-stub-convention") 9 | id("org.gradle.maven-publish") 10 | id("signing") 11 | } 12 | 13 | publishing { 14 | repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { 15 | name = "OSSRH" 16 | 17 | credentials { 18 | username = System.getenv("OSSRH_USER") 19 | password = System.getenv("OSSRH_KEY") 20 | } 21 | } 22 | 23 | publications.withType { 24 | // Provide artifacts information requited by Maven Central 25 | pom { 26 | name.set("MOKO graphics") 27 | description.set("Graphics primitives for mobile (android & ios) Kotlin Multiplatform development") 28 | url.set("https://github.com/icerockdev/moko-graphics") 29 | licenses { 30 | license { 31 | name.set("Apache-2.0") 32 | distribution.set("repo") 33 | url.set("https://github.com/icerockdev/moko-graphics/blob/master/LICENSE.md") 34 | } 35 | } 36 | 37 | developers { 38 | developer { 39 | id.set("Alex009") 40 | name.set("Aleksey Mikhailov") 41 | email.set("aleksey.mikhailov@icerockdev.com") 42 | } 43 | developer { 44 | id.set("nrobi144") 45 | name.set("Nagy Robert") 46 | email.set("nagyrobi144@gmail.com") 47 | } 48 | } 49 | 50 | scm { 51 | connection.set("scm:git:ssh://github.com/icerockdev/moko-graphics.git") 52 | developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-graphics.git") 53 | url.set("https://github.com/icerockdev/moko-graphics") 54 | } 55 | } 56 | } 57 | } 58 | 59 | 60 | signing { 61 | val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") 62 | val signingPassword: String? = System.getenv("SIGNING_PASSWORD") 63 | val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> 64 | String(Base64.getDecoder().decode(base64Key)) 65 | } 66 | if (signingKeyId != null) { 67 | useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) 68 | sign(publishing.publications) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /graphics/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | plugins { 6 | id("multiplatform-library-convention") 7 | id("detekt-convention") 8 | id("dev.icerock.mobile.multiplatform.android-manifest") 9 | id("publication-convention") 10 | } 11 | 12 | group = "dev.icerock.moko" 13 | version = libs.versions.mokoGraphicsVersion.get() 14 | 15 | dependencies { 16 | androidMainImplementation(libs.annotation) 17 | } 18 | 19 | android { 20 | namespace = "dev.icerock.moko.graphics" 21 | } 22 | -------------------------------------------------------------------------------- /graphics/src/androidMain/kotlin/dev/icerock/moko/graphics/ColorExt.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | package dev.icerock.moko.graphics 6 | 7 | import androidx.annotation.ColorInt 8 | 9 | @ColorInt 10 | fun Color.colorInt(): Int { 11 | return argb.toInt() 12 | } 13 | -------------------------------------------------------------------------------- /graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/Color.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | package dev.icerock.moko.graphics 6 | 7 | data class Color( 8 | val red: Int, 9 | val green: Int, 10 | val blue: Int, 11 | val alpha: Int 12 | ) { 13 | @Suppress("MagicNumber") 14 | val rgba: Long = alpha.toLong() or 15 | blue.toLong().shl(8) or 16 | green.toLong().shl(16) or 17 | red.toLong().shl(24) 18 | 19 | @Suppress("MagicNumber") 20 | val argb: Long = blue.toLong() or 21 | green.toLong().shl(8) or 22 | red.toLong().shl(16) or 23 | alpha.toLong().shl(24) 24 | 25 | @Suppress("MagicNumber") 26 | constructor(colorRGBA: Long) : this( 27 | red = (colorRGBA.shr(24) and 0xFF).toInt(), 28 | green = (colorRGBA.shr(16) and 0xFF).toInt(), 29 | blue = (colorRGBA.shr(8) and 0xFF).toInt(), 30 | alpha = (colorRGBA.shr(0) and 0xFF).toInt() 31 | ) 32 | 33 | companion object 34 | } 35 | -------------------------------------------------------------------------------- /graphics/src/commonMain/kotlin/dev/icerock/moko/graphics/ColorHEX.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | package dev.icerock.moko.graphics 6 | 7 | /** 8 | * Parses a hexadecimal color string into a [Color] object. 9 | * 10 | * This function supports multiple hex color formats with optional hash prefix: 11 | * - **3 digits (RGB)**: Each digit is expanded to two digits (e.g., "F0A" → "FF00AA") 12 | * - **4 digits (ARGB)**: Each digit is expanded to two digits (e.g., "8F0A" → "88FF00AA") 13 | * - **6 digits (RRGGBB)**: Standard RGB format with full alpha (255) 14 | * - **8 digits (AARRGGBB)**: Full ARGB format with explicit alpha channel 15 | * 16 | * The hash prefix (#) is optional and will be automatically removed if present. 17 | * All input is converted to uppercase for consistent parsing. 18 | * 19 | * @param colorHEX 20 | * The hexadecimal color string to parse. Can include optional '#' prefix. 21 | * Supports formats: RGB, ARGB, RRGGBB, AARRGGBB (case-insensitive). 22 | * 23 | * @return A [Color] object with ARGB values in the range 0-255. 24 | * 25 | * @throws IllegalArgumentException 26 | * if the input string is not a valid hex color format or contains invalid hexadecimal characters. 27 | * 28 | */ 29 | @Suppress("MagicNumber") 30 | public fun Color.Companion.parseColor(colorHEX: String): Color { 31 | val clean = colorHEX.removePrefix("#").uppercase() 32 | 33 | return when (clean.length) { 34 | 3 -> { 35 | // RGB -> RRGGBB 36 | val r = clean[0].digitToInt(16) * 17 37 | val g = clean[1].digitToInt(16) * 17 38 | val b = clean[2].digitToInt(16) * 17 39 | Color(red = r, green = g, blue = b, alpha = 255) 40 | } 41 | 42 | 4 -> { 43 | // ARGB 44 | val a = clean[0].digitToInt(radix = 16) * 17 45 | val r = clean[1].digitToInt(16) * 17 46 | val g = clean[2].digitToInt(16) * 17 47 | val b = clean[3].digitToInt(16) * 17 48 | Color(alpha = a, red = r, green = g, blue = b) 49 | } 50 | 51 | 6 -> { 52 | // RRGGBB 53 | val r = clean.substring(0, 2).toInt(16) 54 | val g = clean.substring(2, 4).toInt(16) 55 | val b = clean.substring(4, 6).toInt(16) 56 | Color(red = r, green = g, blue = b, alpha = 255) 57 | } 58 | 59 | 8 -> { 60 | // AARRGGBB 61 | val a = clean.substring(0, 2).toInt(16) 62 | val r = clean.substring(2, 4).toInt(16) 63 | val g = clean.substring(4, 6).toInt(16) 64 | val b = clean.substring(6, 8).toInt(16) 65 | Color(alpha = a, red = r, green = g, blue = b) 66 | } 67 | 68 | else -> throw IllegalArgumentException("Invalid Hex color: $colorHEX") 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /graphics/src/iosMain/kotlin/dev/icerock/moko/graphics/ColorExt.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | package dev.icerock.moko.graphics 6 | 7 | import platform.UIKit.UIColor 8 | 9 | // Used in iOS targets 10 | @Suppress("unused") 11 | fun Color.toUIColor(): UIColor { 12 | @Suppress("MagicNumber") 13 | val maxColorValue = 0xFF 14 | return UIColor( 15 | red = red.toDouble() / maxColorValue, 16 | green = green.toDouble() / maxColorValue, 17 | blue = blue.toDouble() / maxColorValue, 18 | alpha = alpha.toDouble() / maxColorValue 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /graphics/src/macosMain/kotlin/dev/icerock/moko/graphics/ColorExt.kt: -------------------------------------------------------------------------------- 1 | package dev.icerock.moko.graphics 2 | 3 | import platform.AppKit.NSColor 4 | 5 | // Used in macOS targets 6 | @Suppress("unused") 7 | fun Color.toNSColor(): NSColor { 8 | @Suppress("MagicNumber") 9 | val maxColorValue = 0xFF 10 | return NSColor.colorWithCalibratedRed( 11 | red = red.toDouble() / maxColorValue, 12 | green = green.toDouble() / maxColorValue, 13 | blue = blue.toDouble() / maxColorValue, 14 | alpha = alpha.toDouble() / maxColorValue 15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icerockdev/moko-graphics/c0e7ef83a243d17772a89be732ef64fb3463ed82/img/logo.png -------------------------------------------------------------------------------- /sample/android-app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | plugins { 6 | id("android-app-convention") 7 | id("kotlin-android") 8 | } 9 | 10 | android { 11 | namespace = "com.icerockdev" 12 | defaultConfig { 13 | applicationId = "dev.icerock.moko.samples.graphics" 14 | 15 | versionCode = 1 16 | versionName = "0.1.0" 17 | } 18 | } 19 | 20 | dependencies { 21 | implementation(libs.appCompat) 22 | 23 | implementation(projects.sample.mppLibrary) 24 | } 25 | -------------------------------------------------------------------------------- /sample/android-app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /opt/android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/android-app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/android-app/src/main/java/com/icerockdev/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | package com.icerockdev 6 | 7 | import android.os.Bundle 8 | import android.view.View 9 | import androidx.appcompat.app.AppCompatActivity 10 | import com.icerockdev.library.GraphicsTest 11 | import dev.icerock.moko.graphics.colorInt 12 | 13 | class MainActivity : AppCompatActivity() { 14 | 15 | private val graphicsTest = GraphicsTest() 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | 20 | setContentView(R.layout.activity_main) 21 | 22 | val background: View = findViewById(R.id.background) 23 | 24 | background.setBackgroundColor(graphicsTest.backgroundColor.colorInt()) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sample/android-app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /sample/android-app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Start 4 | Stop 5 | -------------------------------------------------------------------------------- /sample/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /sample/ios-app/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://cdn.cocoapods.org/' 2 | 3 | # ignore all warnings from all pods 4 | inhibit_all_warnings! 5 | 6 | use_frameworks! 7 | platform :ios, '11.0' 8 | 9 | pre_install do |installer| 10 | # We represent a Kotlin/Native module to CocoaPods as a vendored framework. 11 | # CocoaPods needs access to such frameworks during installation process to obtain 12 | # their type (static or dynamic) and configure the Xcode project accordingly. 13 | # Build MultiPlatformLibrary framework to correct install Pod 14 | puts "prepare MultiPlatformLibrary.framework (require some time...)" 15 | `cd .. && ./gradlew :sample:mpp-library:syncMultiPlatformLibraryDebugFrameworkIosX64` 16 | puts "preparing MultiPlatformLibrary.framework complete" 17 | end 18 | 19 | target 'TestProj' do 20 | # MultiPlatformLibrary 21 | pod 'MultiPlatformLibrary', :path => '../mpp-library' 22 | end 23 | -------------------------------------------------------------------------------- /sample/ios-app/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MultiPlatformLibrary (0.1.0) 3 | 4 | DEPENDENCIES: 5 | - MultiPlatformLibrary (from `../mpp-library`) 6 | 7 | EXTERNAL SOURCES: 8 | MultiPlatformLibrary: 9 | :path: "../mpp-library" 10 | 11 | SPEC CHECKSUMS: 12 | MultiPlatformLibrary: 0317a99a1dff77765bdd4ec5a77568f8a96897f0 13 | 14 | PODFILE CHECKSUM: 4fe4be1b815729054ce80d124b3c324811469f77 15 | 16 | COCOAPODS: 1.10.0 17 | -------------------------------------------------------------------------------- /sample/ios-app/TestProj.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2B70A10DE02726CA8E6981EB /* Pods_TestProj.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8D683A7C91DCD56058C7435 /* Pods_TestProj.framework */; }; 11 | 45D74FCC22BFDDFD00CAB0C8 /* TestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D74FCB22BFDDFD00CAB0C8 /* TestViewController.swift */; }; 12 | 45F4791D219463C7003D25FA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 45F47912219463C7003D25FA /* LaunchScreen.storyboard */; }; 13 | 45F4791E219463C7003D25FA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 45F47914219463C7003D25FA /* Main.storyboard */; }; 14 | 45F47921219463C7003D25FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 45F4791A219463C7003D25FA /* Assets.xcassets */; }; 15 | 45F47922219463C7003D25FA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45F4791B219463C7003D25FA /* AppDelegate.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 287627FF1F319065007FA12B /* mokoSampleGraphics.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = mokoSampleGraphics.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 45964D362282A1FD00C16658 /* mpp-library */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "mpp-library"; path = "../mpp-library"; sourceTree = ""; }; 21 | 45D74FCB22BFDDFD00CAB0C8 /* TestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestViewController.swift; sourceTree = ""; }; 22 | 45F47913219463C7003D25FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 23 | 45F47915219463C7003D25FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 45F4791A219463C7003D25FA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 45F4791B219463C7003D25FA /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | 45F4791C219463C7003D25FA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | A644D2F1C5377C40A53FCD6A /* Pods-TestProj.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TestProj.release.xcconfig"; path = "Pods/Target Support Files/Pods-TestProj/Pods-TestProj.release.xcconfig"; sourceTree = ""; }; 28 | DFBDF7D3559D080FDCA444A6 /* Pods-TestProj.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TestProj.debug.xcconfig"; path = "Pods/Target Support Files/Pods-TestProj/Pods-TestProj.debug.xcconfig"; sourceTree = ""; }; 29 | E8D683A7C91DCD56058C7435 /* Pods_TestProj.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TestProj.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | 287627FC1F319065007FA12B /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | 2B70A10DE02726CA8E6981EB /* Pods_TestProj.framework in Frameworks */, 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 0C46713DE6750675C174D0A7 /* Pods */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | DFBDF7D3559D080FDCA444A6 /* Pods-TestProj.debug.xcconfig */, 48 | A644D2F1C5377C40A53FCD6A /* Pods-TestProj.release.xcconfig */, 49 | ); 50 | name = Pods; 51 | sourceTree = ""; 52 | }; 53 | 287627F61F319065007FA12B = { 54 | isa = PBXGroup; 55 | children = ( 56 | 45964D362282A1FD00C16658 /* mpp-library */, 57 | 45F47910219463C7003D25FA /* src */, 58 | 287628001F319065007FA12B /* Products */, 59 | EE1ABB3E79CE541540D3155F /* Frameworks */, 60 | 0C46713DE6750675C174D0A7 /* Pods */, 61 | ); 62 | indentWidth = 4; 63 | sourceTree = ""; 64 | tabWidth = 4; 65 | usesTabs = 0; 66 | }; 67 | 287628001F319065007FA12B /* Products */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 287627FF1F319065007FA12B /* mokoSampleGraphics.app */, 71 | ); 72 | name = Products; 73 | sourceTree = ""; 74 | }; 75 | 45F47910219463C7003D25FA /* src */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 45F47911219463C7003D25FA /* Resources */, 79 | 45F4791A219463C7003D25FA /* Assets.xcassets */, 80 | 45F4791B219463C7003D25FA /* AppDelegate.swift */, 81 | 45F4791C219463C7003D25FA /* Info.plist */, 82 | 45D74FCB22BFDDFD00CAB0C8 /* TestViewController.swift */, 83 | ); 84 | path = src; 85 | sourceTree = ""; 86 | }; 87 | 45F47911219463C7003D25FA /* Resources */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 45F47912219463C7003D25FA /* LaunchScreen.storyboard */, 91 | 45F47914219463C7003D25FA /* Main.storyboard */, 92 | ); 93 | path = Resources; 94 | sourceTree = ""; 95 | }; 96 | EE1ABB3E79CE541540D3155F /* Frameworks */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | E8D683A7C91DCD56058C7435 /* Pods_TestProj.framework */, 100 | ); 101 | name = Frameworks; 102 | sourceTree = ""; 103 | }; 104 | /* End PBXGroup section */ 105 | 106 | /* Begin PBXNativeTarget section */ 107 | 287627FE1F319065007FA12B /* TestProj */ = { 108 | isa = PBXNativeTarget; 109 | buildConfigurationList = 287628111F319065007FA12B /* Build configuration list for PBXNativeTarget "TestProj" */; 110 | buildPhases = ( 111 | DDE4C06D580BF457BEDF8D0A /* [CP] Check Pods Manifest.lock */, 112 | 287627FB1F319065007FA12B /* Sources */, 113 | 287627FC1F319065007FA12B /* Frameworks */, 114 | 287627FD1F319065007FA12B /* Resources */, 115 | 02B727FAA6B9D00725C179CA /* [CP] Embed Pods Frameworks */, 116 | ); 117 | buildRules = ( 118 | ); 119 | dependencies = ( 120 | ); 121 | name = TestProj; 122 | productName = TestProj; 123 | productReference = 287627FF1F319065007FA12B /* mokoSampleGraphics.app */; 124 | productType = "com.apple.product-type.application"; 125 | }; 126 | /* End PBXNativeTarget section */ 127 | 128 | /* Begin PBXProject section */ 129 | 287627F71F319065007FA12B /* Project object */ = { 130 | isa = PBXProject; 131 | attributes = { 132 | LastSwiftUpdateCheck = 0830; 133 | LastUpgradeCheck = 0830; 134 | ORGANIZATIONNAME = "IceRock Development"; 135 | TargetAttributes = { 136 | 287627FE1F319065007FA12B = { 137 | CreatedOnToolsVersion = 8.3.3; 138 | LastSwiftMigration = 0940; 139 | }; 140 | }; 141 | }; 142 | buildConfigurationList = 287627FA1F319065007FA12B /* Build configuration list for PBXProject "TestProj" */; 143 | compatibilityVersion = "Xcode 9.3"; 144 | developmentRegion = English; 145 | hasScannedForEncodings = 0; 146 | knownRegions = ( 147 | English, 148 | Base, 149 | ); 150 | mainGroup = 287627F61F319065007FA12B; 151 | productRefGroup = 287628001F319065007FA12B /* Products */; 152 | projectDirPath = ""; 153 | projectRoot = ""; 154 | targets = ( 155 | 287627FE1F319065007FA12B /* TestProj */, 156 | ); 157 | }; 158 | /* End PBXProject section */ 159 | 160 | /* Begin PBXResourcesBuildPhase section */ 161 | 287627FD1F319065007FA12B /* Resources */ = { 162 | isa = PBXResourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | 45F4791E219463C7003D25FA /* Main.storyboard in Resources */, 166 | 45F4791D219463C7003D25FA /* LaunchScreen.storyboard in Resources */, 167 | 45F47921219463C7003D25FA /* Assets.xcassets in Resources */, 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | }; 171 | /* End PBXResourcesBuildPhase section */ 172 | 173 | /* Begin PBXShellScriptBuildPhase section */ 174 | 02B727FAA6B9D00725C179CA /* [CP] Embed Pods Frameworks */ = { 175 | isa = PBXShellScriptBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | ); 179 | inputFileListPaths = ( 180 | "${PODS_ROOT}/Target Support Files/Pods-TestProj/Pods-TestProj-frameworks-${CONFIGURATION}-input-files.xcfilelist", 181 | ); 182 | name = "[CP] Embed Pods Frameworks"; 183 | outputFileListPaths = ( 184 | "${PODS_ROOT}/Target Support Files/Pods-TestProj/Pods-TestProj-frameworks-${CONFIGURATION}-output-files.xcfilelist", 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | shellPath = /bin/sh; 188 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TestProj/Pods-TestProj-frameworks.sh\"\n"; 189 | showEnvVarsInLog = 0; 190 | }; 191 | DDE4C06D580BF457BEDF8D0A /* [CP] Check Pods Manifest.lock */ = { 192 | isa = PBXShellScriptBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | ); 196 | inputFileListPaths = ( 197 | ); 198 | inputPaths = ( 199 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 200 | "${PODS_ROOT}/Manifest.lock", 201 | ); 202 | name = "[CP] Check Pods Manifest.lock"; 203 | outputFileListPaths = ( 204 | ); 205 | outputPaths = ( 206 | "$(DERIVED_FILE_DIR)/Pods-TestProj-checkManifestLockResult.txt", 207 | ); 208 | runOnlyForDeploymentPostprocessing = 0; 209 | shellPath = /bin/sh; 210 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 211 | showEnvVarsInLog = 0; 212 | }; 213 | /* End PBXShellScriptBuildPhase section */ 214 | 215 | /* Begin PBXSourcesBuildPhase section */ 216 | 287627FB1F319065007FA12B /* Sources */ = { 217 | isa = PBXSourcesBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | 45D74FCC22BFDDFD00CAB0C8 /* TestViewController.swift in Sources */, 221 | 45F47922219463C7003D25FA /* AppDelegate.swift in Sources */, 222 | ); 223 | runOnlyForDeploymentPostprocessing = 0; 224 | }; 225 | /* End PBXSourcesBuildPhase section */ 226 | 227 | /* Begin PBXVariantGroup section */ 228 | 45F47912219463C7003D25FA /* LaunchScreen.storyboard */ = { 229 | isa = PBXVariantGroup; 230 | children = ( 231 | 45F47913219463C7003D25FA /* Base */, 232 | ); 233 | name = LaunchScreen.storyboard; 234 | sourceTree = ""; 235 | }; 236 | 45F47914219463C7003D25FA /* Main.storyboard */ = { 237 | isa = PBXVariantGroup; 238 | children = ( 239 | 45F47915219463C7003D25FA /* Base */, 240 | ); 241 | name = Main.storyboard; 242 | sourceTree = ""; 243 | }; 244 | /* End PBXVariantGroup section */ 245 | 246 | /* Begin XCBuildConfiguration section */ 247 | 2876280F1F319065007FA12B /* Debug */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | CURRENT_PROJECT_VERSION = 0; 251 | DEFINES_MODULE = YES; 252 | ONLY_ACTIVE_ARCH = YES; 253 | SWIFT_VERSION = 4.0; 254 | }; 255 | name = Debug; 256 | }; 257 | 287628101F319065007FA12B /* Release */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | CURRENT_PROJECT_VERSION = 0; 261 | DEFINES_MODULE = YES; 262 | ONLY_ACTIVE_ARCH = YES; 263 | SWIFT_VERSION = 4.0; 264 | }; 265 | name = Release; 266 | }; 267 | 287628121F319065007FA12B /* Debug */ = { 268 | isa = XCBuildConfiguration; 269 | baseConfigurationReference = DFBDF7D3559D080FDCA444A6 /* Pods-TestProj.debug.xcconfig */; 270 | buildSettings = { 271 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 272 | CODE_SIGN_IDENTITY = "iPhone Developer"; 273 | CODE_SIGN_STYLE = Manual; 274 | DEVELOPMENT_TEAM = ""; 275 | INFOPLIST_FILE = src/Info.plist; 276 | PRODUCT_BUNDLE_IDENTIFIER = dev.icerock.moko.sample.graphics; 277 | PRODUCT_NAME = mokoSampleGraphics; 278 | PROVISIONING_PROFILE_SPECIFIER = ""; 279 | SDKROOT = iphoneos; 280 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; 281 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 282 | }; 283 | name = Debug; 284 | }; 285 | 287628131F319065007FA12B /* Release */ = { 286 | isa = XCBuildConfiguration; 287 | baseConfigurationReference = A644D2F1C5377C40A53FCD6A /* Pods-TestProj.release.xcconfig */; 288 | buildSettings = { 289 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 290 | CODE_SIGN_IDENTITY = "iPhone Developer"; 291 | CODE_SIGN_STYLE = Manual; 292 | DEVELOPMENT_TEAM = ""; 293 | INFOPLIST_FILE = src/Info.plist; 294 | PRODUCT_BUNDLE_IDENTIFIER = dev.icerock.moko.sample.graphics; 295 | PRODUCT_NAME = mokoSampleGraphics; 296 | PROVISIONING_PROFILE_SPECIFIER = ""; 297 | SDKROOT = iphoneos; 298 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; 299 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 300 | }; 301 | name = Release; 302 | }; 303 | /* End XCBuildConfiguration section */ 304 | 305 | /* Begin XCConfigurationList section */ 306 | 287627FA1F319065007FA12B /* Build configuration list for PBXProject "TestProj" */ = { 307 | isa = XCConfigurationList; 308 | buildConfigurations = ( 309 | 2876280F1F319065007FA12B /* Debug */, 310 | 287628101F319065007FA12B /* Release */, 311 | ); 312 | defaultConfigurationIsVisible = 0; 313 | defaultConfigurationName = Release; 314 | }; 315 | 287628111F319065007FA12B /* Build configuration list for PBXNativeTarget "TestProj" */ = { 316 | isa = XCConfigurationList; 317 | buildConfigurations = ( 318 | 287628121F319065007FA12B /* Debug */, 319 | 287628131F319065007FA12B /* Release */, 320 | ); 321 | defaultConfigurationIsVisible = 0; 322 | defaultConfigurationName = Release; 323 | }; 324 | /* End XCConfigurationList section */ 325 | }; 326 | rootObject = 287627F71F319065007FA12B /* Project object */; 327 | } 328 | -------------------------------------------------------------------------------- /sample/ios-app/TestProj.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /sample/ios-app/TestProj.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sample/ios-app/src/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | import UIKit 6 | 7 | @UIApplicationMain 8 | class AppDelegate: NSObject, UIApplicationDelegate { 9 | 10 | var window: UIWindow? 11 | 12 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { 13 | 14 | return true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sample/ios-app/src/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /sample/ios-app/src/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /sample/ios-app/src/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | moko-graphics 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(BUNDLE_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 0.1.0 21 | CFBundleVersion 22 | 1 23 | LSApplicationCategoryType 24 | public.app-category.developer-tools 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | 32 | NSMainStoryboardFile 33 | Main 34 | UILaunchStoryboardName 35 | LaunchScreen 36 | UIMainStoryboardFile 37 | Main 38 | UIRequiredDeviceCapabilities 39 | 40 | armv7 41 | 42 | UIRequiresFullScreen 43 | 44 | UIStatusBarHidden 45 | 46 | UIStatusBarHidden~ipad 47 | 48 | UIStatusBarStyle 49 | UIStatusBarStyleLightContent 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationLandscapeRight 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationPortraitUpsideDown 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /sample/ios-app/src/Resources/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /sample/ios-app/src/Resources/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /sample/ios-app/src/TestViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | import UIKit 6 | import MultiPlatformLibrary 7 | 8 | class TestViewController: UIViewController { 9 | 10 | private let graphicsTest = GraphicsTest() 11 | 12 | override func viewDidLoad() { 13 | super.viewDidLoad() 14 | 15 | view.backgroundColor = graphicsTest.backgroundColor.toUIColor() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sample/macos-app/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | # ignore all warnings from all pods 4 | inhibit_all_warnings! 5 | 6 | use_frameworks! 7 | platform :osx, '10.6' 8 | 9 | pre_install do |installer| 10 | # We represent a Kotlin/Native module to CocoaPods as a vendored framework. 11 | # CocoaPods needs access to such frameworks during installation process to obtain 12 | # their type (static or dynamic) and configure the Xcode project accordingly. 13 | # Build MultiPlatformLibrary framework to correct install Pod 14 | puts "prepare MultiPlatformLibrary.framework (requires some time...)" 15 | `cd .. && ./gradlew :sample:mpp-library:syncMultiPlatformLibraryDebugFrameworkMacosX64` 16 | puts "preparing MultiPlatformLibrary.framework complete" 17 | end 18 | 19 | target 'macos-app' do 20 | # MultiPlatformLibrary 21 | pod 'MultiPlatformLibrary', :path => '../mpp-library' 22 | end 23 | -------------------------------------------------------------------------------- /sample/macos-app/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MultiPlatformLibrary (0.1.0) 3 | 4 | DEPENDENCIES: 5 | - MultiPlatformLibrary (from `../mpp-library`) 6 | 7 | EXTERNAL SOURCES: 8 | MultiPlatformLibrary: 9 | :path: "../mpp-library" 10 | 11 | SPEC CHECKSUMS: 12 | MultiPlatformLibrary: 0317a99a1dff77765bdd4ec5a77568f8a96897f0 13 | 14 | PODFILE CHECKSUM: 093688805caa68eef74b1e9f93486f94144d88ea 15 | 16 | COCOAPODS: 1.10.0 17 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 17BF7647257BAF49000C60A6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17BF7646257BAF49000C60A6 /* AppDelegate.swift */; }; 11 | 17BF7649257BAF49000C60A6 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17BF7648257BAF49000C60A6 /* ContentView.swift */; }; 12 | 17BF764B257BAF4B000C60A6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 17BF764A257BAF4B000C60A6 /* Assets.xcassets */; }; 13 | 17BF764E257BAF4B000C60A6 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 17BF764D257BAF4B000C60A6 /* Preview Assets.xcassets */; }; 14 | 17BF7651257BAF4B000C60A6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 17BF764F257BAF4B000C60A6 /* Main.storyboard */; }; 15 | E804D2A195AE0CDAC21D1E92 /* Pods_macos_app.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5920E713EDFA0E1B17671FEA /* Pods_macos_app.framework */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 17BF7643257BAF49000C60A6 /* macos-app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "macos-app.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 17BF7646257BAF49000C60A6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | 17BF7648257BAF49000C60A6 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 22 | 17BF764A257BAF4B000C60A6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 17BF764D257BAF4B000C60A6 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 24 | 17BF7650257BAF4B000C60A6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | 17BF7652257BAF4B000C60A6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | 17BF7653257BAF4B000C60A6 /* macos_app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macos_app.entitlements; sourceTree = ""; }; 27 | 5920E713EDFA0E1B17671FEA /* Pods_macos_app.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_macos_app.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | D2FAE28DDDFC6CC190B41A87 /* Pods-macos-app.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-macos-app.release.xcconfig"; path = "Target Support Files/Pods-macos-app/Pods-macos-app.release.xcconfig"; sourceTree = ""; }; 29 | D9C3CD1AD9C06CFDCE9830B3 /* Pods-macos-app.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-macos-app.debug.xcconfig"; path = "Target Support Files/Pods-macos-app/Pods-macos-app.debug.xcconfig"; sourceTree = ""; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | 17BF7640257BAF49000C60A6 /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | E804D2A195AE0CDAC21D1E92 /* Pods_macos_app.framework in Frameworks */, 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 17BF763A257BAF49000C60A6 = { 45 | isa = PBXGroup; 46 | children = ( 47 | 17BF7645257BAF49000C60A6 /* macos-app */, 48 | 17BF7644257BAF49000C60A6 /* Products */, 49 | 4EEE2FDDE82FAE5114B2C69A /* Pods */, 50 | E275A0C42745296371666630 /* Frameworks */, 51 | ); 52 | sourceTree = ""; 53 | }; 54 | 17BF7644257BAF49000C60A6 /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 17BF7643257BAF49000C60A6 /* macos-app.app */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | 17BF7645257BAF49000C60A6 /* macos-app */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 17BF7646257BAF49000C60A6 /* AppDelegate.swift */, 66 | 17BF7648257BAF49000C60A6 /* ContentView.swift */, 67 | 17BF764A257BAF4B000C60A6 /* Assets.xcassets */, 68 | 17BF764F257BAF4B000C60A6 /* Main.storyboard */, 69 | 17BF7652257BAF4B000C60A6 /* Info.plist */, 70 | 17BF7653257BAF4B000C60A6 /* macos_app.entitlements */, 71 | 17BF764C257BAF4B000C60A6 /* Preview Content */, 72 | ); 73 | path = "macos-app"; 74 | sourceTree = ""; 75 | }; 76 | 17BF764C257BAF4B000C60A6 /* Preview Content */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 17BF764D257BAF4B000C60A6 /* Preview Assets.xcassets */, 80 | ); 81 | path = "Preview Content"; 82 | sourceTree = ""; 83 | }; 84 | 4EEE2FDDE82FAE5114B2C69A /* Pods */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | D9C3CD1AD9C06CFDCE9830B3 /* Pods-macos-app.debug.xcconfig */, 88 | D2FAE28DDDFC6CC190B41A87 /* Pods-macos-app.release.xcconfig */, 89 | ); 90 | path = Pods; 91 | sourceTree = ""; 92 | }; 93 | E275A0C42745296371666630 /* Frameworks */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 5920E713EDFA0E1B17671FEA /* Pods_macos_app.framework */, 97 | ); 98 | name = Frameworks; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 17BF7642257BAF49000C60A6 /* macos-app */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 17BF7656257BAF4B000C60A6 /* Build configuration list for PBXNativeTarget "macos-app" */; 107 | buildPhases = ( 108 | 83ADEED54696EE7CC98283F4 /* [CP] Check Pods Manifest.lock */, 109 | 17BF763F257BAF49000C60A6 /* Sources */, 110 | 17BF7640257BAF49000C60A6 /* Frameworks */, 111 | 17BF7641257BAF49000C60A6 /* Resources */, 112 | 343F0A24A61C9274995717EF /* [CP] Embed Pods Frameworks */, 113 | ); 114 | buildRules = ( 115 | ); 116 | dependencies = ( 117 | ); 118 | name = "macos-app"; 119 | productName = "macos-app"; 120 | productReference = 17BF7643257BAF49000C60A6 /* macos-app.app */; 121 | productType = "com.apple.product-type.application"; 122 | }; 123 | /* End PBXNativeTarget section */ 124 | 125 | /* Begin PBXProject section */ 126 | 17BF763B257BAF49000C60A6 /* Project object */ = { 127 | isa = PBXProject; 128 | attributes = { 129 | LastSwiftUpdateCheck = 1210; 130 | LastUpgradeCheck = 1210; 131 | TargetAttributes = { 132 | 17BF7642257BAF49000C60A6 = { 133 | CreatedOnToolsVersion = 12.1; 134 | }; 135 | }; 136 | }; 137 | buildConfigurationList = 17BF763E257BAF49000C60A6 /* Build configuration list for PBXProject "macos-app" */; 138 | compatibilityVersion = "Xcode 9.3"; 139 | developmentRegion = en; 140 | hasScannedForEncodings = 0; 141 | knownRegions = ( 142 | en, 143 | Base, 144 | ); 145 | mainGroup = 17BF763A257BAF49000C60A6; 146 | productRefGroup = 17BF7644257BAF49000C60A6 /* Products */; 147 | projectDirPath = ""; 148 | projectRoot = ""; 149 | targets = ( 150 | 17BF7642257BAF49000C60A6 /* macos-app */, 151 | ); 152 | }; 153 | /* End PBXProject section */ 154 | 155 | /* Begin PBXResourcesBuildPhase section */ 156 | 17BF7641257BAF49000C60A6 /* Resources */ = { 157 | isa = PBXResourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | 17BF7651257BAF4B000C60A6 /* Main.storyboard in Resources */, 161 | 17BF764E257BAF4B000C60A6 /* Preview Assets.xcassets in Resources */, 162 | 17BF764B257BAF4B000C60A6 /* Assets.xcassets in Resources */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXResourcesBuildPhase section */ 167 | 168 | /* Begin PBXShellScriptBuildPhase section */ 169 | 343F0A24A61C9274995717EF /* [CP] Embed Pods Frameworks */ = { 170 | isa = PBXShellScriptBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | ); 174 | inputFileListPaths = ( 175 | "${PODS_ROOT}/Target Support Files/Pods-macos-app/Pods-macos-app-frameworks-${CONFIGURATION}-input-files.xcfilelist", 176 | ); 177 | name = "[CP] Embed Pods Frameworks"; 178 | outputFileListPaths = ( 179 | "${PODS_ROOT}/Target Support Files/Pods-macos-app/Pods-macos-app-frameworks-${CONFIGURATION}-output-files.xcfilelist", 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | shellPath = /bin/sh; 183 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-macos-app/Pods-macos-app-frameworks.sh\"\n"; 184 | showEnvVarsInLog = 0; 185 | }; 186 | 83ADEED54696EE7CC98283F4 /* [CP] Check Pods Manifest.lock */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputFileListPaths = ( 192 | ); 193 | inputPaths = ( 194 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 195 | "${PODS_ROOT}/Manifest.lock", 196 | ); 197 | name = "[CP] Check Pods Manifest.lock"; 198 | outputFileListPaths = ( 199 | ); 200 | outputPaths = ( 201 | "$(DERIVED_FILE_DIR)/Pods-macos-app-checkManifestLockResult.txt", 202 | ); 203 | runOnlyForDeploymentPostprocessing = 0; 204 | shellPath = /bin/sh; 205 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 206 | showEnvVarsInLog = 0; 207 | }; 208 | /* End PBXShellScriptBuildPhase section */ 209 | 210 | /* Begin PBXSourcesBuildPhase section */ 211 | 17BF763F257BAF49000C60A6 /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 17BF7649257BAF49000C60A6 /* ContentView.swift in Sources */, 216 | 17BF7647257BAF49000C60A6 /* AppDelegate.swift in Sources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXSourcesBuildPhase section */ 221 | 222 | /* Begin PBXVariantGroup section */ 223 | 17BF764F257BAF4B000C60A6 /* Main.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 17BF7650257BAF4B000C60A6 /* Base */, 227 | ); 228 | name = Main.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 17BF7654257BAF4B000C60A6 /* Debug */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 240 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 241 | CLANG_CXX_LIBRARY = "libc++"; 242 | CLANG_ENABLE_MODULES = YES; 243 | CLANG_ENABLE_OBJC_ARC = YES; 244 | CLANG_ENABLE_OBJC_WEAK = YES; 245 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_COMMA = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 251 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 252 | CLANG_WARN_EMPTY_BODY = YES; 253 | CLANG_WARN_ENUM_CONVERSION = YES; 254 | CLANG_WARN_INFINITE_RECURSION = YES; 255 | CLANG_WARN_INT_CONVERSION = YES; 256 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 257 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 258 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 259 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 260 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 261 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 262 | CLANG_WARN_STRICT_PROTOTYPES = YES; 263 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 264 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | COPY_PHASE_STRIP = NO; 268 | DEBUG_INFORMATION_FORMAT = dwarf; 269 | ENABLE_STRICT_OBJC_MSGSEND = YES; 270 | ENABLE_TESTABILITY = YES; 271 | GCC_C_LANGUAGE_STANDARD = gnu11; 272 | GCC_DYNAMIC_NO_PIC = NO; 273 | GCC_NO_COMMON_BLOCKS = YES; 274 | GCC_OPTIMIZATION_LEVEL = 0; 275 | GCC_PREPROCESSOR_DEFINITIONS = ( 276 | "DEBUG=1", 277 | "$(inherited)", 278 | ); 279 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 280 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 281 | GCC_WARN_UNDECLARED_SELECTOR = YES; 282 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 283 | GCC_WARN_UNUSED_FUNCTION = YES; 284 | GCC_WARN_UNUSED_VARIABLE = YES; 285 | MACOSX_DEPLOYMENT_TARGET = 10.15; 286 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 287 | MTL_FAST_MATH = YES; 288 | ONLY_ACTIVE_ARCH = YES; 289 | SDKROOT = macosx; 290 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 291 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 292 | }; 293 | name = Debug; 294 | }; 295 | 17BF7655257BAF4B000C60A6 /* Release */ = { 296 | isa = XCBuildConfiguration; 297 | buildSettings = { 298 | ALWAYS_SEARCH_USER_PATHS = NO; 299 | CLANG_ANALYZER_NONNULL = YES; 300 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 301 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 302 | CLANG_CXX_LIBRARY = "libc++"; 303 | CLANG_ENABLE_MODULES = YES; 304 | CLANG_ENABLE_OBJC_ARC = YES; 305 | CLANG_ENABLE_OBJC_WEAK = YES; 306 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 307 | CLANG_WARN_BOOL_CONVERSION = YES; 308 | CLANG_WARN_COMMA = YES; 309 | CLANG_WARN_CONSTANT_CONVERSION = YES; 310 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 311 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 312 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 313 | CLANG_WARN_EMPTY_BODY = YES; 314 | CLANG_WARN_ENUM_CONVERSION = YES; 315 | CLANG_WARN_INFINITE_RECURSION = YES; 316 | CLANG_WARN_INT_CONVERSION = YES; 317 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 318 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 319 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 320 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 321 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 322 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 323 | CLANG_WARN_STRICT_PROTOTYPES = YES; 324 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 325 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 326 | CLANG_WARN_UNREACHABLE_CODE = YES; 327 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 328 | COPY_PHASE_STRIP = NO; 329 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 330 | ENABLE_NS_ASSERTIONS = NO; 331 | ENABLE_STRICT_OBJC_MSGSEND = YES; 332 | GCC_C_LANGUAGE_STANDARD = gnu11; 333 | GCC_NO_COMMON_BLOCKS = YES; 334 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 335 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 336 | GCC_WARN_UNDECLARED_SELECTOR = YES; 337 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 338 | GCC_WARN_UNUSED_FUNCTION = YES; 339 | GCC_WARN_UNUSED_VARIABLE = YES; 340 | MACOSX_DEPLOYMENT_TARGET = 10.15; 341 | MTL_ENABLE_DEBUG_INFO = NO; 342 | MTL_FAST_MATH = YES; 343 | SDKROOT = macosx; 344 | SWIFT_COMPILATION_MODE = wholemodule; 345 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 346 | }; 347 | name = Release; 348 | }; 349 | 17BF7657257BAF4B000C60A6 /* Debug */ = { 350 | isa = XCBuildConfiguration; 351 | baseConfigurationReference = D9C3CD1AD9C06CFDCE9830B3 /* Pods-macos-app.debug.xcconfig */; 352 | buildSettings = { 353 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 354 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 355 | CODE_SIGN_ENTITLEMENTS = "macos-app/macos_app.entitlements"; 356 | CODE_SIGN_STYLE = Automatic; 357 | COMBINE_HIDPI_IMAGES = YES; 358 | DEVELOPMENT_ASSET_PATHS = "\"macos-app/Preview Content\""; 359 | ENABLE_PREVIEWS = YES; 360 | INFOPLIST_FILE = "macos-app/Info.plist"; 361 | LD_RUNPATH_SEARCH_PATHS = ( 362 | "$(inherited)", 363 | "@executable_path/../Frameworks", 364 | ); 365 | MACOSX_DEPLOYMENT_TARGET = 10.15; 366 | PRODUCT_BUNDLE_IDENTIFIER = "dev.icerock.moko.macos-app"; 367 | PRODUCT_NAME = "$(TARGET_NAME)"; 368 | SWIFT_VERSION = 5.0; 369 | }; 370 | name = Debug; 371 | }; 372 | 17BF7658257BAF4B000C60A6 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | baseConfigurationReference = D2FAE28DDDFC6CC190B41A87 /* Pods-macos-app.release.xcconfig */; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 378 | CODE_SIGN_ENTITLEMENTS = "macos-app/macos_app.entitlements"; 379 | CODE_SIGN_STYLE = Automatic; 380 | COMBINE_HIDPI_IMAGES = YES; 381 | DEVELOPMENT_ASSET_PATHS = "\"macos-app/Preview Content\""; 382 | ENABLE_PREVIEWS = YES; 383 | INFOPLIST_FILE = "macos-app/Info.plist"; 384 | LD_RUNPATH_SEARCH_PATHS = ( 385 | "$(inherited)", 386 | "@executable_path/../Frameworks", 387 | ); 388 | MACOSX_DEPLOYMENT_TARGET = 10.15; 389 | PRODUCT_BUNDLE_IDENTIFIER = "dev.icerock.moko.macos-app"; 390 | PRODUCT_NAME = "$(TARGET_NAME)"; 391 | SWIFT_VERSION = 5.0; 392 | }; 393 | name = Release; 394 | }; 395 | /* End XCBuildConfiguration section */ 396 | 397 | /* Begin XCConfigurationList section */ 398 | 17BF763E257BAF49000C60A6 /* Build configuration list for PBXProject "macos-app" */ = { 399 | isa = XCConfigurationList; 400 | buildConfigurations = ( 401 | 17BF7654257BAF4B000C60A6 /* Debug */, 402 | 17BF7655257BAF4B000C60A6 /* Release */, 403 | ); 404 | defaultConfigurationIsVisible = 0; 405 | defaultConfigurationName = Release; 406 | }; 407 | 17BF7656257BAF4B000C60A6 /* Build configuration list for PBXNativeTarget "macos-app" */ = { 408 | isa = XCConfigurationList; 409 | buildConfigurations = ( 410 | 17BF7657257BAF4B000C60A6 /* Debug */, 411 | 17BF7658257BAF4B000C60A6 /* Release */, 412 | ); 413 | defaultConfigurationIsVisible = 0; 414 | defaultConfigurationName = Release; 415 | }; 416 | /* End XCConfigurationList section */ 417 | }; 418 | rootObject = 17BF763B257BAF49000C60A6 /* Project object */; 419 | } 420 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // macos-app 4 | // 5 | // Created by Nagy Robert on 05/12/2020. 6 | // 7 | 8 | import Cocoa 9 | import SwiftUI 10 | import MultiPlatformLibrary 11 | 12 | @NSApplicationMain 13 | class AppDelegate: NSObject, NSApplicationDelegate { 14 | 15 | var window: NSWindow! 16 | private let graphicsTest = GraphicsTest() 17 | 18 | func applicationDidFinishLaunching(_ aNotification: Notification) { 19 | // Create the SwiftUI view that provides the window contents. 20 | let contentView = ContentView() 21 | 22 | // Create the window and set the content view. 23 | window = NSWindow( 24 | contentRect: NSRect(x: 0, y: 0, width: 480, height: 300), 25 | styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], 26 | backing: .buffered, defer: false) 27 | window.isReleasedWhenClosed = false 28 | window.center() 29 | window.setFrameAutosaveName("Main Window") 30 | window.contentView = NSHostingView(rootView: contentView) 31 | window.makeKeyAndOrderFront(nil) 32 | window.backgroundColor = graphicsTest.backgroundColor.toNSColor() 33 | } 34 | 35 | func applicationWillTerminate(_ aNotification: Notification) { 36 | // Insert code here to tear down your application 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | Default 529 | 530 | 531 | 532 | 533 | 534 | 535 | Left to Right 536 | 537 | 538 | 539 | 540 | 541 | 542 | Right to Left 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | Default 554 | 555 | 556 | 557 | 558 | 559 | 560 | Left to Right 561 | 562 | 563 | 564 | 565 | 566 | 567 | Right to Left 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // macos-app 4 | // 5 | // Created by Nagy Robert on 05/12/2020. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | var body: some View { 12 | Text("moko-graphics") 13 | .frame(maxWidth: .infinity, maxHeight: .infinity) 14 | } 15 | } 16 | 17 | 18 | struct ContentView_Previews: PreviewProvider { 19 | static var previews: some View { 20 | ContentView() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSMainStoryboardFile 26 | Main 27 | NSPrincipalClass 28 | NSApplication 29 | 30 | 31 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /sample/macos-app/macos-app/macos_app.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sample/mpp-library/MultiPlatformLibrary.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = 'MultiPlatformLibrary' 3 | spec.version = '0.1.0' 4 | spec.homepage = 'Link to a Kotlin/Native module homepage' 5 | spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" } 6 | spec.authors = 'IceRock Development' 7 | spec.license = '' 8 | spec.summary = 'Shared code between iOS and Android' 9 | 10 | spec.vendored_frameworks = "build/cocoapods/framework/#{spec.name}.framework" 11 | spec.libraries = "c++" 12 | spec.module_name = "#{spec.name}_umbrella" 13 | 14 | spec.ios.deployment_target = '11.0' 15 | spec.osx.deployment_target = '10.6' 16 | 17 | spec.pod_target_xcconfig = { 18 | 'MPP_LIBRARY_NAME' => 'MultiPlatformLibrary', 19 | 'GRADLE_TASK[sdk=iphonesimulator*][config=*ebug]' => 'syncMultiPlatformLibraryDebugFrameworkIosX64', 20 | 'GRADLE_TASK[sdk=iphonesimulator*][config=*elease]' => 'syncMultiPlatformLibraryReleaseFrameworkIosX64', 21 | 'GRADLE_TASK[sdk=iphoneos*][config=*ebug]' => 'syncMultiPlatformLibraryDebugFrameworkIosArm64', 22 | 'GRADLE_TASK[sdk=iphoneos*][config=*elease]' => 'syncMultiPlatformLibraryReleaseFrameworkIosArm64', 23 | 'GRADLE_TASK[sdk=macosx*][config=*ebug]' => 'syncMultiPlatformLibraryDebugFrameworkMacosX64', 24 | 'GRADLE_TASK[sdk=macosx*][config=*elease]' => 'syncMultiPlatformLibraryReleaseFrameworkMacosX64' 25 | } 26 | 27 | spec.script_phases = [ 28 | { 29 | :name => 'Compile Kotlin/Native', 30 | :execution_position => :before_compile, 31 | :shell_path => '/bin/sh', 32 | #:output_files => ['$TARGET_BUILD_DIR/$PRODUCT_NAME.framework/$PRODUCT_NAME'], 33 | :script => <<-SCRIPT 34 | MPP_PROJECT_ROOT="$SRCROOT/../../mpp-library" 35 | 36 | MPP_OUTPUT_DIR="$MPP_PROJECT_ROOT/build/cocoapods/framework" 37 | MPP_OUTPUT_NAME="$MPP_OUTPUT_DIR/#{spec.name}.framework" 38 | 39 | "$MPP_PROJECT_ROOT/../gradlew" -p "$MPP_PROJECT_ROOT" "$GRADLE_TASK" 40 | SCRIPT 41 | } 42 | ] 43 | end 44 | -------------------------------------------------------------------------------- /sample/mpp-library/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | plugins { 6 | id("com.android.library") 7 | id("android-base-convention") 8 | id("detekt-convention") 9 | id("org.jetbrains.kotlin.multiplatform") 10 | id("dev.icerock.mobile.multiplatform.android-manifest") 11 | id("dev.icerock.mobile.multiplatform.ios-framework") 12 | } 13 | 14 | kotlin { 15 | androidTarget() 16 | iosX64() 17 | iosArm64() 18 | iosSimulatorArm64() 19 | macosX64() 20 | macosArm64() 21 | targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java).all { 22 | binaries.withType(org.jetbrains.kotlin.gradle.plugin.mpp.Framework::class.java).all { 23 | export(projects.graphics) 24 | } 25 | } 26 | } 27 | 28 | dependencies { 29 | commonMainApi(projects.graphics) 30 | 31 | commonTestImplementation(libs.kotlin.test) 32 | } 33 | 34 | android { 35 | namespace = "com.icerockdev.library" 36 | } 37 | 38 | -------------------------------------------------------------------------------- /sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/GraphicsTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | package com.icerockdev.library 6 | 7 | import dev.icerock.moko.graphics.Color 8 | 9 | class GraphicsTest { 10 | val backgroundColor = Color(red = 0xFF, green = 0xAA, blue = 0xAA, alpha = 0xFF) 11 | } 12 | -------------------------------------------------------------------------------- /sample/mpp-library/src/commonTest/kotlin/com/icerockdev/library/GraphicsTests.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | package com.icerockdev.library 6 | 7 | import dev.icerock.moko.graphics.Color 8 | import dev.icerock.moko.graphics.parseColor 9 | import kotlin.test.Test 10 | import kotlin.test.assertEquals 11 | 12 | class GraphicsTests { 13 | 14 | @Test 15 | fun parseWithoutAlphaTest() { 16 | val colorRGB = Color.parseColor("#88AAFF") 17 | val colorFull = Color.parseColor("#FF88AAFF") 18 | val colorRGBShort = Color.parseColor("#8AF") 19 | val colorAlphaShort = Color.parseColor("#F8AF") 20 | assertEquals( 21 | expected = colorRGB.argb, 22 | actual = 0xFF88AAFF 23 | ) 24 | assertEquals( 25 | expected = colorFull.argb, 26 | actual = 0xFF88AAFF 27 | ) 28 | assertEquals( 29 | expected = colorRGBShort.argb, 30 | actual = 0xFF88AAFF 31 | ) 32 | assertEquals( 33 | expected = colorAlphaShort.argb, 34 | actual = 0xFF88AAFF 35 | ) 36 | } 37 | 38 | @Test 39 | fun parseWithAlphaTest() { 40 | val colorFull = Color.parseColor("#7788AAFF") 41 | val colorAlphaShort = Color.parseColor("#78AF") 42 | assertEquals( 43 | expected = colorAlphaShort.argb, 44 | actual = 0x7788AAFF 45 | ) 46 | assertEquals( 47 | expected = colorFull.argb, 48 | actual = 0x7788AAFF 49 | ) 50 | } 51 | 52 | @Test 53 | fun parseWithoutPrefixTest() { 54 | val colorRGB = Color.parseColor("88AAFF") 55 | val colorFull = Color.parseColor("FF88AAFF") 56 | val colorRGBShort = Color.parseColor("8AF") 57 | val colorAlphaShort = Color.parseColor("F8AF") 58 | assertEquals( 59 | expected = colorRGB.argb, 60 | actual = 0xFF88AAFF 61 | ) 62 | assertEquals( 63 | expected = colorFull.argb, 64 | actual = 0xFF88AAFF 65 | ) 66 | assertEquals( 67 | expected = colorRGBShort.argb, 68 | actual = 0xFF88AAFF 69 | ) 70 | assertEquals( 71 | expected = colorAlphaShort.argb, 72 | actual = 0xFF88AAFF 73 | ) 74 | } 75 | } -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") 6 | 7 | dependencyResolutionManagement { 8 | repositories { 9 | mavenCentral() 10 | google() 11 | } 12 | } 13 | 14 | rootProject.name = "moko-graphics" 15 | 16 | includeBuild("graphics-build-logic") 17 | 18 | include(":graphics") 19 | include(":sample:android-app") 20 | include(":sample:mpp-library") 21 | --------------------------------------------------------------------------------