Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mzgreen committed Jun 20, 2022
0 parents commit 77b8412
Show file tree
Hide file tree
Showing 38 changed files with 1,931 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

[*.{kt, kts}]
ij_kotlin_imports_layout = ascii
73 changes: 73 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: build

on: [push, pull_request]

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx2g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"

jobs:
jvm:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
java-version:
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}

- name: Api Check
run: |
./gradlew apiCheck
- name: Test
run: |
./gradlew -Dkjs=false -Dknative=false build --stacktrace
all-platforms:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ macos-11, ubuntu-latest, windows-latest ]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Configure JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 8

- name: Api Check
run: |
./gradlew apiCheck
- name: Test
run: |
./gradlew build
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
.idea/shelf
/dependencies
/dist
out/
workspace.xml
*.versionsBackup
.gradle/
build/
!**/src/**/build
!**/test/**/build
*.iml
.idea/artifacts/
.idea/libraries/
.idea/modules
.idea/modules.xml
.idea/gradle.xml
.idea/compiler.xml
.idea/inspectionProfiles/profiles_settings.xml
.idea/runConfigurations.xml
.idea/.name
local.properties
*.ser
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 mzgreen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<img src="https://qoiformat.org/qoi-logo.svg" alt="QoiSharp" width="256"/>

# qoi-kotlin

[![qoi-kotlin](https://maven-badges.herokuapp.com/maven-central/io.github.mzgreen/qoi-kotlin/badge.svg?subject=qoi-kotlin)](https://maven-badges.herokuapp.com/maven-central/io.github.mzgreen/qoi-kotlin)

A Kotlin Multiplatform implementation of [Quite OK Image Format](https://qoiformat.org/).

This library depends on [Okio](https://github.com/square/okio) which provides multiplatform file system APIs.

## Maven

```xml

<dependency>
<groupId>io.github.mzgreen</groupId>
<artifactId>qoi-kotlin</artifactId>
<version>1.0.1</version>
</dependency>
```

## Gradle

```gradle
repositories {
// ...
mavenCentral()
}
dependencies {
implementation 'io.github.mzgreen:qoi-kotlin:1.0.1'
}
```

## Usage

#### Reading QOI images

Use `QOIReader` to read QOI images from disk:

```kotlin
val qoiImage: QOIImage = QOIReader().read("image.qoi")
```

#### Writing QOI images

Use `QOIWriter` to write QOI images to disk:

```kotlin
val qoiImage: QOIImage = // ...
QOIWriter().write(qoiImage, "image.qoi")
```

## Building the project

```bash
$ ./gradlew build
```

## License

MIT License

```
Copyright (c) 2022 mzgreen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
44 changes: 44 additions & 0 deletions api/qoi-kotlin.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
public final class io/github/mzgreen/qoi/kotlin/QOIColorModel : java/lang/Enum {
public static final field RGB Lio/github/mzgreen/qoi/kotlin/QOIColorModel;
public static final field RGBA Lio/github/mzgreen/qoi/kotlin/QOIColorModel;
public final fun getChannels ()I
public static fun valueOf (Ljava/lang/String;)Lio/github/mzgreen/qoi/kotlin/QOIColorModel;
public static fun values ()[Lio/github/mzgreen/qoi/kotlin/QOIColorModel;
}

public final class io/github/mzgreen/qoi/kotlin/QOIColorSpace : java/lang/Enum {
public static final field LINEAR Lio/github/mzgreen/qoi/kotlin/QOIColorSpace;
public static final field SRGB Lio/github/mzgreen/qoi/kotlin/QOIColorSpace;
public static fun valueOf (Ljava/lang/String;)Lio/github/mzgreen/qoi/kotlin/QOIColorSpace;
public static fun values ()[Lio/github/mzgreen/qoi/kotlin/QOIColorSpace;
}

public final class io/github/mzgreen/qoi/kotlin/QOIImage {
public fun <init> ([IIILio/github/mzgreen/qoi/kotlin/QOIColorModel;Lio/github/mzgreen/qoi/kotlin/QOIColorSpace;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getColorModel ()Lio/github/mzgreen/qoi/kotlin/QOIColorModel;
public final fun getColorSpace ()Lio/github/mzgreen/qoi/kotlin/QOIColorSpace;
public final fun getColors ()[I
public final fun getHeight ()I
public final fun getWidth ()I
public fun hashCode ()I
}

public final class io/github/mzgreen/qoi/kotlin/QOIReader {
public fun <init> ()V
public fun <init> (Lokio/FileSystem;)V
public final fun read (Ljava/lang/String;)Lio/github/mzgreen/qoi/kotlin/QOIImage;
public final fun read (Lokio/FileHandle;)Lio/github/mzgreen/qoi/kotlin/QOIImage;
public final fun read (Lokio/Path;)Lio/github/mzgreen/qoi/kotlin/QOIImage;
public final fun read (Lokio/Source;)Lio/github/mzgreen/qoi/kotlin/QOIImage;
}

public final class io/github/mzgreen/qoi/kotlin/QOIWriter {
public fun <init> ()V
public fun <init> (Lokio/FileSystem;)V
public final fun write (Lio/github/mzgreen/qoi/kotlin/QOIImage;Ljava/lang/String;)V
public final fun write (Lio/github/mzgreen/qoi/kotlin/QOIImage;Lokio/FileHandle;)V
public final fun write (Lio/github/mzgreen/qoi/kotlin/QOIImage;Lokio/Path;)V
public final fun write (Lio/github/mzgreen/qoi/kotlin/QOIImage;Lokio/Sink;)V
}

Loading

0 comments on commit 77b8412

Please sign in to comment.