diff --git a/.gitignore b/.gitignore
index 7064382f..a61dd6f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
/.idea/deploymentTargetDropDown.xml
/.idea/gradle.xml
/.idea/jarRepositories.xml
+/.idea/kim.iml
/.idea/kotlinScripting.xml
/.idea/kotlinc.xml
/.idea/libraries/
@@ -23,5 +24,4 @@
/.idea/workspace.xml
/build/
/local.properties
-/.idea/kim.iml
/src/commonTest/resources/com/ashampoo/kim/testdata/full/*.html
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 12189240..be2c4be8 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -17,42 +17,64 @@
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -60,27 +82,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -88,11 +124,15 @@
+
+
+
+
@@ -101,51 +141,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -154,81 +224,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -236,62 +363,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -299,16 +488,17 @@
+
+
-
@@ -317,23 +507,41 @@
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -350,7 +558,6 @@
-
@@ -359,17 +566,21 @@
+
-
+
+
+
+
@@ -377,71 +588,89 @@
-
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
-
-
+
-
-
-
-
+
+
+
+
+
@@ -454,7 +683,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -482,43 +733,44 @@
+
-
+
+
+
-
-
-
-
+
-
+
-
+
+
@@ -528,14 +780,13 @@
-
+
+
-
-
@@ -544,10 +795,19 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -567,6 +827,7 @@
+
@@ -614,8 +875,16 @@
+
-
+
+
+
+
+
+
+
+
@@ -651,6 +920,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -662,8 +942,6 @@
-
-
@@ -671,9 +949,8 @@
-
-
+
@@ -681,21 +958,28 @@
-
+
+
+
+
+
+
+
+
@@ -708,12 +992,82 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -728,17 +1082,17 @@
-
-
+
+
+
-
@@ -749,8 +1103,25 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -760,27 +1131,29 @@
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -789,17 +1162,22 @@
-
-
-
+
+
+
+
+
-
+
+
+
+
@@ -808,17 +1186,20 @@
+
-
+
+
+
-
+
-
+
@@ -831,6 +1212,7 @@
+
@@ -839,15 +1221,18 @@
-
-
+
+
+
+
+
@@ -866,6 +1251,7 @@
+
@@ -875,38 +1261,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
+
+
+
-
+
+
-
+
+
-
+
-
@@ -925,28 +1336,32 @@
-
-
-
+
+
+
-
+
+
+
+
+
-
-
+
+
@@ -955,21 +1370,29 @@
+
+
-
+
+
+
+
+
+
+
@@ -983,88 +1406,81 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1085,115 +1501,76 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
-
+
+
-
+
-
-
-
-
-
-
-
+
-
+
@@ -1206,26 +1583,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
@@ -1240,10 +1734,15 @@
+
-
+
+
+
+
+
@@ -1260,32 +1759,41 @@
+
+
-
+
+
+
+
+
+
+
-
+
+
@@ -1294,15 +1802,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
@@ -1313,6 +1843,7 @@
+
@@ -1320,15 +1851,21 @@
+
+
+
+
+
+
+
-
@@ -1336,6 +1873,7 @@
+
@@ -1344,70 +1882,86 @@
-
+
+
+
+
-
+
+
-
-
-
+
-
-
-
+
+
-
+
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -1423,6 +1977,7 @@
+
@@ -1431,6 +1986,7 @@
+
@@ -1444,5 +2000,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index dcdbf1ba..a40ad888 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ of Ashampoo Photo Organizer, which, in turn, is driven by user community feedbac
## Installation
```
-implementation("com.ashampoo:kim:0.17.7")
+implementation("com.ashampoo:kim:0.18")
```
For the targets `wasmJs` & `js` you also need to specify this:
diff --git a/build.gradle.kts b/build.gradle.kts
index bfdc1259..f4793f47 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -22,10 +22,10 @@ repositories {
mavenCentral()
}
-val productName = "Ashampoo Kim"
+val productName: String = "Ashampoo Kim"
val ktorVersion: String = "2.3.10"
-val xmpCoreVersion: String = "1.2.2"
+val xmpCoreVersion: String = "1.3.0"
val dateTimeVersion: String = "0.5.0"
val testRessourcesVersion: String = "0.4.0"
val kotlinxIoVersion: String = "0.3.3"
@@ -115,6 +115,8 @@ dependencies {
kotlin {
+ explicitApi()
+
androidTarget {
compilations.all {
@@ -333,6 +335,7 @@ kotlin {
macosArm64Test.dependsOn(this)
}
+ @Suppress("UnusedPrivateMember", "UNUSED_VARIABLE") // False positive
val jsMain by sourceSets.getting {
dependsOn(commonMain)
@@ -360,7 +363,7 @@ kotlin {
}
// region Writing version.txt for GitHub Actions
-val writeVersion = tasks.register("writeVersion") {
+val writeVersion: TaskProvider = tasks.register("writeVersion") {
doLast {
File("build/version.txt").writeText(project.version.toString())
}
@@ -404,7 +407,7 @@ ext["signing.secretKeyRingFile"] = "secring.pgp"
ext["ossrhUsername"] = System.getenv("OSSRH_USERNAME")
ext["ossrhPassword"] = System.getenv("OSSRH_PASSWORD")
-val javadocJar by tasks.registering(Jar::class) {
+val javadocJar: TaskProvider by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
@@ -485,7 +488,7 @@ afterEvaluate {
}
}
-fun getExtraString(name: String) = ext[name]?.toString()
+fun getExtraString(name: String): String? = ext[name]?.toString()
publishing {
publications {
@@ -515,7 +518,7 @@ publishing {
licenses {
license {
name.set("The Apache License, Version 2.0")
- url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
+ url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
diff --git a/detekt.yml b/detekt.yml
index 11733bd4..c06db502 100644
--- a/detekt.yml
+++ b/detekt.yml
@@ -677,7 +677,7 @@ style:
RedundantHigherOrderMapUsage:
active: true
RedundantVisibilityModifierRule:
- active: true
+ active: false # explicitApi
ReturnCount:
active: false # results in bad style
max: 2
diff --git a/examples/kim-java-sample/build.gradle b/examples/kim-java-sample/build.gradle
index 4dc05d2b..d3034159 100644
--- a/examples/kim-java-sample/build.gradle
+++ b/examples/kim-java-sample/build.gradle
@@ -10,7 +10,7 @@ repositories {
}
dependencies {
- implementation 'com.ashampoo:kim:0.17.7'
+ implementation 'com.ashampoo:kim:0.18'
}
// Needed to make it work for the Gradle java plugin
diff --git a/examples/kim-java-sample/src/main/java/Main.java b/examples/kim-java-sample/src/main/java/Main.java
index bc988974..4c923c25 100644
--- a/examples/kim-java-sample/src/main/java/Main.java
+++ b/examples/kim-java-sample/src/main/java/Main.java
@@ -1,8 +1,8 @@
import com.ashampoo.kim.Kim;
-import com.ashampoo.kim.jvm.KimJvm;
import com.ashampoo.kim.format.ImageMetadata;
import com.ashampoo.kim.input.ByteReader;
import com.ashampoo.kim.input.JvmInputStreamByteReader;
+import com.ashampoo.kim.jvm.KimJvm;
import com.ashampoo.kim.model.MetadataUpdate;
import com.ashampoo.kim.output.ByteArrayByteWriter;
diff --git a/examples/kim-kotlin-jvm-sample/build.gradle.kts b/examples/kim-kotlin-jvm-sample/build.gradle.kts
index 2eedc585..e37da260 100644
--- a/examples/kim-kotlin-jvm-sample/build.gradle.kts
+++ b/examples/kim-kotlin-jvm-sample/build.gradle.kts
@@ -10,5 +10,5 @@ repositories {
}
dependencies {
- implementation("com.ashampoo:kim:0.17.7")
+ implementation("com.ashampoo:kim:0.18")
}
diff --git a/examples/kim-kotlin-jvm-sample/src/main/kotlin/Main.kt b/examples/kim-kotlin-jvm-sample/src/main/kotlin/Main.kt
index 7c23f53c..050ce50b 100644
--- a/examples/kim-kotlin-jvm-sample/src/main/kotlin/Main.kt
+++ b/examples/kim-kotlin-jvm-sample/src/main/kotlin/Main.kt
@@ -12,7 +12,6 @@ import com.ashampoo.kim.input.JvmInputStreamByteReader
import com.ashampoo.kim.input.KotlinIoSourceByteReader
import com.ashampoo.kim.input.use
import com.ashampoo.kim.jvm.readMetadata
-import com.ashampoo.kim.kotlinx.KimKotlinx
import com.ashampoo.kim.model.MetadataUpdate
import com.ashampoo.kim.output.ByteArrayByteWriter
import com.ashampoo.kim.output.OutputStreamByteWriter
diff --git a/src/androidMain/kotlin/com/ashampoo/kim/android/KimAndroid.kt b/src/androidMain/kotlin/com/ashampoo/kim/android/KimAndroid.kt
index 605bba68..6212920e 100644
--- a/src/androidMain/kotlin/com/ashampoo/kim/android/KimAndroid.kt
+++ b/src/androidMain/kotlin/com/ashampoo/kim/android/KimAndroid.kt
@@ -25,21 +25,21 @@ import java.io.InputStream
/**
* Extra object to have a nicer API for Java projects
*/
-object KimAndroid {
+public object KimAndroid {
@JvmStatic
@Throws(ImageReadException::class)
- fun readMetadata(inputStream: InputStream, length: Long): ImageMetadata? =
+ public fun readMetadata(inputStream: InputStream, length: Long): ImageMetadata? =
Kim.readMetadata(AndroidInputStreamByteReader(inputStream, length))
@JvmStatic
@Throws(ImageReadException::class)
- fun readMetadata(path: String): ImageMetadata? =
+ public fun readMetadata(path: String): ImageMetadata? =
readMetadata(File(path))
@JvmStatic
@Throws(ImageReadException::class)
- fun readMetadata(file: File): ImageMetadata? {
+ public fun readMetadata(file: File): ImageMetadata? {
check(file.exists()) { "File does not exist: $file" }
@@ -48,13 +48,13 @@ object KimAndroid {
}
@Throws(ImageReadException::class)
-fun Kim.readMetadata(inputStream: InputStream, length: Long): ImageMetadata? =
+public fun Kim.readMetadata(inputStream: InputStream, length: Long): ImageMetadata? =
KimAndroid.readMetadata(inputStream, length)
@Throws(ImageReadException::class)
-fun Kim.readMetadata(path: String): ImageMetadata? =
+public fun Kim.readMetadata(path: String): ImageMetadata? =
KimAndroid.readMetadata(path)
@Throws(ImageReadException::class)
-fun Kim.readMetadata(file: File): ImageMetadata? =
+public fun Kim.readMetadata(file: File): ImageMetadata? =
KimAndroid.readMetadata(file)
diff --git a/src/androidMain/kotlin/com/ashampoo/kim/common/ZLib.android.kt b/src/androidMain/kotlin/com/ashampoo/kim/common/ZLib.android.kt
index fca5a28a..101ed60e 100644
--- a/src/androidMain/kotlin/com/ashampoo/kim/common/ZLib.android.kt
+++ b/src/androidMain/kotlin/com/ashampoo/kim/common/ZLib.android.kt
@@ -21,7 +21,7 @@ import java.util.zip.Inflater
private const val ZLIB_BUFFER_SIZE: Int = 1024
-actual fun compress(input: String): ByteArray {
+internal actual fun compress(input: String): ByteArray {
val deflater = Deflater()
val inputBytes = input.toByteArray()
@@ -45,7 +45,7 @@ actual fun compress(input: String): ByteArray {
return outputStream.toByteArray()
}
-actual fun decompress(byteArray: ByteArray): String {
+internal actual fun decompress(byteArray: ByteArray): String {
val inflater = Inflater()
val outputStream = ByteArrayOutputStream()
diff --git a/src/androidMain/kotlin/com/ashampoo/kim/input/AndroidInputStreamByteReader.kt b/src/androidMain/kotlin/com/ashampoo/kim/input/AndroidInputStreamByteReader.kt
index 3e287e9c..4c418afc 100644
--- a/src/androidMain/kotlin/com/ashampoo/kim/input/AndroidInputStreamByteReader.kt
+++ b/src/androidMain/kotlin/com/ashampoo/kim/input/AndroidInputStreamByteReader.kt
@@ -22,7 +22,7 @@ import java.io.InputStream
* Provides way to read from Android ContentReolver that
* should work on all versions.
*/
-open class AndroidInputStreamByteReader(
+public open class AndroidInputStreamByteReader(
private val inputStream: InputStream,
override val contentLength: Long
) : ByteReader {
@@ -54,6 +54,6 @@ open class AndroidInputStreamByteReader(
buffer.slice(startIndex = 0, count = count)
}
- override fun close() =
+ override fun close(): Unit =
inputStream.close()
}
diff --git a/src/appleMain/kotlin/com/ashampoo/kim/apple/KimApple.kt b/src/appleMain/kotlin/com/ashampoo/kim/apple/KimApple.kt
index 2b09f60b..5e434226 100644
--- a/src/appleMain/kotlin/com/ashampoo/kim/apple/KimApple.kt
+++ b/src/appleMain/kotlin/com/ashampoo/kim/apple/KimApple.kt
@@ -29,14 +29,14 @@ import platform.posix.memcpy
/**
* Extra object to be aligned with the other modules.
*/
-object KimApple {
+public object KimApple {
@Throws(ImageReadException::class)
- fun readMetadata(data: NSData): ImageMetadata? =
+ public fun readMetadata(data: NSData): ImageMetadata? =
Kim.readMetadata(ByteArrayByteReader(convertDataToByteArray(data)))
@Throws(ImageReadException::class)
- fun readMetadata(path: String): ImageMetadata? {
+ public fun readMetadata(path: String): ImageMetadata? {
val fileBytes = readFileAsByteArray(path) ?: return null
@@ -45,11 +45,11 @@ object KimApple {
}
@Throws(ImageReadException::class)
-fun Kim.readMetadata(data: NSData): ImageMetadata? =
+public fun Kim.readMetadata(data: NSData): ImageMetadata? =
KimApple.readMetadata(data)
@Throws(ImageReadException::class)
-fun Kim.readMetadata(path: String): ImageMetadata? =
+public fun Kim.readMetadata(path: String): ImageMetadata? =
KimApple.readMetadata(path)
@OptIn(ExperimentalForeignApi::class)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/Kim.kt b/src/commonMain/kotlin/com/ashampoo/kim/Kim.kt
index db927c38..b40100e8 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/Kim.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/Kim.kt
@@ -45,13 +45,13 @@ import com.ashampoo.kim.model.MetadataUpdate
import com.ashampoo.kim.output.ByteArrayByteWriter
import com.ashampoo.kim.output.ByteWriter
-object Kim {
+public object Kim {
- var underUnitTesting: Boolean = false
+ internal var underUnitTesting: Boolean = false
@kotlin.jvm.JvmStatic
@Throws(ImageReadException::class)
- fun readMetadata(bytes: ByteArray): ImageMetadata? =
+ public fun readMetadata(bytes: ByteArray): ImageMetadata? =
if (bytes.isEmpty())
null
else
@@ -59,7 +59,7 @@ object Kim {
@kotlin.jvm.JvmStatic
@Throws(ImageReadException::class)
- fun readMetadata(
+ public fun readMetadata(
byteReader: ByteReader
): ImageMetadata? = tryWithImageReadException {
@@ -93,7 +93,7 @@ object Kim {
*/
@kotlin.jvm.JvmStatic
@Throws(ImageReadException::class)
- fun extractMetadataBytes(
+ public fun extractMetadataBytes(
byteReader: ByteReader
): Pair = tryWithImageReadException {
@@ -116,7 +116,7 @@ object Kim {
@kotlin.jvm.JvmStatic
@Throws(ImageReadException::class)
- fun extractPreviewImage(
+ public fun extractPreviewImage(
byteReader: ByteReader
): ByteArray? = tryWithImageReadException {
@@ -166,7 +166,7 @@ object Kim {
*/
@kotlin.jvm.JvmStatic
@Throws(ImageWriteException::class)
- fun update(
+ public fun update(
bytes: ByteArray,
update: MetadataUpdate
): ByteArray = tryWithImageWriteException {
@@ -192,11 +192,11 @@ object Kim {
*/
@kotlin.jvm.JvmStatic
@Throws(ImageWriteException::class)
- fun update(
+ public fun update(
byteReader: ByteReader,
byteWriter: ByteWriter,
update: MetadataUpdate
- ) = tryWithImageWriteException {
+ ): Unit = tryWithImageWriteException {
val headerBytes = byteReader.readBytes(ImageFormat.REQUIRED_HEADER_BYTE_COUNT_FOR_DETECTION)
@@ -216,7 +216,7 @@ object Kim {
@kotlin.jvm.JvmStatic
@Throws(ImageWriteException::class)
- fun updateThumbnail(
+ public fun updateThumbnail(
bytes: ByteArray,
thumbnailBytes: ByteArray
): ByteArray = tryWithImageWriteException {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/ByteArrayExtensions.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/ByteArrayExtensions.kt
index 64d5e085..225154d2 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/ByteArrayExtensions.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/ByteArrayExtensions.kt
@@ -17,34 +17,45 @@
package com.ashampoo.kim.common
-private const val FF = 0xFF
+internal const val HEX_RADIX: Int = 16
-const val HEX_RADIX = 16
+@OptIn(ExperimentalStdlibApi::class)
+private val singleNumberHexFormat = HexFormat {
+ upperCase = false
+ bytes.bytePrefix = "0x"
+ bytes.byteSeparator = ", "
+}
-fun Byte.toHex(): String =
- this.toInt().and(FF).toString(HEX_RADIX).padStart(2, '0')
+@OptIn(ExperimentalStdlibApi::class)
+internal fun Byte.toHex(): String =
+ this.toHexString(HexFormat.Default)
-fun convertHexStringToByteArray(string: String): ByteArray =
+internal fun convertHexStringToByteArray(string: String): ByteArray =
string
.chunked(2)
.map { it.toInt(HEX_RADIX).toByte() }
.toByteArray()
+@OptIn(ExperimentalStdlibApi::class)
@Suppress("MagicNumber")
-fun ByteArray.toHex(): String =
- joinToString("") { it.toHex() }
+internal fun ByteArray.toSingleNumberHexes(): String =
+ this.toHexString(singleNumberHexFormat)
+
+internal fun List.toSingleNumberHexes(): String =
+ this.toByteArray().toSingleNumberHexes()
+@OptIn(ExperimentalStdlibApi::class)
@Suppress("MagicNumber")
-fun ByteArray.toSingleNumberHexes(): String =
- joinToString(", ") { "0x" + it.toHex() }
+internal fun ByteArray.toHex(): String =
+ this.toHexString(HexFormat.Default)
-fun ByteArray.indexOfNullTerminator(): Int =
+internal fun ByteArray.indexOfNullTerminator(): Int =
indexOfNullTerminator(0)
/**
* NUL is often used in image formats to terminate a string.
*/
-fun ByteArray.indexOfNullTerminator(start: Int): Int {
+internal fun ByteArray.indexOfNullTerminator(start: Int): Int {
for (i in start until size)
if (this[i].toInt() == 0)
@@ -53,7 +64,7 @@ fun ByteArray.indexOfNullTerminator(start: Int): Int {
return -1
}
-fun ByteArray.startsWith(bytes: ByteArray): Boolean {
+internal fun ByteArray.startsWith(bytes: ByteArray): Boolean {
if (bytes.size > size)
return false
@@ -65,7 +76,7 @@ fun ByteArray.startsWith(bytes: ByteArray): Boolean {
return true
}
-fun ByteArray.startsWith(bytes: List): Boolean {
+internal fun ByteArray.startsWith(bytes: List): Boolean {
if (bytes.size > size)
return false
@@ -77,7 +88,7 @@ fun ByteArray.startsWith(bytes: List): Boolean {
return true
}
-fun ByteArray.startsWithNullable(bytes: List): Boolean {
+internal fun ByteArray.startsWithNullable(bytes: List): Boolean {
if (bytes.size > size)
return false
@@ -89,22 +100,22 @@ fun ByteArray.startsWithNullable(bytes: List): Boolean {
return true
}
-fun ByteArray.getRemainingBytes(startIndex: Int): ByteArray {
+internal fun ByteArray.getRemainingBytes(startIndex: Int): ByteArray {
val actualStartIndex = startIndex.coerceIn(indices)
return sliceArray(actualStartIndex until size)
}
-fun ByteArray.slice(startIndex: Int, count: Int): ByteArray {
+internal fun ByteArray.slice(startIndex: Int, count: Int): ByteArray {
val endIndex = (startIndex + count).coerceAtMost(size)
return sliceArray(startIndex until endIndex)
}
-fun ByteArray.head(endIndex: Int): ByteArray {
+internal fun ByteArray.head(endIndex: Int): ByteArray {
val actualEndIndex = endIndex.coerceAtMost(size)
return sliceArray(0 until actualEndIndex)
}
-fun ByteArray.isEquals(start: Int, other: ByteArray, otherStart: Int, length: Int): Boolean {
+internal fun ByteArray.isEquals(start: Int, other: ByteArray, otherStart: Int, length: Int): Boolean {
if (size < start + length)
return false
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/ByteConversions.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/ByteConversions.kt
index 91c90d41..b939b1aa 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/ByteConversions.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/ByteConversions.kt
@@ -24,31 +24,28 @@ package com.ashampoo.kim.common
*/
@Suppress("MagicNumber")
-fun Byte.toUInt8(): Int = 0xFF and toInt()
+internal fun Byte.toUInt8(): Int = 0xFF and toInt()
-fun Short.toBytes(byteOrder: ByteOrder): ByteArray {
+internal fun Short.toBytes(byteOrder: ByteOrder): ByteArray {
val result = ByteArray(2)
- this.toBytes(byteOrder, result, 0)
+ this.toBytes(result, 0, byteOrder)
return result
}
-fun ShortArray.toBytes(byteOrder: ByteOrder): ByteArray =
- this.toBytes(0, size, byteOrder)
+internal fun ShortArray.toBytes(byteOrder: ByteOrder): ByteArray {
-private fun ShortArray.toBytes(offset: Int, length: Int, byteOrder: ByteOrder): ByteArray {
+ val result = ByteArray(size * 2)
- val result = ByteArray(length * 2)
-
- for (index in 0 until length)
- this[offset + index].toBytes(byteOrder, result, index * 2)
+ for (index in indices)
+ this[index].toBytes(result, index * 2, byteOrder)
return result
}
-private fun Short.toBytes(byteOrder: ByteOrder, result: ByteArray, offset: Int) {
+private fun Short.toBytes(result: ByteArray, offset: Int, byteOrder: ByteOrder) {
if (byteOrder == ByteOrder.BIG_ENDIAN) {
result[offset + 0] = (toInt() shr 8).toByte()
@@ -59,29 +56,26 @@ private fun Short.toBytes(byteOrder: ByteOrder, result: ByteArray, offset: Int)
}
}
-fun Int.toBytes(byteOrder: ByteOrder): ByteArray {
+internal fun Int.toBytes(byteOrder: ByteOrder): ByteArray {
val result = ByteArray(4)
- this.toBytes(byteOrder, result, 0)
+ this.toBytes(result, 0, byteOrder)
return result
}
-fun IntArray.toBytes(byteOrder: ByteOrder): ByteArray =
- this.toBytes(0, size, byteOrder)
-
-private fun IntArray.toBytes(offset: Int, length: Int, byteOrder: ByteOrder): ByteArray {
+internal fun IntArray.toBytes(byteOrder: ByteOrder): ByteArray {
- val result = ByteArray(length * 4)
+ val result = ByteArray(size * 4)
- for (i in 0 until length)
- this[offset + i].toBytes(byteOrder, result, i * 4)
+ for (i in indices)
+ this[i].toBytes(result, i * 4, byteOrder)
return result
}
-private fun Int.toBytes(byteOrder: ByteOrder, result: ByteArray, offset: Int) {
+private fun Int.toBytes(result: ByteArray, offset: Int, byteOrder: ByteOrder) {
if (byteOrder == ByteOrder.BIG_ENDIAN) {
result[offset + 0] = (this shr 24).toByte()
@@ -96,29 +90,26 @@ private fun Int.toBytes(byteOrder: ByteOrder, result: ByteArray, offset: Int) {
}
}
-fun Float.toBytes(byteOrder: ByteOrder): ByteArray {
+internal fun Float.toBytes(byteOrder: ByteOrder): ByteArray {
val result = ByteArray(4)
- this.toBytes(byteOrder, result, 0)
+ this.toBytes(result, 0, byteOrder)
return result
}
-fun FloatArray.toBytes(byteOrder: ByteOrder): ByteArray =
- this.toBytes(0, size, byteOrder)
-
-private fun FloatArray.toBytes(offset: Int, length: Int, byteOrder: ByteOrder): ByteArray {
+internal fun FloatArray.toBytes(byteOrder: ByteOrder): ByteArray {
- val result = ByteArray(length * 4)
+ val result = ByteArray(size * 4)
- for (i in 0 until length)
- this[offset + i].toBytes(byteOrder, result, i * 4)
+ for (i in indices)
+ this[i].toBytes(result, i * 4, byteOrder)
return result
}
-private fun Float.toBytes(byteOrder: ByteOrder, result: ByteArray, offset: Int) {
+private fun Float.toBytes(result: ByteArray, offset: Int, byteOrder: ByteOrder) {
val bits = toRawBits()
@@ -135,29 +126,26 @@ private fun Float.toBytes(byteOrder: ByteOrder, result: ByteArray, offset: Int)
}
}
-fun Double.toBytes(byteOrder: ByteOrder): ByteArray {
+internal fun Double.toBytes(byteOrder: ByteOrder): ByteArray {
val result = ByteArray(8)
- this.toBytes(byteOrder, result, 0)
+ this.toBytes(result, 0, byteOrder)
return result
}
-fun DoubleArray.toBytes(byteOrder: ByteOrder): ByteArray =
- this.toBytes(0, size, byteOrder)
+internal fun DoubleArray.toBytes(byteOrder: ByteOrder): ByteArray {
-private fun DoubleArray.toBytes(offset: Int, length: Int, byteOrder: ByteOrder): ByteArray {
+ val result = ByteArray(size * 8)
- val result = ByteArray(length * 8)
-
- for (i in 0 until length)
- this[offset + i].toBytes(byteOrder, result, i * 8)
+ for (i in indices)
+ this[i].toBytes(result, i * 8, byteOrder)
return result
}
-private fun Double.toBytes(byteOrder: ByteOrder, result: ByteArray, offset: Int) {
+private fun Double.toBytes(result: ByteArray, offset: Int, byteOrder: ByteOrder) {
val bits = toRawBits()
@@ -182,33 +170,32 @@ private fun Double.toBytes(byteOrder: ByteOrder, result: ByteArray, offset: Int)
}
}
-fun RationalNumber.toBytes(byteOrder: ByteOrder): ByteArray {
+internal fun RationalNumber.toBytes(byteOrder: ByteOrder): ByteArray {
val result = ByteArray(8)
- this.toBytes(byteOrder, result, 0)
+ this.toBytes(result, 0, byteOrder)
return result
}
-fun RationalNumbers.toBytes(byteOrder: ByteOrder): ByteArray =
- this.toBytes(0, values.size, byteOrder)
-
-private fun RationalNumbers.toBytes(
- offset: Int,
- length: Int,
+internal fun RationalNumbers.toBytes(
byteOrder: ByteOrder
): ByteArray {
- val result = ByteArray(length * 8)
+ val result = ByteArray(values.size * 8)
- for (index in 0 until length)
- values[offset + index].toBytes(byteOrder, result, index * 8)
+ for (index in values.indices)
+ values[index].toBytes(result, index * 8, byteOrder)
return result
}
-private fun RationalNumber.toBytes(byteOrder: ByteOrder, result: ByteArray, offset: Int) {
+private fun RationalNumber.toBytes(
+ result: ByteArray,
+ offset: Int,
+ byteOrder: ByteOrder
+) {
if (byteOrder == ByteOrder.BIG_ENDIAN) {
result[offset + 0] = (numerator shr 24).toByte()
@@ -231,29 +218,13 @@ private fun RationalNumber.toBytes(byteOrder: ByteOrder, result: ByteArray, offs
}
}
-fun ByteArray.toShort(byteOrder: ByteOrder): Short =
- toShort(0, byteOrder)
-
-private fun ByteArray.toShort(offset: Int, byteOrder: ByteOrder): Short =
- toUInt16(offset, byteOrder).toShort()
-
-fun ByteArray.toShorts(byteOrder: ByteOrder): ShortArray =
- toShorts(0, size, byteOrder)
-
-private fun ByteArray.toShorts(offset: Int, length: Int, byteOrder: ByteOrder): ShortArray {
-
- val result = ShortArray(length / 2)
+internal fun ByteArray.toShorts(byteOrder: ByteOrder): ShortArray =
+ ShortArray(size / 2) { index -> toUInt16(2 * index, byteOrder).toShort() }
- for (i in result.indices)
- result[i] = toShort(offset + 2 * i, byteOrder)
-
- return result
-}
-
-fun ByteArray.toUInt16(byteOrder: ByteOrder): Int =
+internal fun ByteArray.toUInt16(byteOrder: ByteOrder): Int =
toUInt16(0, byteOrder)
-fun ByteArray.toUInt16(offset: Int, byteOrder: ByteOrder): Int {
+internal fun ByteArray.toUInt16(offset: Int, byteOrder: ByteOrder): Int {
val byte0 = 0xFF and this[offset + 0].toInt()
val byte1 = 0xFF and this[offset + 1].toInt()
@@ -264,10 +235,10 @@ fun ByteArray.toUInt16(offset: Int, byteOrder: ByteOrder): Int {
byte1 shl 8 or byte0
}
-fun ByteArray.toInt(byteOrder: ByteOrder): Int =
+internal fun ByteArray.toInt(byteOrder: ByteOrder): Int =
this.toInt(0, byteOrder)
-fun ByteArray.toInt(offset: Int, byteOrder: ByteOrder): Int {
+internal fun ByteArray.toInt(offset: Int, byteOrder: ByteOrder): Int {
val byte0 = 0xFF and this[offset + 0].toInt()
val byte1 = 0xFF and this[offset + 1].toInt()
@@ -280,22 +251,11 @@ fun ByteArray.toInt(offset: Int, byteOrder: ByteOrder): Int {
byte3 shl 24 or (byte2 shl 16) or (byte1 shl 8) or byte0
}
-fun ByteArray.toInts(byteOrder: ByteOrder): IntArray =
+internal fun ByteArray.toInts(byteOrder: ByteOrder): IntArray =
this.toInts(0, size, byteOrder)
-private fun ByteArray.toInts(offset: Int, length: Int, byteOrder: ByteOrder): IntArray {
-
- val result = IntArray(length / 4)
-
- repeat(result.size) { i ->
- result[i] = toInt(offset + 4 * i, byteOrder)
- }
-
- return result
-}
-
-fun ByteArray.toFloat(byteOrder: ByteOrder): Float =
- this.toFloat(0, byteOrder)
+private fun ByteArray.toInts(offset: Int, length: Int, byteOrder: ByteOrder): IntArray =
+ IntArray(length / 4) { index -> toInt(offset + 4 * index, byteOrder) }
private fun ByteArray.toFloat(offset: Int, byteOrder: ByteOrder): Float {
@@ -312,23 +272,13 @@ private fun ByteArray.toFloat(offset: Int, byteOrder: ByteOrder): Float {
return Float.fromBits(bits)
}
-fun ByteArray.toFloats(byteOrder: ByteOrder): FloatArray =
- this.toFloats(0, size, byteOrder)
-
-private fun ByteArray.toFloats(offset: Int, length: Int, byteOrder: ByteOrder): FloatArray {
+internal fun ByteArray.toFloats(byteOrder: ByteOrder): FloatArray =
+ FloatArray(size / 4) { index -> toFloat(4 * index, byteOrder) }
- val result = FloatArray(length / 4)
-
- for (i in result.indices)
- result[i] = toFloat(offset + 4 * i, byteOrder)
-
- return result
-}
-
-fun ByteArray.toDouble(byteOrder: ByteOrder): Double =
- this.toDouble(0, byteOrder)
-
-private fun ByteArray.toDouble(offset: Int, byteOrder: ByteOrder): Double {
+private fun ByteArray.toDouble(
+ offset: Int = 0,
+ byteOrder: ByteOrder
+): Double {
val byte0 = 0xFFL and this[offset + 0].toLong()
val byte1 = 0xFFL and this[offset + 1].toLong()
@@ -339,8 +289,7 @@ private fun ByteArray.toDouble(offset: Int, byteOrder: ByteOrder): Double {
val byte6 = 0xFFL and this[offset + 6].toLong()
val byte7 = 0xFFL and this[offset + 7].toLong()
- val bits: Long
- bits = if (byteOrder == ByteOrder.BIG_ENDIAN) {
+ val bits: Long = if (byteOrder == ByteOrder.BIG_ENDIAN) {
(
byte0 shl 56 or (byte1 shl 48) or (byte2 shl 40)
or (byte3 shl 32) or (byte4 shl 24) or (byte5 shl 16)
@@ -357,27 +306,13 @@ private fun ByteArray.toDouble(offset: Int, byteOrder: ByteOrder): Double {
return Double.fromBits(bits)
}
-fun ByteArray.toDoubles(byteOrder: ByteOrder): DoubleArray =
- this.toDoubles(0, size, byteOrder)
-
-private fun ByteArray.toDoubles(offset: Int, length: Int, byteOrder: ByteOrder): DoubleArray {
-
- val result = DoubleArray(length / 8)
-
- repeat(result.size) { i ->
- result[i] = toDouble(offset + 8 * i, byteOrder)
- }
-
- return result
-}
-
-fun ByteArray.toRational(byteOrder: ByteOrder, unsignedType: Boolean): RationalNumber =
- this.toRational(0, byteOrder, unsignedType)
+internal fun ByteArray.toDoubles(byteOrder: ByteOrder): DoubleArray =
+ DoubleArray(size / 8) { index -> toDouble(8 * index, byteOrder) }
private fun ByteArray.toRational(
offset: Int,
- byteOrder: ByteOrder,
- unsignedType: Boolean
+ unsignedType: Boolean,
+ byteOrder: ByteOrder
): RationalNumber {
val byte0 = 0xFF and this[offset + 0].toInt()
@@ -403,30 +338,16 @@ private fun ByteArray.toRational(
return RationalNumber(numerator, divisor, unsignedType)
}
-fun ByteArray.toRationals(
- byteOrder: ByteOrder,
- unsignedType: Boolean
-): RationalNumbers =
- toRationals(this, 0, size, byteOrder, unsignedType)
-
-private fun toRationals(
- bytes: ByteArray,
- offset: Int,
- length: Int,
- byteOrder: ByteOrder,
- unsignedType: Boolean
-): RationalNumbers {
-
- val result = arrayOfNulls(length / 8)
-
- repeat(result.size) { i ->
- result[i] = bytes.toRational(offset + 8 * i, byteOrder, unsignedType)
+internal fun ByteArray.toRationals(
+ unsignedType: Boolean,
+ byteOrder: ByteOrder
+): RationalNumbers = RationalNumbers(
+ values = Array(size / 8) { index ->
+ this.toRational(8 * index, unsignedType, byteOrder)
}
+)
- return RationalNumbers(result as Array)
-}
-
-fun Int.quadsToByteArray(): ByteArray {
+internal fun Int.quadsToByteArray(): ByteArray {
val bytes = ByteArray(4)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/ByteOrder.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/ByteOrder.kt
index f802ac80..9a92f3e8 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/ByteOrder.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/ByteOrder.kt
@@ -15,7 +15,9 @@
*/
package com.ashampoo.kim.common
-enum class ByteOrder(val displayName: String) {
+public enum class ByteOrder(
+ public val displayName: String
+) {
BIG_ENDIAN("Big-endian (Motorola, MM)"),
LITTLE_ENDIAN("Little-endian (Intel, II)");
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/Exceptions.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/Exceptions.kt
index dc8a9b72..a88d55b8 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/Exceptions.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/Exceptions.kt
@@ -15,20 +15,20 @@
*/
package com.ashampoo.kim.common
-open class ImageException(message: String? = null, cause: Throwable? = null) :
+public open class ImageException(message: String? = null, cause: Throwable? = null) :
RuntimeException(message, cause)
-class ImageReadException(message: String? = null, cause: Throwable? = null) :
+public class ImageReadException(message: String? = null, cause: Throwable? = null) :
ImageException(message, cause)
-open class ImageWriteException(message: String? = null, cause: Throwable? = null) :
+public open class ImageWriteException(message: String? = null, cause: Throwable? = null) :
ImageException(message, cause)
/**
* We need to ensure that every Exception that can occur is wrapped
* into an ImageReadException, because on Kotlin/Native this is the expected exception type.
*/
-inline fun tryWithImageReadException(block: () -> R): R =
+internal inline fun tryWithImageReadException(block: () -> R): R =
try {
block()
} catch (ex: ImageReadException) {
@@ -42,7 +42,7 @@ inline fun tryWithImageReadException(block: () -> R): R =
* We need to ensure that everything is wrapped into an ImageWriteException,
* because on Kotlin/Native this is the expected exception type.
*/
-inline fun tryWithImageWriteException(block: () -> R): R =
+internal inline fun tryWithImageWriteException(block: () -> R): R =
try {
block()
} catch (ex: ImageWriteException) {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/ExifDateUtil.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/ExifDateUtil.kt
index 7b86bd46..cd794f1e 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/ExifDateUtil.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/ExifDateUtil.kt
@@ -38,14 +38,14 @@ private const val TIME_SEPARATOR_INDEX = 10
private const val FIRST_SECOND_INDEX = 17
private const val SECOND_SECOND_INDEX = 18
-fun isExifDateEmpty(exifDate: String?): Boolean =
+public fun isExifDateEmpty(exifDate: String?): Boolean =
exifDate.isNullOrBlank() || emptyExifDateStrings.contains(exifDate)
/**
* EXIF dates are in the format of "yyyy:MM:dd HH:mm:ss" (19 chars),
* which should be transformed to ISO like "yyyy-MM-ddTHH:mm:ss".
*/
-fun convertExifDateToIso8601Date(exifDate: String): String {
+public fun convertExifDateToIso8601Date(exifDate: String): String {
require(!isExifDateEmpty(exifDate)) { "Given date was empty: $exifDate" }
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/FourCC.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/FourCC.kt
index 6975e8a9..9dfa606f 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/FourCC.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/FourCC.kt
@@ -25,7 +25,7 @@ package com.ashampoo.kim.common
* This excension function converts an int to such an type string.
*/
@Suppress("MagicNumber")
-fun Int.toFourCCTypeString(): String =
+public fun Int.toFourCCTypeString(): String =
charArrayOf(
(0xFF and (this shr 24)).toChar(),
(0xFF and (this shr 16)).toChar(),
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/GpsUtil.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/GpsUtil.kt
index f42766ad..a1c41df8 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/GpsUtil.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/GpsUtil.kt
@@ -19,10 +19,10 @@ import kotlin.math.abs
import kotlin.math.pow
import kotlin.math.roundToLong
-object GpsUtil {
+public object GpsUtil {
- const val MINUTES_PER_HOUR: Double = 60.0
- const val SECONDS_PER_HOUR: Double = 3600.0
+ internal const val MINUTES_PER_HOUR: Double = 60.0
+ internal const val SECONDS_PER_HOUR: Double = 3600.0
private const val MAX_DDM_FRACTION_DIGITS: Int = 4
/**
@@ -35,7 +35,7 @@ object GpsUtil {
* @return the decimal value of the GPS coordinate, or null if the input is null or invalid.
*/
@Suppress("MagicNumber")
- fun dmsToDecimal(dms: String?): Double? {
+ public fun dmsToDecimal(dms: String?): Double? {
/* Blank values are illegal. */
if (dms.isNullOrBlank())
@@ -65,7 +65,7 @@ object GpsUtil {
/**
* XMP requires geo data to be in DDM (Degrees, decimal minutes) format.
*/
- fun decimalLatitudeToDDM(latitude: Double): String {
+ public fun decimalLatitudeToDDM(latitude: Double): String {
val direction = if (latitude >= 0) "N" else "S"
@@ -82,7 +82,7 @@ object GpsUtil {
/**
* XMP requires geo data to be in DDM (Degrees, decimal minutes) format.
*/
- fun decimalLongitudeToDDM(longitude: Double): String {
+ public fun decimalLongitudeToDDM(longitude: Double): String {
val direction = if (longitude >= 0) "E" else "W"
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/Latin1EncodingExtensions.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/Latin1EncodingExtensions.kt
index becb34e2..b67724bf 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/Latin1EncodingExtensions.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/Latin1EncodingExtensions.kt
@@ -15,6 +15,6 @@
*/
package com.ashampoo.kim.common
-expect fun ByteArray.decodeLatin1BytesToString(): String
+internal expect fun ByteArray.decodeLatin1BytesToString(): String
-expect fun String.encodeToLatin1Bytes(): ByteArray
+internal expect fun String.encodeToLatin1Bytes(): ByteArray
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/LocalDateTimeExtensions.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/LocalDateTimeExtensions.kt
index cf5ec644..2d1702c5 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/LocalDateTimeExtensions.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/LocalDateTimeExtensions.kt
@@ -19,7 +19,7 @@ import kotlinx.datetime.LocalDateTime
private const val YEAR_LENGTH = 4
-fun LocalDateTime.toExifDateString(): String {
+internal fun LocalDateTime.toExifDateString(): String {
return year.toString().padStart(YEAR_LENGTH, '0') + ":" +
monthNumber.toString().padStart(2, '0') + ":" +
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/MetadataOffset.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/MetadataOffset.kt
index 07c8c813..106861a3 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/MetadataOffset.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/MetadataOffset.kt
@@ -15,11 +15,11 @@
*/
package com.ashampoo.kim.common
-data class MetadataOffset(
+public data class MetadataOffset(
val type: MetadataType,
val offset: Long,
val length: Long
) {
- val endPosition = offset + length
+ val endPosition: Long = offset + length
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/MetadataType.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/MetadataType.kt
index 99c18c75..c8aebe28 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/MetadataType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/MetadataType.kt
@@ -15,7 +15,7 @@
*/
package com.ashampoo.kim.common
-enum class MetadataType {
+public enum class MetadataType {
EXIF,
IPTC,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/PhotoMetadataConverter.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/PhotoMetadataConverter.kt
index 8e6bed75..6e6cbe7e 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/PhotoMetadataConverter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/PhotoMetadataConverter.kt
@@ -38,12 +38,12 @@ import kotlin.jvm.JvmStatic
* This is a dedicated object with @JvmStatic methods
* to provide a better API to pure Java projects.
*/
-object PhotoMetadataConverter {
+public object PhotoMetadataConverter {
@JvmStatic
@JvmOverloads
@Suppress("LongMethod")
- fun convertToPhotoMetadata(
+ public fun convertToPhotoMetadata(
imageMetadata: ImageMetadata,
ignoreOrientation: Boolean = false
): PhotoMetadata {
@@ -57,7 +57,7 @@ object PhotoMetadataConverter {
val gpsDirectory = imageMetadata.findTiffDirectory(TiffConstants.TIFF_DIRECTORY_GPS)
- val gps = gpsDirectory?.let { GPSInfo.createFrom(it) }
+ val gps = gpsDirectory?.let(GPSInfo::createFrom)
val latitude = gps?.getLatitudeAsDegreesNorth()
val longitude = gps?.getLongitudeAsDegreesEast()
@@ -143,7 +143,7 @@ object PhotoMetadataConverter {
}
@JvmStatic
- fun extractTakenDateAsIsoString(metadata: ImageMetadata): String? {
+ public fun extractTakenDateAsIsoString(metadata: ImageMetadata): String? {
val takenDateField = metadata.findTiffField(ExifTag.EXIF_TAG_DATE_TIME_ORIGINAL)
?: return null
@@ -163,13 +163,11 @@ object PhotoMetadataConverter {
}
@JvmStatic
- fun extractTakenDateMillis(metadata: ImageMetadata): Long? {
-
- var takenDate: String? = null
+ public fun extractTakenDateMillis(metadata: ImageMetadata): Long? {
try {
- takenDate = extractTakenDateAsIsoString(metadata) ?: return null
+ val takenDate = extractTakenDateAsIsoString(metadata) ?: return null
val takenDateSubSecond = metadata
.findStringValue(ExifTag.EXIF_TAG_SUB_SEC_TIME_ORIGINAL)
@@ -200,7 +198,6 @@ object PhotoMetadataConverter {
* Many photos contain wrong values here. We ignore this problem and hope
* that another taken date source like embedded XMP has a valid date instead.
*/
- println("Ignore invalid EXIF DateTimeOriginal: '$takenDate'")
return null
}
@@ -208,7 +205,7 @@ object PhotoMetadataConverter {
}
-fun ImageMetadata.convertToPhotoMetadata(
+public fun ImageMetadata.convertToPhotoMetadata(
ignoreOrientation: Boolean = false
): PhotoMetadata =
PhotoMetadataConverter.convertToPhotoMetadata(
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/PhotoValueFormatter.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/PhotoValueFormatter.kt
index 75a2fbf1..d6bca685 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/PhotoValueFormatter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/PhotoValueFormatter.kt
@@ -17,9 +17,9 @@ package com.ashampoo.kim.common
import kotlin.math.round
-object PhotoValueFormatter {
+public object PhotoValueFormatter {
- const val MEGA_PIXEL_COUNT: Int = 1_000_000
+ public const val MEGA_PIXEL_COUNT: Int = 1_000_000
private const val BYTES_PER_KB = 1000.0
@@ -122,7 +122,7 @@ object PhotoValueFormatter {
* Formats the file length and shows fractions above kilobytes.
* This function tries to format byte sizes the Apple way.
*/
- fun formatFileLength(bytes: Long): String {
+ public fun formatFileLength(bytes: Long): String {
if (bytes < BYTES_PER_KB)
return "$bytes B"
@@ -160,7 +160,7 @@ object PhotoValueFormatter {
* This method tries to create a pretty name out of
* make and model for both camera and lens information.
*/
- fun createCameraOrLensName(make: String?, model: String?): String? {
+ public fun createCameraOrLensName(make: String?, model: String?): String? {
/*
* Apparently real EXIF data has surprisingly a lot of
@@ -206,7 +206,7 @@ object PhotoValueFormatter {
modelMod ?: makeMod
}
- fun createModifiedLensName(
+ public fun createModifiedLensName(
cameraName: String?,
lensName: String?
): String? {
@@ -224,7 +224,7 @@ object PhotoValueFormatter {
}
}
- fun createCameraAndLensName(
+ public fun createCameraAndLensName(
cameraName: String?,
lensName: String?
): String? {
@@ -244,10 +244,10 @@ object PhotoValueFormatter {
}
}
- fun formatIso(iso: Int): String = "ISO $iso"
+ public fun formatIso(iso: Int): String = "ISO $iso"
@Suppress("MagicNumber")
- fun formatExposureTime(seconds: Double): String {
+ public fun formatExposureTime(seconds: Double): String {
if (seconds < 1.0)
return "1/" + (0.5 + 1 / seconds).toInt() + " s"
@@ -262,7 +262,7 @@ object PhotoValueFormatter {
return "$roundedSeconds'' s"
}
- fun formatFNumber(fNumber: Double): String {
+ public fun formatFNumber(fNumber: Double): String {
return if (fNumber % 1.0 == 0.0)
"ƒ${fNumber.toInt()}"
@@ -275,7 +275,7 @@ object PhotoValueFormatter {
* number like "18mm" and should be formatted like that,
* but in case of an iPhone is actually can be "4.2mm".
*/
- fun formatFocalLength(focalLength: Double): String {
+ public fun formatFocalLength(focalLength: Double): String {
return if (focalLength % 1.0 == 0.0)
"${focalLength.toInt()} mm"
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/RationalNumber.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/RationalNumber.kt
index 492e51a5..cd407b2c 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/RationalNumber.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/RationalNumber.kt
@@ -31,10 +31,10 @@ import kotlin.math.roundToLong
* To address this challenge, this class stores the numerator and divisor
* in long (64-bit) integers, applying masks as necessary for the unsigned type.
*/
-class RationalNumber {
+public class RationalNumber {
- val numerator: Long
- val divisor: Long
+ public val numerator: Long
+ public val divisor: Long
/*
* The TIFF and EXIF specifications call for the use
@@ -42,7 +42,7 @@ class RationalNumber {
* unsigned type, this class widens the type to long in order
* to avoid unintended negative numbers.
*/
- val unsignedType: Boolean
+ public val unsignedType: Boolean
/**
* Constructs an instance based on signed integers
@@ -50,7 +50,7 @@ class RationalNumber {
* @param numerator a 32-bit signed integer
* @param divisor a non-zero 32-bit signed integer
*/
- constructor(numerator: Int, divisor: Int) {
+ public constructor(numerator: Int, divisor: Int) {
this.numerator = numerator.toLong()
this.divisor = divisor.toLong()
unsignedType = false
@@ -64,7 +64,7 @@ class RationalNumber {
* @param unsignedType indicates whether the input values are to be treated as unsigned.
*/
@Suppress("MagicNumber")
- constructor(numerator: Int, divisor: Int, unsignedType: Boolean) {
+ public constructor(numerator: Int, divisor: Int, unsignedType: Boolean) {
this.unsignedType = unsignedType
@@ -91,7 +91,7 @@ class RationalNumber {
this.unsignedType = unsignedType
}
- fun doubleValue(): Double = numerator.toDouble() / divisor.toDouble()
+ public fun doubleValue(): Double = numerator.toDouble() / divisor.toDouble()
/**
* Negates the value of the RationalNumber. If the numerator of this
@@ -103,7 +103,7 @@ class RationalNumber {
* way to perform the negation. When a negation cannot be performed correctly,
* this method throws an unchecked exception.
*/
- fun negate(): RationalNumber {
+ public fun negate(): RationalNumber {
val isUnsignedType = unsignedType
val negatedNumerator = -numerator
@@ -173,14 +173,14 @@ class RationalNumber {
return result
}
- companion object {
+ public companion object {
private const val TO_STRING_DOUBLE_ROUND_FRACTION_DIGITS = 6
private const val INT_PRECISION_TOLERANCE = 1E-8
private const val MAX_ITERATIONS = 100
- fun create(numerator: Long, divisor: Long): RationalNumber {
+ public fun create(numerator: Long, divisor: Long): RationalNumber {
val normalizedFraction = normalizeFraction(numerator, divisor)
@@ -200,7 +200,7 @@ class RationalNumber {
if (normalizedDivisor == 0L)
error("Invalid value, numerator: $normalizedNumerator, divisor: $normalizedDivisor")
- return Pair(normalizedNumerator, normalizedDivisor)
+ return normalizedNumerator to normalizedDivisor
}
private fun normalizeValue(value: Long): Long {
@@ -243,7 +243,7 @@ class RationalNumber {
/**
* Calculate rational number using successive approximations.
*/
- fun valueOf(value: Double): RationalNumber {
+ public fun valueOf(value: Double): RationalNumber {
if (value >= Int.MAX_VALUE)
return RationalNumber(Int.MAX_VALUE, 1)
@@ -264,10 +264,10 @@ class RationalNumber {
val approx = absValue.toInt()
- if (approx < absValue)
- low = RationalNumber(approx, 1)
+ low = if (approx < absValue)
+ RationalNumber(approx, 1)
else
- low = RationalNumber(approx - 1, 1)
+ RationalNumber(approx - 1, 1)
high = RationalNumber(approx + 1, 1)
@@ -275,10 +275,10 @@ class RationalNumber {
val approx = (1.0 / absValue).toInt()
- if (1.0 / approx < absValue)
- low = RationalNumber(1, approx)
+ low = if (1.0 / approx < absValue)
+ RationalNumber(1, approx)
else
- low = RationalNumber(1, approx + 1)
+ RationalNumber(1, approx + 1)
high = RationalNumber(1, approx - 1)
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/RationalNumbers.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/RationalNumbers.kt
index 725033b6..435cdc88 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/RationalNumbers.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/RationalNumbers.kt
@@ -19,8 +19,8 @@ package com.ashampoo.kim.common
* To avoid rather unsafe "Array<*>" in instance checking we have this
* extra class to represent a collection of rational numbers.
*/
-class RationalNumbers(
- val values: Array
+public class RationalNumbers(
+ public val values: Array
) {
override fun toString(): String =
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/common/ZLib.kt b/src/commonMain/kotlin/com/ashampoo/kim/common/ZLib.kt
index dfe8a3c4..5fe72257 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/common/ZLib.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/common/ZLib.kt
@@ -15,6 +15,6 @@
*/
package com.ashampoo.kim.common
-expect fun compress(input: String): ByteArray
+internal expect fun compress(input: String): ByteArray
-expect fun decompress(byteArray: ByteArray): String
+internal expect fun decompress(byteArray: ByteArray): String
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/ImageFormatMagicNumbers.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/ImageFormatMagicNumbers.kt
index 9ec0cf71..d7593fb2 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/ImageFormatMagicNumbers.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/ImageFormatMagicNumbers.kt
@@ -22,25 +22,25 @@ package com.ashampoo.kim.format
* For example HEIC has a broad number of different headers bytes.
*/
@Suppress("MagicNumber")
-object ImageFormatMagicNumbers {
+public object ImageFormatMagicNumbers {
- val jpeg: List = byteListOf(
+ public val jpeg: List = byteListOf(
0xFF, 0xD8
)
- val gif87a: List = byteListOf(
+ public val gif87a: List = byteListOf(
0x47, 0x49, 0x46, 0x38, 0x37, 0x61
)
- val gif89a: List = byteListOf(
+ public val gif89a: List = byteListOf(
0x47, 0x49, 0x46, 0x38, 0x39, 0x61
)
- val png: List = byteListOf(
+ public val png: List = byteListOf(
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A
)
- val tiffLittleEndian: List = byteListOf(
+ public val tiffLittleEndian: List = byteListOf(
0x49, 0x49, 0x2A, 0x00
)
@@ -48,78 +48,78 @@ object ImageFormatMagicNumbers {
* Note that NEF, ARW & DNG also starts this way.
* We can't distinguish a normal TIFF and a raw file based on them.
*/
- val tiffBigEndian: List = byteListOf(
+ public val tiffBigEndian: List = byteListOf(
0x4D, 0x4D, 0x00, 0x2A
)
- val cr2: List = byteListOf(
+ public val cr2: List = byteListOf(
0x49, 0x49, 0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x43, 0x52
)
- val raf: List = "FUJIFILMCCD-RAW ".encodeToByteArray().toList()
+ public val raf: List = "FUJIFILMCCD-RAW ".encodeToByteArray().toList()
- val rw2: List = byteListOf(
+ public val rw2: List = byteListOf(
0x49, 0x49, 0x55, 0x00
)
- val orf_iiro: List = byteListOf(
+ public val orf_iiro: List = byteListOf(
0x49, 0x49, 0x52, 0x4F, 0x08, 0x00
)
- val orf_mmor: List = byteListOf(
+ public val orf_mmor: List = byteListOf(
0x4D, 0x4D, 0x4F, 0x52, 0x00, 0x00
)
- val orf_iirs: List = byteListOf(
+ public val orf_iirs: List = byteListOf(
0x49, 0x49, 0x52, 0x53, 0x08, 0x00
)
- val webP: List = byteListOf(
+ public val webP: List = byteListOf(
0x52, 0x49, 0x46, 0x46, null, null, null, null, 0x57, 0x45, 0x42, 0x50
)
/* 4 bytes + "ftypheic" */
- val heic: List = byteListOf(
+ public val heic: List = byteListOf(
null, null, null, null
).plus("ftypheic".encodeToByteArray().toList())
/* A HEIC brand */
- val mif1: List = byteListOf(
+ public val mif1: List = byteListOf(
null, null, null, null
).plus("ftypmif1".encodeToByteArray().toList())
/* A HEIC brand */
- val msf1: List = byteListOf(
+ public val msf1: List = byteListOf(
null, null, null, null
).plus("ftypmsf1".encodeToByteArray().toList())
/* A HEIC brand */
- val heix: List = byteListOf(
+ public val heix: List = byteListOf(
null, null, null, null
).plus("ftypheix".encodeToByteArray().toList())
/* A HEIC brand */
- val hevc: List = byteListOf(
+ public val hevc: List = byteListOf(
null, null, null, null
).plus("ftyphevc".encodeToByteArray().toList())
/* A HEIC brand */
- val hevx: List = byteListOf(
+ public val hevx: List = byteListOf(
null, null, null, null
).plus("ftyphevx".encodeToByteArray().toList())
/* 4 bytes + "ftypavif" */
- val avif: List = byteListOf(
+ public val avif: List = byteListOf(
null, null, null, null
).plus("ftypavif".encodeToByteArray().toList())
/* The regular ISOBMFF-based JPEG XL */
- val jxl: List = byteListOf(
+ public val jxl: List = byteListOf(
0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x4C, 0x20, 0x0D, 0x0A, 0x87, 0x0A
)
/* The 'naked' code stream without metadata. */
- val jxlCodeStream: List = byteListOf(
+ public val jxlCodeStream: List = byteListOf(
0xFF, 0x0A
)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/ImageMetadata.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/ImageMetadata.kt
index 606d32de..9370e9ce 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/ImageMetadata.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/ImageMetadata.kt
@@ -23,7 +23,7 @@ import com.ashampoo.kim.format.tiff.taginfo.TagInfo
import com.ashampoo.kim.model.ImageFormat
import com.ashampoo.kim.model.ImageSize
-data class ImageMetadata(
+public data class ImageMetadata(
val imageFormat: ImageFormat?,
val imageSize: ImageSize?,
val exif: TiffContents?,
@@ -32,7 +32,7 @@ data class ImageMetadata(
val xmp: String?
) {
- fun findStringValue(tagInfo: TagInfo): String? {
+ public fun findStringValue(tagInfo: TagInfo): String? {
val strings = findTiffField(tagInfo)?.value as? List
@@ -43,19 +43,19 @@ data class ImageMetadata(
return findTiffField(tagInfo)?.value as? String
}
- fun findShortValue(tagInfo: TagInfo): Short? =
+ public fun findShortValue(tagInfo: TagInfo): Short? =
findTiffField(tagInfo)?.toShort()
- fun findDoubleValue(tagInfo: TagInfo): Double? =
+ public fun findDoubleValue(tagInfo: TagInfo): Double? =
findTiffField(tagInfo)?.toDouble()
- fun findTiffField(tagInfo: TagInfo): TiffField? =
+ public fun findTiffField(tagInfo: TagInfo): TiffField? =
exif?.findTiffField(tagInfo)
- fun findTiffDirectory(directoryType: Int): TiffDirectory? =
+ public fun findTiffDirectory(directoryType: Int): TiffDirectory? =
exif?.findTiffDirectory(directoryType)
- fun getExifThumbnailBytes(): ByteArray? =
+ public fun getExifThumbnailBytes(): ByteArray? =
exif?.getExifThumbnailBytes()
override fun toString(): String {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/ImageParser.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/ImageParser.kt
index cd34b637..a8e3fffb 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/ImageParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/ImageParser.kt
@@ -26,15 +26,15 @@ import com.ashampoo.kim.input.ByteReader
import com.ashampoo.kim.model.ImageFormat
import kotlin.jvm.JvmStatic
-fun interface ImageParser {
+public fun interface ImageParser {
@Throws(ImageReadException::class)
- fun parseMetadata(byteReader: ByteReader): ImageMetadata
+ public fun parseMetadata(byteReader: ByteReader): ImageMetadata
- companion object {
+ public companion object {
@JvmStatic
- fun forFormat(imageFormat: ImageFormat): ImageParser? =
+ public fun forFormat(imageFormat: ImageFormat): ImageParser? =
when (imageFormat) {
ImageFormat.JPEG -> JpegImageParser
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/MetadataExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/MetadataExtractor.kt
index 88220fe2..478183fc 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/MetadataExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/MetadataExtractor.kt
@@ -18,9 +18,9 @@ package com.ashampoo.kim.format
import com.ashampoo.kim.common.ImageReadException
import com.ashampoo.kim.input.ByteReader
-fun interface MetadataExtractor {
+public fun interface MetadataExtractor {
@Throws(ImageReadException::class)
- fun extractMetadataBytes(byteReader: ByteReader): ByteArray
+ public fun extractMetadataBytes(byteReader: ByteReader): ByteArray
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/MetadataUpdater.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/MetadataUpdater.kt
index 1ffe47b2..fc972cb4 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/MetadataUpdater.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/MetadataUpdater.kt
@@ -20,17 +20,17 @@ import com.ashampoo.kim.input.ByteReader
import com.ashampoo.kim.model.MetadataUpdate
import com.ashampoo.kim.output.ByteWriter
-interface MetadataUpdater {
+public interface MetadataUpdater {
@Throws(ImageWriteException::class)
- fun update(
+ public fun update(
byteReader: ByteReader,
byteWriter: ByteWriter,
update: MetadataUpdate
)
@Throws(ImageWriteException::class)
- fun updateThumbnail(
+ public fun updateThumbnail(
bytes: ByteArray,
thumbnailBytes: ByteArray
): ByteArray
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/TiffPreviewExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/TiffPreviewExtractor.kt
index 0c3bf1aa..7edaacee 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/TiffPreviewExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/TiffPreviewExtractor.kt
@@ -19,10 +19,10 @@ import com.ashampoo.kim.common.ImageReadException
import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.input.RandomAccessByteReader
-fun interface TiffPreviewExtractor {
+public fun interface TiffPreviewExtractor {
@Throws(ImageReadException::class)
- fun extractPreviewImage(
+ public fun extractPreviewImage(
tiffContents: TiffContents,
randomAccessByteReader: RandomAccessByteReader
): ByteArray?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/arw/ArwPreviewExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/arw/ArwPreviewExtractor.kt
index c53b3db4..ef4ff789 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/arw/ArwPreviewExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/arw/ArwPreviewExtractor.kt
@@ -22,7 +22,7 @@ import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.format.tiff.constant.TiffTag
import com.ashampoo.kim.input.RandomAccessByteReader
-object ArwPreviewExtractor : TiffPreviewExtractor {
+public object ArwPreviewExtractor : TiffPreviewExtractor {
@Throws(ImageReadException::class)
override fun extractPreviewImage(
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BMFFConstants.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BMFFConstants.kt
index ead1bb60..2e5629e6 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BMFFConstants.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BMFFConstants.kt
@@ -17,7 +17,7 @@ package com.ashampoo.kim.format.bmff
import com.ashampoo.kim.common.ByteOrder
-object BMFFConstants {
+internal object BMFFConstants {
val BMFF_BYTE_ORDER = ByteOrder.BIG_ENDIAN
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BaseMediaFileFormatImageParser.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BaseMediaFileFormatImageParser.kt
index 6efb3afd..e3e3da7f 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BaseMediaFileFormatImageParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BaseMediaFileFormatImageParser.kt
@@ -29,6 +29,10 @@ import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.format.tiff.TiffReader
import com.ashampoo.kim.input.ByteArrayByteReader
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.readRemainingBytes
+import com.ashampoo.kim.input.skipBytes
/**
* Reads containers that follow the ISO base media file format
@@ -37,7 +41,7 @@ import com.ashampoo.kim.input.ByteReader
*
* https://en.wikipedia.org/wiki/ISO_base_media_file_format
*/
-object BaseMediaFileFormatImageParser : ImageParser {
+public object BaseMediaFileFormatImageParser : ImageParser {
override fun parseMetadata(byteReader: ByteReader): ImageMetadata {
@@ -57,9 +61,7 @@ object BaseMediaFileFormatImageParser : ImageParser {
throw ImageReadException("Illegal ISOBMFF: Has no boxes.")
val fileTypeBox = allBoxes.filterIsInstance().firstOrNull()
-
- if (fileTypeBox == null)
- throw ImageReadException("Illegal ISOBMFF: Has no 'ftyp' Box.")
+ ?: throw ImageReadException("Illegal ISOBMFF: Has no 'ftyp' Box.")
/**
* Handle JPEG XL
@@ -70,9 +72,7 @@ object BaseMediaFileFormatImageParser : ImageParser {
return JxlReader.createMetadata(allBoxes)
val metaBox = allBoxes.filterIsInstance().firstOrNull()
-
- if (metaBox == null)
- throw ImageReadException("Illegal ISOBMFF: Has no 'meta' Box.")
+ ?: throw ImageReadException("Illegal ISOBMFF: Has no 'meta' Box.")
val metadataOffsets = metaBox.findMetadataOffsets()
@@ -131,10 +131,8 @@ object BaseMediaFileFormatImageParser : ImageParser {
* Ignore illegal offsets.
* endPosition is checked for negative values to also catch value overflows.
*/
- if (offset.endPosition < 0 || offset.endPosition > byteReader.contentLength) {
- println("Ignored illegal start offset: $offset")
+ if (offset.endPosition < 0 || offset.endPosition > byteReader.contentLength)
continue
- }
when (offset.type) {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BoxReader.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BoxReader.kt
index 70435aaa..a9582b3d 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BoxReader.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BoxReader.kt
@@ -31,11 +31,14 @@ import com.ashampoo.kim.format.jxl.box.ExifBox
import com.ashampoo.kim.format.jxl.box.JxlParticalCodestreamBox
import com.ashampoo.kim.format.jxl.box.XmlBox
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.read8BytesAsLong
+import com.ashampoo.kim.input.readBytes
/**
* Reads ISOBMFF boxes
*/
-object BoxReader {
+public object BoxReader {
/**
* @param byteReader The reader as source for the bytes
@@ -43,7 +46,7 @@ object BoxReader {
* want to stop reading after the meta boxes to prevent reading the whole image data block in.
* For iPhone HEIC this is possible, but Samsung HEIC has "meta" coming after "mdat"
*/
- fun readBoxes(
+ public fun readBoxes(
byteReader: ByteReader,
stopAfterMetadataRead: Boolean = false,
positionOffset: Long = 0,
@@ -51,7 +54,7 @@ object BoxReader {
updatePosition: ((Long) -> Unit)? = null
): List {
- var haveSeenJxlHeaderBox: Boolean = false
+ var haveSeenJxlHeaderBox = false
val boxes = mutableListOf()
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BoxType.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BoxType.kt
index 197ef9b7..4a1b937a 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BoxType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/BoxType.kt
@@ -17,7 +17,7 @@ package com.ashampoo.kim.format.bmff
import com.ashampoo.kim.common.toFourCCTypeString
-data class BoxType internal constructor(
+public data class BoxType internal constructor(
val bytes: ByteArray,
val name: String,
val intValue: Int
@@ -40,7 +40,7 @@ data class BoxType internal constructor(
override fun toString(): String =
name
- companion object {
+ public companion object {
/*
* Important: All the box types listed below are integral components of the
@@ -55,66 +55,66 @@ data class BoxType internal constructor(
/**
* File Type box, the first box
*/
- val FTYP = of("ftyp".encodeToByteArray())
+ public val FTYP: BoxType = of("ftyp".encodeToByteArray())
/**
* Meta Box for metadata, usually the second box.
* It's a container for several more boxes like IINF.
*/
- val META = of("meta".encodeToByteArray())
+ public val META: BoxType = of("meta".encodeToByteArray())
/**
* Handler Reference Box
*/
- val HDLR = of("hdlr".encodeToByteArray())
+ public val HDLR: BoxType = of("hdlr".encodeToByteArray())
/**
* Primary Item Box
*/
- val PITM = of("pitm".encodeToByteArray())
+ public val PITM: BoxType = of("pitm".encodeToByteArray())
/**
* Item Information Box, container for INFE boxes
*/
- val IINF = of("iinf".encodeToByteArray())
+ public val IINF: BoxType = of("iinf".encodeToByteArray())
/*
* Item Info Entry Box
*/
- val INFE = of("infe".encodeToByteArray())
+ public val INFE: BoxType = of("infe".encodeToByteArray())
/**
* Item Location Box
*/
- val ILOC = of("iloc".encodeToByteArray())
+ public val ILOC: BoxType = of("iloc".encodeToByteArray())
/**
* Media Data box, of which there can be many at the end.
*/
- val MDAT = of("mdat".encodeToByteArray())
+ public val MDAT: BoxType = of("mdat".encodeToByteArray())
/**
* Extra box for EXIF data as part of the JPEG XL spec.
*/
- val EXIF = of("Exif".encodeToByteArray())
+ public val EXIF: BoxType = of("Exif".encodeToByteArray())
/**
* Extra box for XMP data as part of the JPEG XL spec.
*/
- val XML = of("xml ".encodeToByteArray())
+ public val XML: BoxType = of("xml ".encodeToByteArray())
/**
* Extra box for brotli compressed data as part of the JPEG XL spec.
*/
- val BROB = of("brob".encodeToByteArray())
+ public val BROB: BoxType = of("brob".encodeToByteArray())
/**
* JPEG XL partical codestream box
*/
- val JXLP = of("jxlp".encodeToByteArray())
+ public val JXLP: BoxType = of("jxlp".encodeToByteArray())
@Suppress("MagicNumber")
- fun of(typeBytes: ByteArray): BoxType {
+ public fun of(typeBytes: ByteArray): BoxType {
require(typeBytes.size == BMFFConstants.TPYE_LENGTH) {
"BoxType must be always 4 bytes!"
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/Extent.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/Extent.kt
index 8a6fa4a3..62594a61 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/Extent.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/Extent.kt
@@ -16,7 +16,7 @@
*/
package com.ashampoo.kim.format.bmff
-data class Extent(
+public data class Extent(
val itemId: Int,
val index: Long?,
val offset: Long,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/Box.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/Box.kt
index 3913fe5f..7daab49b 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/Box.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/Box.kt
@@ -19,13 +19,13 @@ package com.ashampoo.kim.format.bmff.box
import com.ashampoo.kim.format.bmff.BMFFConstants.BOX_HEADER_LENGTH
import com.ashampoo.kim.format.bmff.BoxType
-open class Box(
- val type: BoxType,
- val offset: Long,
- val size: Long,
- val largeSize: Long?,
+public open class Box(
+ public val type: BoxType,
+ public val offset: Long,
+ public val size: Long,
+ public val largeSize: Long?,
/** Payload bytes, not including type & length bytes */
- val payload: ByteArray
+ public val payload: ByteArray
) {
/*
@@ -35,7 +35,7 @@ open class Box(
* box is the last one in the file, and its contents extend to the
* end of the file (normally only used for a Media Data Box)
*/
- val actualLength: Long =
+ public val actualLength: Long =
when (size) {
0L -> BOX_HEADER_LENGTH.toLong() + payload.size
1L -> largeSize!!
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/BoxContainer.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/BoxContainer.kt
index 8954369a..d1628ae0 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/BoxContainer.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/BoxContainer.kt
@@ -16,13 +16,13 @@
*/
package com.ashampoo.kim.format.bmff.box
-interface BoxContainer {
+public interface BoxContainer {
- val boxes: List
+ public val boxes: List
- companion object {
+ public companion object {
- fun findAllBoxesRecursive(boxes: List): List {
+ public fun findAllBoxesRecursive(boxes: List): List {
val allBoxes = mutableListOf()
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/FileTypeBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/FileTypeBox.kt
index 6735cb84..ee4cfced 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/FileTypeBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/FileTypeBox.kt
@@ -17,27 +17,27 @@
package com.ashampoo.kim.format.bmff.box
import com.ashampoo.kim.common.toFourCCTypeString
-import com.ashampoo.kim.format.bmff.BMFFConstants
import com.ashampoo.kim.format.bmff.BMFFConstants.BMFF_BYTE_ORDER
import com.ashampoo.kim.format.bmff.BMFFConstants.BOX_HEADER_LENGTH
import com.ashampoo.kim.format.bmff.BoxType
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.read4BytesAsInt
/**
* EIC/ISO 14496-12 ftyp box
*/
-class FileTypeBox(
+public class FileTypeBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.FTYP, offset, size, largeSize, payload) {
- val majorBrand: String
+ public val majorBrand: String
- val minorBrand: String
+ public val minorBrand: String
- val compatibleBrands: List
+ public val compatibleBrands: List
init {
@@ -58,7 +58,7 @@ class FileTypeBox(
repeat(brandCount) {
brands.add(
byteReader
- .read4BytesAsInt("brand $it", BMFFConstants.BMFF_BYTE_ORDER)
+ .read4BytesAsInt("brand $it", BMFF_BYTE_ORDER)
.toFourCCTypeString()
)
}
@@ -69,7 +69,7 @@ class FileTypeBox(
override fun toString(): String =
"$type major=$majorBrand minor=$minorBrand compatible=$compatibleBrands"
- companion object {
+ internal companion object {
const val JXL_BRAND = "jxl "
}
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/HandlerReferenceBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/HandlerReferenceBox.kt
index e55cb135..f352cb28 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/HandlerReferenceBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/HandlerReferenceBox.kt
@@ -19,24 +19,28 @@ package com.ashampoo.kim.format.bmff.box
import com.ashampoo.kim.common.toHex
import com.ashampoo.kim.format.bmff.BoxType
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.readByteAsInt
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.readNullTerminatedString
+import com.ashampoo.kim.input.skipBytes
/**
* EIC/ISO 14496-12 hdlr box
*/
-class HandlerReferenceBox(
+public class HandlerReferenceBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.HDLR, offset, size, largeSize, payload) {
- val version: Int
+ public val version: Int
- val flags: ByteArray
+ public val flags: ByteArray
- val handlerType: String
+ public val handlerType: String
- val name: String
+ public val name: String
init {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemInfoEntryBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemInfoEntryBox.kt
index aae3fbc1..beaf8427 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemInfoEntryBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemInfoEntryBox.kt
@@ -21,28 +21,33 @@ import com.ashampoo.kim.common.toHex
import com.ashampoo.kim.format.bmff.BMFFConstants.BMFF_BYTE_ORDER
import com.ashampoo.kim.format.bmff.BoxType
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readByteAsInt
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.readNullTerminatedString
/**
* EIC/ISO 14496-12 infe box
*/
-class ItemInfoEntryBox(
+public class ItemInfoEntryBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.INFE, offset, size, largeSize, payload) {
- val version: Int
+ public val version: Int
- val flags: ByteArray
+ public val flags: ByteArray
- val itemId: Int
+ public val itemId: Int
- val itemProtectionIndex: Int
+ public val itemProtectionIndex: Int
- val itemType: Int
+ public val itemType: Int
- val itemName: String
+ public val itemName: String
init {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemInformationBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemInformationBox.kt
index 2fcd7453..2fe749bd 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemInformationBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemInformationBox.kt
@@ -21,24 +21,28 @@ import com.ashampoo.kim.format.bmff.BMFFConstants.BMFF_BYTE_ORDER
import com.ashampoo.kim.format.bmff.BoxReader
import com.ashampoo.kim.format.bmff.BoxType
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readByteAsInt
+import com.ashampoo.kim.input.readBytes
/**
* EIC/ISO 14496-12 iinf box
*/
-class ItemInformationBox(
+public class ItemInformationBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.IINF, offset, size, largeSize, payload), BoxContainer {
- val version: Int
+ public val version: Int
- val flags: ByteArray
+ public val flags: ByteArray
- val entryCount: Int
+ public val entryCount: Int
- val map: Map
+ public val map: Map
override val boxes: List
@@ -50,10 +54,10 @@ class ItemInformationBox(
flags = byteReader.readBytes("flags", 3)
- if (version == 0)
- entryCount = byteReader.read2BytesAsInt("entryCount", BMFF_BYTE_ORDER)
+ entryCount = if (version == 0)
+ byteReader.read2BytesAsInt("entryCount", BMFF_BYTE_ORDER)
else
- entryCount = byteReader.read4BytesAsInt("entryCount", BMFF_BYTE_ORDER)
+ byteReader.read4BytesAsInt("entryCount", BMFF_BYTE_ORDER)
boxes = BoxReader.readBoxes(
byteReader = byteReader,
@@ -68,7 +72,7 @@ class ItemInformationBox(
box as ItemInfoEntryBox
- map.put(box.itemId, box)
+ map[box.itemId] = box
}
this.map = map
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemLocationBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemLocationBox.kt
index 3254bd96..de13b4cf 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemLocationBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/ItemLocationBox.kt
@@ -20,11 +20,18 @@ import com.ashampoo.kim.format.bmff.BMFFConstants.BMFF_BYTE_ORDER
import com.ashampoo.kim.format.bmff.BoxType
import com.ashampoo.kim.format.bmff.Extent
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.read8BytesAsLong
+import com.ashampoo.kim.input.readByteAsInt
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.readXBytesAtInt
+import com.ashampoo.kim.input.skipBytes
/**
* EIC/ISO 14496-12 iloc box
*/
-class ItemLocationBox(
+public class ItemLocationBox(
offset: Long,
size: Long,
largeSize: Long?,
@@ -34,36 +41,36 @@ class ItemLocationBox(
/**
* The version of the box.
*/
- val version: Int
+ public val version: Int
/**
* Flags that provide additional information about the box.
*/
- val flags: ByteArray
+ public val flags: ByteArray
/**
* The size (in bytes) of the offset field in each item location entry.
*/
- val offsetSize: Int
+ public val offsetSize: Int
/**
* The size (in bytes) of the length field in each item location entry.
*/
- val lengthSize: Int
+ public val lengthSize: Int
/**
* The size (in bytes) of the base offset field in each item location entry.
*/
- val baseOffsetSize: Int
+ public val baseOffsetSize: Int
/**
* This part contains the actual entries describing the location of items within the file.
*/
- val indexSize: Int
+ public val indexSize: Int
- val itemCount: Int
+ public val itemCount: Int
- val extents: List
+ public val extents: List
init {
@@ -80,20 +87,20 @@ class ItemLocationBox(
val offsetAndLengthSize = byteReader.readByteAsInt()
offsetSize = (offsetAndLengthSize and 0xF0) shr 4
- lengthSize = (offsetAndLengthSize and 0x0F)
+ lengthSize = offsetAndLengthSize and 0x0F
val baseOffsetSizeAndIndexSize = byteReader.readByteAsInt()
baseOffsetSize = (baseOffsetSizeAndIndexSize and 0xF0) shr 4
- if (version in 1..2)
- indexSize = (baseOffsetSizeAndIndexSize and 0x0F)
+ indexSize = if (version in 1..2)
+ baseOffsetSizeAndIndexSize and 0x0F
else
- indexSize = 0 // Unused
+ 0 // Unused
- if (version < 2)
- itemCount = byteReader.read2BytesAsInt("itemCount", BMFF_BYTE_ORDER)
+ itemCount = if (version < 2)
+ byteReader.read2BytesAsInt("itemCount", BMFF_BYTE_ORDER)
else if (version == 2)
- itemCount = byteReader.read4BytesAsInt("itemCount", BMFF_BYTE_ORDER)
+ byteReader.read4BytesAsInt("itemCount", BMFF_BYTE_ORDER)
else
error("Unknown version $version")
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/MediaDataBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/MediaDataBox.kt
index 72cb167c..efe93459 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/MediaDataBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/MediaDataBox.kt
@@ -24,7 +24,7 @@ import com.ashampoo.kim.format.bmff.BoxType
* The Media Data Box contains all the actual data.
* This includes the EXIF bytes.
*/
-class MediaDataBox(
+public class MediaDataBox(
offset: Long,
size: Long,
largeSize: Long?,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/MetaBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/MetaBox.kt
index 24e01df1..293b1cef 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/MetaBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/MetaBox.kt
@@ -23,28 +23,30 @@ import com.ashampoo.kim.format.bmff.BMFFConstants
import com.ashampoo.kim.format.bmff.BoxReader
import com.ashampoo.kim.format.bmff.BoxType
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.readByteAsInt
+import com.ashampoo.kim.input.readBytes
/**
* EIC/ISO 14496-12 meta box
*
* The Meta Box is a container for several metadata boxes.
*/
-class MetaBox(
+public class MetaBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.META, offset, size, largeSize, payload), BoxContainer {
- val version: Int
+ public val version: Int
- val flags: ByteArray
+ public val flags: ByteArray
/* Mandatory boxes in META */
- val handlerReferenceBox: HandlerReferenceBox
- val primaryItemBox: PrimaryItemBox
- val itemInfoBox: ItemInformationBox
- val itemLocationBox: ItemLocationBox
+ public val handlerReferenceBox: HandlerReferenceBox
+ public val primaryItemBox: PrimaryItemBox
+ public val itemInfoBox: ItemInformationBox
+ public val itemLocationBox: ItemLocationBox
override val boxes: List
@@ -70,7 +72,7 @@ class MetaBox(
itemLocationBox = boxes.find { it.type == BoxType.ILOC } as ItemLocationBox
}
- fun findMetadataOffsets(): List {
+ public fun findMetadataOffsets(): List {
val offsets = mutableListOf()
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/PrimaryItemBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/PrimaryItemBox.kt
index cdc93c0a..c979ad3b 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/PrimaryItemBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/bmff/box/PrimaryItemBox.kt
@@ -20,22 +20,26 @@ import com.ashampoo.kim.common.toHex
import com.ashampoo.kim.format.bmff.BMFFConstants.BMFF_BYTE_ORDER
import com.ashampoo.kim.format.bmff.BoxType
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readByteAsInt
+import com.ashampoo.kim.input.readBytes
/**
* EIC/ISO 14496-12 pitm box
*/
-class PrimaryItemBox(
+public class PrimaryItemBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.PITM, offset, size, largeSize, payload) {
- val version: Int
+ public val version: Int
- val flags: ByteArray
+ public val flags: ByteArray
- val itemId: Int
+ public val itemId: Int
init {
@@ -45,10 +49,10 @@ class PrimaryItemBox(
flags = byteReader.readBytes("flags", 3)
- if (version == 0)
- itemId = byteReader.read2BytesAsInt("itemId", BMFF_BYTE_ORDER)
+ itemId = if (version == 0)
+ byteReader.read2BytesAsInt("itemId", BMFF_BYTE_ORDER)
else
- itemId = byteReader.read4BytesAsInt("itemId", BMFF_BYTE_ORDER)
+ byteReader.read4BytesAsInt("itemId", BMFF_BYTE_ORDER)
}
override fun toString(): String =
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/cr2/Cr2PreviewExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/cr2/Cr2PreviewExtractor.kt
index ff497906..950d27ed 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/cr2/Cr2PreviewExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/cr2/Cr2PreviewExtractor.kt
@@ -22,7 +22,7 @@ import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.format.tiff.constant.ExifTag
import com.ashampoo.kim.input.RandomAccessByteReader
-object Cr2PreviewExtractor : TiffPreviewExtractor {
+public object Cr2PreviewExtractor : TiffPreviewExtractor {
@Throws(ImageReadException::class)
override fun extractPreviewImage(
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/dng/DngPreviewExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/dng/DngPreviewExtractor.kt
index 900b7442..e90790a4 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/dng/DngPreviewExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/dng/DngPreviewExtractor.kt
@@ -24,7 +24,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
import com.ashampoo.kim.format.tiff.constant.TiffTag
import com.ashampoo.kim.input.RandomAccessByteReader
-object DngPreviewExtractor : TiffPreviewExtractor {
+public object DngPreviewExtractor : TiffPreviewExtractor {
@Throws(ImageReadException::class)
override fun extractPreviewImage(
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegConstants.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegConstants.kt
index ec87cd20..c479142e 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegConstants.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegConstants.kt
@@ -19,14 +19,14 @@ package com.ashampoo.kim.format.jpeg
import com.ashampoo.kim.common.ByteOrder
@Suppress("MagicNumber")
-object JpegConstants {
+public object JpegConstants {
- val JPEG_BYTE_ORDER = ByteOrder.BIG_ENDIAN
+ public val JPEG_BYTE_ORDER: ByteOrder = ByteOrder.BIG_ENDIAN
/* Max segment size is 65535 bytes (around 65 kb). */
- const val MAX_SEGMENT_SIZE = 0xFFFF
+ public const val MAX_SEGMENT_SIZE: Int = 0xFFFF
- val JFIF0_SIGNATURE = byteArrayOf(
+ public val JFIF0_SIGNATURE: ByteArray = byteArrayOf(
0x4a, // J
0x46, // F
0x49, // I
@@ -34,7 +34,7 @@ object JpegConstants {
0x0
)
- val JFIF0_SIGNATURE_ALTERNATIVE = byteArrayOf(
+ public val JFIF0_SIGNATURE_ALTERNATIVE: ByteArray = byteArrayOf(
0x4A, // J
0x46, // F
0x49, // I
@@ -42,7 +42,7 @@ object JpegConstants {
0x20
)
- val EXIF_IDENTIFIER_CODE = byteArrayOf(
+ public val EXIF_IDENTIFIER_CODE: ByteArray = byteArrayOf(
0x45, // E
0x78, // x
0x69, // i
@@ -51,9 +51,9 @@ object JpegConstants {
0 // NUL
)
- const val EXIF_IDENTIFIER_CODE_HEX: String = "457869660000"
+ public const val EXIF_IDENTIFIER_CODE_HEX: String = "457869660000"
- val XMP_IDENTIFIER = byteArrayOf(
+ public val XMP_IDENTIFIER: ByteArray = byteArrayOf(
0x68, // h
0x74, // t
0x74, // t
@@ -85,67 +85,67 @@ object JpegConstants {
0
)
- val SOI = byteArrayOf(0xFF.toByte(), 0xD8.toByte())
- val EOI = byteArrayOf(0xFF.toByte(), 0xD9.toByte())
-
- const val JPEG_APP0_MARKER = 0xFFE0
- const val JPEG_APP1_MARKER = 0xFFE1
- const val JPEG_APP2_MARKER = 0xFFE2
- const val JPEG_APP3_MARKER = 0xFFE3
- const val JPEG_APP4_MARKER = 0xFFE4
- const val JPEG_APP5_MARKER = 0xFFE5
- const val JPEG_APP6_MARKER = 0xFFE6
- const val JPEG_APP7_MARKER = 0xFFE7
- const val JPEG_APP8_MARKER = 0xFFE8
- const val JPEG_APP9_MARKER = 0xFFE9
- const val JPEG_APP10_MARKER = 0xFFEA
- const val JPEG_APP11_MARKER = 0xFFEB
- const val JPEG_APP12_MARKER = 0xFFEC
- const val JPEG_APP13_MARKER = 0xFFED
- const val JPEG_APP14_MARKER = 0xFFEE
- const val JPEG_APP15_MARKER = 0xFFEF
-
- const val JFIF_MARKER = 0xFFE0
- const val DHT_MARKER = 0xFFC4
- const val DAC_MARKER = 0xFFCC
-
- const val SOF0_MARKER = 0xFFC0
- const val SOF1_MARKER = 0xFFC1
- const val SOF2_MARKER = 0xFFC2
- const val SOF3_MARKER = 0xFFC3
- const val SOF5_MARKER = 0xFFC5
- const val SOF6_MARKER = 0xFFC6
- const val SOF7_MARKER = 0xFFC7
- const val SOF9_MARKER = 0xFFC9
- const val SOF10_MARKER = 0xFFCA
- const val SOF11_MARKER = 0xFFCB
- const val SOF13_MARKER = 0xFFCD
- const val SOF14_MARKER = 0xFFCE
- const val SOF15_MARKER = 0xFFCF
-
- const val DRI_MARKER = 0xFFDD
- const val RST0_MARKER = 0xFFD0
- const val RST1_MARKER = 0xFFD1
- const val RST2_MARKER = 0xFFD2
- const val RST3_MARKER = 0xFFD3
- const val RST4_MARKER = 0xFFD4
- const val RST5_MARKER = 0xFFD5
- const val RST6_MARKER = 0xFFD6
- const val RST7_MARKER = 0xFFD7
-
- const val SOI_MARKER = 0xFFD8
- const val EOI_MARKER = 0xFFD9
- const val SOS_MARKER = 0xFFDA
- const val DQT_MARKER = 0xFFDB
- const val DNL_MARKER = 0xFFDC
- const val JPG_EXT_MARKER = 0xFFC8
- const val DHP_MARKER = 0xFFDE
- const val EXP_MARKER = 0xFFDF
-
- const val COM_MARKER_1 = 0xFFFE
- const val COM_MARKER_2 = 0xFFEE
-
- val SOFN_MARKERS = listOf(
+ public val SOI: ByteArray = byteArrayOf(0xFF.toByte(), 0xD8.toByte())
+ public val EOI: ByteArray = byteArrayOf(0xFF.toByte(), 0xD9.toByte())
+
+ public const val JPEG_APP0_MARKER: Int = 0xFFE0
+ public const val JPEG_APP1_MARKER: Int = 0xFFE1
+ public const val JPEG_APP2_MARKER: Int = 0xFFE2
+ public const val JPEG_APP3_MARKER: Int = 0xFFE3
+ public const val JPEG_APP4_MARKER: Int = 0xFFE4
+ public const val JPEG_APP5_MARKER: Int = 0xFFE5
+ public const val JPEG_APP6_MARKER: Int = 0xFFE6
+ public const val JPEG_APP7_MARKER: Int = 0xFFE7
+ public const val JPEG_APP8_MARKER: Int = 0xFFE8
+ public const val JPEG_APP9_MARKER: Int = 0xFFE9
+ public const val JPEG_APP10_MARKER: Int = 0xFFEA
+ public const val JPEG_APP11_MARKER: Int = 0xFFEB
+ public const val JPEG_APP12_MARKER: Int = 0xFFEC
+ public const val JPEG_APP13_MARKER: Int = 0xFFED
+ public const val JPEG_APP14_MARKER: Int = 0xFFEE
+ public const val JPEG_APP15_MARKER: Int = 0xFFEF
+
+ public const val JFIF_MARKER: Int = 0xFFE0
+ public const val DHT_MARKER: Int = 0xFFC4
+ public const val DAC_MARKER: Int = 0xFFCC
+
+ public const val SOF0_MARKER: Int = 0xFFC0
+ public const val SOF1_MARKER: Int = 0xFFC1
+ public const val SOF2_MARKER: Int = 0xFFC2
+ public const val SOF3_MARKER: Int = 0xFFC3
+ public const val SOF5_MARKER: Int = 0xFFC5
+ public const val SOF6_MARKER: Int = 0xFFC6
+ public const val SOF7_MARKER: Int = 0xFFC7
+ public const val SOF9_MARKER: Int = 0xFFC9
+ public const val SOF10_MARKER: Int = 0xFFCA
+ public const val SOF11_MARKER: Int = 0xFFCB
+ public const val SOF13_MARKER: Int = 0xFFCD
+ public const val SOF14_MARKER: Int = 0xFFCE
+ public const val SOF15_MARKER: Int = 0xFFCF
+
+ public const val DRI_MARKER: Int = 0xFFDD
+ public const val RST0_MARKER: Int = 0xFFD0
+ public const val RST1_MARKER: Int = 0xFFD1
+ public const val RST2_MARKER: Int = 0xFFD2
+ public const val RST3_MARKER: Int = 0xFFD3
+ public const val RST4_MARKER: Int = 0xFFD4
+ public const val RST5_MARKER: Int = 0xFFD5
+ public const val RST6_MARKER: Int = 0xFFD6
+ public const val RST7_MARKER: Int = 0xFFD7
+
+ public const val SOI_MARKER: Int = 0xFFD8
+ public const val EOI_MARKER: Int = 0xFFD9
+ public const val SOS_MARKER: Int = 0xFFDA
+ public const val DQT_MARKER: Int = 0xFFDB
+ public const val DNL_MARKER: Int = 0xFFDC
+ public const val JPG_EXT_MARKER: Int = 0xFFC8
+ public const val DHP_MARKER: Int = 0xFFDE
+ public const val EXP_MARKER: Int = 0xFFDF
+
+ public const val COM_MARKER_1: Int = 0xFFFE
+ public const val COM_MARKER_2: Int = 0xFFEE
+
+ public val SOFN_MARKERS: List = listOf(
JpegConstants.SOF0_MARKER,
JpegConstants.SOF1_MARKER,
JpegConstants.SOF2_MARKER,
@@ -161,7 +161,7 @@ object JpegConstants {
JpegConstants.SOF15_MARKER
)
- val SOFN_MARKER_BYTES = listOf(
+ public val SOFN_MARKER_BYTES: List = listOf(
0xC0.toByte(), 0xC1.toByte(), 0xC2.toByte(),
0xC3.toByte(), 0xC5.toByte(), 0xC6.toByte(),
0xC7.toByte(), 0xC9.toByte(), 0xCA.toByte(),
@@ -169,7 +169,7 @@ object JpegConstants {
0xCF.toByte()
)
- val APP13_IDENTIFIER = byteArrayOf(
+ public val APP13_IDENTIFIER: ByteArray = byteArrayOf(
0x50, // P
0x68, // h
0x6F, // o
@@ -186,16 +186,17 @@ object JpegConstants {
0
)
- const val IPTC_MAX_BLOCK_NAME_LENGTH: Int = 255
+ public const val IPTC_MAX_BLOCK_NAME_LENGTH: Int = 255
/** Int value of "8BIM" */
- const val IPTC_RESOURCE_BLOCK_SIGNATURE_INT = 943_868_237
+ public const val IPTC_RESOURCE_BLOCK_SIGNATURE_INT: Int = 943_868_237
/** Hex value of "8BIM" (38 42 49 4D) */
- const val IPTC_RESOURCE_BLOCK_SIGNATURE_HEX = "3842494d"
+ public const val IPTC_RESOURCE_BLOCK_SIGNATURE_HEX: String = "3842494d"
@OptIn(ExperimentalStdlibApi::class)
- fun markerDescription(marker: Int): String =
+ @Suppress("kotlin:S1479")
+ public fun markerDescription(marker: Int): String =
when (marker) {
/* Every file has these markers */
SOI_MARKER -> "SOI (Start of Image)"
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegImageParser.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegImageParser.kt
index 28bddbf6..9abb66f9 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegImageParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegImageParser.kt
@@ -37,18 +37,20 @@ import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.format.tiff.TiffReader
import com.ashampoo.kim.input.ByteArrayByteReader
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.skipBytes
import com.ashampoo.kim.model.ImageFormat
import com.ashampoo.kim.model.ImageSize
-object JpegImageParser : ImageParser {
+public object JpegImageParser : ImageParser {
- fun getImageSize(byteReader: ByteReader): ImageSize? {
+ public fun getImageSize(byteReader: ByteReader): ImageSize? {
val magicNumberBytes = byteReader.readBytes(ImageFormatMagicNumbers.jpeg.size).toList()
/* Ensure it's actually a JPEG. */
require(magicNumberBytes == ImageFormatMagicNumbers.jpeg) {
- "JPEG magic number mismatch: ${magicNumberBytes.toByteArray().toSingleNumberHexes()}"
+ "JPEG magic number mismatch: ${magicNumberBytes.toSingleNumberHexes()}"
}
var readBytesCount = magicNumberBytes.size
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegMetadataExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegMetadataExtractor.kt
index 027be89f..d3ada92a 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegMetadataExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegMetadataExtractor.kt
@@ -24,11 +24,11 @@ import com.ashampoo.kim.format.ImageFormatMagicNumbers
import com.ashampoo.kim.format.MetadataExtractor
import com.ashampoo.kim.input.ByteReader
-object JpegMetadataExtractor : MetadataExtractor {
+public object JpegMetadataExtractor : MetadataExtractor {
- const val SEGMENT_IDENTIFIER = 0xFF.toByte()
- const val SEGMENT_START_OF_SCAN = 0xDA.toByte()
- const val MARKER_END_OF_IMAGE = 0xD9.toByte()
+ internal const val SEGMENT_IDENTIFIER = 0xFF.toByte()
+ internal const val SEGMENT_START_OF_SCAN = 0xDA.toByte()
+ internal const val MARKER_END_OF_IMAGE = 0xD9.toByte()
private const val ADDITIONAL_BYTE_COUNT_AFTER_HEADER: Int = 12
@@ -44,7 +44,7 @@ object JpegMetadataExtractor : MetadataExtractor {
/* Ensure it's actually a JPEG. */
require(magicNumberBytes == ImageFormatMagicNumbers.jpeg) {
- "JPEG magic number mismatch: ${magicNumberBytes.toByteArray().toSingleNumberHexes()}"
+ "JPEG magic number mismatch: ${magicNumberBytes.toSingleNumberHexes()}"
}
bytes.addAll(magicNumberBytes)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegOrientationOffsetFinder.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegOrientationOffsetFinder.kt
index fa2254c1..b30df880 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegOrientationOffsetFinder.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegOrientationOffsetFinder.kt
@@ -29,19 +29,22 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants.TIFF_ENTRY_LENGTH
import com.ashampoo.kim.format.tiff.constant.TiffConstants.TIFF_HEADER_SIZE
import com.ashampoo.kim.format.tiff.constant.TiffTag
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.skipBytes
/**
* This algorithm quickly identifies the EXIF orientation offset.
* If the file already has one no restructuring of the whole file is necessary.
*/
-object JpegOrientationOffsetFinder {
+public object JpegOrientationOffsetFinder {
- const val APP1_MARKER = 0xE1.toByte()
+ private const val APP1_MARKER = 0xE1.toByte()
@OptIn(ExperimentalStdlibApi::class)
@Throws(ImageReadException::class)
@Suppress("ComplexMethod")
- fun findOrientationOffset(
+ public fun findOrientationOffset(
byteReader: ByteReader
): Long? = tryWithImageReadException {
@@ -49,7 +52,7 @@ object JpegOrientationOffsetFinder {
/* Ensure it's actually a JPEG. */
require(magicNumberBytes == ImageFormatMagicNumbers.jpeg) {
- "JPEG magic number mismatch: ${magicNumberBytes.toByteArray().toSingleNumberHexes()}"
+ "JPEG magic number mismatch: ${magicNumberBytes.toSingleNumberHexes()}"
}
var positionCounter: Long = ImageFormatMagicNumbers.jpeg.size.toLong()
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegRewriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegRewriter.kt
index 07137609..62d9bc58 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegRewriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegRewriter.kt
@@ -36,11 +36,12 @@ import com.ashampoo.kim.format.tiff.write.TiffWriterLossy
import com.ashampoo.kim.input.ByteReader
import com.ashampoo.kim.output.ByteArrayByteWriter
import com.ashampoo.kim.output.ByteWriter
+import kotlin.jvm.JvmStatic
/**
* Interface for Exif write/update/remove functionality for Jpeg/JFIF images.
*/
-object JpegRewriter {
+public object JpegRewriter {
private fun readSegments(byteReader: ByteReader): JFIFPieces {
@@ -106,7 +107,8 @@ object JpegRewriter {
return mergedSegments
}
- fun updateExifMetadataLossless(byteReader: ByteReader, byteWriter: ByteWriter, outputSet: TiffOutputSet) {
+ @JvmStatic
+ public fun updateExifMetadataLossless(byteReader: ByteReader, byteWriter: ByteWriter, outputSet: TiffOutputSet) {
val (oldSegments, segmentPieces) = readSegments(byteReader)
@@ -114,7 +116,7 @@ object JpegRewriter {
oldSegments.filterNot { piece -> piece is JFIFPieceSegment && piece.isExifSegment() }
val exifSegmentPieces =
- segmentPieces.filterIsInstance().filter { it.isExifSegment() }
+ segmentPieces.filterIsInstance().filter(JFIFPieceSegment::isExifSegment)
val writer: TiffWriterBase
@@ -136,6 +138,7 @@ object JpegRewriter {
writeSegmentsReplacingExif(byteWriter, oldSegmentsWithoutExif, newBytes)
}
+ @JvmStatic
private fun writeSegmentsReplacingExif(
byteWriter: ByteWriter,
oldSegments: List,
@@ -223,7 +226,8 @@ object JpegRewriter {
* Reads a JPEG image, replaces the IPTC data in the App13 segment, but leaves the other
* data in that segment (if present) unchanged and writes the result to a stream.
*/
- fun writeIPTC(byteReader: ByteReader, byteWriter: ByteWriter, metadata: IptcMetadata) {
+ @JvmStatic
+ public fun writeIPTC(byteReader: ByteReader, byteWriter: ByteWriter, metadata: IptcMetadata) {
val oldPieces = readSegments(byteReader).allPieces
@@ -254,9 +258,10 @@ object JpegRewriter {
piece.write(byteWriter)
}
- fun updateXmpXml(byteReader: ByteReader, byteWriter: ByteWriter, xmpXml: String) {
+ @JvmStatic
+ public fun updateXmpXml(byteReader: ByteReader, byteWriter: ByteWriter, xmpXml: String) {
- val (allPieces) = readSegments(byteReader)
+ val (allPieces, _) = readSegments(byteReader)
val piecesWithoutXmpSegments =
allPieces.filterNot { piece -> piece is JFIFPieceSegment && piece.isXmpSegment() }
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegSegmentAnalyzer.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegSegmentAnalyzer.kt
index a9184bb5..387e3db1 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegSegmentAnalyzer.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegSegmentAnalyzer.kt
@@ -26,16 +26,20 @@ import com.ashampoo.kim.format.jpeg.JpegConstants.markerDescription
import com.ashampoo.kim.format.jpeg.JpegMetadataExtractor.SEGMENT_IDENTIFIER
import com.ashampoo.kim.format.jpeg.JpegMetadataExtractor.SEGMENT_START_OF_SCAN
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.skipBytes
+import kotlin.jvm.JvmStatic
/**
* Algorithm to find segment offsets, types and lengths
*/
-object JpegSegmentAnalyzer {
+public object JpegSegmentAnalyzer {
@OptIn(ExperimentalStdlibApi::class)
@Throws(ImageReadException::class)
@Suppress("ComplexMethod")
- fun findSegmentInfos(
+ @JvmStatic
+ public fun findSegmentInfos(
byteReader: ByteReader
): List = tryWithImageReadException {
@@ -144,7 +148,7 @@ object JpegSegmentAnalyzer {
return segmentInfos
}
- data class JpegSegmentInfo(
+ public data class JpegSegmentInfo(
val offset: Int,
val marker: Int,
val length: Int
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegUpdater.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegUpdater.kt
index 7a5c904f..40cf4747 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegUpdater.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegUpdater.kt
@@ -28,6 +28,7 @@ import com.ashampoo.kim.format.tiff.write.TiffOutputSet
import com.ashampoo.kim.format.xmp.XmpWriter
import com.ashampoo.kim.input.ByteArrayByteReader
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.readRemainingBytes
import com.ashampoo.kim.model.MetadataUpdate
import com.ashampoo.kim.model.TiffOrientation
import com.ashampoo.kim.output.ByteArrayByteWriter
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegUtils.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegUtils.kt
index 07e287bc..0312b9c2 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegUtils.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegUtils.kt
@@ -19,8 +19,11 @@ package com.ashampoo.kim.format.jpeg
import com.ashampoo.kim.common.toUInt16
import com.ashampoo.kim.format.jpeg.JpegConstants.JPEG_BYTE_ORDER
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.readAndVerifyBytes
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.readRemainingBytes
-object JpegUtils {
+internal object JpegUtils {
fun traverseJFIF(byteReader: ByteReader, visitor: JpegVisitor) {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegVisitor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegVisitor.kt
index 3cacac72..688d4519 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegVisitor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/JpegVisitor.kt
@@ -16,7 +16,7 @@
*/
package com.ashampoo.kim.format.jpeg
-interface JpegVisitor {
+internal interface JpegVisitor {
/** Return false to exit before reading image data. */
fun beginSOS(): Boolean
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcBlock.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcBlock.kt
index f3340064..3ee6a2b4 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcBlock.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcBlock.kt
@@ -19,13 +19,13 @@ package com.ashampoo.kim.format.jpeg.iptc
/**
* Represents an IPTC block, a set of key-value pairs of Photoshop IPTC data.
*/
-class IptcBlock(
- val blockType: Int,
- val blockNameBytes: ByteArray,
- val blockData: ByteArray
+public class IptcBlock(
+ public val blockType: Int,
+ public val blockNameBytes: ByteArray,
+ public val blockData: ByteArray
) {
- fun isIPTCBlock(): Boolean =
+ public fun isIPTCBlock(): Boolean =
blockType == IptcConstants.IMAGE_RESOURCE_BLOCK_IPTC_DATA
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcConstants.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcConstants.kt
index 2cfa8f57..2d93fbac 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcConstants.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcConstants.kt
@@ -16,7 +16,7 @@
*/
package com.ashampoo.kim.format.jpeg.iptc
-object IptcConstants {
+internal object IptcConstants {
const val IPTC_NON_EXTENDED_RECORD_MAXIMUM_SIZE = 32_767
const val IMAGE_RESOURCE_BLOCK_PHOTOSHOP2_INFO = 0x03e8
const val IMAGE_RESOURCE_BLOCK_MACINTOSH_PRINT_INFO = 0x03e9
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcMetadata.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcMetadata.kt
index 8430ac02..1595b73c 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcMetadata.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcMetadata.kt
@@ -19,13 +19,13 @@ package com.ashampoo.kim.format.jpeg.iptc
/**
* IPTC as located in JPEG APP13 segments
*/
-data class IptcMetadata(
+public data class IptcMetadata(
val records: List,
val rawBlocks: List
) {
val nonIptcBlocks: List by lazy {
- rawBlocks.filterNot { it.isIPTCBlock() }
+ rawBlocks.filterNot(IptcBlock::isIPTCBlock)
}
override fun toString(): String {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcParser.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcParser.kt
index 272a2fb2..56dbea36 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcParser.kt
@@ -27,33 +27,40 @@ import com.ashampoo.kim.common.toUInt8
import com.ashampoo.kim.format.jpeg.JpegConstants
import com.ashampoo.kim.format.jpeg.iptc.IptcTypes.Companion.getIptcType
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readByte
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.skipToQuad
+import kotlin.jvm.JvmStatic
-object IptcParser {
+public object IptcParser {
- val EMPTY_BYTE_ARRAY = byteArrayOf()
+ internal val EMPTY_BYTE_ARRAY = byteArrayOf()
/**
* Block types (or Image Resource IDs) that are not recommended to be
* interpreted when libraries process Photoshop IPTC metadata.
*
- * @see https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
+ * See https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
*/
@Suppress("MagicNumber")
private val PHOTOSHOP_IGNORED_BLOCK_TYPE = listOf(1084, 1085, 1086, 1087)
- const val CODED_CHARACTER_SET_IPTC_CODE = 90
+ public const val CODED_CHARACTER_SET_IPTC_CODE: Int = 90
/* "ESC % G" as bytes */
- val UTF8_CHARACTER_ESCAPE_SEQUENCE =
+ public val UTF8_CHARACTER_ESCAPE_SEQUENCE: ByteArray =
byteArrayOf('\u001B'.code.toByte(), '%'.code.toByte(), 'G'.code.toByte())
- val APP13_BYTE_ORDER = ByteOrder.BIG_ENDIAN
+ public val APP13_BYTE_ORDER: ByteOrder = ByteOrder.BIG_ENDIAN
/**
* Checks if the ByteArray starts with the Photoshop identifaction header.
* This is mandatory for IPTC embedded into APP13.
*/
- fun isPhotoshopApp13Segment(segmentData: ByteArray): Boolean {
+ @JvmStatic
+ public fun isPhotoshopApp13Segment(segmentData: ByteArray): Boolean {
if (!segmentData.startsWith(JpegConstants.APP13_IDENTIFIER))
return false
@@ -70,7 +77,8 @@ object IptcParser {
* @param bytes The IPTC bytes
* @param startsWithApp13Header If IPTC is read from JPEG the header is required.
*/
- fun parseIptc(
+ @JvmStatic
+ public fun parseIptc(
bytes: ByteArray,
startsWithApp13Header: Boolean = true
): IptcMetadata {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcRecord.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcRecord.kt
index 8e858785..fac07e77 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcRecord.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcRecord.kt
@@ -19,21 +19,17 @@ package com.ashampoo.kim.format.jpeg.iptc
/*
* Represents an IPTC record, a single key-value pair of Photoshop IPTC data.
*/
-data class IptcRecord(
+public data class IptcRecord(
val iptcType: IptcType,
val value: String
-) {
+) : Comparable {
override fun toString(): String =
"$iptcType = '$value\'"
- companion object {
-
- /**
- * IPTC records must be written in numerical order.
- */
-
- val comparator: Comparator =
- compareBy { -it.iptcType.type }
- }
+ /**
+ * IPTC records must be written in ascending order of their type.
+ */
+ override fun compareTo(other: IptcRecord): Int =
+ other.iptcType.type - this.iptcType.type
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcType.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcType.kt
index 2552654b..65d2889c 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcType.kt
@@ -16,11 +16,11 @@
*/
package com.ashampoo.kim.format.jpeg.iptc
-interface IptcType {
+public interface IptcType {
- val type: Int
+ public val type: Int
- val fieldName: String
+ public val fieldName: String
override fun toString(): String
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcTypes.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcTypes.kt
index 55a29cdb..c0d4ada9 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcTypes.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcTypes.kt
@@ -17,7 +17,7 @@
package com.ashampoo.kim.format.jpeg.iptc
@Suppress("MagicNumber")
-enum class IptcTypes(
+internal enum class IptcTypes(
override val type: Int,
override val fieldName: String
) : IptcType {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcWriter.kt
index 04bdef8e..243eda06 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/iptc/IptcWriter.kt
@@ -22,11 +22,13 @@ import com.ashampoo.kim.format.jpeg.iptc.IptcParser.APP13_BYTE_ORDER
import com.ashampoo.kim.output.BigEndianBinaryByteWriter
import com.ashampoo.kim.output.BinaryByteWriter
import com.ashampoo.kim.output.ByteArrayByteWriter
+import kotlin.jvm.JvmStatic
-object IptcWriter {
+public object IptcWriter {
@Suppress("ThrowsCount")
- fun writeIptcBlocks(
+ @JvmStatic
+ public fun writeIptcBlocks(
blocks: List,
includeApp13Identifier: Boolean = true
): ByteArray {
@@ -78,7 +80,7 @@ object IptcWriter {
}
/* Writes the IPTC block in UTF-8 */
- fun writeIptcBlockData(records: List): ByteArray {
+ public fun writeIptcBlockData(records: List): ByteArray {
val byteWriter = ByteArrayByteWriter()
@@ -103,9 +105,10 @@ object IptcWriter {
binaryWriter.write2Bytes(2) // record version record size
binaryWriter.write2Bytes(IptcConstants.IPTC_RECORD_VERSION_VALUE)
- val sortedRecords: List = records.sortedWith(IptcRecord.comparator)
-
- for ((iptcType, value) in sortedRecords) {
+ /**
+ * Write the IPTC records in order.
+ */
+ for ((iptcType, value) in records.sorted()) {
/* Ignore the record version, because we already wrote it. */
if (iptcType === IptcTypes.RECORD_VERSION)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPiece.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPiece.kt
index 5e3ffd14..6b55a419 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPiece.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPiece.kt
@@ -18,7 +18,7 @@ package com.ashampoo.kim.format.jpeg.jfif
import com.ashampoo.kim.output.ByteWriter
-fun interface JFIFPiece {
+internal fun interface JFIFPiece {
fun write(byteWriter: ByteWriter)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceImageData.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceImageData.kt
index 949fd261..721e1f3e 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceImageData.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceImageData.kt
@@ -18,7 +18,7 @@ package com.ashampoo.kim.format.jpeg.jfif
import com.ashampoo.kim.output.ByteWriter
-class JFIFPieceImageData(
+internal class JFIFPieceImageData(
private val markerBytes: ByteArray,
private val imageData: ByteArray
) : JFIFPiece {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceSegment.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceSegment.kt
index eb504c15..916d4d8e 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceSegment.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceSegment.kt
@@ -22,7 +22,7 @@ import com.ashampoo.kim.format.jpeg.JpegConstants
import com.ashampoo.kim.format.jpeg.iptc.IptcParser
import com.ashampoo.kim.output.ByteWriter
-open class JFIFPieceSegment(
+internal open class JFIFPieceSegment(
val marker: Int,
val markerBytes: ByteArray,
val segmentLengthBytes: ByteArray,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceSegmentExif.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceSegmentExif.kt
index eebaff90..fe4887cf 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceSegmentExif.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/jfif/JFIFPieceSegmentExif.kt
@@ -16,7 +16,7 @@
*/
package com.ashampoo.kim.format.jpeg.jfif
-class JFIFPieceSegmentExif(
+internal class JFIFPieceSegmentExif(
marker: Int,
markerBytes: ByteArray,
markerLengthBytes: ByteArray,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/App13Segment.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/App13Segment.kt
index 6e882df5..10abe131 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/App13Segment.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/App13Segment.kt
@@ -21,7 +21,7 @@ import com.ashampoo.kim.format.jpeg.iptc.IptcParser
import com.ashampoo.kim.input.ByteArrayByteReader
import com.ashampoo.kim.input.ByteReader
-class App13Segment(marker: Int, markerLength: Int, byteReader: ByteReader) :
+internal class App13Segment(marker: Int, markerLength: Int, byteReader: ByteReader) :
AppnSegment(marker, markerLength, byteReader) {
constructor(marker: Int, segmentData: ByteArray) :
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/AppnSegment.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/AppnSegment.kt
index 6bc3620f..7dbbb2db 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/AppnSegment.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/AppnSegment.kt
@@ -20,7 +20,7 @@ import com.ashampoo.kim.format.jpeg.JpegConstants
import com.ashampoo.kim.input.ByteArrayByteReader
import com.ashampoo.kim.input.ByteReader
-open class AppnSegment(marker: Int, markerLength: Int, byteReader: ByteReader) :
+internal open class AppnSegment(marker: Int, markerLength: Int, byteReader: ByteReader) :
GenericSegment(marker, markerLength, byteReader) {
constructor(marker: Int, segmentData: ByteArray) :
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/GenericSegment.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/GenericSegment.kt
index f74c767f..51b47315 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/GenericSegment.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/GenericSegment.kt
@@ -17,8 +17,9 @@
package com.ashampoo.kim.format.jpeg.segment
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.readBytes
-abstract class GenericSegment : Segment {
+internal abstract class GenericSegment : Segment {
val segmentBytes: ByteArray
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/JfifSegment.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/JfifSegment.kt
index 92c58032..2da30dd3 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/JfifSegment.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/JfifSegment.kt
@@ -21,8 +21,12 @@ import com.ashampoo.kim.format.jpeg.JpegConstants
import com.ashampoo.kim.format.jpeg.JpegConstants.JPEG_BYTE_ORDER
import com.ashampoo.kim.input.ByteArrayByteReader
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.readByte
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.skipBytes
-class JfifSegment(
+internal class JfifSegment(
marker: Int,
length: Int,
byteReader: ByteReader
@@ -58,7 +62,7 @@ class JfifSegment(
thumbnailSize = xThumbnail * yThumbnail
if (thumbnailSize > 0)
- byteReader.skipBytes("Skip thumbnail", thumbnailSize)
+ byteReader.skipBytes("thumbnail", thumbnailSize)
}
constructor(marker: Int, segmentBytes: ByteArray) :
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/Segment.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/Segment.kt
index 79612b7a..8b405ff9 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/Segment.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/Segment.kt
@@ -16,7 +16,7 @@
*/
package com.ashampoo.kim.format.jpeg.segment
-abstract class Segment(val marker: Int, val length: Int) {
+internal abstract class Segment(val marker: Int, val length: Int) {
abstract fun getDescription(): String
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/SofnSegment.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/SofnSegment.kt
index 53f3f682..c0bd27af 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/SofnSegment.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/SofnSegment.kt
@@ -20,8 +20,10 @@ import com.ashampoo.kim.format.jpeg.JpegConstants
import com.ashampoo.kim.format.jpeg.JpegConstants.JPEG_BYTE_ORDER
import com.ashampoo.kim.input.ByteArrayByteReader
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.skipBytes
-class SofnSegment(marker: Int, markerLength: Int, byteReader: ByteReader) : Segment(marker, markerLength) {
+internal class SofnSegment(marker: Int, markerLength: Int, byteReader: ByteReader) : Segment(marker, markerLength) {
val width: Int
val height: Int
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/UnknownSegment.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/UnknownSegment.kt
index c7ec73c3..2ee23d55 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/UnknownSegment.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/segment/UnknownSegment.kt
@@ -16,7 +16,7 @@
*/
package com.ashampoo.kim.format.jpeg.segment
-class UnknownSegment(marker: Int, bytes: ByteArray) : GenericSegment(marker, bytes) {
+internal class UnknownSegment(marker: Int, bytes: ByteArray) : GenericSegment(marker, bytes) {
override fun getDescription(): String =
"Unknown ($marker)"
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/xmp/JpegXmpParser.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/xmp/JpegXmpParser.kt
index ef93b930..ddf84594 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/xmp/JpegXmpParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jpeg/xmp/JpegXmpParser.kt
@@ -21,7 +21,7 @@ import com.ashampoo.kim.common.slice
import com.ashampoo.kim.common.startsWith
import com.ashampoo.kim.format.jpeg.JpegConstants
-object JpegXmpParser {
+internal object JpegXmpParser {
fun isXmpJpegSegment(segmentData: ByteArray): Boolean =
segmentData.startsWith(JpegConstants.XMP_IDENTIFIER)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/JxlWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/JxlWriter.kt
index 703d02ec..1df3f07e 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/JxlWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/JxlWriter.kt
@@ -24,8 +24,11 @@ import com.ashampoo.kim.format.jxl.box.CompressedBox
import com.ashampoo.kim.format.jxl.box.JxlParticalCodestreamBox
import com.ashampoo.kim.input.ByteReader
import com.ashampoo.kim.output.ByteWriter
+import com.ashampoo.kim.output.writeInt
+import com.ashampoo.kim.output.writeLong
+import kotlin.jvm.JvmStatic
-object JxlWriter {
+public object JxlWriter {
/*
* As a safety measure we don't want to write uncompressed boxes to
@@ -36,19 +39,21 @@ object JxlWriter {
"Writing to this file will result in data loss. " +
"Please only update uncompressed metadata for now."
- fun writeImage(
+ @JvmStatic
+ public fun writeImage(
byteReader: ByteReader,
byteWriter: ByteWriter,
exifBytes: ByteArray?,
xmp: String?
- ) = writeImage(
+ ): Unit = writeImage(
boxes = BoxReader.readBoxes(byteReader, false),
byteWriter = byteWriter,
exifBytes = exifBytes,
xmp = xmp
)
- fun writeImage(
+ @JvmStatic
+ public fun writeImage(
boxes: List,
byteWriter: ByteWriter,
exifBytes: ByteArray?,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/CompressedBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/CompressedBox.kt
index 9dfb7ace..38a6b994 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/CompressedBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/CompressedBox.kt
@@ -22,17 +22,13 @@ import com.ashampoo.kim.format.bmff.box.Box
/**
* JPEG XL brob box for brotli compressed Exif or XMP
*/
-class CompressedBox(
+public class CompressedBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.BROB, offset, size, largeSize, payload) {
- val actualType: BoxType
-
- init {
-
- actualType = BoxType.of(payload.take(BMFFConstants.TPYE_LENGTH).toByteArray())
- }
+ public val actualType: BoxType =
+ BoxType.of(payload.take(BMFFConstants.TPYE_LENGTH).toByteArray())
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/ExifBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/ExifBox.kt
index fa6ef711..2a3d672a 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/ExifBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/ExifBox.kt
@@ -20,24 +20,27 @@ import com.ashampoo.kim.format.bmff.box.Box
import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.format.tiff.TiffReader
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.readByteAsInt
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.readRemainingBytes
/**
* JPEG XL Exif box
*/
-class ExifBox(
+public class ExifBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.EXIF, offset, size, largeSize, payload) {
- val version: Int
+ public val version: Int
- val flags: ByteArray
+ public val flags: ByteArray
- val exifBytes: ByteArray
+ public val exifBytes: ByteArray
- val tiffContents: TiffContents
+ public val tiffContents: TiffContents
init {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/JxlParticalCodestreamBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/JxlParticalCodestreamBox.kt
index 5c53ea8b..bcd663f3 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/JxlParticalCodestreamBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/JxlParticalCodestreamBox.kt
@@ -21,24 +21,19 @@ import com.ashampoo.kim.format.bmff.box.Box
/**
* JPEG XL jxlp box
*/
-class JxlParticalCodestreamBox(
+public class JxlParticalCodestreamBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.JXLP, offset, size, largeSize, payload) {
- val isHeader: Boolean
+ public val isHeader: Boolean =
+ jxlCodeStreamSignaure == payload.take(jxlCodeStreamSignaure.size)
- init {
+ private companion object {
- /* Check if it's the header */
- isHeader = jxlCodeStreamSignaure == payload.take(jxlCodeStreamSignaure.size)
- }
-
- companion object {
-
- val jxlCodeStreamSignaure = listOf(
+ private val jxlCodeStreamSignaure = listOf(
0x00, 0x00, 0x00, 0x00, 0xFF.toByte(), 0x0A
)
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/XmlBox.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/XmlBox.kt
index c915b107..cb9cbfca 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/XmlBox.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/jxl/box/XmlBox.kt
@@ -21,17 +21,12 @@ import com.ashampoo.kim.format.bmff.box.Box
/**
* JPEG XL XML box
*/
-class XmlBox(
+public class XmlBox(
offset: Long,
size: Long,
largeSize: Long?,
payload: ByteArray
) : Box(BoxType.XML, offset, size, largeSize, payload) {
- val xmp: String
-
- init {
-
- xmp = payload.decodeToString()
- }
+ public val xmp: String = payload.decodeToString()
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/nef/NefPreviewExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/nef/NefPreviewExtractor.kt
index e778fb8c..4f744454 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/nef/NefPreviewExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/nef/NefPreviewExtractor.kt
@@ -23,7 +23,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
import com.ashampoo.kim.format.tiff.constant.TiffTag
import com.ashampoo.kim.input.RandomAccessByteReader
-object NefPreviewExtractor : TiffPreviewExtractor {
+public object NefPreviewExtractor : TiffPreviewExtractor {
@Throws(ImageReadException::class)
override fun extractPreviewImage(
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngChunkType.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngChunkType.kt
index 0447d3b8..eeb848ff 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngChunkType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngChunkType.kt
@@ -24,7 +24,7 @@ import com.ashampoo.kim.format.png.PngConstants.TPYE_LENGTH
*
* @see [Portable Network Graphics Specification - Chunk specifications](http://www.w3.org/TR/PNG/.11Chunks)
*/
-data class PngChunkType internal constructor(
+public data class PngChunkType internal constructor(
val bytes: ByteArray,
val name: String,
val intValue: Int
@@ -47,34 +47,34 @@ data class PngChunkType internal constructor(
override fun toString(): String =
name
- companion object {
+ public companion object {
/** Image header */
- val IHDR = of("IHDR".encodeToByteArray())
+ public val IHDR: PngChunkType = of("IHDR".encodeToByteArray())
/** Image data */
- val IDAT = of("IDAT".encodeToByteArray())
+ public val IDAT: PngChunkType = of("IDAT".encodeToByteArray())
/** Image end */
- val IEND = of("IEND".encodeToByteArray())
+ public val IEND: PngChunkType = of("IEND".encodeToByteArray())
/** Time */
- val TIME = of("tIME".encodeToByteArray())
+ public val TIME: PngChunkType = of("tIME".encodeToByteArray())
/** Text */
- val TEXT = of("tEXt".encodeToByteArray())
+ public val TEXT: PngChunkType = of("tEXt".encodeToByteArray())
/** Compressed text */
- val ZTXT = of("zTXt".encodeToByteArray())
+ public val ZTXT: PngChunkType = of("zTXt".encodeToByteArray())
/** UTF-8 text, for example XMP */
- val ITXT = of("iTXt".encodeToByteArray())
+ public val ITXT: PngChunkType = of("iTXt".encodeToByteArray())
/** EXIF (since 2017) */
- val EXIF = of("eXIf".encodeToByteArray())
+ public val EXIF: PngChunkType = of("eXIf".encodeToByteArray())
@Suppress("MagicNumber")
- fun of(typeBytes: ByteArray): PngChunkType {
+ public fun of(typeBytes: ByteArray): PngChunkType {
require(typeBytes.size == TPYE_LENGTH) {
"ChunkType must be always 4 bytes, but got ${typeBytes.size} bytes!"
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngConstants.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngConstants.kt
index 9698b393..31a85084 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngConstants.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngConstants.kt
@@ -18,17 +18,17 @@ package com.ashampoo.kim.format.png
import com.ashampoo.kim.common.ByteOrder
-object PngConstants {
+public object PngConstants {
- val PNG_BYTE_ORDER = ByteOrder.BIG_ENDIAN
+ public val PNG_BYTE_ORDER: ByteOrder = ByteOrder.BIG_ENDIAN
/* ChunkType is a FourCC, so it's 4 bytes. */
- const val TPYE_LENGTH = 4
+ public const val TPYE_LENGTH: Int = 4
- const val COMPRESSION_DEFLATE_INFLATE = 0
+ public const val COMPRESSION_DEFLATE_INFLATE: Int = 0
@Suppress("MagicNumber")
- val PNG_SIGNATURE = byteArrayOf(
+ public val PNG_SIGNATURE: ByteArray = byteArrayOf(
0x89.toByte(),
'P'.code.toByte(),
'N'.code.toByte(),
@@ -39,14 +39,14 @@ object PngConstants {
'\n'.code.toByte()
)
- const val XMP_KEYWORD = "XML:com.adobe.xmp"
+ public const val XMP_KEYWORD: String = "XML:com.adobe.xmp"
- const val EXIF_KEYWORD = "Raw profile type exif"
+ public const val EXIF_KEYWORD: String = "Raw profile type exif"
- const val IPTC_KEYWORD = "Raw profile type iptc"
+ public const val IPTC_KEYWORD: String = "Raw profile type iptc"
/* Size in raw profiles is always 8 chars long and padded with spaces. */
- const val TXT_SIZE_LENGTH = 8
- const val TXT_SIZE_PAD = ' '
+ public const val TXT_SIZE_LENGTH: Int = 8
+ public const val TXT_SIZE_PAD: Char = ' '
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngImageParser.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngImageParser.kt
index 04a51f82..81e1e763 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngImageParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngImageParser.kt
@@ -35,9 +35,14 @@ import com.ashampoo.kim.format.png.chunk.PngTextChunk
import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.format.tiff.TiffReader
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readAndVerifyBytes
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.skipBytes
import com.ashampoo.kim.model.ImageFormat
+import kotlin.jvm.JvmStatic
-object PngImageParser : ImageParser {
+public object PngImageParser : ImageParser {
/* Note that [\\p{Cntrl}] does not work for Kotlin/JS. */
private val controlCharRegex = Regex("[\\x00-\\x1F\\x7F-\\x9F]")
@@ -63,7 +68,8 @@ object PngImageParser : ImageParser {
}
@Throws(ImageReadException::class)
- fun parseMetadataFromChunks(chunks: List): ImageMetadata =
+ @JvmStatic
+ public fun parseMetadataFromChunks(chunks: List): ImageMetadata =
tryWithImageReadException {
require(chunks.isNotEmpty()) {
@@ -233,7 +239,8 @@ object PngImageParser : ImageParser {
private fun readAndVerifySignature(byteReader: ByteReader) =
byteReader.readAndVerifyBytes("PNG signature", PngConstants.PNG_SIGNATURE)
- fun readChunks(
+ @JvmStatic
+ public fun readChunks(
byteReader: ByteReader,
chunkTypeFilter: List?
): List = tryWithImageReadException {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngMetadataExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngMetadataExtractor.kt
index b0b12d91..05d3664d 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngMetadataExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngMetadataExtractor.kt
@@ -22,9 +22,9 @@ import com.ashampoo.kim.format.ImageFormatMagicNumbers
import com.ashampoo.kim.format.MetadataExtractor
import com.ashampoo.kim.input.ByteReader
-object PngMetadataExtractor : MetadataExtractor {
+public object PngMetadataExtractor : MetadataExtractor {
- const val INT32_BYTE_SIZE: Int = 4
+ private const val INT32_BYTE_SIZE: Int = 4
/* Length of black pixel chunk data. */
private val fakeImageDataChunkLength: List = listOf(
@@ -63,7 +63,7 @@ object PngMetadataExtractor : MetadataExtractor {
/* Ensure it's actually a PNG. */
require(magicNumberBytes == ImageFormatMagicNumbers.png) {
- "PNG magic number mismatch: ${magicNumberBytes.toByteArray().toSingleNumberHexes()}"
+ "PNG magic number mismatch: ${magicNumberBytes.toSingleNumberHexes()}"
}
bytes.addAll(magicNumberBytes)
@@ -128,7 +128,7 @@ object PngMetadataExtractor : MetadataExtractor {
return@tryWithImageReadException bytes.toByteArray()
}
- fun extractExifBytes(reader: ByteReader): ByteArray? {
+ internal fun extractExifBytes(reader: ByteReader): ByteArray? {
val bytes = mutableListOf()
@@ -136,7 +136,7 @@ object PngMetadataExtractor : MetadataExtractor {
/* Ensure it's actually a PNG. */
require(magicNumberBytes == ImageFormatMagicNumbers.png) {
- "PNG magic number mismatch: ${magicNumberBytes.toByteArray().toSingleNumberHexes()}"
+ "PNG magic number mismatch: ${magicNumberBytes.toSingleNumberHexes()}"
}
bytes.addAll(magicNumberBytes)
@@ -228,7 +228,7 @@ object PngMetadataExtractor : MetadataExtractor {
}
@Suppress("MagicNumber")
-fun ByteArray.toInt32(): Int =
+private fun ByteArray.toInt32(): Int =
this[0].toInt() shl 24 and -0x1000000 or
(this[1].toInt() shl 16 and 0xFF0000) or
(this[2].toInt() shl 8 and 0xFF00) or
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngWriter.kt
index 46ebbdab..e2ff9342 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/PngWriter.kt
@@ -26,16 +26,17 @@ import com.ashampoo.kim.format.png.chunk.PngTextChunk
import com.ashampoo.kim.input.ByteReader
import com.ashampoo.kim.output.ByteArrayByteWriter
import com.ashampoo.kim.output.ByteWriter
+import com.ashampoo.kim.output.writeInt
-object PngWriter {
+public object PngWriter {
- fun writeImage(
+ public fun writeImage(
byteReader: ByteReader,
byteWriter: ByteWriter,
exifBytes: ByteArray?,
iptcBytes: ByteArray?,
xmp: String?
- ) = writeImage(
+ ): Unit = writeImage(
chunks = PngImageParser.readChunks(byteReader, null),
byteWriter = byteWriter,
exifBytes = exifBytes,
@@ -43,7 +44,7 @@ object PngWriter {
xmp = xmp
)
- fun writeImage(
+ public fun writeImage(
chunks: List,
byteWriter: ByteWriter,
exifBytes: ByteArray?,
@@ -96,7 +97,7 @@ object PngWriter {
byteWriter.close()
}
- fun writeImage(
+ public fun writeImage(
chunks: List,
byteWriter: ByteWriter,
) {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunk.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunk.kt
index 8b6da4a3..3699e980 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunk.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunk.kt
@@ -19,16 +19,16 @@ package com.ashampoo.kim.format.png.chunk
import com.ashampoo.kim.format.png.PngChunkType
@Suppress("MagicNumber")
-open class PngChunk(
- val type: PngChunkType,
- val bytes: ByteArray,
- val crc: Int
+public open class PngChunk(
+ public val type: PngChunkType,
+ public val bytes: ByteArray,
+ public val crc: Int
) {
- val ancillary: Boolean
- val isPrivate: Boolean
- val reserved: Boolean
- val safeToCopy: Boolean
+ public val ancillary: Boolean
+ public val isPrivate: Boolean
+ public val reserved: Boolean
+ public val safeToCopy: Boolean
init {
@@ -52,7 +52,7 @@ open class PngChunk(
safeToCopy = propertyBits[3]
}
- override fun toString() =
+ override fun toString(): String =
"PngChunk ${type.name} " +
"(${bytes.size} bytes, " +
(if (ancillary) "ancillary" else "critical") + ", " +
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkExif.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkExif.kt
index 72a753a1..00b78d5a 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkExif.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkExif.kt
@@ -16,13 +16,14 @@
package com.ashampoo.kim.format.png.chunk
import com.ashampoo.kim.format.png.PngChunkType
+import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.format.tiff.TiffReader
-class PngChunkExif(
+public class PngChunkExif(
bytes: ByteArray,
crc: Int
) : PngChunk(PngChunkType.EXIF, bytes, crc) {
- val tiffContents = TiffReader.read(bytes)
+ public val tiffContents: TiffContents = TiffReader.read(bytes)
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkIhdr.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkIhdr.kt
index 349c33ec..0963c7c0 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkIhdr.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkIhdr.kt
@@ -19,14 +19,15 @@ package com.ashampoo.kim.format.png.chunk
import com.ashampoo.kim.format.png.PngChunkType
import com.ashampoo.kim.format.png.PngConstants.PNG_BYTE_ORDER
import com.ashampoo.kim.input.ByteArrayByteReader
+import com.ashampoo.kim.input.read4BytesAsInt
import com.ashampoo.kim.model.ImageSize
-class PngChunkIhdr(
+public class PngChunkIhdr(
bytes: ByteArray,
crc: Int
) : PngChunk(PngChunkType.IHDR, bytes, crc) {
- val imageSize: ImageSize
+ public val imageSize: ImageSize
init {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkItxt.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkItxt.kt
index be3d887c..76cfa736 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkItxt.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkItxt.kt
@@ -24,20 +24,20 @@ import com.ashampoo.kim.common.slice
import com.ashampoo.kim.format.png.PngChunkType
import com.ashampoo.kim.format.png.PngConstants
-class PngChunkItxt(
+public class PngChunkItxt(
bytes: ByteArray,
crc: Int
) : PngTextChunk(PngChunkType.ITXT, bytes, crc) {
@kotlin.jvm.JvmField
- val keyword: String
+ public val keyword: String
@kotlin.jvm.JvmField
- var text: String
+ public var text: String
- val languageTag: String
+ public val languageTag: String
- val translatedKeyword: String
+ public val translatedKeyword: String
init {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkText.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkText.kt
index 90c3aa86..75769651 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkText.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkText.kt
@@ -21,17 +21,17 @@ import com.ashampoo.kim.common.decodeLatin1BytesToString
import com.ashampoo.kim.common.indexOfNullTerminator
import com.ashampoo.kim.format.png.PngChunkType
-class PngChunkText(
+public class PngChunkText(
chunkType: PngChunkType,
bytes: ByteArray,
crc: Int
) : PngTextChunk(chunkType, bytes, crc) {
@kotlin.jvm.JvmField
- val keyword: String
+ public val keyword: String
@kotlin.jvm.JvmField
- val text: String
+ public val text: String
init {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkZtxt.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkZtxt.kt
index 42094f2c..a2842f64 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkZtxt.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngChunkZtxt.kt
@@ -23,16 +23,16 @@ import com.ashampoo.kim.common.indexOfNullTerminator
import com.ashampoo.kim.format.png.PngChunkType
import com.ashampoo.kim.format.png.PngConstants
-class PngChunkZtxt(
+public class PngChunkZtxt(
bytes: ByteArray,
crc: Int
) : PngTextChunk(PngChunkType.ZTXT, bytes, crc) {
@kotlin.jvm.JvmField
- val keyword: String
+ public val keyword: String
@kotlin.jvm.JvmField
- val text: String
+ public val text: String
init {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngTextChunk.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngTextChunk.kt
index 99de5e66..71f3e0eb 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngTextChunk.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/png/chunk/PngTextChunk.kt
@@ -18,15 +18,15 @@ package com.ashampoo.kim.format.png.chunk
import com.ashampoo.kim.format.png.PngChunkType
-abstract class PngTextChunk(
+public abstract class PngTextChunk(
chunkType: PngChunkType,
bytes: ByteArray,
crc: Int
) : PngChunk(chunkType, bytes, crc) {
- abstract fun getKeyword(): String
+ public abstract fun getKeyword(): String
- abstract fun getText(): String
+ public abstract fun getText(): String
override fun toString(): String =
super.toString() + " '" + getKeyword() + "'"
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafImageParser.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafImageParser.kt
index 3c4a7cfd..f0dedb56 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafImageParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafImageParser.kt
@@ -23,9 +23,12 @@ import com.ashampoo.kim.format.ImageMetadata
import com.ashampoo.kim.format.ImageParser
import com.ashampoo.kim.format.jpeg.JpegImageParser
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readAndVerifyBytes
+import com.ashampoo.kim.input.skipBytes
import com.ashampoo.kim.model.ImageFormat
-object RafImageParser : ImageParser {
+public object RafImageParser : ImageParser {
/**
* The RAF file contains a JPEG with EXIF metadata.
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafMetadataExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafMetadataExtractor.kt
index 26aad8f2..17473bb6 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafMetadataExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafMetadataExtractor.kt
@@ -22,10 +22,13 @@ import com.ashampoo.kim.format.ImageFormatMagicNumbers
import com.ashampoo.kim.format.MetadataExtractor
import com.ashampoo.kim.format.jpeg.JpegMetadataExtractor
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readAndVerifyBytes
+import com.ashampoo.kim.input.skipBytes
-object RafMetadataExtractor : MetadataExtractor {
+public object RafMetadataExtractor : MetadataExtractor {
- const val REMAINING_HEADER_BYTE_COUNT = 68
+ internal const val REMAINING_HEADER_BYTE_COUNT = 68
/**
* The RAF file contains a JPEG with EXIF metadata.
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafPreviewExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafPreviewExtractor.kt
index f6b355f1..bc3acea4 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafPreviewExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/raf/RafPreviewExtractor.kt
@@ -20,11 +20,16 @@ import com.ashampoo.kim.common.ImageReadException
import com.ashampoo.kim.common.tryWithImageReadException
import com.ashampoo.kim.format.ImageFormatMagicNumbers
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readAndVerifyBytes
+import com.ashampoo.kim.input.skipBytes
+import kotlin.jvm.JvmStatic
-object RafPreviewExtractor {
+public object RafPreviewExtractor {
@Throws(ImageReadException::class)
- fun extractPreviewImage(
+ @JvmStatic
+ public fun extractPreviewImage(
reader: ByteReader
): ByteArray? = tryWithImageReadException {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/rw2/Rw2PreviewExtractor.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/rw2/Rw2PreviewExtractor.kt
index 53e2c946..62654fa9 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/rw2/Rw2PreviewExtractor.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/rw2/Rw2PreviewExtractor.kt
@@ -20,7 +20,7 @@ import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.format.tiff.constant.TiffTag
import com.ashampoo.kim.input.RandomAccessByteReader
-object Rw2PreviewExtractor : TiffPreviewExtractor {
+public object Rw2PreviewExtractor : TiffPreviewExtractor {
override fun extractPreviewImage(
tiffContents: TiffContents,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/GPSInfo.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/GPSInfo.kt
index b89963f0..c3d01362 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/GPSInfo.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/GPSInfo.kt
@@ -22,7 +22,7 @@ import com.ashampoo.kim.common.ImageReadException
import com.ashampoo.kim.common.RationalNumbers
import com.ashampoo.kim.format.tiff.constant.GpsTag
-data class GPSInfo private constructor(
+internal data class GPSInfo(
private val latitudeRef: String,
private val longitudeRef: String,
private val latitudeDegrees: Double,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/ImageDataElement.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/ImageDataElement.kt
index bacb2b3a..6b9be15f 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/ImageDataElement.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/ImageDataElement.kt
@@ -15,7 +15,7 @@
*/
package com.ashampoo.kim.format.tiff
-open class ImageDataElement(
+public open class ImageDataElement(
offset: Int,
length: Int
) : TiffElement(
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffContents.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffContents.kt
index 58f81255..b309a7bb 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffContents.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffContents.kt
@@ -20,7 +20,7 @@ import com.ashampoo.kim.format.tiff.geotiff.GeoTiffDirectory
import com.ashampoo.kim.format.tiff.taginfo.TagInfo
import com.ashampoo.kim.format.tiff.write.TiffOutputSet
-data class TiffContents(
+public data class TiffContents(
val header: TiffHeader,
val directories: List,
/** Artificial MakerNote directory */
@@ -29,18 +29,18 @@ data class TiffContents(
val geoTiffDirectory: GeoTiffDirectory?
) {
- fun findTiffField(tagInfo: TagInfo): TiffField? =
+ public fun findTiffField(tagInfo: TagInfo): TiffField? =
TiffDirectory.findTiffField(directories, tagInfo)
- fun findTiffDirectory(directoryType: Int): TiffDirectory? =
+ public fun findTiffDirectory(directoryType: Int): TiffDirectory? =
directories.find { it.type == directoryType }
- fun getExifThumbnailBytes(): ByteArray? =
+ public fun getExifThumbnailBytes(): ByteArray? =
directories.asSequence()
.mapNotNull { it.thumbnailBytes }
.firstOrNull()
- fun createOutputSet(): TiffOutputSet {
+ public fun createOutputSet(): TiffOutputSet {
val result = TiffOutputSet(header.byteOrder)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffDirectory.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffDirectory.kt
index 56ed2ba0..be6f66ff 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffDirectory.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffDirectory.kt
@@ -40,12 +40,12 @@ import com.ashampoo.kim.model.TiffOrientation
* for individual images or sets of metadata. While not all Directories contain
* images, images are always stored in a Directory.
*/
-class TiffDirectory(
- val type: Int,
- val entries: List,
+public class TiffDirectory(
+ public val type: Int,
+ public val entries: List,
offset: Int,
- val nextDirectoryOffset: Int,
- val byteOrder: ByteOrder
+ public val nextDirectoryOffset: Int,
+ public val byteOrder: ByteOrder
) : TiffElement(
debugDescription = "Directory " + description(type) + " @ $offset",
offset = offset,
@@ -53,25 +53,25 @@ class TiffDirectory(
TiffConstants.TIFF_ENTRY_LENGTH + TiffConstants.TIFF_DIRECTORY_FOOTER_LENGTH
) {
- var thumbnailBytes: ByteArray? = null
- var tiffImageBytes: ByteArray? = null
+ internal var thumbnailBytes: ByteArray? = null
+ internal var tiffImageBytes: ByteArray? = null
- fun getDirectoryEntries(): List = entries
+ public fun getDirectoryEntries(): List = entries
- fun hasJpegImageData(): Boolean =
+ public fun hasJpegImageData(): Boolean =
null != findField(TiffTag.TIFF_TAG_JPEG_INTERCHANGE_FORMAT)
- fun hasStripImageData(): Boolean =
+ public fun hasStripImageData(): Boolean =
null != findField(TiffTag.TIFF_TAG_STRIP_OFFSETS)
- fun findField(tag: TagInfo): TiffField? {
+ public fun findField(tag: TagInfo): TiffField? {
return findField(
tag = tag,
failIfMissing = false
)
}
- fun findField(tag: TagInfo, failIfMissing: Boolean = false): TiffField? {
+ public fun findField(tag: TagInfo, failIfMissing: Boolean = false): TiffField? {
for (field in entries)
if (field.tag == tag.tag)
@@ -83,7 +83,7 @@ class TiffDirectory(
return null
}
- fun getFieldValue(tag: TagInfoBytes, mustExist: Boolean): ByteArray? {
+ public fun getFieldValue(tag: TagInfoBytes, mustExist: Boolean): ByteArray? {
val field = findField(tag)
@@ -99,7 +99,7 @@ class TiffDirectory(
}
@Suppress("ThrowsCount")
- fun getFieldValue(tag: TagInfoLong): Int? {
+ public fun getFieldValue(tag: TagInfoLong): Int? {
val field = findField(tag) ?: return null
@@ -113,7 +113,7 @@ class TiffDirectory(
}
@Suppress("ThrowsCount")
- fun getFieldValue(tag: TagInfoLongs): IntArray {
+ public fun getFieldValue(tag: TagInfoLongs): IntArray {
val field = findField(tag)
?: throw ImageReadException("Required field ${tag.name} is missing")
@@ -124,7 +124,7 @@ class TiffDirectory(
return field.valueBytes.toInts(field.byteOrder)
}
- fun getJpegImageDataElement(): ImageDataElement? {
+ public fun getJpegImageDataElement(): ImageDataElement? {
val jpegInterchangeFormat = findField(TiffTag.TIFF_TAG_JPEG_INTERCHANGE_FORMAT)
val jpegInterchangeFormatLength = findField(TiffTag.TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH)
@@ -144,7 +144,7 @@ class TiffDirectory(
* Returns a list as tiff image bytes can be splitted upon the whole file.
* ImageIO creates small splits while GIMP creates a single big chunk.
*/
- fun getStripImageDataElements(): List? {
+ public fun getStripImageDataElements(): List? {
val offsetField = findField(TiffTag.TIFF_TAG_STRIP_OFFSETS)
val lengthField = findField(TiffTag.TIFF_TAG_STRIP_BYTE_COUNTS)
@@ -168,7 +168,7 @@ class TiffDirectory(
return null
}
- fun createOutputDirectory(byteOrder: ByteOrder): TiffOutputDirectory {
+ public fun createOutputDirectory(byteOrder: ByteOrder): TiffOutputDirectory {
/*
* Prevent attempts to add MakerNote directories.
@@ -263,7 +263,7 @@ class TiffDirectory(
return sb.toString()
}
- companion object {
+ public companion object {
private val tagsToTrim = setOf(
TiffTag.TIFF_TAG_COPYRIGHT,
@@ -272,7 +272,7 @@ class TiffDirectory(
)
@kotlin.jvm.JvmStatic
- fun description(type: Int): String {
+ public fun description(type: Int): String {
return when (type) {
TiffConstants.DIRECTORY_TYPE_UNKNOWN -> "Unknown"
TiffConstants.TIFF_DIRECTORY_TYPE_IFD0 -> "IFD0"
@@ -293,7 +293,7 @@ class TiffDirectory(
* Note: Keep in sync with TiffTags.getTag()
*/
@Suppress("UnnecessaryParentheses")
- fun findTiffField(directories: List, tagInfo: TagInfo): TiffField? {
+ public fun findTiffField(directories: List, tagInfo: TagInfo): TiffField? {
/*
* TagInfos that specify a directory (like GPS and MakerNotes)
@@ -309,11 +309,10 @@ class TiffDirectory(
/*
* All others are matched with all directories.
*/
- for (directory in directories) {
+ for (directory in directories)
directory.findField(tagInfo)?.let {
- return it
+ return@findTiffField it
}
- }
return null
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffElement.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffElement.kt
index 3da1faa7..a804d725 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffElement.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffElement.kt
@@ -16,16 +16,15 @@
*/
package com.ashampoo.kim.format.tiff
-open class TiffElement(
- val debugDescription: String,
- val offset: Int,
- val length: Int
-) {
+public open class TiffElement(
+ public val debugDescription: String,
+ public val offset: Int,
+ public val length: Int
+) : Comparable {
override fun toString(): String =
debugDescription
- companion object {
- val offsetComparator = compareBy { e: TiffElement -> e.offset }
- }
+ override fun compareTo(other: TiffElement): Int =
+ offset - other.offset
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffField.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffField.kt
index 5271a317..9512ff0c 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffField.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffField.kt
@@ -30,42 +30,42 @@ import com.ashampoo.kim.format.tiff.taginfo.TagInfoGpsText
/**
* A TIFF field in a TIFF directory.
*/
-class TiffField(
+public class TiffField(
/** Offset relative to TIFF header */
- val offset: Int,
- val tag: Int,
- val directoryType: Int,
- val fieldType: FieldType,
- val count: Int,
+ public val offset: Int,
+ public val tag: Int,
+ public val directoryType: Int,
+ public val fieldType: FieldType,
+ public val count: Int,
/** Set if field has a local value. */
- val localValue: Int?,
+ public val localValue: Int?,
/** Set if field has a offset pointer to its value. */
- val valueOffset: Int?,
- val valueBytes: ByteArray,
- val byteOrder: ByteOrder,
- val sortHint: Int
+ public val valueOffset: Int?,
+ public val valueBytes: ByteArray,
+ public val byteOrder: ByteOrder,
+ public val sortHint: Int
) {
/**
* Returns the offset with padding.
* Because TIFF files can be as big as 4 GB we need 10 digits to present that.
*/
- val offsetFormatted: String =
+ public val offsetFormatted: String =
offset.toString().padStart(10, '0')
/** Return a proper Tag ID like 0x0100 */
- val tagFormatted: String =
+ public val tagFormatted: String =
"0x" + tag.toString(HEX_RADIX).padStart(4, '0')
/** TagInfo, if the tag is found in our registry. */
- val tagInfo: TagInfo? = getTag(directoryType, tag)
+ public val tagInfo: TagInfo? = getTag(directoryType, tag)
- val value: Any = if (tagInfo is TagInfoGpsText)
+ public val value: Any = if (tagInfo is TagInfoGpsText)
tagInfo.getValue(this)
else
fieldType.getValue(this.valueBytes, this.byteOrder)
- val valueDescription: String by lazy {
+ public val valueDescription: String by lazy {
try {
if (value is ByteArray) {
@@ -141,7 +141,7 @@ class TiffField(
}
}
- fun toStringValue(): String {
+ public fun toStringValue(): String {
if (value is List<*>) {
@@ -154,12 +154,12 @@ class TiffField(
}
if (value !is String)
- throw ImageReadException("Expected String for $tagFormatted, but got: " + value)
+ throw ImageReadException("Expected String for $tagFormatted, but got: $value")
return value
}
- fun toIntArray(): IntArray {
+ public fun toIntArray(): IntArray {
if (value is Number)
return intArrayOf(value.toInt())
@@ -181,28 +181,28 @@ class TiffField(
throw ImageReadException("Can't format value of tag $tagFormatted as int: $value")
}
- fun toInt(): Int = when (value) {
+ public fun toInt(): Int = when (value) {
is ByteArray -> value.first().toInt()
is ShortArray -> value.first().toInt()
- is IntArray -> value.first().toInt()
+ is IntArray -> value.first()
else -> (value as Number).toInt()
}
- fun toShort(): Short = when (value) {
+ public fun toShort(): Short = when (value) {
is ByteArray -> value.first().toShort()
is ShortArray -> value.first()
is IntArray -> value.first().toShort()
else -> (value as Number).toShort()
}
- fun toDouble(): Double = when (value) {
+ public fun toDouble(): Double = when (value) {
is RationalNumbers -> value.values.first().doubleValue()
is RationalNumber -> value.doubleValue()
is ByteArray -> value.first().toDouble()
is ShortArray -> value.first().toDouble()
is IntArray -> value.first().toDouble()
is FloatArray -> value.first().toDouble()
- is DoubleArray -> value.first().toDouble()
+ is DoubleArray -> value.first()
else -> (value as Number).toDouble()
}
@@ -213,10 +213,10 @@ class TiffField(
override fun toString(): String =
"$offsetFormatted $tagFormatted ${tagInfo?.name ?: "Unknown"} = $valueDescription"
- fun createOversizeValueElement(): TiffElement? =
- valueOffset?.let { OversizeValueElement(it.toInt(), valueBytes.size) }
+ internal fun createOversizeValueElement(): TiffElement? =
+ valueOffset?.let { OversizeValueElement(it, valueBytes.size) }
- inner class OversizeValueElement(offset: Int, length: Int) : TiffElement(
+ internal inner class OversizeValueElement(offset: Int, length: Int) : TiffElement(
debugDescription = "Value of $tagInfo ($fieldType) @ $offset",
offset = offset,
length = length
@@ -226,7 +226,7 @@ class TiffField(
debugDescription
}
- companion object {
+ private companion object {
/**
* Limit to 16 bytes, so that a GeoTiff ModelTransformationTag
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffHeader.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffHeader.kt
index 9f22b246..a7ea37ef 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffHeader.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffHeader.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff
import com.ashampoo.kim.common.ByteOrder
import com.ashampoo.kim.format.tiff.constant.TiffConstants
-data class TiffHeader(
+public data class TiffHeader(
val byteOrder: ByteOrder,
val tiffVersion: Int,
val offsetToFirstIFD: Int
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffImageParser.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffImageParser.kt
index e1c93266..54c6ed1a 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffImageParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffImageParser.kt
@@ -28,7 +28,7 @@ import com.ashampoo.kim.input.DefaultRandomAccessByteReader
import com.ashampoo.kim.model.ImageFormat
import com.ashampoo.kim.model.ImageSize
-object TiffImageParser : ImageParser {
+public object TiffImageParser : ImageParser {
@Throws(ImageReadException::class)
override fun parseMetadata(byteReader: ByteReader): ImageMetadata =
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffReader.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffReader.kt
index e9337333..1e29279a 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffReader.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/TiffReader.kt
@@ -37,13 +37,19 @@ import com.ashampoo.kim.format.tiff.taginfo.TagInfoLongs
import com.ashampoo.kim.input.ByteArrayByteReader
import com.ashampoo.kim.input.ByteReader
import com.ashampoo.kim.input.RandomAccessByteReader
+import com.ashampoo.kim.input.read2BytesAsInt
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readByte
+import com.ashampoo.kim.input.readByteAsInt
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.skipBytes
import com.ashampoo.kim.output.ByteArrayByteWriter
import kotlin.jvm.JvmStatic
@Suppress("TooManyFunctions")
-object TiffReader {
+public object TiffReader {
- const val NIKON_MAKER_NOTE_SIGNATURE = "Nikon\u0000"
+ internal const val NIKON_MAKER_NOTE_SIGNATURE = "Nikon\u0000"
private val offsetFields = listOf(
ExifTag.EXIF_TAG_EXIF_OFFSET,
@@ -64,7 +70,7 @@ object TiffReader {
* the EXIF bytes in JPG, which are limited to 64 KB.
*/
@JvmStatic
- fun read(exifBytes: ByteArray): TiffContents =
+ public fun read(exifBytes: ByteArray): TiffContents =
read(ByteArrayByteReader(exifBytes))
/**
@@ -76,7 +82,7 @@ object TiffReader {
* For normal reading of RAW metadata this consumes a lot of memory.
*/
@JvmStatic
- fun read(
+ public fun read(
byteReader: RandomAccessByteReader,
readTiffImageBytes: Boolean = false
): TiffContents {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/CanonTag.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/CanonTag.kt
index 5f062937..f7be8761 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/CanonTag.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/CanonTag.kt
@@ -26,38 +26,38 @@ import com.ashampoo.kim.format.tiff.taginfo.TagInfoUndefineds
* See https://exiftool.org/TagNames/Canon.html
*/
@Suppress("MagicNumber", "LargeClass", "StringLiteralDuplication")
-object CanonTag {
+public object CanonTag {
/*
* TODO This list is incomplete
*/
- val CANON_CAMERA_SETTINGS = TagInfoUndefineds(
+ public val CANON_CAMERA_SETTINGS: TagInfoUndefineds = TagInfoUndefineds(
0x0001, "CanonCameraSettings", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
- val CANON_IMAGE_TYPE = TagInfoAscii(
+ public val CANON_IMAGE_TYPE: TagInfoAscii = TagInfoAscii(
0x0006, "CanonImageType", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
- val CANON_FIRMWARE_VERSION = TagInfoAscii(
+ public val CANON_FIRMWARE_VERSION: TagInfoAscii = TagInfoAscii(
0x0007, "CanonFirmwareVersion", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
- val FILE_NUMBER = TagInfoLong(
+ public val FILE_NUMBER: TagInfoLong = TagInfoLong(
0x0008, "FileNumber",
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
- val OWNER_NAME = TagInfoAscii(
+ public val OWNER_NAME: TagInfoAscii = TagInfoAscii(
0x0009, "OwnerName", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
- val SERIAL_NUMBER = TagInfoLong(
+ public val SERIAL_NUMBER: TagInfoLong = TagInfoLong(
0x000c, "SerialNumber",
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
@@ -65,27 +65,27 @@ object CanonTag {
/**
* See https://exiftool.org/TagNames/Canon.html#CanonModelID
*/
- val CANON_MODEL_ID = TagInfoLong(
+ public val CANON_MODEL_ID: TagInfoLong = TagInfoLong(
0x0010, "CanonModelID",
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
- val LENS_MODEL = TagInfoAscii(
+ public val LENS_MODEL: TagInfoAscii = TagInfoAscii(
0x0095, "LensModel", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
- val INTERNAL_SERIAL_NUMBER = TagInfoAscii(
+ public val INTERNAL_SERIAL_NUMBER: TagInfoAscii = TagInfoAscii(
0x0096, "InternalSerialNumber", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
- val LENS_INFO = TagInfoUndefineds(
+ public val LENS_INFO: TagInfoUndefineds = TagInfoUndefineds(
0x4019, "LensInfo", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_CANON
)
- val ALL = listOf(
+ public val ALL: List = listOf(
CANON_CAMERA_SETTINGS,
CANON_IMAGE_TYPE,
CANON_FIRMWARE_VERSION,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/ExifTag.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/ExifTag.kt
index f6c43f78..b565d990 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/ExifTag.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/ExifTag.kt
@@ -43,261 +43,261 @@ import com.ashampoo.kim.format.tiff.taginfo.TagInfoUndefineds
* See https://exiv2.org/tags.html
*/
@Suppress("MagicNumber", "LargeClass", "StringLiteralDuplication")
-object ExifTag {
+public object ExifTag {
/*
* TODO This list is incomplete
*/
- val EXIF_DIRECTORY_UNKNOWN: TiffDirectoryType? = null
+ internal val EXIF_DIRECTORY_UNKNOWN: TiffDirectoryType? = null
- val EXIF_TAG_INTEROPERABILITY_INDEX = TagInfoAscii(
+ public val EXIF_TAG_INTEROPERABILITY_INDEX: TagInfoAscii = TagInfoAscii(
0x0001, "InteroperabilityIndex", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_INTEROP_IFD
)
- val EXIF_TAG_INTEROPERABILITY_VERSION = TagInfoUndefined(
+ public val EXIF_TAG_INTEROPERABILITY_VERSION: TagInfoUndefined = TagInfoUndefined(
0x0002, "InteroperabilityVersion",
TiffDirectoryType.EXIF_DIRECTORY_INTEROP_IFD
)
- val EXIF_TAG_INTEROPERABILITY_RELATED_IMAGE_WIDTH = TagInfoShort(
+ public val EXIF_TAG_INTEROPERABILITY_RELATED_IMAGE_WIDTH: TagInfoShort = TagInfoShort(
0x1001, "RelatedImageWidth",
TiffDirectoryType.EXIF_DIRECTORY_INTEROP_IFD
)
- val EXIF_TAG_INTEROPERABILITY_RELATED_IMAGE_HEIGHT = TagInfoShort(
+ public val EXIF_TAG_INTEROPERABILITY_RELATED_IMAGE_HEIGHT: TagInfoShort = TagInfoShort(
0x1002, "RelatedImageHeight",
TiffDirectoryType.EXIF_DIRECTORY_INTEROP_IFD
)
- val EXIF_TAG_PROCESSING_SOFTWARE = TagInfoAscii(
+ public val EXIF_TAG_PROCESSING_SOFTWARE: TagInfoAscii = TagInfoAscii(
0x000b, "ProcessingSoftware", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val EXIF_TAG_SUB_IFDS_OFFSET = TagInfoLongs(
+ public val EXIF_TAG_SUB_IFDS_OFFSET: TagInfoLongs = TagInfoLongs(
0x014a, "SubIFD", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0,
isOffset = true
)
- val EXIF_TAG_SOFTWARE = TagInfoAscii(
+ public val EXIF_TAG_SOFTWARE: TagInfoAscii = TagInfoAscii(
0x0131, "Software", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val EXIF_TAG_PREVIEW_IMAGE_START_IFD0 = TagInfoLong(
+ public val EXIF_TAG_PREVIEW_IMAGE_START_IFD0: TagInfoLong = TagInfoLong(
0x0111, "PreviewImageStart",
TIFF_DIRECTORY_IFD0,
isOffset = true
)
- val EXIF_TAG_PREVIEW_IMAGE_START_SUB_IFD1 = TagInfoLong(
+ public val EXIF_TAG_PREVIEW_IMAGE_START_SUB_IFD1: TagInfoLong = TagInfoLong(
0x0111, "PreviewImageStart",
TIFF_DIRECTORY_IFD2,
isOffset = true
)
- val EXIF_TAG_JPG_FROM_RAW_START_SUB_IFD2 = TagInfoLong(
+ public val EXIF_TAG_JPG_FROM_RAW_START_SUB_IFD2: TagInfoLong = TagInfoLong(
0x0111, "JpgFromRawStart",
TIFF_DIRECTORY_IFD3,
isOffset = true
)
- val EXIF_TAG_PREVIEW_IMAGE_LENGTH_IFD0 = TagInfoLong(
+ public val EXIF_TAG_PREVIEW_IMAGE_LENGTH_IFD0: TagInfoLong = TagInfoLong(
0x0117, "PreviewImageLength",
TIFF_DIRECTORY_IFD0
)
- val EXIF_TAG_PREVIEW_IMAGE_LENGTH_SUB_IFD1 = TagInfoLong(
+ public val EXIF_TAG_PREVIEW_IMAGE_LENGTH_SUB_IFD1: TagInfoLong = TagInfoLong(
0x0117, "PreviewImageLength",
TIFF_DIRECTORY_IFD2
)
- val EXIF_TAG_JPG_FROM_RAW_LENGTH_SUB_IFD2 = TagInfoLong(
+ public val EXIF_TAG_JPG_FROM_RAW_LENGTH_SUB_IFD2: TagInfoLong = TagInfoLong(
0x0117, "JpgFromRawLength",
TIFF_DIRECTORY_IFD3
)
- val EXIF_TAG_JPG_FROM_RAW_START_SUB_IFD = TagInfoLong(
+ public val EXIF_TAG_JPG_FROM_RAW_START_SUB_IFD: TagInfoLong = TagInfoLong(
0x0201, "JpgFromRawStart",
TIFF_DIRECTORY_IFD1,
isOffset = true
)
- val EXIF_TAG_JPG_FROM_RAW_START_IFD2 = TagInfoLong(
+ public val EXIF_TAG_JPG_FROM_RAW_START_IFD2: TagInfoLong = TagInfoLong(
0x0201, "JpgFromRawStart",
TIFF_DIRECTORY_IFD2,
isOffset = true
)
- val EXIF_TAG_OTHER_IMAGE_START = TagInfoLong(
+ public val EXIF_TAG_OTHER_IMAGE_START: TagInfoLong = TagInfoLong(
0x0201, "OtherImageStart",
EXIF_DIRECTORY_UNKNOWN,
isOffset = true
)
- val EXIF_TAG_JPG_FROM_RAW_LENGTH_SUB_IFD = TagInfoLong(
+ public val EXIF_TAG_JPG_FROM_RAW_LENGTH_SUB_IFD: TagInfoLong = TagInfoLong(
0x0202, "JpgFromRawLength",
TIFF_DIRECTORY_IFD1
)
- val EXIF_TAG_JPG_FROM_RAW_LENGTH_IFD2 = TagInfoLong(
+ public val EXIF_TAG_JPG_FROM_RAW_LENGTH_IFD2: TagInfoLong = TagInfoLong(
0x0202, "JpgFromRawLength",
TIFF_DIRECTORY_IFD2
)
- val EXIF_TAG_OTHER_IMAGE_LENGTH = TagInfoLong(
+ public val EXIF_TAG_OTHER_IMAGE_LENGTH: TagInfoLong = TagInfoLong(
0x0202, "OtherImageLength",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_APPLICATION_NOTES = TagInfoBytes(
+ public val EXIF_TAG_APPLICATION_NOTES: TagInfoBytes = TagInfoBytes(
0x02bc, "ApplicationNotes", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_EXPOSURE_TIME = TagInfoRationals(
+ public val EXIF_TAG_EXPOSURE_TIME: TagInfoRationals = TagInfoRationals(
0x829a, "ExposureTime", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_FNUMBER = TagInfoRationals(
+ public val EXIF_TAG_FNUMBER: TagInfoRationals = TagInfoRationals(
0x829d, "FNumber", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_IPTC_NAA = TagInfoLong(
+ public val EXIF_TAG_IPTC_NAA: TagInfoLong = TagInfoLong(
0x83bb, "IPTC-NAA",
TIFF_DIRECTORY_IFD0
)
- val EXIF_TAG_INTERGRAPH_PACKET_DATA = TagInfoShorts(
+ public val EXIF_TAG_INTERGRAPH_PACKET_DATA: TagInfoShorts = TagInfoShorts(
0x847e, "IntergraphPacketData", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_INTERGRAPH_FLAG_REGISTERS = TagInfoLongs(
+ public val EXIF_TAG_INTERGRAPH_FLAG_REGISTERS: TagInfoLongs = TagInfoLongs(
0x847f, "IntergraphFlagRegisters", 16,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_SITE = TagInfoAscii(
+ public val EXIF_TAG_SITE: TagInfoAscii = TagInfoAscii(
0x84e0, "Site", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_COLOR_SEQUENCE = TagInfoAscii(
+ public val EXIF_TAG_COLOR_SEQUENCE: TagInfoAscii = TagInfoAscii(
0x84e1, "ColorSequence", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_IT8HEADER = TagInfoAscii(
+ public val EXIF_TAG_IT8HEADER: TagInfoAscii = TagInfoAscii(
0x84e2, "IT8Header", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_RASTER_PADDING = TagInfoShort(
+ public val EXIF_TAG_RASTER_PADDING: TagInfoShort = TagInfoShort(
0x84e3, "RasterPadding",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_BITS_PER_RUN_LENGTH = TagInfoShort(
+ public val EXIF_TAG_BITS_PER_RUN_LENGTH: TagInfoShort = TagInfoShort(
0x84e4, "BitsPerRunLength",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_BITS_PER_EXTENDED_RUN_LENGTH = TagInfoShort(
+ public val EXIF_TAG_BITS_PER_EXTENDED_RUN_LENGTH: TagInfoShort = TagInfoShort(
0x84e5, "BitsPerExtendedRunLength",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_COLOR_TABLE = TagInfoBytes(
+ public val EXIF_TAG_COLOR_TABLE: TagInfoBytes = TagInfoBytes(
0x84e6, "ColorTable", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_IMAGE_COLOR_INDICATOR = TagInfoByte(
+ public val EXIF_TAG_IMAGE_COLOR_INDICATOR: TagInfoByte = TagInfoByte(
0x84e7, "ImageColorIndicator",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_BACKGROUND_COLOR_INDICATOR = TagInfoByte(
+ public val EXIF_TAG_BACKGROUND_COLOR_INDICATOR: TagInfoByte = TagInfoByte(
0x84e8, "BackgroundColorIndicator",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_IMAGE_COLOR_VALUE = TagInfoBytes(
+ public val EXIF_TAG_IMAGE_COLOR_VALUE: TagInfoBytes = TagInfoBytes(
0x84e9, "ImageColorValue", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_BACKGROUND_COLOR_VALUE = TagInfoBytes(
+ public val EXIF_TAG_BACKGROUND_COLOR_VALUE: TagInfoBytes = TagInfoBytes(
0x84ea, "BackgroundColorValue", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_PIXEL_INTENSITY_RANGE = TagInfoBytes(
+ public val EXIF_TAG_PIXEL_INTENSITY_RANGE: TagInfoBytes = TagInfoBytes(
0x84eb, "PixelIntensityRange", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_TRANSPARENCY_INDICATOR = TagInfoByte(
+ public val EXIF_TAG_TRANSPARENCY_INDICATOR: TagInfoByte = TagInfoByte(
0x84ec, "TransparencyIndicator",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_COLOR_CHARACTERIZATION = TagInfoAscii(
+ public val EXIF_TAG_COLOR_CHARACTERIZATION: TagInfoAscii = TagInfoAscii(
0x84ed, "ColorCharacterization", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_SEMINFO = TagInfoAscii(
+ public val EXIF_TAG_SEMINFO: TagInfoAscii = TagInfoAscii(
0x8546, "SEMInfo", 1,
TIFF_DIRECTORY_IFD0
)
- val EXIF_TAG_AFCP_IPTC = TagInfoLong(
+ public val EXIF_TAG_AFCP_IPTC: TagInfoLong = TagInfoLong(
0x8568, "AFCP_IPTC",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_LEAF_DATA = TagInfoLong(
+ public val EXIF_TAG_LEAF_DATA: TagInfoLong = TagInfoLong(
0x8606, "LeafData",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_PHOTOSHOP_SETTINGS = TagInfoBytes(
+ public val EXIF_TAG_PHOTOSHOP_SETTINGS: TagInfoBytes = TagInfoBytes(
0x8649, "PhotoshopSettings", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_EXIF_OFFSET = TagInfoLong(
+ public val EXIF_TAG_EXIF_OFFSET: TagInfoLong = TagInfoLong(
0x8769, "ExifOffset",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_EXPOSURE_PROGRAM = TagInfoShort(
+ public val EXIF_TAG_EXPOSURE_PROGRAM: TagInfoShort = TagInfoShort(
0x8822, "ExposureProgram",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val EXPOSURE_PROGRAM_VALUE_MANUAL = 1
- const val EXPOSURE_PROGRAM_VALUE_PROGRAM_AE = 2
- const val EXPOSURE_PROGRAM_VALUE_APERTURE_PRIORITY_AE = 3
- const val EXPOSURE_PROGRAM_VALUE_SHUTTER_SPEED_PRIORITY_AE = 4
- const val EXPOSURE_PROGRAM_VALUE_CREATIVE_SLOW_SPEED = 5
- const val EXPOSURE_PROGRAM_VALUE_ACTION_HIGH_SPEED = 6
- const val EXPOSURE_PROGRAM_VALUE_PORTRAIT = 7
- const val EXPOSURE_PROGRAM_VALUE_LANDSCAPE = 8
+ public const val EXPOSURE_PROGRAM_VALUE_MANUAL: Int = 1
+ public const val EXPOSURE_PROGRAM_VALUE_PROGRAM_AE: Int = 2
+ public const val EXPOSURE_PROGRAM_VALUE_APERTURE_PRIORITY_AE: Int = 3
+ public const val EXPOSURE_PROGRAM_VALUE_SHUTTER_SPEED_PRIORITY_AE: Int = 4
+ public const val EXPOSURE_PROGRAM_VALUE_CREATIVE_SLOW_SPEED: Int = 5
+ public const val EXPOSURE_PROGRAM_VALUE_ACTION_HIGH_SPEED: Int = 6
+ public const val EXPOSURE_PROGRAM_VALUE_PORTRAIT: Int = 7
+ public const val EXPOSURE_PROGRAM_VALUE_LANDSCAPE: Int = 8
- val EXIF_TAG_SPECTRAL_SENSITIVITY = TagInfoAscii(
+ public val EXIF_TAG_SPECTRAL_SENSITIVITY: TagInfoAscii = TagInfoAscii(
0x8824, "SpectralSensitivity", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_GPSINFO = TagInfoLong(
+ public val EXIF_TAG_GPSINFO: TagInfoLong = TagInfoLong(
0x8825, "GPSInfo",
EXIF_DIRECTORY_UNKNOWN,
isOffset = true
@@ -310,7 +310,7 @@ object ExifTag {
* EXIF 2.3: "PhotographicSensitivity"
* ExifTool: "ISO"
*/
- val EXIF_TAG_ISO = TagInfoShorts(
+ public val EXIF_TAG_ISO: TagInfoShorts = TagInfoShorts(
0x8827, "ISO", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
@@ -321,159 +321,159 @@ object ExifTag {
*
* See https://exiftool.org/TagNames/PanasonicRaw.html
*/
- val EXIF_TAG_ISO_PANASONIC = TagInfoShort(
+ public val EXIF_TAG_ISO_PANASONIC: TagInfoShort = TagInfoShort(
0x0017, "ISO",
TIFF_DIRECTORY_IFD0
)
- val EXIF_TAG_OPTO_ELECTRIC_CONV_FACTOR = TagInfoUndefineds(
+ public val EXIF_TAG_OPTO_ELECTRIC_CONV_FACTOR: TagInfoUndefineds = TagInfoUndefineds(
0x8828, "Opto - Electric Conv Factor", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_LEAF_SUB_IFD = TagInfoLong(
+ public val EXIF_TAG_LEAF_SUB_IFD: TagInfoLong = TagInfoLong(
0x888a, "LeafSubIFD",
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_EXIF_VERSION = TagInfoUndefineds(
+ public val EXIF_TAG_EXIF_VERSION: TagInfoUndefineds = TagInfoUndefineds(
0x9000, "ExifVersion", 4,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_DATE_TIME_ORIGINAL = TagInfoAscii(
+ public val EXIF_TAG_DATE_TIME_ORIGINAL: TagInfoAscii = TagInfoAscii(
0x9003, "DateTimeOriginal", 20,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_DATE_TIME_DIGITIZED = TagInfoAscii(
+ public val EXIF_TAG_DATE_TIME_DIGITIZED: TagInfoAscii = TagInfoAscii(
0x9004, "DateTimeDigitized", 20,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_COMPONENTS_CONFIGURATION = TagInfoUndefineds(
+ public val EXIF_TAG_COMPONENTS_CONFIGURATION: TagInfoUndefineds = TagInfoUndefineds(
0x9101, "ComponentsConfiguration", 4,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_COMPRESSED_BITS_PER_PIXEL = TagInfoRational(
+ public val EXIF_TAG_COMPRESSED_BITS_PER_PIXEL: TagInfoRational = TagInfoRational(
0x9102, "CompressedBitsPerPixel",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SHUTTER_SPEED_VALUE = TagInfoSRational(
+ public val EXIF_TAG_SHUTTER_SPEED_VALUE: TagInfoSRational = TagInfoSRational(
0x9201, "ShutterSpeedValue",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_APERTURE_VALUE = TagInfoRational(
+ public val EXIF_TAG_APERTURE_VALUE: TagInfoRational = TagInfoRational(
0x9202, "ApertureValue",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_BRIGHTNESS_VALUE = TagInfoSRational(
+ public val EXIF_TAG_BRIGHTNESS_VALUE: TagInfoSRational = TagInfoSRational(
0x9203, "BrightnessValue",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_EXPOSURE_COMPENSATION = TagInfoSRational(
+ public val EXIF_TAG_EXPOSURE_COMPENSATION: TagInfoSRational = TagInfoSRational(
0x9204, "ExposureCompensation",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_MAX_APERTURE_VALUE = TagInfoRational(
+ public val EXIF_TAG_MAX_APERTURE_VALUE: TagInfoRational = TagInfoRational(
0x9205, "MaxApertureValue",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SUBJECT_DISTANCE = TagInfoRationals(
+ public val EXIF_TAG_SUBJECT_DISTANCE: TagInfoRationals = TagInfoRationals(
0x9206, "Subject Distance", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_METERING_MODE = TagInfoShort(
+ public val EXIF_TAG_METERING_MODE: TagInfoShort = TagInfoShort(
0x9207, "MeteringMode",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val METERING_MODE_VALUE_AVERAGE = 1
- const val METERING_MODE_VALUE_CENTER_WEIGHTED_AVERAGE = 2
- const val METERING_MODE_VALUE_SPOT = 3
- const val METERING_MODE_VALUE_MULTI_SPOT = 4
- const val METERING_MODE_VALUE_MULTI_SEGMENT = 5
- const val METERING_MODE_VALUE_PARTIAL = 6
- const val METERING_MODE_VALUE_OTHER = 255
+ public const val METERING_MODE_VALUE_AVERAGE: Int = 1
+ public const val METERING_MODE_VALUE_CENTER_WEIGHTED_AVERAGE: Int = 2
+ public const val METERING_MODE_VALUE_SPOT: Int = 3
+ public const val METERING_MODE_VALUE_MULTI_SPOT: Int = 4
+ public const val METERING_MODE_VALUE_MULTI_SEGMENT: Int = 5
+ public const val METERING_MODE_VALUE_PARTIAL: Int = 6
+ public const val METERING_MODE_VALUE_OTHER: Int = 255
- val EXIF_TAG_LIGHT_SOURCE = TagInfoShort(
+ public val EXIF_TAG_LIGHT_SOURCE: TagInfoShort = TagInfoShort(
0x9208, "LightSource",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val LIGHT_SOURCE_VALUE_DAYLIGHT = 1
- const val LIGHT_SOURCE_VALUE_FLUORESCENT = 2
- const val LIGHT_SOURCE_VALUE_TUNGSTEN = 3
- const val LIGHT_SOURCE_VALUE_FLASH = 4
- const val LIGHT_SOURCE_VALUE_FINE_WEATHER = 9
- const val LIGHT_SOURCE_VALUE_CLOUDY = 10
- const val LIGHT_SOURCE_VALUE_SHADE = 11
- const val LIGHT_SOURCE_VALUE_DAYLIGHT_FLUORESCENT = 12
- const val LIGHT_SOURCE_VALUE_DAY_WHITE_FLUORESCENT = 13
- const val LIGHT_SOURCE_VALUE_COOL_WHITE_FLUORESCENT = 14
- const val LIGHT_SOURCE_VALUE_WHITE_FLUORESCENT = 15
- const val LIGHT_SOURCE_VALUE_STANDARD_LIGHT_A = 17
- const val LIGHT_SOURCE_VALUE_STANDARD_LIGHT_B = 18
- const val LIGHT_SOURCE_VALUE_STANDARD_LIGHT_C = 19
- const val LIGHT_SOURCE_VALUE_D55 = 20
- const val LIGHT_SOURCE_VALUE_D65 = 21
- const val LIGHT_SOURCE_VALUE_D75 = 22
- const val LIGHT_SOURCE_VALUE_D50 = 23
- const val LIGHT_SOURCE_VALUE_ISO_STUDIO_TUNGSTEN = 24
- const val LIGHT_SOURCE_VALUE_OTHER = 255
-
- val EXIF_TAG_FLASH = TagInfoShort(
+ public const val LIGHT_SOURCE_VALUE_DAYLIGHT: Int = 1
+ public const val LIGHT_SOURCE_VALUE_FLUORESCENT: Int = 2
+ public const val LIGHT_SOURCE_VALUE_TUNGSTEN: Int = 3
+ public const val LIGHT_SOURCE_VALUE_FLASH: Int = 4
+ public const val LIGHT_SOURCE_VALUE_FINE_WEATHER: Int = 9
+ public const val LIGHT_SOURCE_VALUE_CLOUDY: Int = 10
+ public const val LIGHT_SOURCE_VALUE_SHADE: Int = 11
+ public const val LIGHT_SOURCE_VALUE_DAYLIGHT_FLUORESCENT: Int = 12
+ public const val LIGHT_SOURCE_VALUE_DAY_WHITE_FLUORESCENT: Int = 13
+ public const val LIGHT_SOURCE_VALUE_COOL_WHITE_FLUORESCENT: Int = 14
+ public const val LIGHT_SOURCE_VALUE_WHITE_FLUORESCENT: Int = 15
+ public const val LIGHT_SOURCE_VALUE_STANDARD_LIGHT_A: Int = 17
+ public const val LIGHT_SOURCE_VALUE_STANDARD_LIGHT_B: Int = 18
+ public const val LIGHT_SOURCE_VALUE_STANDARD_LIGHT_C: Int = 19
+ public const val LIGHT_SOURCE_VALUE_D55: Int = 20
+ public const val LIGHT_SOURCE_VALUE_D65: Int = 21
+ public const val LIGHT_SOURCE_VALUE_D75: Int = 22
+ public const val LIGHT_SOURCE_VALUE_D50: Int = 23
+ public const val LIGHT_SOURCE_VALUE_ISO_STUDIO_TUNGSTEN: Int = 24
+ public const val LIGHT_SOURCE_VALUE_OTHER: Int = 255
+
+ public val EXIF_TAG_FLASH: TagInfoShort = TagInfoShort(
0x9209, "Flash",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val FLASH_VALUE_NO_FLASH = 0x0
- const val FLASH_VALUE_FIRED = 0x1
- const val FLASH_VALUE_FIRED_RETURN_NOT_DETECTED = 0x5
- const val FLASH_VALUE_FIRED_RETURN_DETECTED = 0x7
- const val FLASH_VALUE_ON_DID_NOT_FIRE = 0x8
- const val FLASH_VALUE_ON = 0x9
- const val FLASH_VALUE_ON_RETURN_NOT_DETECTED = 0xd
- const val FLASH_VALUE_ON_RETURN_DETECTED = 0xf
- const val FLASH_VALUE_OFF = 0x10
- const val FLASH_VALUE_OFF_DID_NOT_FIRE_RETURN_NOT_DETECTED = 0x14
- const val FLASH_VALUE_AUTO_DID_NOT_FIRE = 0x18
- const val FLASH_VALUE_AUTO_FIRED = 0x19
- const val FLASH_VALUE_AUTO_FIRED_RETURN_NOT_DETECTED = 0x1d
- const val FLASH_VALUE_AUTO_FIRED_RETURN_DETECTED = 0x1f
- const val FLASH_VALUE_NO_FLASH_FUNCTION = 0x20
- const val FLASH_VALUE_OFF_NO_FLASH_FUNCTION = 0x30
- const val FLASH_VALUE_FIRED_RED_EYE_REDUCTION = 0x41
- const val FLASH_VALUE_FIRED_RED_EYE_REDUCTION_RETURN_NOT_DETECTED = 0x45
- const val FLASH_VALUE_FIRED_RED_EYE_REDUCTION_RETURN_DETECTED = 0x47
- const val FLASH_VALUE_ON_RED_EYE_REDUCTION = 0x49
- const val FLASH_VALUE_ON_RED_EYE_REDUCTION_RETURN_NOT_DETECTED = 0x4d
- const val FLASH_VALUE_ON_RED_EYE_REDUCTION_RETURN_DETECTED = 0x4f
- const val FLASH_VALUE_OFF_RED_EYE_REDUCTION = 0x50
- const val FLASH_VALUE_AUTO_DID_NOT_FIRE_RED_EYE_REDUCTION = 0x58
- const val FLASH_VALUE_AUTO_FIRED_RED_EYE_REDUCTION = 0x59
- const val FLASH_VALUE_AUTO_FIRED_RED_EYE_REDUCTION_RETURN_NOT_DETECTED = 0x5d
- const val FLASH_VALUE_AUTO_FIRED_RED_EYE_REDUCTION_RETURN_DETECTED = 0x5f
-
- val EXIF_TAG_FOCAL_LENGTH = TagInfoRationals(
+ public const val FLASH_VALUE_NO_FLASH: Int = 0x0
+ public const val FLASH_VALUE_FIRED: Int = 0x1
+ public const val FLASH_VALUE_FIRED_RETURN_NOT_DETECTED: Int = 0x5
+ public const val FLASH_VALUE_FIRED_RETURN_DETECTED: Int = 0x7
+ public const val FLASH_VALUE_ON_DID_NOT_FIRE: Int = 0x8
+ public const val FLASH_VALUE_ON: Int = 0x9
+ public const val FLASH_VALUE_ON_RETURN_NOT_DETECTED: Int = 0xd
+ public const val FLASH_VALUE_ON_RETURN_DETECTED: Int = 0xf
+ public const val FLASH_VALUE_OFF: Int = 0x10
+ public const val FLASH_VALUE_OFF_DID_NOT_FIRE_RETURN_NOT_DETECTED: Int = 0x14
+ public const val FLASH_VALUE_AUTO_DID_NOT_FIRE: Int = 0x18
+ public const val FLASH_VALUE_AUTO_FIRED: Int = 0x19
+ public const val FLASH_VALUE_AUTO_FIRED_RETURN_NOT_DETECTED: Int = 0x1d
+ public const val FLASH_VALUE_AUTO_FIRED_RETURN_DETECTED: Int = 0x1f
+ public const val FLASH_VALUE_NO_FLASH_FUNCTION: Int = 0x20
+ public const val FLASH_VALUE_OFF_NO_FLASH_FUNCTION: Int = 0x30
+ public const val FLASH_VALUE_FIRED_RED_EYE_REDUCTION: Int = 0x41
+ public const val FLASH_VALUE_FIRED_RED_EYE_REDUCTION_RETURN_NOT_DETECTED: Int = 0x45
+ public const val FLASH_VALUE_FIRED_RED_EYE_REDUCTION_RETURN_DETECTED: Int = 0x47
+ public const val FLASH_VALUE_ON_RED_EYE_REDUCTION: Int = 0x49
+ public const val FLASH_VALUE_ON_RED_EYE_REDUCTION_RETURN_NOT_DETECTED: Int = 0x4d
+ public const val FLASH_VALUE_ON_RED_EYE_REDUCTION_RETURN_DETECTED: Int = 0x4f
+ public const val FLASH_VALUE_OFF_RED_EYE_REDUCTION: Int = 0x50
+ public const val FLASH_VALUE_AUTO_DID_NOT_FIRE_RED_EYE_REDUCTION: Int = 0x58
+ public const val FLASH_VALUE_AUTO_FIRED_RED_EYE_REDUCTION: Int = 0x59
+ public const val FLASH_VALUE_AUTO_FIRED_RED_EYE_REDUCTION_RETURN_NOT_DETECTED: Int = 0x5d
+ public const val FLASH_VALUE_AUTO_FIRED_RED_EYE_REDUCTION_RETURN_DETECTED: Int = 0x5f
+
+ public val EXIF_TAG_FOCAL_LENGTH: TagInfoRationals = TagInfoRationals(
0x920a, "FocalLength", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SUBJECT_AREA = TagInfoShorts(
+ public val EXIF_TAG_SUBJECT_AREA: TagInfoShorts = TagInfoShorts(
0x9214, "SubjectArea", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_STO_NITS = TagInfoDouble(
+ public val EXIF_TAG_STO_NITS: TagInfoDouble = TagInfoDouble(
0x923f, "StoNits",
EXIF_DIRECTORY_UNKNOWN
)
@@ -482,396 +482,396 @@ object ExifTag {
* A tag for manufacturers of Exif writers to record any desired information.
* The contents are up to the manufacturer.
*/
- val EXIF_TAG_MAKER_NOTE = TagInfoUndefineds(
+ public val EXIF_TAG_MAKER_NOTE: TagInfoUndefineds = TagInfoUndefineds(
0x927c, "MakerNote", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_USER_COMMENT = TagInfoGpsText(
+ public val EXIF_TAG_USER_COMMENT: TagInfoGpsText = TagInfoGpsText(
0x9286, "UserComment",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SUB_SEC_TIME = TagInfoAscii(
+ public val EXIF_TAG_SUB_SEC_TIME: TagInfoAscii = TagInfoAscii(
0x9290, "SubSecTime", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SUB_SEC_TIME_ORIGINAL = TagInfoAscii(
+ public val EXIF_TAG_SUB_SEC_TIME_ORIGINAL: TagInfoAscii = TagInfoAscii(
0x9291, "SubSecTimeOriginal", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SUB_SEC_TIME_DIGITIZED = TagInfoAscii(
+ public val EXIF_TAG_SUB_SEC_TIME_DIGITIZED: TagInfoAscii = TagInfoAscii(
0x9292, "SubSecTimeDigitized", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_OFFSET_TIME = TagInfoAscii(
+ public val EXIF_TAG_OFFSET_TIME: TagInfoAscii = TagInfoAscii(
0x9010, "OffsetTime", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_OFFSET_TIME_ORIGINAL = TagInfoAscii(
+ public val EXIF_TAG_OFFSET_TIME_ORIGINAL: TagInfoAscii = TagInfoAscii(
0x9011, "OffsetTimeOriginal", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_FLASHPIX_VERSION = TagInfoUndefineds(
+ public val EXIF_TAG_FLASHPIX_VERSION: TagInfoUndefineds = TagInfoUndefineds(
0xa000, "FlashpixVersion", 4,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_EXIF_IMAGE_WIDTH = TagInfoLong(
+ public val EXIF_TAG_EXIF_IMAGE_WIDTH: TagInfoLong = TagInfoLong(
0xa002, "ExifImageWidth",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_EXIF_IMAGE_HEIGHT = TagInfoLong(
+ public val EXIF_TAG_EXIF_IMAGE_HEIGHT: TagInfoLong = TagInfoLong(
0xa003, "ExifImageHeight",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_RELATED_SOUND_FILE = TagInfoAscii(
+ public val EXIF_TAG_RELATED_SOUND_FILE: TagInfoAscii = TagInfoAscii(
0xa004, "RelatedSoundFile", 13,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_INTEROP_OFFSET = TagInfoLong(
+ public val EXIF_TAG_INTEROP_OFFSET: TagInfoLong = TagInfoLong(
0xa005, "InteropOffset",
EXIF_DIRECTORY_UNKNOWN,
isOffset = true
)
- val EXIF_TAG_FLASH_ENERGY_EXIF_IFD = TagInfoRationals(
+ public val EXIF_TAG_FLASH_ENERGY_EXIF_IFD: TagInfoRationals = TagInfoRationals(
0xa20b, "FlashEnergy", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SPATIAL_FREQUENCY_RESPONSE_2 = TagInfoUndefineds(
+ public val EXIF_TAG_SPATIAL_FREQUENCY_RESPONSE_2: TagInfoUndefineds = TagInfoUndefineds(
0xa20c, "SpatialFrequencyResponse", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_FOCAL_PLANE_XRESOLUTION_EXIF_IFD = TagInfoRational(
+ public val EXIF_TAG_FOCAL_PLANE_XRESOLUTION_EXIF_IFD: TagInfoRational = TagInfoRational(
0xa20e, "FocalPlaneXResolution",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_FOCAL_PLANE_YRESOLUTION_EXIF_IFD = TagInfoRational(
+ public val EXIF_TAG_FOCAL_PLANE_YRESOLUTION_EXIF_IFD: TagInfoRational = TagInfoRational(
0xa20f, "FocalPlaneYResolution",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD = TagInfoShort(
+ public val EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD: TagInfoShort = TagInfoShort(
0xa210, "FocalPlaneResolutionUnit",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_NONE = 1
- const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_INCHES = 2
- const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_CM = 3
- const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_MM = 4
- const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_UM = 5
+ public const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_NONE: Int = 1
+ public const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_INCHES: Int = 2
+ public const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_CM: Int = 3
+ public const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_MM: Int = 4
+ public const val FOCAL_PLANE_RESOLUTION_UNIT_EXIF_IFD_VALUE_UM: Int = 5
- val EXIF_TAG_SUBJECT_LOCATION = TagInfoShorts(
+ public val EXIF_TAG_SUBJECT_LOCATION: TagInfoShorts = TagInfoShorts(
0xa214, "SubjectLocation", 2,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_EXPOSURE_INDEX_EXIF_IFD = TagInfoRational(
+ public val EXIF_TAG_EXPOSURE_INDEX_EXIF_IFD: TagInfoRational = TagInfoRational(
0xa215, "ExposureIndex",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SENSING_METHOD_EXIF_IFD = TagInfoShort(
+ public val EXIF_TAG_SENSING_METHOD_EXIF_IFD: TagInfoShort = TagInfoShort(
0xa217, "SensingMethod",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val SENSING_METHOD_EXIF_IFD_VALUE_NOT_DEFINED = 1
- const val SENSING_METHOD_EXIF_IFD_VALUE_ONE_CHIP_COLOR_AREA = 2
- const val SENSING_METHOD_EXIF_IFD_VALUE_TWO_CHIP_COLOR_AREA = 3
- const val SENSING_METHOD_EXIF_IFD_VALUE_THREE_CHIP_COLOR_AREA = 4
- const val SENSING_METHOD_EXIF_IFD_VALUE_COLOR_SEQUENTIAL_AREA = 5
- const val SENSING_METHOD_EXIF_IFD_VALUE_TRILINEAR = 7
- const val SENSING_METHOD_EXIF_IFD_VALUE_COLOR_SEQUENTIAL_LINEAR = 8
+ public const val SENSING_METHOD_EXIF_IFD_VALUE_NOT_DEFINED: Int = 1
+ public const val SENSING_METHOD_EXIF_IFD_VALUE_ONE_CHIP_COLOR_AREA: Int = 2
+ public const val SENSING_METHOD_EXIF_IFD_VALUE_TWO_CHIP_COLOR_AREA: Int = 3
+ public const val SENSING_METHOD_EXIF_IFD_VALUE_THREE_CHIP_COLOR_AREA: Int = 4
+ public const val SENSING_METHOD_EXIF_IFD_VALUE_COLOR_SEQUENTIAL_AREA: Int = 5
+ public const val SENSING_METHOD_EXIF_IFD_VALUE_TRILINEAR: Int = 7
+ public const val SENSING_METHOD_EXIF_IFD_VALUE_COLOR_SEQUENTIAL_LINEAR: Int = 8
- val EXIF_TAG_FILE_SOURCE = TagInfoUndefined(
+ public val EXIF_TAG_FILE_SOURCE: TagInfoUndefined = TagInfoUndefined(
0xa300, "FileSource",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val FILE_SOURCE_VALUE_FILM_SCANNER = 1
- const val FILE_SOURCE_VALUE_REFLECTION_PRINT_SCANNER = 2
- const val FILE_SOURCE_VALUE_DIGITAL_CAMERA = 3
+ public const val FILE_SOURCE_VALUE_FILM_SCANNER: Int = 1
+ public const val FILE_SOURCE_VALUE_REFLECTION_PRINT_SCANNER: Int = 2
+ public const val FILE_SOURCE_VALUE_DIGITAL_CAMERA: Int = 3
- val EXIF_TAG_SCENE_TYPE = TagInfoUndefined(
+ public val EXIF_TAG_SCENE_TYPE: TagInfoUndefined = TagInfoUndefined(
0xa301, "SceneType",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_CFAPATTERN = TagInfoUndefineds(
+ public val EXIF_TAG_CFAPATTERN: TagInfoUndefineds = TagInfoUndefineds(
0xa302, "CFAPattern", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_CUSTOM_RENDERED = TagInfoShort(
+ public val EXIF_TAG_CUSTOM_RENDERED: TagInfoShort = TagInfoShort(
0xa401, "CustomRendered",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val CUSTOM_RENDERED_VALUE_NORMAL = 0
- const val CUSTOM_RENDERED_VALUE_CUSTOM = 1
+ public const val CUSTOM_RENDERED_VALUE_NORMAL: Int = 0
+ public const val CUSTOM_RENDERED_VALUE_CUSTOM: Int = 1
- val EXIF_TAG_EXPOSURE_MODE = TagInfoShort(
+ public val EXIF_TAG_EXPOSURE_MODE: TagInfoShort = TagInfoShort(
0xa402, "ExposureMode",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val EXPOSURE_MODE_VALUE_AUTO = 0
- const val EXPOSURE_MODE_VALUE_MANUAL = 1
- const val EXPOSURE_MODE_VALUE_AUTO_BRACKET = 2
+ public const val EXPOSURE_MODE_VALUE_AUTO: Int = 0
+ public const val EXPOSURE_MODE_VALUE_MANUAL: Int = 1
+ public const val EXPOSURE_MODE_VALUE_AUTO_BRACKET: Int = 2
- val EXIF_TAG_WHITE_BALANCE_1 = TagInfoShort(
+ public val EXIF_TAG_WHITE_BALANCE_1: TagInfoShort = TagInfoShort(
0xa403, "WhiteBalance",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val WHITE_BALANCE_1_VALUE_AUTO = 0
- const val WHITE_BALANCE_1_VALUE_MANUAL = 1
+ public const val WHITE_BALANCE_1_VALUE_AUTO: Int = 0
+ public const val WHITE_BALANCE_1_VALUE_MANUAL: Int = 1
- val EXIF_TAG_DIGITAL_ZOOM_RATIO = TagInfoRational(
+ public val EXIF_TAG_DIGITAL_ZOOM_RATIO: TagInfoRational = TagInfoRational(
0xa404, "DigitalZoomRatio",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_FOCAL_LENGTH_IN_35MM_FORMAT = TagInfoShort(
+ public val EXIF_TAG_FOCAL_LENGTH_IN_35MM_FORMAT: TagInfoShort = TagInfoShort(
0xa405, "FocalLengthIn35mmFormat",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SCENE_CAPTURE_TYPE = TagInfoShort(
+ public val EXIF_TAG_SCENE_CAPTURE_TYPE: TagInfoShort = TagInfoShort(
0xa406, "SceneCaptureType",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val SCENE_CAPTURE_TYPE_VALUE_STANDARD = 0
- const val SCENE_CAPTURE_TYPE_VALUE_LANDSCAPE = 1
- const val SCENE_CAPTURE_TYPE_VALUE_PORTRAIT = 2
- const val SCENE_CAPTURE_TYPE_VALUE_NIGHT = 3
+ public const val SCENE_CAPTURE_TYPE_VALUE_STANDARD: Int = 0
+ public const val SCENE_CAPTURE_TYPE_VALUE_LANDSCAPE: Int = 1
+ public const val SCENE_CAPTURE_TYPE_VALUE_PORTRAIT: Int = 2
+ public const val SCENE_CAPTURE_TYPE_VALUE_NIGHT: Int = 3
- val EXIF_TAG_GAIN_CONTROL = TagInfoShort(
+ public val EXIF_TAG_GAIN_CONTROL: TagInfoShort = TagInfoShort(
0xa407, "GainControl",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val GAIN_CONTROL_VALUE_NONE = 0
- const val GAIN_CONTROL_VALUE_LOW_GAIN_UP = 1
- const val GAIN_CONTROL_VALUE_HIGH_GAIN_UP = 2
- const val GAIN_CONTROL_VALUE_LOW_GAIN_DOWN = 3
- const val GAIN_CONTROL_VALUE_HIGH_GAIN_DOWN = 4
+ public const val GAIN_CONTROL_VALUE_NONE: Int = 0
+ public const val GAIN_CONTROL_VALUE_LOW_GAIN_UP: Int = 1
+ public const val GAIN_CONTROL_VALUE_HIGH_GAIN_UP: Int = 2
+ public const val GAIN_CONTROL_VALUE_LOW_GAIN_DOWN: Int = 3
+ public const val GAIN_CONTROL_VALUE_HIGH_GAIN_DOWN: Int = 4
- val EXIF_TAG_CONTRAST_1 = TagInfoShort(
+ public val EXIF_TAG_CONTRAST_1: TagInfoShort = TagInfoShort(
0xa408, "Contrast",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val CONTRAST_1_VALUE_NORMAL = 0
- const val CONTRAST_1_VALUE_LOW = 1
- const val CONTRAST_1_VALUE_HIGH = 2
+ public const val CONTRAST_1_VALUE_NORMAL: Int = 0
+ public const val CONTRAST_1_VALUE_LOW: Int = 1
+ public const val CONTRAST_1_VALUE_HIGH: Int = 2
- val EXIF_TAG_SATURATION_1 = TagInfoShort(
+ public val EXIF_TAG_SATURATION_1: TagInfoShort = TagInfoShort(
0xa409, "Saturation",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val SATURATION_1_VALUE_NORMAL = 0
- const val SATURATION_1_VALUE_LOW = 1
- const val SATURATION_1_VALUE_HIGH = 2
+ public const val SATURATION_1_VALUE_NORMAL: Int = 0
+ public const val SATURATION_1_VALUE_LOW: Int = 1
+ public const val SATURATION_1_VALUE_HIGH: Int = 2
- val EXIF_TAG_SHARPNESS_1 = TagInfoShort(
+ public val EXIF_TAG_SHARPNESS_1: TagInfoShort = TagInfoShort(
0xa40a, "Sharpness",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val SHARPNESS_1_VALUE_NORMAL = 0
- const val SHARPNESS_1_VALUE_SOFT = 1
- const val SHARPNESS_1_VALUE_HARD = 2
+ public const val SHARPNESS_1_VALUE_NORMAL: Int = 0
+ public const val SHARPNESS_1_VALUE_SOFT: Int = 1
+ public const val SHARPNESS_1_VALUE_HARD: Int = 2
- val EXIF_TAG_DEVICE_SETTING_DESCRIPTION = TagInfoUndefineds(
+ public val EXIF_TAG_DEVICE_SETTING_DESCRIPTION: TagInfoUndefineds = TagInfoUndefineds(
0xa40b, "DeviceSettingDescription", TagInfo.LENGTH_UNKNOWN,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_SUBJECT_DISTANCE_RANGE = TagInfoShort(
+ public val EXIF_TAG_SUBJECT_DISTANCE_RANGE: TagInfoShort = TagInfoShort(
0xa40c, "SubjectDistanceRange",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- const val SUBJECT_DISTANCE_RANGE_VALUE_MACRO = 1
- const val SUBJECT_DISTANCE_RANGE_VALUE_CLOSE = 2
- const val SUBJECT_DISTANCE_RANGE_VALUE_DISTANT = 3
+ public const val SUBJECT_DISTANCE_RANGE_VALUE_MACRO: Int = 1
+ public const val SUBJECT_DISTANCE_RANGE_VALUE_CLOSE: Int = 2
+ public const val SUBJECT_DISTANCE_RANGE_VALUE_DISTANT: Int = 3
- val EXIF_TAG_IMAGE_UNIQUE_ID = TagInfoAscii(
+ public val EXIF_TAG_IMAGE_UNIQUE_ID: TagInfoAscii = TagInfoAscii(
0xa420, "ImageUniqueID", 33,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_CAMERA_OWNER_NAME = TagInfoAscii(
+ public val EXIF_TAG_CAMERA_OWNER_NAME: TagInfoAscii = TagInfoAscii(
0xa430, "CameraOwnerName", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_BODY_SERIAL_NUMBER = TagInfoAscii(
+ public val EXIF_TAG_BODY_SERIAL_NUMBER: TagInfoAscii = TagInfoAscii(
0xa431, "BodySerialNumber", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_LENS_SPECIFICATION = TagInfoRationals(
+ public val EXIF_TAG_LENS_SPECIFICATION: TagInfoRationals = TagInfoRationals(
0xa432, "LensSpecification", 4,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_LENS_MAKE = TagInfoAscii(
+ public val EXIF_TAG_LENS_MAKE: TagInfoAscii = TagInfoAscii(
0xa433, "LensMake", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_LENS_MODEL = TagInfoAscii(
+ public val EXIF_TAG_LENS_MODEL: TagInfoAscii = TagInfoAscii(
0xa434, "LensModel", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_LENS_SERIAL_NUMBER = TagInfoAscii(
+ public val EXIF_TAG_LENS_SERIAL_NUMBER: TagInfoAscii = TagInfoAscii(
0xa435, "LensSerialNumber", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_GAMMA = TagInfoRational(
+ public val EXIF_TAG_GAMMA: TagInfoRational = TagInfoRational(
0xa500, "Gamma",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_PRINT_IM = TagInfoUndefined(
+ public val EXIF_TAG_PRINT_IM: TagInfoUndefined = TagInfoUndefined(
0xc4a5, "PrintIM",
TIFF_DIRECTORY_IFD0
)
- val EXIF_TAG_OFFSET_SCHEMA = TagInfoSLong(
+ public val EXIF_TAG_OFFSET_SCHEMA: TagInfoSLong = TagInfoSLong(
0xea1d, "OffsetSchema",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_OWNER_NAME = TagInfoAscii(
+ public val EXIF_TAG_OWNER_NAME: TagInfoAscii = TagInfoAscii(
0xfde8, "OwnerName", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SERIAL_NUMBER = TagInfoAscii(
+ public val EXIF_TAG_SERIAL_NUMBER: TagInfoAscii = TagInfoAscii(
0xfde9, "SerialNumber", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_LENS = TagInfoAscii(
+ public val EXIF_TAG_LENS: TagInfoAscii = TagInfoAscii(
0xfdea, "Lens", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_RAW_FILE = TagInfoAscii(
+ public val EXIF_TAG_RAW_FILE: TagInfoAscii = TagInfoAscii(
0xfe4c, "RawFile", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_CONVERTER = TagInfoAscii(
+ public val EXIF_TAG_CONVERTER: TagInfoAscii = TagInfoAscii(
0xfe4d, "Converter", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_WHITE_BALANCE_2 = TagInfoAscii(
+ public val EXIF_TAG_WHITE_BALANCE_2: TagInfoAscii = TagInfoAscii(
0xfe4e, "WhiteBalance", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_EXPOSURE = TagInfoAscii(
+ public val EXIF_TAG_EXPOSURE: TagInfoAscii = TagInfoAscii(
0xfe51, "Exposure", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SHADOWS = TagInfoAscii(
+ public val EXIF_TAG_SHADOWS: TagInfoAscii = TagInfoAscii(
0xfe52, "Shadows", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_BRIGHTNESS = TagInfoAscii(
+ public val EXIF_TAG_BRIGHTNESS: TagInfoAscii = TagInfoAscii(
0xfe53, "Brightness", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_CONTRAST_2 = TagInfoAscii(
+ public val EXIF_TAG_CONTRAST_2: TagInfoAscii = TagInfoAscii(
0xfe54, "Contrast", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SATURATION_2 = TagInfoAscii(
+ public val EXIF_TAG_SATURATION_2: TagInfoAscii = TagInfoAscii(
0xfe55, "Saturation", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SHARPNESS_2 = TagInfoAscii(
+ public val EXIF_TAG_SHARPNESS_2: TagInfoAscii = TagInfoAscii(
0xfe56, "Sharpness", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_SMOOTHNESS = TagInfoAscii(
+ public val EXIF_TAG_SMOOTHNESS: TagInfoAscii = TagInfoAscii(
0xfe57, "Smoothness", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_MOIRE_FILTER = TagInfoAscii(
+ public val EXIF_TAG_MOIRE_FILTER: TagInfoAscii = TagInfoAscii(
0xfe58, "MoireFilter", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
/** Rating tag used by Windows */
- val EXIF_TAG_RATING = TagInfoShort(
+ public val EXIF_TAG_RATING: TagInfoShort = TagInfoShort(
0x4746, "Rating",
TiffDirectoryType.TIFF_DIRECTORY_IFD0
)
/** Rating tag used by Windows, value in percent */
- val EXIF_TAG_RATING_PERCENT = TagInfoShort(
+ public val EXIF_TAG_RATING_PERCENT: TagInfoShort = TagInfoShort(
0x4749, "RatingPercent",
TiffDirectoryType.TIFF_DIRECTORY_IFD0
)
- val EXIF_TAG_MODIFY_DATE = TagInfoAscii(
+ public val EXIF_TAG_MODIFY_DATE: TagInfoAscii = TagInfoAscii(
0x0132, "ModifyDate", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.TIFF_DIRECTORY_IFD0
)
- val EXIF_TAG_SENSITIVITY_TYPE = TagInfoShort(
+ public val EXIF_TAG_SENSITIVITY_TYPE: TagInfoShort = TagInfoShort(
0x8830, "SensitivityType",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_RECOMMENDED_EXPOSURE_INDEX = TagInfoLong(
+ public val EXIF_TAG_RECOMMENDED_EXPOSURE_INDEX: TagInfoLong = TagInfoLong(
0x8832, "RecommendedExposureIndex",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_COLOR_SPACE = TagInfoShort(
+ public val EXIF_TAG_COLOR_SPACE: TagInfoShort = TagInfoShort(
0xa001, "ColorSpace",
TiffDirectoryType.EXIF_DIRECTORY_EXIF_IFD
)
- val EXIF_TAG_ICC_PROFILE_OFFSET = TagInfoUndefined(
+ public val EXIF_TAG_ICC_PROFILE_OFFSET: TagInfoUndefined = TagInfoUndefined(
0x8773, "ICC_Profile",
TIFF_DIRECTORY_IFD0
)
/* Affinity Photo creates it's own tag with custom data. */
- val EXIF_TAG_AFFINITY_PHOTO_OFFSET = TagInfoUndefined(
+ public val EXIF_TAG_AFFINITY_PHOTO_OFFSET: TagInfoUndefined = TagInfoUndefined(
0xC7E0, "AffinityPhoto",
TIFF_DIRECTORY_IFD0
)
@@ -887,12 +887,12 @@ object ExifTag {
* 100 characters or so to improve human display. The amount of padding is
* workflow-dependent; around 2000 bytes is often a reasonable amount.
*/
- val EXIF_TAG_PADDING = TagInfoUndefined(
+ public val EXIF_TAG_PADDING: TagInfoUndefined = TagInfoUndefined(
0xEA1C, "Padding",
TIFF_DIRECTORY_IFD0
)
- val ALL = listOf(
+ public val ALL: List = listOf(
EXIF_TAG_INTEROPERABILITY_INDEX, EXIF_TAG_INTEROPERABILITY_VERSION,
EXIF_TAG_INTEROPERABILITY_RELATED_IMAGE_WIDTH,
EXIF_TAG_INTEROPERABILITY_RELATED_IMAGE_HEIGHT,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/GeoTiffTag.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/GeoTiffTag.kt
index 4a587f3e..48339d18 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/GeoTiffTag.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/GeoTiffTag.kt
@@ -17,6 +17,7 @@
package com.ashampoo.kim.format.tiff.constant
import com.ashampoo.kim.format.tiff.constant.ExifTag.EXIF_DIRECTORY_UNKNOWN
+import com.ashampoo.kim.format.tiff.taginfo.TagInfo
import com.ashampoo.kim.format.tiff.taginfo.TagInfoAscii
import com.ashampoo.kim.format.tiff.taginfo.TagInfoDoubles
import com.ashampoo.kim.format.tiff.taginfo.TagInfoShorts
@@ -25,44 +26,44 @@ import com.ashampoo.kim.format.tiff.taginfo.TagInfoShorts
* See https://exiftool.org/TagNames/GeoTiff.html
*/
@Suppress("MagicNumber")
-object GeoTiffTag {
+public object GeoTiffTag {
- val EXIF_TAG_MODEL_PIXEL_SCALE_TAG: TagInfoDoubles = TagInfoDoubles(
+ public val EXIF_TAG_MODEL_PIXEL_SCALE_TAG: TagInfoDoubles = TagInfoDoubles(
0x830e, "ModelPixelScaleTag", 3,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_INTERGRAPH_MATRIX_TAG: TagInfoDoubles = TagInfoDoubles(
+ public val EXIF_TAG_INTERGRAPH_MATRIX_TAG: TagInfoDoubles = TagInfoDoubles(
0x8480, "IntergraphMatrixTag", -1,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_MODEL_TIEPOINT_TAG: TagInfoDoubles = TagInfoDoubles(
+ public val EXIF_TAG_MODEL_TIEPOINT_TAG: TagInfoDoubles = TagInfoDoubles(
0x8482, "ModelTiepointTag", -1,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_MODEL_TRANSFORMATION_TAG: TagInfoDoubles = TagInfoDoubles(
+ public val EXIF_TAG_MODEL_TRANSFORMATION_TAG: TagInfoDoubles = TagInfoDoubles(
0x85d8, "ModelTransformationTag", 16,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_GEO_KEY_DIRECTORY_TAG: TagInfoShorts = TagInfoShorts(
+ public val EXIF_TAG_GEO_KEY_DIRECTORY_TAG: TagInfoShorts = TagInfoShorts(
0x87af, "GeoKeyDirectoryTag", -1,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_GEO_DOUBLE_PARAMS_TAG: TagInfoDoubles = TagInfoDoubles(
+ public val EXIF_TAG_GEO_DOUBLE_PARAMS_TAG: TagInfoDoubles = TagInfoDoubles(
0x87b0, "GeoDoubleParamsTag", -1,
EXIF_DIRECTORY_UNKNOWN
)
- val EXIF_TAG_GEO_ASCII_PARAMS_TAG: TagInfoAscii = TagInfoAscii(
+ public val EXIF_TAG_GEO_ASCII_PARAMS_TAG: TagInfoAscii = TagInfoAscii(
0x87b1, "GeoAsciiParamsTag", -1,
EXIF_DIRECTORY_UNKNOWN
)
- val ALL = listOf(
+ public val ALL: List = listOf(
EXIF_TAG_MODEL_PIXEL_SCALE_TAG,
EXIF_TAG_INTERGRAPH_MATRIX_TAG,
EXIF_TAG_MODEL_TIEPOINT_TAG,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/GpsTag.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/GpsTag.kt
index 4213e5fc..b7510d4d 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/GpsTag.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/GpsTag.kt
@@ -16,6 +16,7 @@
*/
package com.ashampoo.kim.format.tiff.constant
+import com.ashampoo.kim.format.tiff.taginfo.TagInfo
import com.ashampoo.kim.format.tiff.taginfo.TagInfoAscii
import com.ashampoo.kim.format.tiff.taginfo.TagInfoByte
import com.ashampoo.kim.format.tiff.taginfo.TagInfoBytes
@@ -25,198 +26,199 @@ import com.ashampoo.kim.format.tiff.taginfo.TagInfoRationals
import com.ashampoo.kim.format.tiff.taginfo.TagInfoShort
@Suppress("MagicNumber")
-object GpsTag {
+public object GpsTag {
- val GPS_TAG_GPS_VERSION_ID = TagInfoBytes(
+ public val GPS_TAG_GPS_VERSION_ID: TagInfoBytes = TagInfoBytes(
0x0000, "GPSVersionID", 4,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_VERSION = byteArrayOf(2.toByte(), 3.toByte(), 0.toByte(), 0.toByte())
+ public val GPS_VERSION: ByteArray =
+ byteArrayOf(2.toByte(), 3.toByte(), 0.toByte(), 0.toByte())
- val GPS_TAG_GPS_LATITUDE_REF = TagInfoAscii(
+ public val GPS_TAG_GPS_LATITUDE_REF: TagInfoAscii = TagInfoAscii(
0x0001, "GPSLatitudeRef", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH = "N"
- const val GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH = "S"
+ public const val GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH: String = "N"
+ public const val GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH: String = "S"
- val GPS_TAG_GPS_LATITUDE = TagInfoRationals(
+ public val GPS_TAG_GPS_LATITUDE: TagInfoRationals = TagInfoRationals(
0x0002, "GPSLatitude", 3,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_LONGITUDE_REF = TagInfoAscii(
+ public val GPS_TAG_GPS_LONGITUDE_REF: TagInfoAscii = TagInfoAscii(
0x0003, "GPSLongitudeRef", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_LONGITUDE_REF_VALUE_EAST = "E"
- const val GPS_TAG_GPS_LONGITUDE_REF_VALUE_WEST = "W"
+ public const val GPS_TAG_GPS_LONGITUDE_REF_VALUE_EAST: String = "E"
+ public const val GPS_TAG_GPS_LONGITUDE_REF_VALUE_WEST: String = "W"
- val GPS_TAG_GPS_LONGITUDE = TagInfoRationals(
+ public val GPS_TAG_GPS_LONGITUDE: TagInfoRationals = TagInfoRationals(
0x0004, "GPSLongitude", 3,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_ALTITUDE_REF = TagInfoByte(
+ public val GPS_TAG_GPS_ALTITUDE_REF: TagInfoByte = TagInfoByte(
0x0005, "GPSAltitudeRef",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_ALTITUDE_REF_VALUE_ABOVE_SEA_LEVEL = 0
- const val GPS_TAG_GPS_ALTITUDE_REF_VALUE_BELOW_SEA_LEVEL = 1
+ public const val GPS_TAG_GPS_ALTITUDE_REF_VALUE_ABOVE_SEA_LEVEL: Int = 0
+ public const val GPS_TAG_GPS_ALTITUDE_REF_VALUE_BELOW_SEA_LEVEL: Int = 1
- val GPS_TAG_GPS_ALTITUDE = TagInfoRational(
+ public val GPS_TAG_GPS_ALTITUDE: TagInfoRational = TagInfoRational(
0x0006, "GPSAltitude",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_TIME_STAMP = TagInfoRationals(
+ public val GPS_TAG_GPS_TIME_STAMP: TagInfoRationals = TagInfoRationals(
0x0007, "GPSTimeStamp", 3,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_SATELLITES = TagInfoAscii(
+ public val GPS_TAG_GPS_SATELLITES: TagInfoAscii = TagInfoAscii(
0x0008, "GPSSatellites", -1,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_STATUS = TagInfoAscii(
+ public val GPS_TAG_GPS_STATUS: TagInfoAscii = TagInfoAscii(
0x0009, "GPSStatus", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_IN_PROGRESS = "A"
- const val GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_INTEROPERABILITY = "V"
+ public const val GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_IN_PROGRESS: String = "A"
+ public const val GPS_TAG_GPS_STATUS_VALUE_MEASUREMENT_INTEROPERABILITY: String = "V"
- val GPS_TAG_GPS_MEASURE_MODE = TagInfoAscii(
+ public val GPS_TAG_GPS_MEASURE_MODE: TagInfoAscii = TagInfoAscii(
0x000a, "GPSMeasureMode", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_MEASURE_MODE_VALUE_2_DIMENSIONAL_MEASUREMENT = 2
- const val GPS_TAG_GPS_MEASURE_MODE_VALUE_3_DIMENSIONAL_MEASUREMENT = 3
+ public const val GPS_TAG_GPS_MEASURE_MODE_VALUE_2_DIMENSIONAL_MEASUREMENT: Int = 2
+ public const val GPS_TAG_GPS_MEASURE_MODE_VALUE_3_DIMENSIONAL_MEASUREMENT: Int = 3
- val GPS_TAG_GPS_DOP = TagInfoRational(
+ public val GPS_TAG_GPS_DOP: TagInfoRational = TagInfoRational(
0x000b, "GPSDOP",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_SPEED_REF = TagInfoAscii(
+ public val GPS_TAG_GPS_SPEED_REF: TagInfoAscii = TagInfoAscii(
0x000c, "GPSSpeedRef", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_SPEED_REF_VALUE_KMPH = "K"
- const val GPS_TAG_GPS_SPEED_REF_VALUE_MPH = "M"
- const val GPS_TAG_GPS_SPEED_REF_VALUE_KNOTS = "N"
+ public const val GPS_TAG_GPS_SPEED_REF_VALUE_KMPH: String = "K"
+ public const val GPS_TAG_GPS_SPEED_REF_VALUE_MPH: String = "M"
+ public const val GPS_TAG_GPS_SPEED_REF_VALUE_KNOTS: String = "N"
- val GPS_TAG_GPS_SPEED = TagInfoRational(
+ public val GPS_TAG_GPS_SPEED: TagInfoRational = TagInfoRational(
0x000d, "GPSSpeed",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_TRACK_REF = TagInfoAscii(
+ public val GPS_TAG_GPS_TRACK_REF: TagInfoAscii = TagInfoAscii(
0x000e, "GPSTrackRef", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_TRACK_REF_VALUE_MAGNETIC_NORTH = "M"
- const val GPS_TAG_GPS_TRACK_REF_VALUE_TRUE_NORTH = "T"
+ public const val GPS_TAG_GPS_TRACK_REF_VALUE_MAGNETIC_NORTH: String = "M"
+ public const val GPS_TAG_GPS_TRACK_REF_VALUE_TRUE_NORTH: String = "T"
- val GPS_TAG_GPS_TRACK = TagInfoRational(
+ public val GPS_TAG_GPS_TRACK: TagInfoRational = TagInfoRational(
0x000f, "GPSTrack",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_IMG_DIRECTION_REF = TagInfoAscii(
+ public val GPS_TAG_GPS_IMG_DIRECTION_REF: TagInfoAscii = TagInfoAscii(
0x0010, "GPSImgDirectionRef", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_MAGNETIC_NORTH = "M"
- const val GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_TRUE_NORTH = "T"
+ public const val GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_MAGNETIC_NORTH: String = "M"
+ public const val GPS_TAG_GPS_IMG_DIRECTION_REF_VALUE_TRUE_NORTH: String = "T"
- val GPS_TAG_GPS_IMG_DIRECTION = TagInfoRational(
+ public val GPS_TAG_GPS_IMG_DIRECTION: TagInfoRational = TagInfoRational(
0x0011, "GPSImgDirection",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_MAP_DATUM = TagInfoAscii(
+ public val GPS_TAG_GPS_MAP_DATUM: TagInfoAscii = TagInfoAscii(
0x0012, "GPSMapDatum", -1,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_DEST_LATITUDE_REF = TagInfoAscii(
+ public val GPS_TAG_GPS_DEST_LATITUDE_REF: TagInfoAscii = TagInfoAscii(
0x0013, "GPSDestLatitudeRef", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_NORTH = "N"
- const val GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_SOUTH = "S"
+ public const val GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_NORTH: String = "N"
+ public const val GPS_TAG_GPS_DEST_LATITUDE_REF_VALUE_SOUTH: String = "S"
- val GPS_TAG_GPS_DEST_LATITUDE = TagInfoRationals(
+ public val GPS_TAG_GPS_DEST_LATITUDE: TagInfoRationals = TagInfoRationals(
0x0014, "GPSDestLatitude", 3,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_DEST_LONGITUDE_REF = TagInfoAscii(
+ public val GPS_TAG_GPS_DEST_LONGITUDE_REF: TagInfoAscii = TagInfoAscii(
0x0015, "GPSDestLongitudeRef", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_EAST = "E"
- const val GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_WEST = "W"
+ public const val GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_EAST: String = "E"
+ public const val GPS_TAG_GPS_DEST_LONGITUDE_REF_VALUE_WEST: String = "W"
- val GPS_TAG_GPS_DEST_LONGITUDE = TagInfoRationals(
+ public val GPS_TAG_GPS_DEST_LONGITUDE: TagInfoRationals = TagInfoRationals(
0x0016, "GPSDestLongitude", 3,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_DEST_BEARING_REF = TagInfoAscii(
+ public val GPS_TAG_GPS_DEST_BEARING_REF: TagInfoAscii = TagInfoAscii(
0x0017, "GPSDestBearingRef", 2,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_DEST_BEARING_REF_VALUE_MAGNETIC_NORTH = "M"
- const val GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH = "T"
+ public const val GPS_TAG_GPS_DEST_BEARING_REF_VALUE_MAGNETIC_NORTH: String = "M"
+ public const val GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH: String = "T"
- val GPS_TAG_GPS_DEST_BEARING = TagInfoRational(
+ public val GPS_TAG_GPS_DEST_BEARING: TagInfoRational = TagInfoRational(
0x0018, "GPSDestBearing",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_DEST_DISTANCE = TagInfoRational(
+ public val GPS_TAG_GPS_DEST_DISTANCE: TagInfoRational = TagInfoRational(
0x001a, "GPSDestDistance",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_PROCESSING_METHOD = TagInfoGpsText(
+ public val GPS_TAG_GPS_PROCESSING_METHOD: TagInfoGpsText = TagInfoGpsText(
0x001b, "GPSProcessingMethod",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_AREA_INFORMATION = TagInfoGpsText(
+ public val GPS_TAG_GPS_AREA_INFORMATION: TagInfoGpsText = TagInfoGpsText(
0x001c, "GPSAreaInformation",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_DATE_STAMP = TagInfoAscii(
+ public val GPS_TAG_GPS_DATE_STAMP: TagInfoAscii = TagInfoAscii(
0x001d, "GPSDateStamp", 11,
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- val GPS_TAG_GPS_DIFFERENTIAL = TagInfoShort(
+ public val GPS_TAG_GPS_DIFFERENTIAL: TagInfoShort = TagInfoShort(
0x001e, "GPSDifferential",
TiffDirectoryType.EXIF_DIRECTORY_GPS
)
- const val GPS_TAG_GPS_DIFFERENTIAL_VALUE_NO_CORRECTION = 0
- const val GPS_TAG_GPS_DIFFERENTIAL_VALUE_DIFFERENTIAL_CORRECTED = 1
+ public const val GPS_TAG_GPS_DIFFERENTIAL_VALUE_NO_CORRECTION: Int = 0
+ public const val GPS_TAG_GPS_DIFFERENTIAL_VALUE_DIFFERENTIAL_CORRECTED: Int = 1
- val ALL = listOf(
+ public val ALL: List = listOf(
GPS_TAG_GPS_VERSION_ID, GPS_TAG_GPS_LATITUDE_REF,
GPS_TAG_GPS_LATITUDE, GPS_TAG_GPS_LONGITUDE_REF,
GPS_TAG_GPS_LONGITUDE, GPS_TAG_GPS_ALTITUDE_REF,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/NikonTag.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/NikonTag.kt
index acf53e7b..9fec3d45 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/NikonTag.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/NikonTag.kt
@@ -28,43 +28,43 @@ import com.ashampoo.kim.format.tiff.taginfo.TagInfoUndefineds
* https://exiftool.org/TagNames/Nikon.html
*/
@Suppress("MagicNumber", "LargeClass", "StringLiteralDuplication")
-object NikonTag {
+public object NikonTag {
/*
* TODO This list is incomplete
*/
- val MAKER_NOTE_VERSION = TagInfoUndefineds(
+ public val MAKER_NOTE_VERSION: TagInfoUndefineds = TagInfoUndefineds(
0x0001, "MakerNoteVersion", 4,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_NIKON
)
- val SHUTTER_COUNT = TagInfoLong(
+ public val SHUTTER_COUNT: TagInfoLong = TagInfoLong(
0x00a7, "ShutterCount",
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_NIKON
)
- val AUXILIARY_LENS = TagInfoAscii(
+ public val AUXILIARY_LENS: TagInfoAscii = TagInfoAscii(
0x0082, "AuxiliaryLens", TagInfo.LENGTH_UNKNOWN,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_NIKON
)
- val LENS_TYPE = TagInfoByte(
+ public val LENS_TYPE: TagInfoByte = TagInfoByte(
0x0083, "LensType",
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_NIKON
)
- val LENS = TagInfoRationals(
+ public val LENS: TagInfoRationals = TagInfoRationals(
0x0084, "Lens", 4,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_NIKON
)
- val LENS_F_STOPS = TagInfoUndefineds(
+ public val LENS_F_STOPS: TagInfoUndefineds = TagInfoUndefineds(
0x008b, "LensFStops", 4,
TiffDirectoryType.EXIF_DIRECTORY_MAKER_NOTE_NIKON
)
- val ALL = listOf(
+ public val ALL: List = listOf(
MAKER_NOTE_VERSION, SHUTTER_COUNT,
AUXILIARY_LENS, LENS_TYPE, LENS, LENS_F_STOPS
)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffConstants.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffConstants.kt
index c7f72080..701c3718 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffConstants.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffConstants.kt
@@ -23,56 +23,56 @@ import com.ashampoo.kim.common.ByteOrder
* applications to define parameters for reading and writing TIFF files.
*/
@Suppress("UnderscoresInNumericLiterals")
-object TiffConstants {
+public object TiffConstants {
- const val TIFF_VERSION: Int = 42
+ public const val TIFF_VERSION: Int = 42
/*
* ExifTool defaults to big endian.
* It's more natural to read.
*/
- val DEFAULT_TIFF_BYTE_ORDER = ByteOrder.BIG_ENDIAN
+ public val DEFAULT_TIFF_BYTE_ORDER: ByteOrder = ByteOrder.BIG_ENDIAN
- const val TIFF_HEADER_SIZE = 8
- const val TIFF_DIRECTORY_HEADER_LENGTH = 2
- const val TIFF_DIRECTORY_FOOTER_LENGTH = 4
- const val TIFF_ENTRY_LENGTH = 12
- const val TIFF_ENTRY_MAX_VALUE_LENGTH = 4
+ public const val TIFF_HEADER_SIZE: Int = 8
+ public const val TIFF_DIRECTORY_HEADER_LENGTH: Int = 2
+ public const val TIFF_DIRECTORY_FOOTER_LENGTH: Int = 4
+ public const val TIFF_ENTRY_LENGTH: Int = 12
+ public const val TIFF_ENTRY_MAX_VALUE_LENGTH: Int = 4
/** Root directory */
- const val TIFF_DIRECTORY_TYPE_IFD0 = 0
+ public const val TIFF_DIRECTORY_TYPE_IFD0: Int = 0
/** Thumbnail directory */
- const val TIFF_DIRECTORY_TYPE_IFD1 = 1
+ public const val TIFF_DIRECTORY_TYPE_IFD1: Int = 1
- const val TIFF_DIRECTORY_TYPE_IFD2 = 2
- const val TIFF_DIRECTORY_TYPE_IFD3 = 3
+ public const val TIFF_DIRECTORY_TYPE_IFD2: Int = 2
+ public const val TIFF_DIRECTORY_TYPE_IFD3: Int = 3
- const val EXIF_SUB_IFD1 = 2
- const val EXIF_SUB_IFD2 = 3
- const val EXIF_SUB_IFD3 = 4
+ public const val EXIF_SUB_IFD1: Int = 2
+ public const val EXIF_SUB_IFD2: Int = 3
+ public const val EXIF_SUB_IFD3: Int = 4
- const val TIFF_DIRECTORY_EXIF = -2
- const val TIFF_DIRECTORY_GPS = -3
- const val TIFF_DIRECTORY_INTEROP = -4
+ public const val TIFF_DIRECTORY_EXIF: Int = -2
+ public const val TIFF_DIRECTORY_GPS: Int = -3
+ public const val TIFF_DIRECTORY_INTEROP: Int = -4
- const val DIRECTORY_TYPE_UNKNOWN = -1
+ public const val DIRECTORY_TYPE_UNKNOWN: Int = -1
/* Artificial MakerNote directores */
- const val TIFF_MAKER_NOTE_CANON = -101
- const val TIFF_MAKER_NOTE_NIKON = -102
+ public const val TIFF_MAKER_NOTE_CANON: Int = -101
+ public const val TIFF_MAKER_NOTE_NIKON: Int = -102
- const val FIELD_TYPE_BYTE_INDEX = 1
- const val FIELD_TYPE_ASCII_INDEX = 2
- const val FIELD_TYPE_SHORT_INDEX = 3
- const val FIELD_TYPE_LONG_INDEX = 4
- const val FIELD_TYPE_RATIONAL_INDEX = 5
- const val FIELD_TYPE_SBYTE_INDEX = 6
- const val FIELD_TYPE_UNDEFINED_INDEX = 7
- const val FIELD_TYPE_SSHORT_INDEX = 8
- const val FIELD_TYPE_SLONG_INDEX = 9
- const val FIELD_TYPE_SRATIONAL_INDEX = 10
- const val FIELD_TYPE_FLOAT_INDEX = 11
- const val FIELD_TYPE_DOUBLE_INDEX = 12
- const val FIELD_TYPE_IFD_INDEX = 13
+ public const val FIELD_TYPE_BYTE_INDEX: Int = 1
+ public const val FIELD_TYPE_ASCII_INDEX: Int = 2
+ public const val FIELD_TYPE_SHORT_INDEX: Int = 3
+ public const val FIELD_TYPE_LONG_INDEX: Int = 4
+ public const val FIELD_TYPE_RATIONAL_INDEX: Int = 5
+ public const val FIELD_TYPE_SBYTE_INDEX: Int = 6
+ public const val FIELD_TYPE_UNDEFINED_INDEX: Int = 7
+ public const val FIELD_TYPE_SSHORT_INDEX: Int = 8
+ public const val FIELD_TYPE_SLONG_INDEX: Int = 9
+ public const val FIELD_TYPE_SRATIONAL_INDEX: Int = 10
+ public const val FIELD_TYPE_FLOAT_INDEX: Int = 11
+ public const val FIELD_TYPE_DOUBLE_INDEX: Int = 12
+ public const val FIELD_TYPE_IFD_INDEX: Int = 13
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffDirectoryType.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffDirectoryType.kt
index beb7a30e..16f85962 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffDirectoryType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffDirectoryType.kt
@@ -16,10 +16,10 @@
*/
package com.ashampoo.kim.format.tiff.constant
-enum class TiffDirectoryType(
- val typeId: Int,
- val displayName: String,
- val isImageDirectory: Boolean
+public enum class TiffDirectoryType(
+ public val typeId: Int,
+ public val displayName: String,
+ public val isImageDirectory: Boolean
) {
TIFF_DIRECTORY_IFD0(
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffTag.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffTag.kt
index eceeed5e..301d53e6 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffTag.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/constant/TiffTag.kt
@@ -34,172 +34,172 @@ import com.ashampoo.kim.format.tiff.taginfo.TagInfoShorts
* http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
*/
@Suppress("MagicNumber", "VariableMaxLength", "UnderscoresInNumericLiterals")
-object TiffTag {
+public object TiffTag {
/*
* TODO This list is incomplete
*/
- val TIFF_TAG_NEW_SUBFILE_TYPE = TagInfoLong(
+ public val TIFF_TAG_NEW_SUBFILE_TYPE: TagInfoLong = TagInfoLong(
0xFE, "NewSubfileType",
TIFF_DIRECTORY_IFD0
)
- const val SUBFILE_TYPE_VALUE_FULL_RESOLUTION_IMAGE = 0
- const val SUBFILE_TYPE_VALUE_REDUCED_RESOLUTION_IMAGE = 1
- const val SUBFILE_TYPE_VALUE_SINGLE_PAGE_OF_MULTI_PAGE_IMAGE = 2
- const val SUBFILE_TYPE_VALUE_SINGLE_PAGE_OF_MULTI_PAGE_REDUCED_RESOLUTION_IMAGE = 3
- const val SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK = 4
- const val SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK_OF_REDUCED_RESOLUTION_IMAGE = 5
- const val SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK_OF_MULTI_PAGE_IMAGE = 6
- const val SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK_OF_REDUCED_RESOLUTION_MULTI_PAGE_IMAGE = 7
+ public const val SUBFILE_TYPE_VALUE_FULL_RESOLUTION_IMAGE: Int = 0
+ public const val SUBFILE_TYPE_VALUE_REDUCED_RESOLUTION_IMAGE: Int = 1
+ public const val SUBFILE_TYPE_VALUE_SINGLE_PAGE_OF_MULTI_PAGE_IMAGE: Int = 2
+ public const val SUBFILE_TYPE_VALUE_SINGLE_PAGE_OF_MULTI_PAGE_REDUCED_RESOLUTION_IMAGE: Int = 3
+ public const val SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK: Int = 4
+ public const val SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK_OF_REDUCED_RESOLUTION_IMAGE: Int = 5
+ public const val SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK_OF_MULTI_PAGE_IMAGE: Int = 6
+ public const val SUBFILE_TYPE_VALUE_TRANSPARENCY_MASK_OF_REDUCED_RESOLUTION_MULTI_PAGE_IMAGE: Int = 7
- val TIFF_TAG_SUBFILE_TYPE = TagInfoShort(
+ public val TIFF_TAG_SUBFILE_TYPE: TagInfoShort = TagInfoShort(
0xFF, "SubfileType",
TIFF_DIRECTORY_IFD0
)
- const val OLD_SUBFILE_TYPE_VALUE_FULL_RESOLUTION_IMAGE = 1
- const val OLD_SUBFILE_TYPE_VALUE_REDUCED_RESOLUTION_IMAGE = 2
- const val OLD_SUBFILE_TYPE_VALUE_SINGLE_PAGE_OF_MULTI_PAGE_IMAGE = 3
+ public const val OLD_SUBFILE_TYPE_VALUE_FULL_RESOLUTION_IMAGE: Int = 1
+ public const val OLD_SUBFILE_TYPE_VALUE_REDUCED_RESOLUTION_IMAGE: Int = 2
+ public const val OLD_SUBFILE_TYPE_VALUE_SINGLE_PAGE_OF_MULTI_PAGE_IMAGE: Int = 3
- val TIFF_TAG_IMAGE_WIDTH = TagInfoLong(
+ public val TIFF_TAG_IMAGE_WIDTH: TagInfoLong = TagInfoLong(
0x100, "ImageWidth", TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_IMAGE_LENGTH = TagInfoLong(
+ public val TIFF_TAG_IMAGE_LENGTH: TagInfoLong = TagInfoLong(
0x0101, "ImageLength", TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_BITS_PER_SAMPLE = TagInfoShorts(
+ public val TIFF_TAG_BITS_PER_SAMPLE: TagInfoShorts = TagInfoShorts(
0x0102, "BitsPerSample", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_COMPRESSION = TagInfoShort(
+ public val TIFF_TAG_COMPRESSION: TagInfoShort = TagInfoShort(
0x0103, "Compression",
TIFF_DIRECTORY_IFD0
)
- const val COMPRESSION_VALUE_UNCOMPRESSED = 1
- const val COMPRESSION_VALUE_CCITT_1D = 2
- const val COMPRESSION_VALUE_T4_GROUP_3_FAX = 3
- const val COMPRESSION_VALUE_T6_GROUP_4_FAX = 4
- const val COMPRESSION_VALUE_LZW = 5
- const val COMPRESSION_VALUE_JPEG_OLD_STYLE = 6
- const val COMPRESSION_VALUE_JPEG = 7
- const val COMPRESSION_VALUE_ADOBE_DEFLATE = 8
- const val COMPRESSION_VALUE_JBIG_B_AND_W = 9
- const val COMPRESSION_VALUE_JBIG_COLOR = 10
- const val COMPRESSION_VALUE_NEXT = 32766
- const val COMPRESSION_VALUE_EPSON_ERF_COMPRESSED = 32769
- const val COMPRESSION_VALUE_CCIRLEW = 32771
- const val COMPRESSION_VALUE_PACK_BITS = 32773
- const val COMPRESSION_VALUE_THUNDERSCAN = 32809
- const val COMPRESSION_VALUE_IT8CTPAD = 32895
- const val COMPRESSION_VALUE_IT8LW = 32896
- const val COMPRESSION_VALUE_IT8MP = 32897
- const val COMPRESSION_VALUE_IT8BL = 32898
- const val COMPRESSION_VALUE_PIXAR_FILM = 32908
- const val COMPRESSION_VALUE_PIXAR_LOG = 32909
- const val COMPRESSION_VALUE_DEFLATE = 32946
- const val COMPRESSION_VALUE_DCS = 32947
- const val COMPRESSION_VALUE_JBIG = 34661
- const val COMPRESSION_VALUE_SGILOG = 34676
- const val COMPRESSION_VALUE_SGILOG_24 = 34677
- const val COMPRESSION_VALUE_JPEG_2000 = 34712
- const val COMPRESSION_VALUE_NIKON_NEF_COMPRESSED = 34713
- const val COMPRESSION_VALUE_KODAK_DCR_COMPRESSED = 65000
- const val COMPRESSION_VALUE_PENTAX_PEF_COMPRESSED = 65535
-
- val TIFF_TAG_PHOTOMETRIC_INTERPRETATION = TagInfoShort(
+ public const val COMPRESSION_VALUE_UNCOMPRESSED: Int = 1
+ public const val COMPRESSION_VALUE_CCITT_1D: Int = 2
+ public const val COMPRESSION_VALUE_T4_GROUP_3_FAX: Int = 3
+ public const val COMPRESSION_VALUE_T6_GROUP_4_FAX: Int = 4
+ public const val COMPRESSION_VALUE_LZW: Int = 5
+ public const val COMPRESSION_VALUE_JPEG_OLD_STYLE: Int = 6
+ public const val COMPRESSION_VALUE_JPEG: Int = 7
+ public const val COMPRESSION_VALUE_ADOBE_DEFLATE: Int = 8
+ public const val COMPRESSION_VALUE_JBIG_B_AND_W: Int = 9
+ public const val COMPRESSION_VALUE_JBIG_COLOR: Int = 10
+ public const val COMPRESSION_VALUE_NEXT: Int = 32766
+ public const val COMPRESSION_VALUE_EPSON_ERF_COMPRESSED: Int = 32769
+ public const val COMPRESSION_VALUE_CCIRLEW: Int = 32771
+ public const val COMPRESSION_VALUE_PACK_BITS: Int = 32773
+ public const val COMPRESSION_VALUE_THUNDERSCAN: Int = 32809
+ public const val COMPRESSION_VALUE_IT8CTPAD: Int = 32895
+ public const val COMPRESSION_VALUE_IT8LW: Int = 32896
+ public const val COMPRESSION_VALUE_IT8MP: Int = 32897
+ public const val COMPRESSION_VALUE_IT8BL: Int = 32898
+ public const val COMPRESSION_VALUE_PIXAR_FILM: Int = 32908
+ public const val COMPRESSION_VALUE_PIXAR_LOG: Int = 32909
+ public const val COMPRESSION_VALUE_DEFLATE: Int = 32946
+ public const val COMPRESSION_VALUE_DCS: Int = 32947
+ public const val COMPRESSION_VALUE_JBIG: Int = 34661
+ public const val COMPRESSION_VALUE_SGILOG: Int = 34676
+ public const val COMPRESSION_VALUE_SGILOG_24: Int = 34677
+ public const val COMPRESSION_VALUE_JPEG_2000: Int = 34712
+ public const val COMPRESSION_VALUE_NIKON_NEF_COMPRESSED: Int = 34713
+ public const val COMPRESSION_VALUE_KODAK_DCR_COMPRESSED: Int = 65000
+ public const val COMPRESSION_VALUE_PENTAX_PEF_COMPRESSED: Int = 65535
+
+ public val TIFF_TAG_PHOTOMETRIC_INTERPRETATION: TagInfoShort = TagInfoShort(
0x106, "PhotometricInterpretation",
TIFF_DIRECTORY_IFD0
)
- const val PHOTOMETRIC_INTERPRETATION_VALUE_WHITE_IS_ZERO = 0
- const val PHOTOMETRIC_INTERPRETATION_VALUE_BLACK_IS_ZERO = 1
- const val PHOTOMETRIC_INTERPRETATION_VALUE_RGB = 2
- const val PHOTOMETRIC_INTERPRETATION_VALUE_RGB_PALETTE = 3
- const val PHOTOMETRIC_INTERPRETATION_VALUE_TRANSPARENCY_MASK = 4
- const val PHOTOMETRIC_INTERPRETATION_VALUE_CMYK = 5
- const val PHOTOMETRIC_INTERPRETATION_VALUE_YCB_CR = 6
- const val PHOTOMETRIC_INTERPRETATION_VALUE_CIELAB = 8
- const val PHOTOMETRIC_INTERPRETATION_VALUE_ICCLAB = 9
- const val PHOTOMETRIC_INTERPRETATION_VALUE_ITULAB = 10
- const val PHOTOMETRIC_INTERPRETATION_VALUE_COLOR_FILTER_ARRAY = 32803
- const val PHOTOMETRIC_INTERPRETATION_VALUE_PIXAR_LOG_L = 32844
- const val PHOTOMETRIC_INTERPRETATION_VALUE_PIXAR_LOG_LUV = 32845
- const val PHOTOMETRIC_INTERPRETATION_VALUE_LINEAR_RAW = 34892
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_WHITE_IS_ZERO: Int = 0
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_BLACK_IS_ZERO: Int = 1
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_RGB: Int = 2
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_RGB_PALETTE: Int = 3
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_TRANSPARENCY_MASK: Int = 4
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_CMYK: Int = 5
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_YCB_CR: Int = 6
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_CIELAB: Int = 8
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_ICCLAB: Int = 9
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_ITULAB: Int = 10
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_COLOR_FILTER_ARRAY: Int = 32803
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_PIXAR_LOG_L: Int = 32844
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_PIXAR_LOG_LUV: Int = 32845
+ public const val PHOTOMETRIC_INTERPRETATION_VALUE_LINEAR_RAW: Int = 34892
- val TIFF_TAG_THRESHHOLDING = TagInfoShort(
+ public val TIFF_TAG_THRESHHOLDING: TagInfoShort = TagInfoShort(
0x107, "Threshholding",
TIFF_DIRECTORY_IFD0
)
- const val THRESHOLDING_VALUE_NO_DITHERING_OR_HALFTONING = 1
- const val THRESHOLDING_VALUE_ORDERED_DITHER_OR_HALFTONE = 2
- const val THRESHOLDING_VALUE_RANDOMIZED_DITHER = 3
+ public const val THRESHOLDING_VALUE_NO_DITHERING_OR_HALFTONING: Int = 1
+ public const val THRESHOLDING_VALUE_ORDERED_DITHER_OR_HALFTONE: Int = 2
+ public const val THRESHOLDING_VALUE_RANDOMIZED_DITHER: Int = 3
- val TIFF_TAG_CELL_WIDTH = TagInfoShort(
+ public val TIFF_TAG_CELL_WIDTH: TagInfoShort = TagInfoShort(
0x108, "CellWidth",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_CELL_LENGTH = TagInfoShort(
+ public val TIFF_TAG_CELL_LENGTH: TagInfoShort = TagInfoShort(
0x109, "CellLength",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_FILL_ORDER = TagInfoShort(
+ public val TIFF_TAG_FILL_ORDER: TagInfoShort = TagInfoShort(
0x10A, "FillOrder",
TIFF_DIRECTORY_IFD0
)
- const val FILL_ORDER_VALUE_NORMAL = 1
- const val FILL_ORDER_VALUE_REVERSED = 2
+ public const val FILL_ORDER_VALUE_NORMAL: Int = 1
+ public const val FILL_ORDER_VALUE_REVERSED: Int = 2
- val TIFF_TAG_DOCUMENT_NAME = TagInfoAscii(
+ public val TIFF_TAG_DOCUMENT_NAME: TagInfoAscii = TagInfoAscii(
0x10D, "DocumentName", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_IMAGE_DESCRIPTION = TagInfoAscii(
+ public val TIFF_TAG_IMAGE_DESCRIPTION: TagInfoAscii = TagInfoAscii(
0x10E, "ImageDescription", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_MAKE = TagInfoAscii(
+ public val TIFF_TAG_MAKE: TagInfoAscii = TagInfoAscii(
0x10F, "Make", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_MODEL = TagInfoAscii(
+ public val TIFF_TAG_MODEL: TagInfoAscii = TagInfoAscii(
0x0110, "Model", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_STRIP_OFFSETS = TagInfoLong(
+ public val TIFF_TAG_STRIP_OFFSETS: TagInfoLong = TagInfoLong(
0x0111, "StripOffsets",
TIFF_DIRECTORY_IFD0,
isOffset = true
)
- val TIFF_TAG_ORIENTATION = TagInfoShort(
+ public val TIFF_TAG_ORIENTATION: TagInfoShort = TagInfoShort(
0x0112, "Orientation",
TIFF_DIRECTORY_IFD0
)
- const val ORIENTATION_VALUE_HORIZONTAL_NORMAL = 1
- const val ORIENTATION_VALUE_MIRROR_HORIZONTAL = 2
- const val ORIENTATION_VALUE_ROTATE_180 = 3
- const val ORIENTATION_VALUE_MIRROR_VERTICAL = 4
- const val ORIENTATION_VALUE_MIRROR_HORIZONTAL_AND_ROTATE_270_CW = 5
- const val ORIENTATION_VALUE_ROTATE_90_CW = 6
- const val ORIENTATION_VALUE_MIRROR_HORIZONTAL_AND_ROTATE_90_CW = 7
- const val ORIENTATION_VALUE_ROTATE_270_CW = 8
+ public const val ORIENTATION_VALUE_HORIZONTAL_NORMAL: Int = 1
+ public const val ORIENTATION_VALUE_MIRROR_HORIZONTAL: Int = 2
+ public const val ORIENTATION_VALUE_ROTATE_180: Int = 3
+ public const val ORIENTATION_VALUE_MIRROR_VERTICAL: Int = 4
+ public const val ORIENTATION_VALUE_MIRROR_HORIZONTAL_AND_ROTATE_270_CW: Int = 5
+ public const val ORIENTATION_VALUE_ROTATE_90_CW: Int = 6
+ public const val ORIENTATION_VALUE_MIRROR_HORIZONTAL_AND_ROTATE_90_CW: Int = 7
+ public const val ORIENTATION_VALUE_ROTATE_270_CW: Int = 8
- val TIFF_TAG_SAMPLES_PER_PIXEL = TagInfoShort(
+ public val TIFF_TAG_SAMPLES_PER_PIXEL: TagInfoShort = TagInfoShort(
0x0115, "SamplesPerPixel",
TIFF_DIRECTORY_IFD0
)
@@ -210,158 +210,158 @@ object TiffTag {
* With JPEG compressed data this designation is not needed and is omitted.
* See also and .
*/
- val TIFF_TAG_ROWS_PER_STRIP = TagInfoLong(
+ public val TIFF_TAG_ROWS_PER_STRIP: TagInfoLong = TagInfoLong(
0x0116, "RowsPerStrip", TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_STRIP_BYTE_COUNTS = TagInfoLong(
+ public val TIFF_TAG_STRIP_BYTE_COUNTS: TagInfoLong = TagInfoLong(
0x0117, "StripByteCounts",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_MIN_SAMPLE_VALUE = TagInfoShorts(
+ public val TIFF_TAG_MIN_SAMPLE_VALUE: TagInfoShorts = TagInfoShorts(
0x0118, "MinSampleValue", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_MAX_SAMPLE_VALUE = TagInfoShorts(
+ public val TIFF_TAG_MAX_SAMPLE_VALUE: TagInfoShorts = TagInfoShorts(
0x0119, "MaxSampleValue", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_XRESOLUTION = TagInfoRational(
+ public val TIFF_TAG_XRESOLUTION: TagInfoRational = TagInfoRational(
0x011A, "XResolution",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_YRESOLUTION = TagInfoRational(
+ public val TIFF_TAG_YRESOLUTION: TagInfoRational = TagInfoRational(
0x011B, "YResolution",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_PLANAR_CONFIGURATION = TagInfoShort(
+ public val TIFF_TAG_PLANAR_CONFIGURATION: TagInfoShort = TagInfoShort(
0x11C, "PlanarConfiguration",
TIFF_DIRECTORY_IFD0
)
- const val PLANAR_CONFIGURATION_VALUE_CHUNKY = 1
- const val PLANAR_CONFIGURATION_VALUE_PLANAR = 2
+ public const val PLANAR_CONFIGURATION_VALUE_CHUNKY: Int = 1
+ public const val PLANAR_CONFIGURATION_VALUE_PLANAR: Int = 2
- val TIFF_TAG_PAGE_NAME = TagInfoAscii(
+ public val TIFF_TAG_PAGE_NAME: TagInfoAscii = TagInfoAscii(
0x11D, "PageName", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_XPOSITION = TagInfoRationals(
+ public val TIFF_TAG_XPOSITION: TagInfoRationals = TagInfoRationals(
0x11E, "XPosition", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_YPOSITION = TagInfoRationals(
+ public val TIFF_TAG_YPOSITION: TagInfoRationals = TagInfoRationals(
0x11F, "YPosition", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_FREE_OFFSETS = TagInfoLongs(
+ public val TIFF_TAG_FREE_OFFSETS: TagInfoLongs = TagInfoLongs(
0x120, "FreeOffsets", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_FREE_BYTE_COUNTS = TagInfoLongs(
+ public val TIFF_TAG_FREE_BYTE_COUNTS: TagInfoLongs = TagInfoLongs(
0x121, "FreeByteCounts", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_GRAY_RESPONSE_UNIT = TagInfoShort(
+ public val TIFF_TAG_GRAY_RESPONSE_UNIT: TagInfoShort = TagInfoShort(
0x122, "GrayResponseUnit",
TIFF_DIRECTORY_IFD0
)
- const val GRAY_RESPONSE_UNIT_VALUE_0_1 = 1
- const val GRAY_RESPONSE_UNIT_VALUE_0_01 = 2
- const val GRAY_RESPONSE_UNIT_VALUE_0_001 = 3
- const val GRAY_RESPONSE_UNIT_VALUE_0_0001 = 4
- const val GRAY_RESPONSE_UNIT_VALUE_0_00001 = 5
+ public const val GRAY_RESPONSE_UNIT_VALUE_0_1: Int = 1
+ public const val GRAY_RESPONSE_UNIT_VALUE_0_01: Int = 2
+ public const val GRAY_RESPONSE_UNIT_VALUE_0_001: Int = 3
+ public const val GRAY_RESPONSE_UNIT_VALUE_0_0001: Int = 4
+ public const val GRAY_RESPONSE_UNIT_VALUE_0_00001: Int = 5
- val TIFF_TAG_GRAY_RESPONSE_CURVE = TagInfoShorts(
+ public val TIFF_TAG_GRAY_RESPONSE_CURVE: TagInfoShorts = TagInfoShorts(
0x123, "GrayResponseCurve", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_T4_OPTIONS = TagInfoLong(
+ public val TIFF_TAG_T4_OPTIONS: TagInfoLong = TagInfoLong(
0x124, "T4Options",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_T6_OPTIONS = TagInfoLong(
+ public val TIFF_TAG_T6_OPTIONS: TagInfoLong = TagInfoLong(
0x125, "T6Options",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_RESOLUTION_UNIT = TagInfoShort(
+ public val TIFF_TAG_RESOLUTION_UNIT: TagInfoShort = TagInfoShort(
0x128, "ResolutionUnit",
TIFF_DIRECTORY_IFD0
)
- const val RESOLUTION_UNIT_VALUE_NONE = 1
- const val RESOLUTION_UNIT_VALUE_INCHES = 2
- const val RESOLUTION_UNIT_VALUE_CM = 3
+ public const val RESOLUTION_UNIT_VALUE_NONE: Int = 1
+ public const val RESOLUTION_UNIT_VALUE_INCHES: Int = 2
+ public const val RESOLUTION_UNIT_VALUE_CM: Int = 3
- val TIFF_TAG_PAGE_NUMBER = TagInfoShorts(
+ public val TIFF_TAG_PAGE_NUMBER: TagInfoShorts = TagInfoShorts(
0x129, "PageNumber", 2,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_TRANSFER_FUNCTION = TagInfoShorts(
+ public val TIFF_TAG_TRANSFER_FUNCTION: TagInfoShorts = TagInfoShorts(
0x12D, "TransferFunction", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_SOFTWARE = TagInfoAscii(
+ public val TIFF_TAG_SOFTWARE: TagInfoAscii = TagInfoAscii(
0x131, "Software", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_DATE_TIME = TagInfoAscii(
+ public val TIFF_TAG_DATE_TIME: TagInfoAscii = TagInfoAscii(
0x132, "ModifyDate", 20,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_ARTIST = TagInfoAscii(
+ public val TIFF_TAG_ARTIST: TagInfoAscii = TagInfoAscii(
0x13B, "Artist", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_HOST_COMPUTER = TagInfoAscii(
+ public val TIFF_TAG_HOST_COMPUTER: TagInfoAscii = TagInfoAscii(
0x13C, "HostComputer", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_PREDICTOR = TagInfoShort(
+ public val TIFF_TAG_PREDICTOR: TagInfoShort = TagInfoShort(
0x13D, "Predictor",
TIFF_DIRECTORY_IFD0
)
- const val PREDICTOR_VALUE_NONE = 1
- const val PREDICTOR_VALUE_HORIZONTAL_DIFFERENCING = 2
- const val PREDICTOR_VALUE_FLOATING_POINT_DIFFERENCING = 3
+ public const val PREDICTOR_VALUE_NONE: Int = 1
+ public const val PREDICTOR_VALUE_HORIZONTAL_DIFFERENCING: Int = 2
+ public const val PREDICTOR_VALUE_FLOATING_POINT_DIFFERENCING: Int = 3
- val TIFF_TAG_WHITE_POINT = TagInfoRationals(
+ public val TIFF_TAG_WHITE_POINT: TagInfoRationals = TagInfoRationals(
0x13E, "WhitePoint", 2,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_PRIMARY_CHROMATICITIES = TagInfoRationals(
+ public val TIFF_TAG_PRIMARY_CHROMATICITIES: TagInfoRationals = TagInfoRationals(
0x13F, "PrimaryChromaticities", 6,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_COLOR_MAP = TagInfoShorts(
+ public val TIFF_TAG_COLOR_MAP: TagInfoShorts = TagInfoShorts(
0x140, "ColorMap", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_HALFTONE_HINTS = TagInfoShorts(
+ public val TIFF_TAG_HALFTONE_HINTS: TagInfoShorts = TagInfoShorts(
0x141, "HalftoneHints", 2,
TIFF_DIRECTORY_IFD0
)
@@ -370,7 +370,7 @@ object TiffTag {
* The tile width in pixels.
* This is the number of columns in each tile.
*/
- val TIFF_TAG_TILE_WIDTH = TagInfoLong(
+ public val TIFF_TAG_TILE_WIDTH: TagInfoLong = TagInfoLong(
0x142, "TileWidth", TIFF_DIRECTORY_IFD0
)
@@ -378,33 +378,33 @@ object TiffTag {
* The tile length (height) in pixels.
* This is the number of rows in each tile.
*/
- val TIFF_TAG_TILE_LENGTH = TagInfoLong(
+ public val TIFF_TAG_TILE_LENGTH: TagInfoLong = TagInfoLong(
0x143, "TileLength", TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_TILE_OFFSETS = TagInfoLongs(
+ public val TIFF_TAG_TILE_OFFSETS: TagInfoLongs = TagInfoLongs(
0x144, "TileOffsets", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0, true
)
- val TIFF_TAG_TILE_BYTE_COUNTS = TagInfoLong(
+ public val TIFF_TAG_TILE_BYTE_COUNTS: TagInfoLong = TagInfoLong(
0x145, "TileByteCounts", TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_INK_SET = TagInfoShort(
+ public val TIFF_TAG_INK_SET: TagInfoShort = TagInfoShort(
0x14C, "InkSet",
TIFF_DIRECTORY_IFD0
)
- const val INK_SET_VALUE_CMYK = 1
- const val INK_SET_VALUE_NOT_CMYK = 2
+ public const val INK_SET_VALUE_CMYK: Int = 1
+ public const val INK_SET_VALUE_NOT_CMYK: Int = 2
- val TIFF_TAG_INK_NAMES = TagInfoAscii(
+ public val TIFF_TAG_INK_NAMES: TagInfoAscii = TagInfoAscii(
0x14D, "InkNames", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_NUMBER_OF_INKS = TagInfoShort(
+ public val TIFF_TAG_NUMBER_OF_INKS: TagInfoShort = TagInfoShort(
0x14E, "NumberOfInks",
TIFF_DIRECTORY_IFD0
)
@@ -412,39 +412,39 @@ object TiffTag {
/**
* The component values that correspond to a 0% dot and 100% dot.
*/
- val TIFF_TAG_DOT_RANGE = TagInfoByte(
+ public val TIFF_TAG_DOT_RANGE: TagInfoByte = TagInfoByte(
0x150, "DotRange", TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_TARGET_PRINTER = TagInfoAscii(
+ public val TIFF_TAG_TARGET_PRINTER: TagInfoAscii = TagInfoAscii(
0x151, "TargetPrinter", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_EXTRA_SAMPLES = TagInfoShorts(
+ public val TIFF_TAG_EXTRA_SAMPLES: TagInfoShorts = TagInfoShorts(
0x152, "ExtraSamples", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- const val EXTRA_SAMPLE_ASSOCIATED_ALPHA = 1
- const val EXTRA_SAMPLE_UNASSOCIATED_ALPHA = 2
+ public const val EXTRA_SAMPLE_ASSOCIATED_ALPHA: Int = 1
+ public const val EXTRA_SAMPLE_UNASSOCIATED_ALPHA: Int = 2
- val TIFF_TAG_SAMPLE_FORMAT = TagInfoShorts(
+ public val TIFF_TAG_SAMPLE_FORMAT: TagInfoShorts = TagInfoShorts(
0x153, "SampleFormat", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- const val SAMPLE_FORMAT_VALUE_UNSIGNED_INTEGER = 1
- const val SAMPLE_FORMAT_VALUE_TWOS_COMPLEMENT_SIGNED_INTEGER = 2
- const val SAMPLE_FORMAT_VALUE_IEEE_FLOATING_POINT = 3
- const val SAMPLE_FORMAT_VALUE_UNDEFINED = 4
- const val SAMPLE_FORMAT_VALUE_COMPLEX_INTEGER = 5
- const val SAMPLE_FORMAT_VALUE_IEEE_COMPLEX_FLOAT = 6
+ public const val SAMPLE_FORMAT_VALUE_UNSIGNED_INTEGER: Int = 1
+ public const val SAMPLE_FORMAT_VALUE_TWOS_COMPLEMENT_SIGNED_INTEGER: Int = 2
+ public const val SAMPLE_FORMAT_VALUE_IEEE_FLOATING_POINT: Int = 3
+ public const val SAMPLE_FORMAT_VALUE_UNDEFINED: Int = 4
+ public const val SAMPLE_FORMAT_VALUE_COMPLEX_INTEGER: Int = 5
+ public const val SAMPLE_FORMAT_VALUE_IEEE_COMPLEX_FLOAT: Int = 6
/**
* This field specifies the minimum sample value.
*/
- val TIFF_TAG_SMIN_SAMPLE_VALUE = TagInfoShort(
+ public val TIFF_TAG_SMIN_SAMPLE_VALUE: TagInfoShort = TagInfoShort(
0x154, "SMinSampleValue",
TIFF_DIRECTORY_IFD0
)
@@ -452,23 +452,23 @@ object TiffTag {
/**
* This field specifies the maximum sample value.
*/
- val TIFF_TAG_SMAX_SAMPLE_VALUE = TagInfoShort(
+ public val TIFF_TAG_SMAX_SAMPLE_VALUE: TagInfoShort = TagInfoShort(
0x155, "SMaxSampleValue",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_TRANSFER_RANGE = TagInfoShorts(
+ public val TIFF_TAG_TRANSFER_RANGE: TagInfoShorts = TagInfoShorts(
0x156, "TransferRange", 6,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_JPEG_PROC = TagInfoShort(
+ public val TIFF_TAG_JPEG_PROC: TagInfoShort = TagInfoShort(
0x200, "JPEGProc",
TIFF_DIRECTORY_IFD0
)
- const val JPEGPROC_VALUE_BASELINE = 1
- const val JPEGPROC_VALUE_LOSSLESS = 14
+ public const val JPEGPROC_VALUE_BASELINE: Int = 1
+ public const val JPEGPROC_VALUE_LOSSLESS: Int = 14
/**
* This marks where the thumbnail starts.
@@ -477,87 +477,87 @@ object TiffTag {
* "ThumbnailOffset", "PreviewImageStart", "JpgFromRawStart"
* and "OtherImageStart".
*/
- val TIFF_TAG_JPEG_INTERCHANGE_FORMAT = TagInfoLong(
+ public val TIFF_TAG_JPEG_INTERCHANGE_FORMAT: TagInfoLong = TagInfoLong(
0x0201, "JPEGInterchangeFormat",
TIFF_DIRECTORY_IFD0, true
)
- val TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = TagInfoLong(
+ public val TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH: TagInfoLong = TagInfoLong(
0x0202, "JPEGInterchangeFormatLength",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_JPEG_RESTART_INTERVAL = TagInfoShort(
+ public val TIFF_TAG_JPEG_RESTART_INTERVAL: TagInfoShort = TagInfoShort(
0x203, "JPEGRestartInterval",
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_JPEG_LOSSLESS_PREDICTORS = TagInfoShorts(
+ public val TIFF_TAG_JPEG_LOSSLESS_PREDICTORS: TagInfoShorts = TagInfoShorts(
0x205, "JPEGLosslessPredictors", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_JPEG_POINT_TRANSFORMS = TagInfoShorts(
+ public val TIFF_TAG_JPEG_POINT_TRANSFORMS: TagInfoShorts = TagInfoShorts(
0x206, "JPEGPointTransforms", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_JPEG_QTABLES = TagInfoLongs(
+ public val TIFF_TAG_JPEG_QTABLES: TagInfoLongs = TagInfoLongs(
0x207, "JPEGQTables", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_JPEG_DCTABLES = TagInfoLongs(
+ public val TIFF_TAG_JPEG_DCTABLES: TagInfoLongs = TagInfoLongs(
0x208, "JPEGDCTables", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_JPEG_ACTABLES = TagInfoLongs(
+ public val TIFF_TAG_JPEG_ACTABLES: TagInfoLongs = TagInfoLongs(
0x209, "JPEGACTables", TagInfo.LENGTH_UNKNOWN,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_YCBCR_COEFFICIENTS = TagInfoRationals(
+ public val TIFF_TAG_YCBCR_COEFFICIENTS: TagInfoRationals = TagInfoRationals(
0x211, "YCbCrCoefficients", 3,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_YCBCR_SUB_SAMPLING = TagInfoShorts(
+ public val TIFF_TAG_YCBCR_SUB_SAMPLING: TagInfoShorts = TagInfoShorts(
0x212, "YCbCrSubSampling", 2,
TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_YCBCR_POSITIONING = TagInfoShort(
+ public val TIFF_TAG_YCBCR_POSITIONING: TagInfoShort = TagInfoShort(
0x213, "YCbCrPositioning",
TIFF_DIRECTORY_IFD0
)
- const val YCB_CR_POSITIONING_VALUE_CENTERED = 1
- const val YCB_CR_POSITIONING_VALUE_CO_SITED = 2
+ public const val YCB_CR_POSITIONING_VALUE_CENTERED: Int = 1
+ public const val YCB_CR_POSITIONING_VALUE_CO_SITED: Int = 2
- val TIFF_TAG_REFERENCE_BLACK_WHITE = TagInfoLongs(
+ public val TIFF_TAG_REFERENCE_BLACK_WHITE: TagInfoLongs = TagInfoLongs(
0x214, "ReferenceBlackWhite", TagInfo.LENGTH_UNKNOWN, TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_COPYRIGHT = TagInfoAscii(
+ public val TIFF_TAG_COPYRIGHT: TagInfoAscii = TagInfoAscii(
0x8298, "Copyright", TagInfo.LENGTH_UNKNOWN, TIFF_DIRECTORY_IFD0
)
- val TIFF_TAG_XMP = TagInfoBytes(
+ public val TIFF_TAG_XMP: TagInfoBytes = TagInfoBytes(
0x2BC, "XMP", TagInfo.LENGTH_UNKNOWN, TIFF_DIRECTORY_IFD0
)
/** Panasonic RW2 special tag. */
- val TIFF_TAG_JPG_FROM_RAW = TagInfoBytes(
+ public val TIFF_TAG_JPG_FROM_RAW: TagInfoBytes = TagInfoBytes(
0x002E, "JpgFromRaw", TagInfo.LENGTH_UNKNOWN, TIFF_DIRECTORY_IFD0
)
/** Required field for all DNGs. Can be used to detect if TIFF is a DNG. */
- val TIFF_TAG_DNG_VERSION = TagInfoBytes(
+ public val TIFF_TAG_DNG_VERSION: TagInfoBytes = TagInfoBytes(
0xC612, "DNGVersion", 4, TIFF_DIRECTORY_IFD0
)
- val ALL = listOf(
+ public val ALL: List = listOf(
TIFF_TAG_NEW_SUBFILE_TYPE, TIFF_TAG_SUBFILE_TYPE,
TIFF_TAG_IMAGE_WIDTH, TIFF_TAG_IMAGE_LENGTH,
TIFF_TAG_BITS_PER_SAMPLE, TIFF_TAG_COMPRESSION,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldType.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldType.kt
index 9a6ba1b0..db770245 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldType.kt
@@ -32,22 +32,22 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants.FIELD_TYPE_SRATIONAL_
import com.ashampoo.kim.format.tiff.constant.TiffConstants.FIELD_TYPE_SSHORT_INDEX
import com.ashampoo.kim.format.tiff.constant.TiffConstants.FIELD_TYPE_UNDEFINED_INDEX
-interface FieldType {
+public interface FieldType {
- val type: Int
+ public val type: Int
- val name: String
+ public val name: String
- val size: Int
+ public val size: Int
- fun getValue(bytes: ByteArray, byteOrder: ByteOrder): T
+ public fun getValue(bytes: ByteArray, byteOrder: ByteOrder): T
- fun writeData(data: Any, byteOrder: ByteOrder): ByteArray
+ public fun writeData(data: Any, byteOrder: ByteOrder): ByteArray
- companion object {
+ public companion object {
@kotlin.jvm.JvmStatic
- fun getFieldType(type: Int): FieldType =
+ public fun getFieldType(type: Int): FieldType =
when (type) {
FIELD_TYPE_BYTE_INDEX -> FieldTypeByte
FIELD_TYPE_ASCII_INDEX -> FieldTypeAscii
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeAscii.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeAscii.kt
index 64fdf009..d78e2893 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeAscii.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeAscii.kt
@@ -26,7 +26,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
* 8-bit byte that contains a 7-bit ASCII code;
* the last byte must be NUL (binary zero).
*/
-data object FieldTypeAscii : FieldType {
+public data object FieldTypeAscii : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_ASCII_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeByte.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeByte.kt
index ed2a9e42..4f624f8a 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeByte.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeByte.kt
@@ -23,7 +23,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
/**
* 8-bit unsigned integer.
*/
-data object FieldTypeByte : FieldType {
+public data object FieldTypeByte : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_BYTE_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeDouble.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeDouble.kt
index 451dceae..3f7f79e0 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeDouble.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeDouble.kt
@@ -25,7 +25,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
/**
* Double precision (8-byte) IEEE format.
*/
-object FieldTypeDouble : FieldType {
+public object FieldTypeDouble : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_DOUBLE_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeFloat.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeFloat.kt
index c905ffdf..4fe8aace 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeFloat.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeFloat.kt
@@ -25,7 +25,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
/**
* Single precision (4-byte) IEEE format.
*/
-object FieldTypeFloat : FieldType {
+public object FieldTypeFloat : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_FLOAT_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeIfd.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeIfd.kt
index 4863f285..831d0543 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeIfd.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeIfd.kt
@@ -22,7 +22,7 @@ import com.ashampoo.kim.common.toBytes
import com.ashampoo.kim.common.toInts
import com.ashampoo.kim.format.tiff.constant.TiffConstants
-data object FieldTypeIfd : FieldType {
+public data object FieldTypeIfd : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_IFD_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeLong.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeLong.kt
index 687fbf39..5bc104ae 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeLong.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeLong.kt
@@ -25,7 +25,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants.FIELD_TYPE_LONG_INDEX
/**
* 32-bit (4-byte) unsigned integer.
*/
-data object FieldTypeLong : FieldType {
+public data object FieldTypeLong : FieldType {
override val type: Int = FIELD_TYPE_LONG_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeRational.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeRational.kt
index aec7fb3a..46c8b9cd 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeRational.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeRational.kt
@@ -26,7 +26,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
* Two LONGs: the first represents the numerator of a
* fraction; the second, the denominator.
*/
-object FieldTypeRational : FieldType {
+public object FieldTypeRational : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_RATIONAL_INDEX
@@ -35,16 +35,8 @@ object FieldTypeRational : FieldType {
override val size: Int = 8
override fun getValue(bytes: ByteArray, byteOrder: ByteOrder): RationalNumbers =
- bytes.toRationals(byteOrder, unsignedType = true)
+ bytes.toRationals(unsignedType = true, byteOrder)
override fun writeData(data: Any, byteOrder: ByteOrder): ByteArray =
(data as RationalNumbers).toBytes(byteOrder)
-
-// val rationalNumbers = arrayOfNulls(data.size)
-//
-// repeat(rationalNumbers.size) { i ->
-// rationalNumbers[i] = valueOf(i.toDouble())
-// }
-//
-// return (rationalNumbers as Array).toBytes(byteOrder)
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSByte.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSByte.kt
index 8235e929..b2314a8c 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSByte.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSByte.kt
@@ -23,7 +23,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
/**
* An 8-bit signed (twos-complement) integer.
*/
-data object FieldTypeSByte : FieldType {
+public data object FieldTypeSByte : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_SBYTE_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSLong.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSLong.kt
index 6c5286c3..92fe0b45 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSLong.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSLong.kt
@@ -27,7 +27,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
*
* Hint: Signed 4 Bytes are in Kotlin a normal Integer.
*/
-data object FieldTypeSLong : FieldType {
+public data object FieldTypeSLong : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_SLONG_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSRational.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSRational.kt
index 28cca47a..029e0a33 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSRational.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSRational.kt
@@ -26,7 +26,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
* Two SLONG’s: the first represents the numerator of a
* fraction, the second the denominator.
*/
-object FieldTypeSRational : FieldType {
+public object FieldTypeSRational : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_SRATIONAL_INDEX
@@ -35,7 +35,7 @@ object FieldTypeSRational : FieldType {
override val size: Int = 8
override fun getValue(bytes: ByteArray, byteOrder: ByteOrder): RationalNumbers =
- bytes.toRationals(byteOrder, unsignedType = false)
+ bytes.toRationals(unsignedType = false, byteOrder)
override fun writeData(data: Any, byteOrder: ByteOrder): ByteArray =
(data as RationalNumbers).toBytes(byteOrder)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSShort.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSShort.kt
index 62f3971b..0a04ac09 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSShort.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeSShort.kt
@@ -25,7 +25,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
/**
* A 16-bit (2-byte) signed (twos-complement) integer.
*/
-object FieldTypeSShort : FieldType {
+public object FieldTypeSShort : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_SSHORT_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeShort.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeShort.kt
index cf4af25a..8bda1023 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeShort.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeShort.kt
@@ -25,7 +25,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
/**
* 16-bit (2-byte) unsigned integer.
*/
-data object FieldTypeShort : FieldType {
+public data object FieldTypeShort : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_SHORT_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeUndefined.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeUndefined.kt
index 9aef759f..e6715142 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeUndefined.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/fieldtype/FieldTypeUndefined.kt
@@ -24,7 +24,7 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants
* An 8-bit byte that may contain anything,
* depending on the definition of the field.
*/
-data object FieldTypeUndefined : FieldType {
+public data object FieldTypeUndefined : FieldType {
override val type: Int = TiffConstants.FIELD_TYPE_UNDEFINED_INDEX
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoKey.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoKey.kt
index b42ba58d..f8db1f8d 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoKey.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoKey.kt
@@ -21,8 +21,8 @@ import kotlin.jvm.JvmStatic
* See http://geotiff.maptools.org/spec/geotiff6.html
*/
@Suppress("MagicNumber")
-enum class GeoKey(
- val keyId: Short
+public enum class GeoKey(
+ public val keyId: Short
) {
/* 6.2.1 GeoTIFF Configuration Keys */
@@ -78,10 +78,10 @@ enum class GeoKey(
VerticalDatumGeoKey(4098),
VerticalUnitsGeoKey(4099);
- companion object {
+ public companion object {
@JvmStatic
- fun of(keyId: Short): GeoKey? =
+ public fun of(keyId: Short): GeoKey? =
GeoKey.entries.firstOrNull { it.keyId == keyId }
}
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffDirectory.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffDirectory.kt
index 21f76494..240d3dff 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffDirectory.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffDirectory.kt
@@ -20,7 +20,7 @@ import com.ashampoo.kim.common.ImageReadException
/**
* See http://geotiff.maptools.org/spec/geotiff2.4.html
*/
-data class GeoTiffDirectory(
+public data class GeoTiffDirectory(
/**
* "KeyDirectoryVersion" indicates the current version of Key
@@ -65,10 +65,10 @@ data class GeoTiffDirectory(
return sb.toString()
}
- companion object {
+ public companion object {
@Suppress("MagicNumber")
- fun parseFrom(shorts: ShortArray): GeoTiffDirectory {
+ public fun parseFrom(shorts: ShortArray): GeoTiffDirectory {
require(shorts.size >= 4) {
"GeoTiffDirectory should be at least 4 bytes, but was ${shorts.size}."
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffGeographicType.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffGeographicType.kt
index f4783f08..a4a2f0d5 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffGeographicType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffGeographicType.kt
@@ -23,9 +23,9 @@ import kotlin.jvm.JvmStatic
* See http://geotiff.maptools.org/spec/geotiff6.html#6.3.2.1
*/
@Suppress("MagicNumber")
-enum class GeoTiffGeographicType(
- val typeCode: Short,
- val displayName: String
+public enum class GeoTiffGeographicType(
+ public val typeCode: Short,
+ public val displayName: String
) {
GCS_ADINDAN(4201, "Adindan"),
@@ -202,10 +202,10 @@ enum class GeoTiffGeographicType(
/** user-defined */
USER_DEFINED(32767, "User Defined");
- companion object {
+ public companion object {
@JvmStatic
- fun of(typeCode: Short): GeoTiffGeographicType? =
+ public fun of(typeCode: Short): GeoTiffGeographicType? =
GeoTiffGeographicType.entries.firstOrNull { it.typeCode == typeCode }
}
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffModelType.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffModelType.kt
index b6350c73..11976e53 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffModelType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffModelType.kt
@@ -23,9 +23,9 @@ import kotlin.jvm.JvmStatic
* See http://geotiff.maptools.org/spec/geotiff6.html#6.3.1.1
*/
@Suppress("MagicNumber")
-enum class GeoTiffModelType(
- val typeCode: Short,
- val displayName: String
+public enum class GeoTiffModelType(
+ public val typeCode: Short,
+ public val displayName: String
) {
/** Projection Coordinate System */
@@ -40,10 +40,10 @@ enum class GeoTiffModelType(
/** user-defined */
USER_DEFINED(32767, "User Defined");
- companion object {
+ public companion object {
@JvmStatic
- fun of(typeCode: Short): GeoTiffModelType? =
+ public fun of(typeCode: Short): GeoTiffModelType? =
GeoTiffModelType.entries.firstOrNull { it.typeCode == typeCode }
}
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffRasterType.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffRasterType.kt
index 76ada0ca..1cfbf7e5 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffRasterType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/geotiff/GeoTiffRasterType.kt
@@ -23,9 +23,9 @@ import kotlin.jvm.JvmStatic
* See http://geotiff.maptools.org/spec/geotiff6.html#6.3.1.2
*/
@Suppress("MagicNumber")
-enum class GeoTiffRasterType(
- val typeCode: Short,
- val displayName: String
+public enum class GeoTiffRasterType(
+ public val typeCode: Short,
+ public val displayName: String
) {
/** Projection Coordinate System */
@@ -37,10 +37,10 @@ enum class GeoTiffRasterType(
/** user-defined */
USER_DEFINED(32767, "User Defined");
- companion object {
+ public companion object {
@JvmStatic
- fun of(typeCode: Short): GeoTiffRasterType? =
+ public fun of(typeCode: Short): GeoTiffRasterType? =
GeoTiffRasterType.entries.firstOrNull { it.typeCode == typeCode }
}
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfo.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfo.kt
index 88a0bb8d..b0c73a3d 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfo.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfo.kt
@@ -21,26 +21,26 @@ import com.ashampoo.kim.format.tiff.constant.ExifTag.EXIF_DIRECTORY_UNKNOWN
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldType
-abstract class TagInfo(
- val tag: Int,
- val name: String,
- val fieldType: FieldType,
- val length: Int = LENGTH_UNKNOWN,
- val directoryType: TiffDirectoryType? = EXIF_DIRECTORY_UNKNOWN,
- val isOffset: Boolean = false
+public abstract class TagInfo(
+ public val tag: Int,
+ public val name: String,
+ public val fieldType: FieldType,
+ public val length: Int = LENGTH_UNKNOWN,
+ public val directoryType: TiffDirectoryType? = EXIF_DIRECTORY_UNKNOWN,
+ public val isOffset: Boolean = false
) {
/** Return a proper Tag ID like 0x0100 */
- val tagFormatted: String =
+ public val tagFormatted: String =
"0x" + tag.toString(HEX_RADIX).padStart(4, '0')
- val description: String =
+ public val description: String =
"$tagFormatted $name"
override fun toString(): String =
description
- open fun isText(): Boolean =
+ public open fun isText(): Boolean =
false
override fun equals(other: Any?): Boolean {
@@ -72,7 +72,7 @@ abstract class TagInfo(
return result
}
- companion object {
- const val LENGTH_UNKNOWN = -1
+ public companion object {
+ public const val LENGTH_UNKNOWN: Int = -1
}
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoAscii.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoAscii.kt
index 17d5307a..2cc2f97d 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoAscii.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoAscii.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeAscii
-class TagInfoAscii(
+public class TagInfoAscii(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoByte.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoByte.kt
index 97a685b0..80d859df 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoByte.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoByte.kt
@@ -20,15 +20,15 @@ import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeByte
-open class TagInfoByte : TagInfo {
+public open class TagInfoByte : TagInfo {
- constructor(
+ public constructor(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
) : super(tag, name, FieldTypeByte, 1, directoryType)
- constructor(
+ public constructor(
tag: Int,
name: String,
fieldType: FieldType,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoBytes.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoBytes.kt
index af2a9604..f8246b1c 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoBytes.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoBytes.kt
@@ -20,16 +20,16 @@ import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeByte
-open class TagInfoBytes : TagInfo {
+public open class TagInfoBytes : TagInfo {
- constructor(
+ public constructor(
tag: Int,
name: String,
length: Int,
directoryType: TiffDirectoryType?
) : super(tag, name, FieldTypeByte, length, directoryType)
- constructor(
+ public constructor(
tag: Int,
name: String,
fieldType: FieldType,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoDouble.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoDouble.kt
index 40b1cfd4..697315e6 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoDouble.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoDouble.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeDouble
-class TagInfoDouble(
+public class TagInfoDouble(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoDoubles.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoDoubles.kt
index 42675333..f74552d2 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoDoubles.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoDoubles.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeDouble
-class TagInfoDoubles(
+public class TagInfoDoubles(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoFloat.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoFloat.kt
index ff261c34..03fd4a23 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoFloat.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoFloat.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeFloat
-class TagInfoFloat(
+public class TagInfoFloat(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoFloats.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoFloats.kt
index 4e2141e0..ade928f8 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoFloats.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoFloats.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeFloat
-class TagInfoFloats(
+public class TagInfoFloats(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoGpsText.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoGpsText.kt
index 3caa80da..47449d63 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoGpsText.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoGpsText.kt
@@ -34,16 +34,16 @@ import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeUndefined
* the text encoding in the first 8 bytes followed by
* the non-null-terminated text in an unknown byte order.
*/
-class TagInfoGpsText(
+public class TagInfoGpsText(
tag: Int,
name: String,
exifDirectory: TiffDirectoryType?
-) : TagInfo(tag, name, FieldTypeUndefined, TagInfo.LENGTH_UNKNOWN, exifDirectory) {
+) : TagInfo(tag, name, FieldTypeUndefined, LENGTH_UNKNOWN, exifDirectory) {
override fun isText(): Boolean =
true
- fun encodeValue(value: Any): ByteArray {
+ public fun encodeValue(value: Any): ByteArray {
if (value !is String)
throw ImageWriteException("GPS text value not String: $value")
@@ -67,7 +67,7 @@ class TagInfoGpsText(
return result
}
- fun getValue(entry: TiffField): String {
+ public fun getValue(entry: TiffField): String {
val fieldType = entry.fieldType
@@ -123,7 +123,7 @@ class TagInfoGpsText(
return bytes.decodeLatin1BytesToString()
}
- companion object {
+ private companion object {
private const val ZERO_BYTE: Byte = 0.toByte()
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoLong.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoLong.kt
index 0196f89a..2cc03ada 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoLong.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoLong.kt
@@ -19,15 +19,15 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeLong
-class TagInfoLong : TagInfo {
+public class TagInfoLong : TagInfo {
- constructor(
+ public constructor(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
) : super(tag, name, FieldTypeLong, 1, directoryType)
- constructor(
+ public constructor(
tag: Int,
name: String,
directoryType: TiffDirectoryType?,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoLongs.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoLongs.kt
index ec382e43..6fb0cbd4 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoLongs.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoLongs.kt
@@ -19,16 +19,16 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeLong
-class TagInfoLongs : TagInfo {
+public class TagInfoLongs : TagInfo {
- constructor(
+ public constructor(
tag: Int,
name: String,
length: Int,
directoryType: TiffDirectoryType?
) : super(tag, name, FieldTypeLong, length, directoryType)
- constructor(
+ public constructor(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoRational.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoRational.kt
index 1b9ac23e..51fb04ee 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoRational.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoRational.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeRational
-class TagInfoRational(
+public class TagInfoRational(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoRationals.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoRationals.kt
index 059543f6..f03b759f 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoRationals.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoRationals.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeRational
-class TagInfoRationals(
+public class TagInfoRationals(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSByte.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSByte.kt
index 0cbdc640..59b11b04 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSByte.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSByte.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeSByte
-class TagInfoSByte(
+public class TagInfoSByte(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSBytes.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSBytes.kt
index 6fdde38c..fb1bcada 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSBytes.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSBytes.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeSByte
-class TagInfoSBytes(
+public class TagInfoSBytes(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSLong.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSLong.kt
index 2e759114..b0b9cd14 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSLong.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSLong.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeSLong
-class TagInfoSLong(
+public class TagInfoSLong(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSLongs.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSLongs.kt
index 2eaa6fc1..cf37b86a 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSLongs.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSLongs.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeSLong
-class TagInfoSLongs(
+public class TagInfoSLongs(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSRational.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSRational.kt
index 5beaae57..7b3bf544 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSRational.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSRational.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeSRational
-class TagInfoSRational(
+public class TagInfoSRational(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSRationals.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSRationals.kt
index 116d6fbf..45fecbbe 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSRationals.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSRationals.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeSRational
-class TagInfoSRationals(
+public class TagInfoSRationals(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSShort.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSShort.kt
index 8bf13735..c289de48 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSShort.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSShort.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeShort
-class TagInfoSShort(
+public class TagInfoSShort(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSShorts.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSShorts.kt
index bf212d69..a5529114 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSShorts.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoSShorts.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeShort
-class TagInfoSShorts(
+public class TagInfoSShorts(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoShort.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoShort.kt
index 70212097..dd842189 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoShort.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoShort.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeShort
-class TagInfoShort(
+public class TagInfoShort(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoShorts.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoShorts.kt
index 3103b896..b7364631 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoShorts.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoShorts.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeShort
-class TagInfoShorts(
+public class TagInfoShorts(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoUndefined.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoUndefined.kt
index 35c8120b..5838ab4c 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoUndefined.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoUndefined.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeUndefined
-class TagInfoUndefined(
+public class TagInfoUndefined(
tag: Int,
name: String,
directoryType: TiffDirectoryType?
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoUndefineds.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoUndefineds.kt
index 5344ec3a..07d947e1 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoUndefineds.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/taginfo/TagInfoUndefineds.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.taginfo
import com.ashampoo.kim.format.tiff.constant.TiffDirectoryType
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeUndefined
-class TagInfoUndefineds(
+public class TagInfoUndefineds(
tag: Int,
name: String,
length: Int,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOffsetItem.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOffsetItem.kt
index 1bfff39c..49309a3f 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOffsetItem.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOffsetItem.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.write
/**
* This class combines an Directory like the GPS directory with it's offset value.
*/
-data class TiffOffsetItem(
+public data class TiffOffsetItem(
val outputItem: TiffOutputItem,
val outputField: TiffOutputField
)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOffsetItems.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOffsetItems.kt
index ef1013d3..f8d54cee 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOffsetItems.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOffsetItems.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.format.tiff.write
import com.ashampoo.kim.common.ByteOrder
import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeLong
-class TiffOffsetItems(val byteOrder: ByteOrder) {
+internal class TiffOffsetItems(val byteOrder: ByteOrder) {
private val offsetItems = mutableSetOf()
@@ -30,7 +30,7 @@ class TiffOffsetItems(val byteOrder: ByteOrder) {
offsetItems.forEach {
it.outputField.setBytes(
FieldTypeLong.writeData(
- data = it.outputItem.offset.toInt(),
+ data = it.outputItem.offset,
byteOrder = byteOrder
)
)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputDirectory.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputDirectory.kt
index 3af71c88..9977e5c6 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputDirectory.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputDirectory.kt
@@ -65,24 +65,24 @@ import com.ashampoo.kim.format.tiff.write.TiffOutputItem.Companion.UNDEFINED_VAL
import com.ashampoo.kim.output.BinaryByteWriter
@Suppress("TooManyFunctions", "MethodOverloading")
-class TiffOutputDirectory(
- val type: Int,
+public class TiffOutputDirectory(
+ public val type: Int,
private val byteOrder: ByteOrder
) : TiffOutputItem {
- private val fields = mutableListOf()
+ private val fields = mutableSetOf()
private var nextDirectory: TiffOutputDirectory? = null
override var offset: Int = UNDEFINED_VALUE
- var thumbnailBytes: ByteArray? = null
+ public var thumbnailBytes: ByteArray? = null
private set
- var tiffImageBytes: ByteArray? = null
+ public var tiffImageBytes: ByteArray? = null
private set
- fun setNextDirectory(nextDirectory: TiffOutputDirectory?) {
+ internal fun setNextDirectory(nextDirectory: TiffOutputDirectory?) {
this.nextDirectory = nextDirectory
}
@@ -92,7 +92,7 @@ class TiffOutputDirectory(
throw ImageWriteException("Tag length is ${tagInfo.length}, parameter length was $length")
}
- fun add(tagInfo: TagInfoByte, value: Byte) {
+ public fun add(tagInfo: TagInfoByte, value: Byte) {
add(
TiffOutputField(
@@ -104,7 +104,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoBytes, bytes: ByteArray) {
+ public fun add(tagInfo: TagInfoBytes, bytes: ByteArray) {
checkMatchingLength(tagInfo, bytes.size)
@@ -118,7 +118,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoAscii, value: String) {
+ public fun add(tagInfo: TagInfoAscii, value: String) {
val bytes = FieldTypeAscii.writeData(value, byteOrder)
@@ -134,7 +134,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoShort, value: Short) {
+ public fun add(tagInfo: TagInfoShort, value: Short) {
add(
TiffOutputField(
@@ -146,7 +146,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoShorts, values: ShortArray) {
+ public fun add(tagInfo: TagInfoShorts, values: ShortArray) {
checkMatchingLength(tagInfo, values.size)
@@ -160,7 +160,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoLong, value: Int) {
+ public fun add(tagInfo: TagInfoLong, value: Int) {
add(
TiffOutputField(
@@ -172,7 +172,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoLongs, values: IntArray) {
+ public fun add(tagInfo: TagInfoLongs, values: IntArray) {
checkMatchingLength(tagInfo, values.size)
@@ -186,7 +186,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoRational, value: RationalNumber) {
+ public fun add(tagInfo: TagInfoRational, value: RationalNumber) {
add(
TiffOutputField(
@@ -198,7 +198,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoRationals, values: RationalNumbers) {
+ public fun add(tagInfo: TagInfoRationals, values: RationalNumbers) {
checkMatchingLength(tagInfo, values.values.size)
@@ -212,7 +212,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoSByte, value: Byte) {
+ public fun add(tagInfo: TagInfoSByte, value: Byte) {
add(
TiffOutputField(
@@ -224,7 +224,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoSBytes, value: ByteArray) {
+ public fun add(tagInfo: TagInfoSBytes, value: ByteArray) {
checkMatchingLength(tagInfo, value.size)
@@ -238,7 +238,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoSShort, value: Short) {
+ public fun add(tagInfo: TagInfoSShort, value: Short) {
add(
TiffOutputField(
@@ -250,7 +250,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoSShorts, values: ShortArray) {
+ public fun add(tagInfo: TagInfoSShorts, values: ShortArray) {
checkMatchingLength(tagInfo, values.size)
@@ -264,7 +264,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoSLong, value: Int) {
+ public fun add(tagInfo: TagInfoSLong, value: Int) {
add(
TiffOutputField(
@@ -276,7 +276,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoSLongs, values: IntArray) {
+ public fun add(tagInfo: TagInfoSLongs, values: IntArray) {
checkMatchingLength(tagInfo, values.size)
@@ -290,7 +290,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoSRational, value: RationalNumber) {
+ public fun add(tagInfo: TagInfoSRational, value: RationalNumber) {
add(
TiffOutputField(
@@ -302,7 +302,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoSRationals, value: RationalNumbers) {
+ public fun add(tagInfo: TagInfoSRationals, value: RationalNumbers) {
checkMatchingLength(tagInfo, value.values.size)
@@ -316,7 +316,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoFloat, value: Float) {
+ public fun add(tagInfo: TagInfoFloat, value: Float) {
val bytes = value.toBytes(byteOrder)
@@ -330,7 +330,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoFloats, values: FloatArray) {
+ public fun add(tagInfo: TagInfoFloats, values: FloatArray) {
checkMatchingLength(tagInfo, values.size)
@@ -344,7 +344,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoDouble, value: Double) {
+ public fun add(tagInfo: TagInfoDouble, value: Double) {
add(
TiffOutputField(
@@ -356,7 +356,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoDoubles, values: DoubleArray) {
+ public fun add(tagInfo: TagInfoDoubles, values: DoubleArray) {
checkMatchingLength(tagInfo, values.size)
@@ -370,7 +370,7 @@ class TiffOutputDirectory(
)
}
- fun add(tagInfo: TagInfoGpsText, value: String) {
+ public fun add(tagInfo: TagInfoGpsText, value: String) {
val bytes = tagInfo.encodeValue(value)
@@ -384,68 +384,44 @@ class TiffOutputDirectory(
)
}
- fun add(field: TiffOutputField) =
+ public fun add(field: TiffOutputField): Boolean =
fields.add(field)
- fun getFields(): List =
+ public fun getFields(): Set =
fields
- fun removeField(tagInfo: TagInfo) =
+ public fun removeField(tagInfo: TagInfo): Boolean =
removeField(tagInfo.tag)
- fun removeField(tag: Int) {
+ public fun removeField(tag: Int): Boolean =
+ fields.removeAll { it.tag == tag }
- val matches = mutableListOf()
-
- for (field in fields)
- if (field.tag == tag)
- matches.add(field)
-
- fields.removeAll(matches)
- }
-
- fun findField(tagInfo: TagInfo): TiffOutputField? =
+ public fun findField(tagInfo: TagInfo): TiffOutputField? =
findField(tagInfo.tag)
- fun findField(tag: Int): TiffOutputField? {
-
- for (field in fields)
- if (field.tag == tag)
- return field
-
- return null
- }
-
- fun sortFields() {
+ public fun findField(tag: Int): TiffOutputField? =
+ fields.find { it.tag == tag }
- val comparator = Comparator { e1: TiffOutputField, e2: TiffOutputField ->
-
- if (e1.tag != e2.tag)
- return@Comparator e1.tag - e2.tag
-
- e1.sortHint - e2.sortHint
- }
-
- fields.sortWith(comparator)
- }
-
- override fun writeItem(binaryByteWriter: BinaryByteWriter) {
+ override fun writeItem(
+ binaryByteWriter: BinaryByteWriter
+ ) {
/* Write directory field count. */
binaryByteWriter.write2Bytes(fields.size)
- for (field in fields)
+ for (field in fields.sorted())
field.writeField(binaryByteWriter)
- var nextDirectoryOffset: Int = 0
+ var nextDirectoryOffset = 0
- if (nextDirectory != null)
- nextDirectoryOffset = nextDirectory!!.offset
+ nextDirectory?.let {
+ nextDirectoryOffset = it.offset
+ }
if (nextDirectoryOffset == UNDEFINED_VALUE)
binaryByteWriter.write4Bytes(0)
else
- binaryByteWriter.write4Bytes(nextDirectoryOffset.toInt())
+ binaryByteWriter.write4Bytes(nextDirectoryOffset)
}
/* Internal, because callers should use setThumbnailBytes() */
@@ -463,7 +439,7 @@ class TiffOutputDirectory(
private fun removeFieldIfPresent(tagInfo: TagInfo) =
findField(tagInfo)?.let { field -> fields.remove(field) }
- fun getOutputItems(tiffOffsetItems: TiffOffsetItems): List {
+ internal fun getOutputItems(tiffOffsetItems: TiffOffsetItems): List {
/* First remove old fields */
removeFieldIfPresent(TiffTag.TIFF_TAG_JPEG_INTERCHANGE_FORMAT)
@@ -542,9 +518,8 @@ class TiffOutputDirectory(
val result = mutableListOf()
result.add(this)
- sortFields()
- for (field in fields) {
+ for (field in fields.sorted()) {
if (field.isLocalValue)
continue
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputField.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputField.kt
index 187b4037..1bf72634 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputField.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputField.kt
@@ -26,24 +26,24 @@ import com.ashampoo.kim.format.tiff.fieldtype.FieldTypeLong
import com.ashampoo.kim.format.tiff.taginfo.TagInfo
import com.ashampoo.kim.output.BinaryByteWriter
-class TiffOutputField(
- val tag: Int,
- val fieldType: FieldType,
- val count: Int,
+public class TiffOutputField(
+ public val tag: Int,
+ public val fieldType: FieldType,
+ public val count: Int,
private var bytes: ByteArray
-) {
+) : Comparable {
- val tagFormatted: String =
+ public val tagFormatted: String =
"0x" + tag.toString(HEX_RADIX).padStart(4, '0')
- val isLocalValue: Boolean = bytes.size <= TIFF_ENTRY_MAX_VALUE_LENGTH
+ public val isLocalValue: Boolean = bytes.size <= TIFF_ENTRY_MAX_VALUE_LENGTH
- val separateValue: TiffOutputValue? =
+ public val separateValue: TiffOutputValue? =
if (isLocalValue) null else TiffOutputValue("Value of $this", bytes)
- var sortHint = -1
+ public var sortHint: Int = -1
- fun writeField(byteWriter: BinaryByteWriter) {
+ internal fun writeField(byteWriter: BinaryByteWriter) {
byteWriter.write2Bytes(tag)
byteWriter.write2Bytes(fieldType.type)
@@ -69,17 +69,17 @@ class TiffOutputField(
if (separateValue == null)
throw ImageWriteException("Missing separate value item.")
- byteWriter.write4Bytes(separateValue.offset.toInt())
+ byteWriter.write4Bytes(separateValue.offset)
}
}
- fun bytesAsHex(): String =
+ internal fun bytesAsHex(): String =
bytes.toHex()
- fun bytesEqual(data: ByteArray): Boolean =
+ internal fun bytesEqual(data: ByteArray): Boolean =
bytes.contentEquals(data)
- fun setBytes(bytes: ByteArray) {
+ internal fun setBytes(bytes: ByteArray) {
if (this.bytes.size != bytes.size)
throw ImageWriteException("Cannot change size of value.")
@@ -92,9 +92,17 @@ class TiffOutputField(
override fun toString(): String =
"TiffOutputField $tagFormatted"
- companion object {
+ override fun compareTo(other: TiffOutputField): Int {
- fun createOffsetField(tagInfo: TagInfo, byteOrder: ByteOrder): TiffOutputField =
+ if (tag != other.tag)
+ return tag - other.tag
+
+ return sortHint - other.sortHint
+ }
+
+ internal companion object {
+
+ internal fun createOffsetField(tagInfo: TagInfo, byteOrder: ByteOrder): TiffOutputField =
TiffOutputField(tagInfo.tag, FieldTypeLong, 1, FieldTypeLong.writeData(0, byteOrder))
}
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputItem.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputItem.kt
index 9fb4a4c0..faf8d006 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputItem.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputItem.kt
@@ -18,15 +18,15 @@ package com.ashampoo.kim.format.tiff.write
import com.ashampoo.kim.output.BinaryByteWriter
-interface TiffOutputItem {
+public interface TiffOutputItem {
- var offset: Int
+ public var offset: Int
- fun getItemLength(): Int
+ public fun getItemLength(): Int
- fun writeItem(binaryByteWriter: BinaryByteWriter)
+ public fun writeItem(binaryByteWriter: BinaryByteWriter)
- companion object {
- const val UNDEFINED_VALUE: Int = -1
+ public companion object {
+ public const val UNDEFINED_VALUE: Int = -1
}
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputSet.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputSet.kt
index bafd5a3d..1728e847 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputSet.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputSet.kt
@@ -36,13 +36,13 @@ import kotlinx.datetime.toLocalDateTime
import kotlin.math.abs
@Suppress("TooManyFunctions")
-class TiffOutputSet(
- val byteOrder: ByteOrder = DEFAULT_TIFF_BYTE_ORDER
+public class TiffOutputSet(
+ public val byteOrder: ByteOrder = DEFAULT_TIFF_BYTE_ORDER
) {
private val directories = mutableListOf()
- fun getOutputItems(tiffOffsetItems: TiffOffsetItems): List {
+ internal fun getOutputItems(tiffOffsetItems: TiffOffsetItems): List {
val outputItems = mutableListOf()
@@ -52,7 +52,7 @@ class TiffOutputSet(
return outputItems
}
- fun addDirectory(directory: TiffOutputDirectory): TiffOutputDirectory {
+ public fun addDirectory(directory: TiffOutputDirectory): TiffOutputDirectory {
if (findDirectory(directory.type) != null)
throw ImageWriteException("Output set already contains a directory of that type.")
@@ -62,12 +62,12 @@ class TiffOutputSet(
return directory
}
- fun getDirectories(): List = directories
+ public fun getDirectories(): List = directories
- fun getOrCreateRootDirectory(): TiffOutputDirectory =
+ public fun getOrCreateRootDirectory(): TiffOutputDirectory =
findDirectory(TiffConstants.TIFF_DIRECTORY_TYPE_IFD0) ?: addRootDirectory()
- fun getOrCreateExifDirectory(): TiffOutputDirectory {
+ public fun getOrCreateExifDirectory(): TiffOutputDirectory {
/* The EXIF directory requires root directory. */
getOrCreateRootDirectory()
@@ -75,7 +75,7 @@ class TiffOutputSet(
return findDirectory(TiffConstants.TIFF_DIRECTORY_EXIF) ?: addExifDirectory()
}
- fun getOrCreateThumbnailDirectory(): TiffOutputDirectory {
+ public fun getOrCreateThumbnailDirectory(): TiffOutputDirectory {
/* The Thumbnail directory requires root directory. */
getOrCreateRootDirectory()
@@ -83,7 +83,7 @@ class TiffOutputSet(
return findDirectory(TiffConstants.TIFF_DIRECTORY_TYPE_IFD1) ?: addThumbnailDirectory()
}
- fun getOrCreateGPSDirectory(): TiffOutputDirectory {
+ public fun getOrCreateGPSDirectory(): TiffOutputDirectory {
/* The GPS directory requires EXIF directory */
getOrCreateExifDirectory()
@@ -91,10 +91,10 @@ class TiffOutputSet(
return findDirectory(TiffConstants.TIFF_DIRECTORY_GPS) ?: addGPSDirectory()
}
- fun findDirectory(directoryType: Int): TiffOutputDirectory? =
+ public fun findDirectory(directoryType: Int): TiffOutputDirectory? =
directories.find { it.type == directoryType }
- fun applyUpdate(update: MetadataUpdate) {
+ public fun applyUpdate(update: MetadataUpdate) {
val rootDirectory = getOrCreateRootDirectory()
val exifDirectory = getOrCreateExifDirectory()
@@ -140,7 +140,7 @@ class TiffOutputSet(
/**
* Sets the provided thumbnail bytes to the thumbnail directory (IFD1)
*/
- fun setThumbnailBytes(thumbnailBytes: ByteArray) {
+ public fun setThumbnailBytes(thumbnailBytes: ByteArray) {
val thumbnailDirectory = getOrCreateThumbnailDirectory()
@@ -150,7 +150,7 @@ class TiffOutputSet(
/**
* A convenience method to update GPS values in EXIF metadata.
*/
- fun setGpsCoordinates(gpsCoordinates: GpsCoordinates?) {
+ public fun setGpsCoordinates(gpsCoordinates: GpsCoordinates?) {
val gpsDirectory = getOrCreateGPSDirectory()
@@ -229,23 +229,21 @@ class TiffOutputSet(
}
}
- fun findMakerNoteField(): TiffOutputField? =
+ public fun findMakerNoteField(): TiffOutputField? =
findField(ExifTag.EXIF_TAG_MAKER_NOTE.tag)
- fun findField(tag: Int): TiffOutputField? =
- directories
- .mapNotNull { directory -> directory.findField(tag) }
- .firstOrNull()
+ public fun findField(tag: Int): TiffOutputField? =
+ directories.firstNotNullOfOrNull { directory -> directory.findField(tag) }
- fun addRootDirectory(): TiffOutputDirectory =
+ public fun addRootDirectory(): TiffOutputDirectory =
addDirectory(TiffOutputDirectory(TiffConstants.TIFF_DIRECTORY_TYPE_IFD0, byteOrder))
- fun addExifDirectory(): TiffOutputDirectory =
+ public fun addExifDirectory(): TiffOutputDirectory =
addDirectory(TiffOutputDirectory(TiffConstants.TIFF_DIRECTORY_EXIF, byteOrder))
- fun addThumbnailDirectory(): TiffOutputDirectory =
+ public fun addThumbnailDirectory(): TiffOutputDirectory =
addDirectory(TiffOutputDirectory(TiffConstants.TIFF_DIRECTORY_TYPE_IFD1, byteOrder))
- fun addGPSDirectory(): TiffOutputDirectory =
+ public fun addGPSDirectory(): TiffOutputDirectory =
addDirectory(TiffOutputDirectory(TiffConstants.TIFF_DIRECTORY_GPS, byteOrder))
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputValue.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputValue.kt
index 3f049b76..6156a79b 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputValue.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffOutputValue.kt
@@ -20,7 +20,7 @@ import com.ashampoo.kim.common.ImageWriteException
import com.ashampoo.kim.common.toHex
import com.ashampoo.kim.output.BinaryByteWriter
-class TiffOutputValue internal constructor(
+public class TiffOutputValue internal constructor(
private val description: String,
private val bytes: ByteArray
) : TiffOutputItem {
@@ -31,7 +31,7 @@ class TiffOutputValue internal constructor(
override fun getItemLength(): Int =
bytes.size
- fun updateValue(bytes: ByteArray) {
+ public fun updateValue(bytes: ByteArray) {
if (this.bytes.size != bytes.size)
throw ImageWriteException("Updated data size mismatch: ${this.bytes.size} != ${bytes.size}")
@@ -39,7 +39,7 @@ class TiffOutputValue internal constructor(
bytes.copyInto(this.bytes)
}
- override fun writeItem(binaryByteWriter: BinaryByteWriter) =
+ override fun writeItem(binaryByteWriter: BinaryByteWriter): Unit =
binaryByteWriter.write(bytes)
override fun toString(): String =
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterBase.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterBase.kt
index ace5e4fa..d5f443fa 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterBase.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterBase.kt
@@ -25,13 +25,13 @@ import com.ashampoo.kim.format.tiff.constant.TiffConstants.TIFF_VERSION
import com.ashampoo.kim.output.BinaryByteWriter
import com.ashampoo.kim.output.ByteWriter
-abstract class TiffWriterBase(
- val byteOrder: ByteOrder
+public abstract class TiffWriterBase(
+ public val byteOrder: ByteOrder
) {
- abstract fun write(byteWriter: ByteWriter, outputSet: TiffOutputSet)
+ public abstract fun write(byteWriter: ByteWriter, outputSet: TiffOutputSet)
- protected fun createOffsetItems(outputSet: TiffOutputSet): TiffOffsetItems {
+ internal fun createOffsetItems(outputSet: TiffOutputSet): TiffOffsetItems {
val directories = outputSet.getDirectories()
@@ -85,22 +85,20 @@ abstract class TiffWriterBase(
interoperabilityDirectory = directory
}
- else -> throw ImageWriteException("Unknown directory: " + dirType)
+ else -> throw ImageWriteException("Unknown directory: $dirType")
}
} else {
if (directoryIndices.contains(dirType))
- throw ImageWriteException("More than one directory with index: " + dirType + ".")
+ throw ImageWriteException("More than one directory with index: $dirType")
directoryIndices.add(dirType)
}
val fieldTags = mutableSetOf()
- val fields = directory.getFields()
-
- for (field in fields) {
+ for (field in directory.getFields()) {
if (fieldTags.contains(field.tag))
throw ImageWriteException("Tag ${field.tagFormatted} appears twice in directory.")
@@ -158,9 +156,7 @@ abstract class TiffWriterBase(
}
val rootDirectory = directoryTypeMap[TiffConstants.TIFF_DIRECTORY_TYPE_IFD0]
-
- if (rootDirectory == null)
- throw ImageWriteException("Root directory is missing.")
+ ?: throw ImageWriteException("Root directory is missing.")
if (interoperabilityDirectory == null && interoperabilityDirectoryOffsetField != null)
throw ImageWriteException(
@@ -243,13 +239,13 @@ abstract class TiffWriterBase(
}
byteWriter.write2Bytes(TIFF_VERSION)
- byteWriter.write4Bytes(offsetToFirstIFD.toInt())
+ byteWriter.write4Bytes(offsetToFirstIFD)
}
- companion object {
+ public companion object {
/** Returns an appropriate TiffImageWriter instance. */
- fun createTiffWriter(
+ public fun createTiffWriter(
byteOrder: ByteOrder,
oldExifBytes: ByteArray?
): TiffWriterBase {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterLossless.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterLossless.kt
index 71bab4c5..0c55a996 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterLossless.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterLossless.kt
@@ -27,7 +27,7 @@ import com.ashampoo.kim.output.BinaryByteWriter.Companion.createBinaryByteWriter
import com.ashampoo.kim.output.BufferByteWriter
import com.ashampoo.kim.output.ByteWriter
-class TiffWriterLossless(
+public class TiffWriterLossless(
byteOrder: ByteOrder,
private val exifBytes: ByteArray
) : TiffWriterBase(byteOrder) {
@@ -52,6 +52,10 @@ class TiffWriterLossless(
}
}
+ /**
+ * Returns a sorted list of existing [TiffElement]s.
+ */
+ @Suppress("NestedBlockDepth")
private fun findExistingTiffElements(
tiffContents: TiffContents,
makerNoteField: TiffOutputField?
@@ -77,8 +81,7 @@ class TiffWriterLossless(
if (oversizeValue != null) {
/* MakerNote offsets must stay the same. */
- if (makerNoteField != null &&
- makerNoteField.separateValue != null &&
+ if (makerNoteField?.separateValue != null &&
makerNoteField.bytesEqual(field.valueBytes)
)
makerNoteField.separateValue.offset = field.valueOffset!!
@@ -96,7 +99,7 @@ class TiffWriterLossless(
}
}
- elements.sortWith(TiffElement.offsetComparator)
+ elements.sort()
return elements
}
@@ -126,6 +129,13 @@ class TiffWriterLossless(
continue
}
+ /*
+ * Ensure that the list of elements is sorted.
+ */
+ require(element.offset > lastElement.offset) {
+ "Parameterized elements must be sorted."
+ }
+
/*
* We look for the next big gap. This is when an element
* has an offset, that does not come next. This way we
@@ -224,15 +234,15 @@ class TiffWriterLossless(
outputItems: List
): Int {
- val filterAndSortElementsResult = filterAndSortRewriteableSpaceRanges(
+ val result = filterRewriteableSpaceRanges(
rewritableSpaceRanges,
exifBytes.size
)
- val unusedSpaceRanges = filterAndSortElementsResult.first
+ val unusedSpaceRanges = result.first
/* Keeps track of the total length the exif bytes we have. */
- var newExifBytesLength = filterAndSortElementsResult.second
+ var newExifBytesLength = result.second
val unplacedItems = outputItems.toMutableList()
@@ -299,24 +309,22 @@ class TiffWriterLossless(
return newExifBytesLength
}
- private fun filterAndSortRewriteableSpaceRanges(
+ private fun filterRewriteableSpaceRanges(
rewritableSpaceRanges: List,
exifBytesLength: Int
): Pair, Int> {
var newExifBytesLength = exifBytesLength
- val filteredAndSortedRewritableSpaceRanges = rewritableSpaceRanges
- .sortedBy { it.offset }
- .toMutableList()
+ val filteredRewritableSpaceRanges = rewritableSpaceRanges.toMutableList()
/*
* Any items that represent a gap at the end of
* the exif segment, can be discarded.
*/
- while (filteredAndSortedRewritableSpaceRanges.isNotEmpty()) {
+ while (filteredRewritableSpaceRanges.isNotEmpty()) {
- val lastRange = filteredAndSortedRewritableSpaceRanges.last()
+ val lastRange = filteredRewritableSpaceRanges.last()
val rangeEnd = lastRange.offset + lastRange.length
@@ -328,10 +336,10 @@ class TiffWriterLossless(
newExifBytesLength -= lastRange.length
- filteredAndSortedRewritableSpaceRanges.removeLast()
+ filteredRewritableSpaceRanges.removeLast()
}
- return Pair(filteredAndSortedRewritableSpaceRanges, newExifBytesLength)
+ return filteredRewritableSpaceRanges to newExifBytesLength
}
private fun writeInternal(
@@ -344,7 +352,7 @@ class TiffWriterLossless(
val rootDirectory = outputSet.getOrCreateRootDirectory()
- val outputByteArray = ByteArray(outputLength.toInt())
+ val outputByteArray = ByteArray(outputLength)
/* Copy old data that inclued makers notes and other stuff. */
exifBytes.copyInto(
@@ -371,11 +379,11 @@ class TiffWriterLossless(
for (element in rewritableSpaceRanges)
outputByteArray.fill(
element = 0.toByte(),
- fromIndex = element.offset.toInt(),
+ fromIndex = element.offset,
toIndex = minOf(
a = element.offset + element.length,
b = outputByteArray.size
- ).toInt(),
+ ),
)
/* Write in the new items */
@@ -384,7 +392,7 @@ class TiffWriterLossless(
val binaryByteWriter = createBinaryByteWriter(
byteWriter = BufferByteWriter(
buffer = outputByteArray,
- index = outputItem.offset.toInt()
+ index = outputItem.offset
),
byteOrder = byteOrder
)
@@ -395,7 +403,7 @@ class TiffWriterLossless(
byteWriter.write(outputByteArray)
}
- companion object {
+ private companion object {
const val OFFSET_TOLERANCE = 3
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterLossy.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterLossy.kt
index cedf8443..76407831 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterLossy.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/tiff/write/TiffWriterLossy.kt
@@ -23,7 +23,7 @@ import com.ashampoo.kim.output.BinaryByteWriter.Companion.createBinaryByteWriter
import com.ashampoo.kim.output.ByteWriter
import kotlin.jvm.JvmStatic
-class TiffWriterLossy(
+public class TiffWriterLossy(
byteOrder: ByteOrder
) : TiffWriterBase(byteOrder) {
@@ -77,7 +77,7 @@ class TiffWriterLossy(
}
}
- companion object {
+ private companion object {
private const val FOUR = 4
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPChunkType.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPChunkType.kt
index 2844ccd8..7d6325d6 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPChunkType.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPChunkType.kt
@@ -20,7 +20,7 @@ import com.ashampoo.kim.common.toFourCCTypeString
/**
* Type of a WebP chunk.
*/
-data class WebPChunkType internal constructor(
+public data class WebPChunkType internal constructor(
val bytes: ByteArray,
val name: String,
val intValue: Int
@@ -43,25 +43,25 @@ data class WebPChunkType internal constructor(
override fun toString(): String =
name
- companion object {
+ public companion object {
/** Standard lossy VP8 */
- val VP8 = of("VP8 ".encodeToByteArray())
+ public val VP8: WebPChunkType = of("VP8 ".encodeToByteArray())
/** Lossless VP8 */
- val VP8L = of("VP8L".encodeToByteArray())
+ public val VP8L: WebPChunkType = of("VP8L".encodeToByteArray())
/** Extended VP8 */
- val VP8X = of("VP8X".encodeToByteArray())
+ public val VP8X: WebPChunkType = of("VP8X".encodeToByteArray())
/** EXIF metadata */
- val EXIF = of("EXIF".encodeToByteArray())
+ public val EXIF: WebPChunkType = of("EXIF".encodeToByteArray())
/** XMP metadata */
- val XMP = of("XMP ".encodeToByteArray())
+ public val XMP: WebPChunkType = of("XMP ".encodeToByteArray())
@Suppress("MagicNumber")
- fun of(typeBytes: ByteArray): WebPChunkType {
+ public fun of(typeBytes: ByteArray): WebPChunkType {
require(typeBytes.size == WebPConstants.TPYE_LENGTH) {
"ChunkType must be always 4 bytes, but got ${typeBytes.size} bytes!"
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPConstants.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPConstants.kt
index e6095039..8ace985c 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPConstants.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPConstants.kt
@@ -17,27 +17,27 @@ package com.ashampoo.kim.format.webp
import com.ashampoo.kim.common.ByteOrder
-object WebPConstants {
+public object WebPConstants {
- val WEBP_BYTE_ORDER = ByteOrder.LITTLE_ENDIAN
+ public val WEBP_BYTE_ORDER: ByteOrder = ByteOrder.LITTLE_ENDIAN
- val RIFF_SIGNATURE = "RIFF".encodeToByteArray()
- val WEBP_SIGNATURE = "WEBP".encodeToByteArray()
+ public val RIFF_SIGNATURE: ByteArray = "RIFF".encodeToByteArray()
+ public val WEBP_SIGNATURE: ByteArray = "WEBP".encodeToByteArray()
/* ChunkType is a FourCC, so it's 4 bytes. */
- const val TPYE_LENGTH = 4
+ public const val TPYE_LENGTH: Int = 4
- const val CHUNK_SIZE_LENGTH = 4
+ public const val CHUNK_SIZE_LENGTH: Int = 4
- const val CHUNK_HEADER_LENGTH = WebPConstants.TPYE_LENGTH + WebPConstants.CHUNK_SIZE_LENGTH
+ public const val CHUNK_HEADER_LENGTH: Int = TPYE_LENGTH + CHUNK_SIZE_LENGTH
- const val VP8X_PAYLOAD_LENGTH = 10
+ public const val VP8X_PAYLOAD_LENGTH: Int = 10
/**
* 16383 x 16383 pixels is the max size for an WebP
*
* https://developers.google.com/speed/webp/faq#what_is_the_maximum_size_a_webp_image_can_be
*/
- const val MAX_SIDE_LENGTH: Int = 16383
+ public const val MAX_SIDE_LENGTH: Int = 16383
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPImageParser.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPImageParser.kt
index c486bc0a..4a254485 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPImageParser.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPImageParser.kt
@@ -32,9 +32,14 @@ import com.ashampoo.kim.format.webp.chunk.WebPChunkVP8L
import com.ashampoo.kim.format.webp.chunk.WebPChunkVP8X
import com.ashampoo.kim.format.webp.chunk.WebPChunkXmp
import com.ashampoo.kim.input.ByteReader
+import com.ashampoo.kim.input.read4BytesAsInt
+import com.ashampoo.kim.input.readAndVerifyBytes
+import com.ashampoo.kim.input.readBytes
+import com.ashampoo.kim.input.skipBytes
import com.ashampoo.kim.model.ImageFormat
+import kotlin.jvm.JvmStatic
-object WebPImageParser : ImageParser {
+public object WebPImageParser : ImageParser {
/*
* https://developers.google.com/speed/webp/docs/riff_container
@@ -54,7 +59,8 @@ object WebPImageParser : ImageParser {
}
@Throws(ImageReadException::class)
- fun parseMetadataFromChunks(chunks: List): ImageMetadata =
+ @JvmStatic
+ public fun parseMetadataFromChunks(chunks: List): ImageMetadata =
tryWithImageReadException {
val imageSizeAwareChunk = chunks.filterIsInstance().firstOrNull()
@@ -79,7 +85,7 @@ object WebPImageParser : ImageParser {
)
}
- fun readChunks(
+ public fun readChunks(
byteReader: ByteReader,
stopAfterMetadataRead: Boolean = false
): List = tryWithImageReadException {
@@ -107,6 +113,7 @@ object WebPImageParser : ImageParser {
var bytesReadCount = 0
+ @Suppress("LoopWithTooManyJumpStatements")
while (bytesReadCount < bytesToRead) {
val chunkType = WebPChunkType.of(
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPWriter.kt
index d16be248..ead57747 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/WebPWriter.kt
@@ -23,22 +23,26 @@ import com.ashampoo.kim.format.webp.chunk.WebPChunkVP8X
import com.ashampoo.kim.input.ByteReader
import com.ashampoo.kim.output.ByteArrayByteWriter
import com.ashampoo.kim.output.ByteWriter
+import com.ashampoo.kim.output.writeInt
+import kotlin.jvm.JvmStatic
-object WebPWriter {
+public object WebPWriter {
- fun writeImage(
+ @JvmStatic
+ public fun writeImage(
byteReader: ByteReader,
byteWriter: ByteWriter,
exifBytes: ByteArray?,
xmp: String?
- ) = writeImage(
+ ): Unit = writeImage(
chunks = WebPImageParser.readChunks(byteReader, false),
byteWriter = byteWriter,
exifBytes = exifBytes,
xmp = xmp
)
- fun writeImage(
+ @JvmStatic
+ public fun writeImage(
chunks: List,
byteWriter: ByteWriter,
exifBytes: ByteArray?,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/ImageSizeAware.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/ImageSizeAware.kt
index 0106f999..a245f33c 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/ImageSizeAware.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/ImageSizeAware.kt
@@ -21,8 +21,8 @@ import com.ashampoo.kim.model.ImageSize
* Effectively a marker interface for VP8, VP8L & VP8X.
* One of these must always be present and contains the image size.
*/
-interface ImageSizeAware {
+public interface ImageSizeAware {
- val imageSize: ImageSize
+ public val imageSize: ImageSize
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunk.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunk.kt
index 6cbf260d..15a35f96 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunk.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunk.kt
@@ -17,9 +17,9 @@ package com.ashampoo.kim.format.webp.chunk
import com.ashampoo.kim.format.webp.WebPChunkType
-open class WebPChunk(
- val type: WebPChunkType,
- val bytes: ByteArray
+public open class WebPChunk(
+ public val type: WebPChunkType,
+ public val bytes: ByteArray
) {
override fun toString(): String =
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkExif.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkExif.kt
index 7d58fc48..1ccfbe79 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkExif.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkExif.kt
@@ -15,14 +15,15 @@
*/
package com.ashampoo.kim.format.webp.chunk
+import com.ashampoo.kim.format.tiff.TiffContents
import com.ashampoo.kim.format.tiff.TiffReader
import com.ashampoo.kim.format.webp.WebPChunkType
-class WebPChunkExif(
+public class WebPChunkExif(
bytes: ByteArray
) : WebPChunk(WebPChunkType.EXIF, bytes) {
/* Directly parse EXIF to ensure that it's valid. */
- val tiffContents = TiffReader.read(bytes)
+ public val tiffContents: TiffContents = TiffReader.read(bytes)
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8.kt
index fcdce4c1..6aa1b8d4 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8.kt
@@ -25,16 +25,16 @@ import com.ashampoo.kim.model.ImageSize
* https://developers.google.com/speed/webp/docs/riff_container#simple_file_format_lossy
*/
@Suppress("MagicNumber")
-class WebPChunkVP8(
+public class WebPChunkVP8(
bytes: ByteArray
) : WebPChunk(WebPChunkType.VP8, bytes), ImageSizeAware {
- val versionNumber: Int
+ public val versionNumber: Int
override val imageSize: ImageSize
- val horizontalScale: Int
- val verticalScale: Int
+ public val horizontalScale: Int
+ public val verticalScale: Int
init {
@@ -101,7 +101,7 @@ class WebPChunkVP8(
" versionNumber=$versionNumber imageSize=$imageSize" +
" horizontalScale=$horizontalScale verticalScale=$verticalScale"
- companion object {
+ private companion object {
private const val REQUIRED_BYTE_SIZE: Int = 10
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8L.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8L.kt
index f491f01f..9739ebe4 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8L.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8L.kt
@@ -25,15 +25,15 @@ import com.ashampoo.kim.model.ImageSize
* https://developers.google.com/speed/webp/docs/riff_container#simple_file_format_lossless
*/
@Suppress("MagicNumber")
-class WebPChunkVP8L(
+public class WebPChunkVP8L(
bytes: ByteArray
) : WebPChunk(WebPChunkType.VP8L, bytes), ImageSizeAware {
override val imageSize: ImageSize
- val hasAlpha: Boolean
+ public val hasAlpha: Boolean
- val versionNumber: Int
+ public val versionNumber: Int
init {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8X.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8X.kt
index b4b911fb..b1f12d9d 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8X.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkVP8X.kt
@@ -26,15 +26,15 @@ import com.ashampoo.kim.model.ImageSize
* https://developers.google.com/speed/webp/docs/riff_container#extended_file_format
*/
@Suppress("MagicNumber")
-class WebPChunkVP8X(
+public class WebPChunkVP8X(
bytes: ByteArray
) : WebPChunk(WebPChunkType.VP8X, bytes), ImageSizeAware {
- val hasIcc: Boolean
- val hasAlpha: Boolean
- val hasExif: Boolean
- val hasXmp: Boolean
- val hasAnimation: Boolean
+ public val hasIcc: Boolean
+ public val hasAlpha: Boolean
+ public val hasExif: Boolean
+ public val hasXmp: Boolean
+ public val hasAnimation: Boolean
override val imageSize: ImageSize
@@ -74,9 +74,9 @@ class WebPChunkVP8X(
" hasXmp=$hasXmp hasAnimation=$hasAnimation" +
" imageSize=$imageSize"
- companion object {
+ public companion object {
- fun createBytes(
+ public fun createBytes(
hasIcc: Boolean,
hasAlpha: Boolean,
hasExif: Boolean,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkXmp.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkXmp.kt
index 3ce9ca4b..96ceba93 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkXmp.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/webp/chunk/WebPChunkXmp.kt
@@ -17,10 +17,10 @@ package com.ashampoo.kim.format.webp.chunk
import com.ashampoo.kim.format.webp.WebPChunkType
-class WebPChunkXmp(
+public class WebPChunkXmp(
bytes: ByteArray
) : WebPChunk(WebPChunkType.XMP, bytes) {
- val xmp = bytes.decodeToString()
+ public val xmp: String = bytes.decodeToString()
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/xmp/XmpReader.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/xmp/XmpReader.kt
index 7ae96ed9..f2753cbb 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/xmp/XmpReader.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/xmp/XmpReader.kt
@@ -26,6 +26,7 @@ import com.ashampoo.xmp.XMPMetaFactory
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toInstant
+import kotlin.jvm.JvmStatic
/**
* We only read metadata that the user is likely to change/correct
@@ -34,11 +35,12 @@ import kotlinx.datetime.toInstant
* We ignore capture parameters like iso, focal length and so
* on because we prefer to get that from EXIF.
*/
-object XmpReader {
+public object XmpReader {
@Suppress("LoopWithTooManyJumpStatements")
@Throws(XMPException::class)
- fun readMetadata(xmp: String): PhotoMetadata {
+ @JvmStatic
+ public fun readMetadata(xmp: String): PhotoMetadata {
val xmpMeta = XMPMetaFactory.parseFromString(xmp)
@@ -102,7 +104,8 @@ object XmpReader {
}
@Suppress("Unused")
- fun determineXmpPath(path: String): String {
+ @JvmStatic
+ public fun determineXmpPath(path: String): String {
val xmpPath = path.replaceAfterLast(".", "xmp")
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/format/xmp/XmpWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/format/xmp/XmpWriter.kt
index eef2c967..2c2313eb 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/format/xmp/XmpWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/format/xmp/XmpWriter.kt
@@ -25,8 +25,9 @@ import com.ashampoo.xmp.options.SerializeOptions
import kotlinx.datetime.Instant
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
+import kotlin.jvm.JvmStatic
-object XmpWriter {
+public object XmpWriter {
private val xmpSerializeOptions =
SerializeOptions()
@@ -36,7 +37,8 @@ object XmpWriter {
.setUseCanonicalFormat(false)
.setSort(true)
- fun XMPMeta.applyUpdate(update: MetadataUpdate) {
+ @JvmStatic
+ public fun XMPMeta.applyUpdate(update: MetadataUpdate) {
when (update) {
@@ -100,7 +102,8 @@ object XmpWriter {
*/
@Throws(XMPException::class)
@Suppress("LoopWithTooManyJumpStatements")
- fun updateXmp(
+ @JvmStatic
+ public fun updateXmp(
xmpMeta: XMPMeta,
updates: Set,
writePackageWrapper: Boolean
@@ -117,7 +120,8 @@ object XmpWriter {
*/
@Throws(XMPException::class)
@Suppress("LoopWithTooManyJumpStatements")
- fun updateXmp(
+ @JvmStatic
+ public fun updateXmp(
xmpMeta: XMPMeta,
update: MetadataUpdate,
writePackageWrapper: Boolean
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/input/ByteArrayByteReader.kt b/src/commonMain/kotlin/com/ashampoo/kim/input/ByteArrayByteReader.kt
index 94a9616a..dfc21605 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/input/ByteArrayByteReader.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/input/ByteArrayByteReader.kt
@@ -25,7 +25,7 @@ import kotlin.math.min
* Note that huge files in production shouldn't be loaded into a ByteArray.
* For unit the purpose of unit tests this is acceptable.
*/
-class ByteArrayByteReader(
+public class ByteArrayByteReader(
private val bytes: ByteArray
) : RandomAccessByteReader {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/input/ByteReader.kt b/src/commonMain/kotlin/com/ashampoo/kim/input/ByteReader.kt
index 527382c5..89b4432d 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/input/ByteReader.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/input/ByteReader.kt
@@ -15,228 +15,15 @@
*/
package com.ashampoo.kim.input
-import com.ashampoo.kim.common.ByteOrder
-import com.ashampoo.kim.common.ImageReadException
-import com.ashampoo.kim.common.quadsToByteArray
-import com.ashampoo.kim.common.toHex
-import com.ashampoo.kim.output.ByteArrayByteWriter
+public interface ByteReader : Closeable {
-@Suppress("TooManyFunctions", "ComplexInterface", "MagicNumber")
-interface ByteReader : Closeable {
-
- val contentLength: Long
+ public val contentLength: Long
/**
* Returns the next Byte, if any.
*/
- fun readByte(): Byte?
-
- fun readBytes(count: Int): ByteArray
-
- fun readByte(fieldName: String): Byte {
-
- val byte = readByte()
-
- if (byte == null)
- throw ImageReadException("Couldn't read byte for $fieldName")
-
- return byte
- }
-
- fun readBytes(fieldName: String, count: Int): ByteArray {
-
- if (count < 0)
- throw ImageReadException("Couldn't read $fieldName, invalid length: $count")
-
- val bytes = readBytes(count)
-
- if (bytes.size != count)
- throw ImageReadException("Couldn't read $count bytes for $fieldName. Got only ${bytes.size}.")
-
- return bytes
- }
-
- fun readNullTerminatedString(fieldName: String): String {
-
- val bytes = mutableListOf()
-
- var byte: Byte?
-
- while (true) {
-
- byte = readByte()
-
- if (byte == null)
- throw ImageReadException("No bytes for $fieldName, never reached terminator byte.")
-
- if (byte.toInt() == 0)
- break
-
- bytes.add(byte)
- }
-
- return bytes.toByteArray().decodeToString()
- }
-
- /** Reads one byte as unsigned number, also known as "byte" or "UInt8" */
- fun readByteAsInt(): Int =
- readByte()?.let { it.toInt() and 0xFF } ?: -1
-
- /** Reads 2 bytes as unsigned number, also known as "short" or "UInt16" */
- fun read2BytesAsInt(fieldName: String, byteOrder: ByteOrder): Int {
-
- val byte0 = readByteAsInt()
- val byte1 = readByteAsInt()
-
- if (byte0 or byte1 < 0)
- throw ImageReadException("Couldn't read two bytes for $fieldName")
-
- return if (byteOrder == ByteOrder.BIG_ENDIAN)
- byte0 shl 8 or byte1
- else
- byte1 shl 8 or byte0
- }
-
- /** Reads 4 bytes as unsigned number, also known as "int" or "UInt32" */
- fun read4BytesAsInt(fieldName: String, byteOrder: ByteOrder): Int {
-
- val byte0 = readByteAsInt()
- val byte1 = readByteAsInt()
- val byte2 = readByteAsInt()
- val byte3 = readByteAsInt()
-
- if (byte0 or byte1 or byte2 or byte3 < 0)
- throw ImageReadException("Couldn't read 4 bytes for $fieldName")
-
- val result: Int = if (byteOrder == ByteOrder.BIG_ENDIAN)
- byte0 shl 24 or (byte1 shl 16) or (byte2 shl 8) or (byte3 shl 0)
- else
- byte3 shl 24 or (byte2 shl 16) or (byte1 shl 8) or (byte0 shl 0)
-
- return result
- }
-
- /** Reads 8 bytes as unsigned number, also known as "long" or "UInt64" */
- fun read8BytesAsLong(fieldName: String, byteOrder: ByteOrder): Long {
-
- val byte0 = readByteAsInt()
- val byte1 = readByteAsInt()
- val byte2 = readByteAsInt()
- val byte3 = readByteAsInt()
- val byte4 = readByteAsInt()
- val byte5 = readByteAsInt()
- val byte6 = readByteAsInt()
- val byte7 = readByteAsInt()
-
- if (byte0 or byte1 or byte2 or byte3 or byte4 or byte5 or byte6 or byte7 < 0)
- throw ImageReadException("Couldn't read 8 bytes for $fieldName")
-
- val result: Long = if (byteOrder == ByteOrder.BIG_ENDIAN)
- byte0.toLong() shl 56 or (byte1.toLong() shl 48) or (byte2.toLong() shl 40) or (byte3.toLong() shl 32) or
- (byte4.toLong() shl 24) or (byte5.toLong() shl 16) or (byte6.toLong() shl 8) or (byte7.toLong() shl 0)
- else
- byte7.toLong() shl 56 or (byte6.toLong() shl 48) or (byte5.toLong() shl 40) or (byte4.toLong() shl 32) or
- (byte3.toLong() shl 24) or (byte2.toLong() shl 16) or (byte1.toLong() shl 8) or (byte0.toLong() shl 0)
-
- return result
- }
-
- fun readXBytesAtInt(fieldName: String, count: Int, byteOrder: ByteOrder): Long =
- when (count) {
- 1 -> readByteAsInt().toLong()
- 2 -> read2BytesAsInt(fieldName, byteOrder).toLong()
- 4 -> read4BytesAsInt(fieldName, byteOrder).toLong()
- 8 -> read8BytesAsLong(fieldName, byteOrder)
- else -> error("Illegal byteCount specified: $count")
- }
-
- fun readAndVerifyBytes(fieldName: String, expectedBytes: ByteArray) {
-
- for (index in expectedBytes.indices) {
-
- val byte = readByte()
-
- if (byte == null)
- throw ImageReadException("Unexpected EOF for $fieldName")
-
- if (byte != expectedBytes[index])
- throw ImageReadException("Byte $index is different by reading $fieldName: ${byte.toHex()}")
- }
- }
-
- fun readRemainingBytes(): ByteArray {
-
- val os = ByteArrayByteWriter()
-
- while (true) {
-
- val bytes = readBytes(DEFAULT_BUFFER_SIZE)
-
- if (bytes.isEmpty())
- break
-
- os.write(bytes)
- }
-
- return os.toByteArray()
- }
-
- fun skipBytes(fieldName: String, count: Int) {
-
- /* Nothing to do. */
- if (count == 0)
- return
-
- if (count < 0)
- throw ImageReadException("Couldn't read $fieldName, invalid length: $count")
-
- var total: Int = 0
-
- while (count != total) {
-
- val skippedByteCount = readBytes(count).size
-
- if (skippedByteCount == 0) {
-
- val missingBytesCount = count - total
-
- throw ImageReadException(
- "Skipped $total bytes of $count for $fieldName: " +
- "Missing $missingBytesCount bytes."
- )
- }
-
- total += skippedByteCount
- }
- }
-
- fun skipToQuad(quad: Int): Boolean {
-
- val needle = quad.quadsToByteArray()
-
- var position = 0
-
- while (true) {
-
- val byte = readByteAsInt()
-
- if (byte == -1)
- break
-
- if (needle[position].toInt() == byte) {
-
- position++
-
- if (position == needle.size) {
- return true
- }
-
- } else {
+ public fun readByte(): Byte?
- position = 0
- }
- }
+ public fun readBytes(count: Int): ByteArray
- return false
- }
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/input/ByteReaderExtensions.kt b/src/commonMain/kotlin/com/ashampoo/kim/input/ByteReaderExtensions.kt
new file mode 100644
index 00000000..f0209adc
--- /dev/null
+++ b/src/commonMain/kotlin/com/ashampoo/kim/input/ByteReaderExtensions.kt
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2024 Ashampoo GmbH & Co. KG
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+@file:Suppress("TooManyFunctions")
+
+package com.ashampoo.kim.input
+
+import com.ashampoo.kim.common.ByteOrder
+import com.ashampoo.kim.common.ImageReadException
+import com.ashampoo.kim.common.quadsToByteArray
+import com.ashampoo.kim.common.toHex
+import com.ashampoo.kim.output.ByteArrayByteWriter
+
+/*
+ * For easier implementation of the [ByteReader] in
+ * Java these functions are designed as extension functions.
+ */
+
+internal fun ByteReader.readByte(fieldName: String): Byte =
+ readByte() ?: throw ImageReadException("Couldn't read byte for $fieldName")
+
+internal fun ByteReader.readBytes(fieldName: String, count: Int): ByteArray {
+
+ if (count < 0)
+ throw ImageReadException("Couldn't read $fieldName, invalid length: $count")
+
+ val bytes = readBytes(count)
+
+ if (bytes.size != count)
+ throw ImageReadException("Couldn't read $count bytes for $fieldName. Got only ${bytes.size}.")
+
+ return bytes
+}
+
+internal fun ByteReader.readNullTerminatedString(fieldName: String): String {
+
+ val bytes = mutableListOf()
+
+ var byte: Byte?
+
+ while (true) {
+
+ byte = readByte()
+
+ if (byte == null)
+ throw ImageReadException("No bytes for $fieldName, never reached terminator byte.")
+
+ if (byte.toInt() == 0)
+ break
+
+ bytes.add(byte)
+ }
+
+ return bytes.toByteArray().decodeToString()
+}
+
+/** Reads one byte as unsigned number, also known as "byte" or "UInt8" */
+internal fun ByteReader.readByteAsInt(): Int =
+ readByte()?.let { it.toInt() and 0xFF } ?: -1
+
+/** Reads 2 bytes as unsigned number, also known as "short" or "UInt16" */
+internal fun ByteReader.read2BytesAsInt(fieldName: String, byteOrder: ByteOrder): Int {
+
+ val byte0 = readByteAsInt()
+ val byte1 = readByteAsInt()
+
+ if (byte0 or byte1 < 0)
+ throw ImageReadException("Couldn't read two bytes for $fieldName")
+
+ return if (byteOrder == ByteOrder.BIG_ENDIAN)
+ byte0 shl 8 or byte1
+ else
+ byte1 shl 8 or byte0
+}
+
+/** Reads 4 bytes as unsigned number, also known as "int" or "UInt32" */
+internal fun ByteReader.read4BytesAsInt(fieldName: String, byteOrder: ByteOrder): Int {
+
+ val byte0 = readByteAsInt()
+ val byte1 = readByteAsInt()
+ val byte2 = readByteAsInt()
+ val byte3 = readByteAsInt()
+
+ if (byte0 or byte1 or byte2 or byte3 < 0)
+ throw ImageReadException("Couldn't read 4 bytes for $fieldName")
+
+ val result: Int = if (byteOrder == ByteOrder.BIG_ENDIAN)
+ byte0 shl 24 or (byte1 shl 16) or (byte2 shl 8) or (byte3 shl 0)
+ else
+ byte3 shl 24 or (byte2 shl 16) or (byte1 shl 8) or (byte0 shl 0)
+
+ return result
+}
+
+/** Reads 8 bytes as unsigned number, also known as "long" or "UInt64" */
+internal fun ByteReader.read8BytesAsLong(fieldName: String, byteOrder: ByteOrder): Long {
+
+ val byte0 = readByteAsInt()
+ val byte1 = readByteAsInt()
+ val byte2 = readByteAsInt()
+ val byte3 = readByteAsInt()
+ val byte4 = readByteAsInt()
+ val byte5 = readByteAsInt()
+ val byte6 = readByteAsInt()
+ val byte7 = readByteAsInt()
+
+ if (byte0 or byte1 or byte2 or byte3 or byte4 or byte5 or byte6 or byte7 < 0)
+ throw ImageReadException("Couldn't read 8 bytes for $fieldName")
+
+ val result: Long = if (byteOrder == ByteOrder.BIG_ENDIAN)
+ byte0.toLong() shl 56 or (byte1.toLong() shl 48) or (byte2.toLong() shl 40) or (byte3.toLong() shl 32) or
+ (byte4.toLong() shl 24) or (byte5.toLong() shl 16) or (byte6.toLong() shl 8) or (byte7.toLong() shl 0)
+ else
+ byte7.toLong() shl 56 or (byte6.toLong() shl 48) or (byte5.toLong() shl 40) or (byte4.toLong() shl 32) or
+ (byte3.toLong() shl 24) or (byte2.toLong() shl 16) or (byte1.toLong() shl 8) or (byte0.toLong() shl 0)
+
+ return result
+}
+
+internal fun ByteReader.readXBytesAtInt(fieldName: String, count: Int, byteOrder: ByteOrder): Long =
+ when (count) {
+ 1 -> readByteAsInt().toLong()
+ 2 -> read2BytesAsInt(fieldName, byteOrder).toLong()
+ 4 -> read4BytesAsInt(fieldName, byteOrder).toLong()
+ 8 -> read8BytesAsLong(fieldName, byteOrder)
+ else -> error("Illegal byteCount specified: $count")
+ }
+
+internal fun ByteReader.readAndVerifyBytes(fieldName: String, expectedBytes: ByteArray) {
+
+ for (index in expectedBytes.indices) {
+
+ val byte = readByte()
+ ?: throw ImageReadException("Unexpected EOF for $fieldName")
+
+ if (byte != expectedBytes[index])
+ throw ImageReadException("Byte $index is different by reading $fieldName: ${byte.toHex()}")
+ }
+}
+
+internal fun ByteReader.readRemainingBytes(): ByteArray {
+
+ val os = ByteArrayByteWriter()
+
+ while (true) {
+
+ val bytes = readBytes(DEFAULT_BUFFER_SIZE)
+
+ if (bytes.isEmpty())
+ break
+
+ os.write(bytes)
+ }
+
+ return os.toByteArray()
+}
+
+internal fun ByteReader.skipBytes(fieldName: String, count: Int) {
+
+ /* Nothing to do. */
+ if (count == 0)
+ return
+
+ if (count < 0)
+ throw ImageReadException("Couldn't read $fieldName, invalid length: $count")
+
+ var total = 0
+
+ while (count != total) {
+
+ val skippedByteCount = readBytes(count).size
+
+ if (skippedByteCount == 0) {
+
+ val missingBytesCount = count - total
+
+ throw ImageReadException(
+ "Skipped $total bytes of $count for $fieldName: " +
+ "Missing $missingBytesCount bytes."
+ )
+ }
+
+ total += skippedByteCount
+ }
+}
+
+internal fun ByteReader.skipToQuad(quad: Int): Boolean {
+
+ val needle = quad.quadsToByteArray()
+
+ var position = 0
+
+ while (true) {
+
+ val byte = readByteAsInt()
+
+ if (byte == -1)
+ break
+
+ if (needle[position].toInt() == byte) {
+
+ position++
+
+ if (position == needle.size) {
+ return true
+ }
+
+ } else {
+
+ position = 0
+ }
+ }
+
+ return false
+}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/input/Closeable.kt b/src/commonMain/kotlin/com/ashampoo/kim/input/Closeable.kt
index ce047e7a..cbd2b83b 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/input/Closeable.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/input/Closeable.kt
@@ -15,8 +15,8 @@
*/
package com.ashampoo.kim.input
-fun interface Closeable {
- fun close()
+public fun interface Closeable {
+ public fun close()
}
/** Executes the code and closes the source after. */
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/input/Constants.kt b/src/commonMain/kotlin/com/ashampoo/kim/input/Constants.kt
index 24a06c03..d8dccced 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/input/Constants.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/input/Constants.kt
@@ -16,4 +16,4 @@
package com.ashampoo.kim.input
/** Same as kotlin.io.DEFAULT_BUFFER_SIZE */
-const val DEFAULT_BUFFER_SIZE: Int = 8 * 1024
+internal const val DEFAULT_BUFFER_SIZE: Int = 8 * 1024
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/input/DefaultRandomAccessByteReader.kt b/src/commonMain/kotlin/com/ashampoo/kim/input/DefaultRandomAccessByteReader.kt
index 56032ebd..51537630 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/input/DefaultRandomAccessByteReader.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/input/DefaultRandomAccessByteReader.kt
@@ -22,8 +22,8 @@ import kotlin.math.max
* This class buffers the reading from the original ByteReader and
* provides random access needed for parsing TIFF files.
*/
-class DefaultRandomAccessByteReader(
- val byteReader: ByteReader
+public class DefaultRandomAccessByteReader(
+ public val byteReader: ByteReader
) : RandomAccessByteReader {
override val contentLength: Long =
@@ -84,7 +84,7 @@ class DefaultRandomAccessByteReader(
return buffer.copyOfRange(offset, endIndex)
}
- override fun close() =
+ override fun close(): Unit =
byteReader.close()
private fun readToIndex(index: Int) {
@@ -115,7 +115,7 @@ class DefaultRandomAccessByteReader(
bufferPosition = index
}
- companion object {
+ private companion object {
/*
* We read the file in chunks of the usual EXIF size (65kb).
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/input/PrePendingByteReader.kt b/src/commonMain/kotlin/com/ashampoo/kim/input/PrePendingByteReader.kt
index f1fe8857..d1b67cfa 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/input/PrePendingByteReader.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/input/PrePendingByteReader.kt
@@ -20,7 +20,7 @@ package com.ashampoo.kim.input
* read from [ByteReader] after that. Can be used to
* prepend the magic number again.
*/
-class PrePendingByteReader(
+internal class PrePendingByteReader(
private val delegate: ByteReader,
prependedBytes: List
) : ByteReader {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/input/RandomAccessByteReader.kt b/src/commonMain/kotlin/com/ashampoo/kim/input/RandomAccessByteReader.kt
index 7335834b..03e6d833 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/input/RandomAccessByteReader.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/input/RandomAccessByteReader.kt
@@ -19,12 +19,12 @@ package com.ashampoo.kim.input
* Random access to the bytes are required to read TIFF files
* where an offset can even be lower than the current position.
*/
-interface RandomAccessByteReader : ByteReader {
+public interface RandomAccessByteReader : ByteReader {
- fun reset() = moveTo(0)
+ public fun reset(): Unit = moveTo(0)
- fun moveTo(position: Int)
+ public fun moveTo(position: Int)
- fun readBytes(offset: Int, length: Int): ByteArray
+ public fun readBytes(offset: Int, length: Int): ByteArray
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/model/GpsCoordinates.kt b/src/commonMain/kotlin/com/ashampoo/kim/model/GpsCoordinates.kt
index 28bb4c39..aebda30b 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/model/GpsCoordinates.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/model/GpsCoordinates.kt
@@ -26,21 +26,21 @@ private const val MIN_LONGITUDE = -MAX_LONGITUDE
private const val THREE_DIGIT_PRECISE: Double = 1_000.0
private const val FIVE_DIGIT_PRECISE: Double = 100_000.0
-data class GpsCoordinates(
+public data class GpsCoordinates(
val latitude: Double,
val longitude: Double
) {
val displayString: String = "GPS: ${roundForDisplay(latitude)}, ${roundForDisplay(longitude)}"
- fun toRoundedForCaching(): GpsCoordinates = GpsCoordinates(
+ public fun toRoundedForCaching(): GpsCoordinates = GpsCoordinates(
latitude = roundForCaching(latitude),
longitude = roundForCaching(longitude)
)
- fun isNullIsland(): Boolean = latitude == 0.0 && longitude == 0.0
+ public fun isNullIsland(): Boolean = latitude == 0.0 && longitude == 0.0
- fun isValid(): Boolean =
+ public fun isValid(): Boolean =
latitude in MIN_LATITUDE..MAX_LATITUDE && longitude in MIN_LONGITUDE..MAX_LONGITUDE
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/model/ImageFormat.kt b/src/commonMain/kotlin/com/ashampoo/kim/model/ImageFormat.kt
index 4de52693..7834ec4b 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/model/ImageFormat.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/model/ImageFormat.kt
@@ -21,10 +21,10 @@ import com.ashampoo.kim.common.toSingleNumberHexes
import com.ashampoo.kim.format.ImageFormatMagicNumbers
import kotlin.jvm.JvmStatic
-enum class ImageFormat(
- val mimeType: String,
- val uniformTypeIdentifier: String,
- val fileNameExtensions: Set
+public enum class ImageFormat(
+ public val mimeType: String,
+ public val uniformTypeIdentifier: String,
+ public val fileNameExtensions: Set
) {
JPEG("image/jpeg", "public.jpeg", setOf("jpg", "jpeg")),
@@ -43,23 +43,20 @@ enum class ImageFormat(
DNG("image/x-adobe-dng", "com.adobe.raw-image", setOf("dng")),
JXL("image/jxl", "public.jxl", setOf("jxl"));
- fun isMetadataEmbeddable(): Boolean =
- this == ImageFormat.JPEG ||
- this == ImageFormat.PNG ||
- this == ImageFormat.WEBP ||
- this == ImageFormat.JXL
+ public fun isMetadataEmbeddable(): Boolean =
+ this == JPEG || this == PNG || this == WEBP || this == JXL
- companion object {
+ public companion object {
/**
* RAF is the longest format that requires us to read 16 bytes to detect it.
* Right after that we need 12 bytes to check for HEIC.
*/
- const val REQUIRED_HEADER_BYTE_COUNT_FOR_DETECTION: Int = 16
+ public const val REQUIRED_HEADER_BYTE_COUNT_FOR_DETECTION: Int = 16
private val allImageFormats = ImageFormat.entries
- private val allFileNameExtensions = getAllFileNameExtensions()
+ public val allFileNameExtensions: Set = computeAllFileNameExtensions()
/*
* OneDrive reports RAW files under wrong mime types
@@ -72,8 +69,7 @@ enum class ImageFormat(
private const val ORF_ONEDRIVE_MIME_TYPE = "image/ORF"
private const val DNG_ONEDRIVE_MIME_TYPE = "image/DNG"
- @JvmStatic
- private fun getAllFileNameExtensions(): MutableSet {
+ private fun computeAllFileNameExtensions(): MutableSet {
val fileNameExtensions = mutableSetOf()
@@ -85,7 +81,7 @@ enum class ImageFormat(
}
@JvmStatic
- fun hasValidFileNameExtension(fileName: String): Boolean {
+ public fun hasValidFileNameExtension(fileName: String): Boolean {
for (extension in allFileNameExtensions)
if (fileName.endsWith(".$extension", ignoreCase = true))
@@ -95,7 +91,7 @@ enum class ImageFormat(
}
@JvmStatic
- fun byMimeType(mimeType: String): ImageFormat? {
+ public fun byMimeType(mimeType: String): ImageFormat? {
for (fileType in allImageFormats)
if (mimeType.contentEquals(fileType.mimeType, ignoreCase = true))
@@ -114,7 +110,7 @@ enum class ImageFormat(
}
@JvmStatic
- fun byUniformTypeIdentifier(
+ public fun byUniformTypeIdentifier(
uniformTypeIdentifier: String
): ImageFormat? {
@@ -126,7 +122,7 @@ enum class ImageFormat(
}
@JvmStatic
- fun byFileNameExtension(fileName: String): ImageFormat? {
+ public fun byFileNameExtension(fileName: String): ImageFormat? {
for (fileType in allImageFormats)
for (extension in fileType.fileNameExtensions)
@@ -143,7 +139,7 @@ enum class ImageFormat(
* (for example empty) than the detection returns null.
*/
@JvmStatic
- fun detect(bytes: ByteArray): ImageFormat? {
+ public fun detect(bytes: ByteArray): ImageFormat? {
/*
* If empty or not enough bytes we can't detect the format and will return NULL.
@@ -159,34 +155,34 @@ enum class ImageFormat(
*/
return when {
/* JPG is the most common format. Check this first. */
- bytes.startsWith(ImageFormatMagicNumbers.jpeg) -> ImageFormat.JPEG
+ bytes.startsWith(ImageFormatMagicNumbers.jpeg) -> JPEG
/* Check other common formats. */
- bytes.startsWith(ImageFormatMagicNumbers.png) -> ImageFormat.PNG
- bytes.startsWithNullable(ImageFormatMagicNumbers.webP) -> ImageFormat.WEBP
+ bytes.startsWith(ImageFormatMagicNumbers.png) -> PNG
+ bytes.startsWithNullable(ImageFormatMagicNumbers.webP) -> WEBP
/* Canon CR2 et al *must* be checked before TIFF, because they are based on TIFF */
- bytes.startsWith(ImageFormatMagicNumbers.cr2) -> ImageFormat.CR2
- bytes.startsWith(ImageFormatMagicNumbers.rw2) -> ImageFormat.RW2
- bytes.startsWith(ImageFormatMagicNumbers.orf_iiro) -> ImageFormat.ORF
- bytes.startsWith(ImageFormatMagicNumbers.orf_mmor) -> ImageFormat.ORF
- bytes.startsWith(ImageFormatMagicNumbers.orf_iirs) -> ImageFormat.ORF
- bytes.startsWith(ImageFormatMagicNumbers.raf) -> ImageFormat.RAF
+ bytes.startsWith(ImageFormatMagicNumbers.cr2) -> CR2
+ bytes.startsWith(ImageFormatMagicNumbers.rw2) -> RW2
+ bytes.startsWith(ImageFormatMagicNumbers.orf_iiro) -> ORF
+ bytes.startsWith(ImageFormatMagicNumbers.orf_mmor) -> ORF
+ bytes.startsWith(ImageFormatMagicNumbers.orf_iirs) -> ORF
+ bytes.startsWith(ImageFormatMagicNumbers.raf) -> RAF
/* Check TIFF after the RAW files. */
- bytes.startsWith(ImageFormatMagicNumbers.tiffLittleEndian) -> ImageFormat.TIFF
- bytes.startsWith(ImageFormatMagicNumbers.tiffBigEndian) -> ImageFormat.TIFF
+ bytes.startsWith(ImageFormatMagicNumbers.tiffLittleEndian) -> TIFF
+ bytes.startsWith(ImageFormatMagicNumbers.tiffBigEndian) -> TIFF
/* Check JXL ISOBMFF */
- bytes.startsWith(ImageFormatMagicNumbers.jxl) -> ImageFormat.JXL
+ bytes.startsWith(ImageFormatMagicNumbers.jxl) -> JXL
/* Check HEIC variants */
- bytes.startsWithNullable(ImageFormatMagicNumbers.heic) -> ImageFormat.HEIC
- bytes.startsWithNullable(ImageFormatMagicNumbers.mif1) -> ImageFormat.HEIC
- bytes.startsWithNullable(ImageFormatMagicNumbers.msf1) -> ImageFormat.HEIC
- bytes.startsWithNullable(ImageFormatMagicNumbers.heix) -> ImageFormat.HEIC
- bytes.startsWithNullable(ImageFormatMagicNumbers.hevc) -> ImageFormat.HEIC
- bytes.startsWithNullable(ImageFormatMagicNumbers.hevx) -> ImageFormat.HEIC
+ bytes.startsWithNullable(ImageFormatMagicNumbers.heic) -> HEIC
+ bytes.startsWithNullable(ImageFormatMagicNumbers.mif1) -> HEIC
+ bytes.startsWithNullable(ImageFormatMagicNumbers.msf1) -> HEIC
+ bytes.startsWithNullable(ImageFormatMagicNumbers.heix) -> HEIC
+ bytes.startsWithNullable(ImageFormatMagicNumbers.hevc) -> HEIC
+ bytes.startsWithNullable(ImageFormatMagicNumbers.hevx) -> HEIC
/* Check AVIF */
- bytes.startsWithNullable(ImageFormatMagicNumbers.avif) -> ImageFormat.AVIF
+ bytes.startsWithNullable(ImageFormatMagicNumbers.avif) -> AVIF
/* Check GIF and other unlikely formats... */
- bytes.startsWith(ImageFormatMagicNumbers.gif87a) -> ImageFormat.GIF
- bytes.startsWith(ImageFormatMagicNumbers.gif89a) -> ImageFormat.GIF
+ bytes.startsWith(ImageFormatMagicNumbers.gif87a) -> GIF
+ bytes.startsWith(ImageFormatMagicNumbers.gif89a) -> GIF
else -> null
}
}
@@ -196,7 +192,7 @@ enum class ImageFormat(
* It translates to a readable name or returns a hex presentation of the bytes.
*/
@JvmStatic
- fun detectNameOrReturnHex(byteArray: ByteArray): String =
+ public fun detectNameOrReturnHex(byteArray: ByteArray): String =
detect(byteArray)?.name ?: byteArray
.take(REQUIRED_HEADER_BYTE_COUNT_FOR_DETECTION)
.toByteArray()
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/model/ImageSize.kt b/src/commonMain/kotlin/com/ashampoo/kim/model/ImageSize.kt
index 6b6d4691..1e18aefc 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/model/ImageSize.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/model/ImageSize.kt
@@ -17,7 +17,7 @@ package com.ashampoo.kim.model
import kotlin.math.max
-data class ImageSize(
+public data class ImageSize(
val width: Int,
val height: Int
) {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/model/Location.kt b/src/commonMain/kotlin/com/ashampoo/kim/model/Location.kt
index 584717be..ea5f5e7e 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/model/Location.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/model/Location.kt
@@ -15,7 +15,7 @@
*/
package com.ashampoo.kim.model
-data class Location(
+public data class Location(
val name: String?,
val city: String?,
val state: String?,
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/model/MetadataUpdate.kt b/src/commonMain/kotlin/com/ashampoo/kim/model/MetadataUpdate.kt
index 46454ba0..c45966f2 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/model/MetadataUpdate.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/model/MetadataUpdate.kt
@@ -20,33 +20,33 @@ import com.ashampoo.xmp.XMPRegionArea
/**
* Represents possible updates that can be performed.
*/
-sealed interface MetadataUpdate {
+public sealed interface MetadataUpdate {
/**
* In a perfect world every file has an orientation flag. So we don't want NULLs here.
*/
- data class Orientation(
+ public data class Orientation(
val tiffOrientation: TiffOrientation
) : MetadataUpdate
/**
* New taken date in millis or NULL to remove it (if the date is wrong and/or not known).
*/
- data class TakenDate(
+ public data class TakenDate(
val takenDate: Long?
) : MetadataUpdate
/**
* New GPS coordinates or NULL to remove it (if the location is wrong and/or not known)
*/
- data class GpsCoordinates(
+ public data class GpsCoordinates(
val gpsCoordinates: com.ashampoo.kim.model.GpsCoordinates?
) : MetadataUpdate
/**
* Set a photo as flagged/tagged/picked.
*/
- data class Flagged(
+ public data class Flagged(
val flagged: Boolean
) : MetadataUpdate
@@ -54,21 +54,21 @@ sealed interface MetadataUpdate {
* Set a new Rating.
* Can't be NULL and should be UNRATED instead.
*/
- data class Rating(
+ public data class Rating(
val photoRating: PhotoRating
) : MetadataUpdate
/**
* List of new keywords to set. An empty list removes all keywords.
*/
- data class Keywords(
+ public data class Keywords(
val keywords: Set
) : MetadataUpdate
/**
* List of new faces to set. An empty map removes all faces.
*/
- data class Faces(
+ public data class Faces(
val faces: Map,
val widthPx: Int,
val heightPx: Int
@@ -77,14 +77,14 @@ sealed interface MetadataUpdate {
/**
* List of new persons to set. An empty list removes all persons.
*/
- data class Persons(
+ public data class Persons(
val personsInImage: Set
) : MetadataUpdate
/**
* List of new albums to set. An empty list removes all albums.
*/
- data class Albums(
+ public data class Albums(
val albums: Set
) : MetadataUpdate
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/model/PhotoMetadata.kt b/src/commonMain/kotlin/com/ashampoo/kim/model/PhotoMetadata.kt
index 46b29b31..c305af63 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/model/PhotoMetadata.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/model/PhotoMetadata.kt
@@ -26,7 +26,7 @@ import kotlinx.datetime.toLocalDateTime
* Represents a high-level summary of image metadata extracted from raw ImageMetadata.
* This summary is used by Ashampoo Photo Organizer.
*/
-data class PhotoMetadata(
+public data class PhotoMetadata(
val imageFormat: ImageFormat? = null,
@@ -78,10 +78,7 @@ data class PhotoMetadata(
(widthPx * heightPx).div(PhotoValueFormatter.MEGA_PIXEL_COUNT)
val locationDisplay: String? =
- if (location != null)
- location.displayString
- else
- gpsCoordinates?.let { gpsCoordinates.displayString }
+ location?.displayString ?: gpsCoordinates?.let { gpsCoordinates.displayString }
val cameraName: String? =
PhotoValueFormatter.createCameraOrLensName(cameraMake, cameraModel)
@@ -98,7 +95,7 @@ data class PhotoMetadata(
)
@Suppress("DataClassContainsFunctions")
- fun isEmpty(): Boolean = this == emptyPhotoMetadata
+ public fun isEmpty(): Boolean = this == emptyPhotoMetadata
/**
* Combine the current metadata with the given one,
@@ -110,7 +107,7 @@ data class PhotoMetadata(
* If the other metadata is NULL the same object is returned.
* This API is provided to chain it.
*/
- fun merge(other: PhotoMetadata?): PhotoMetadata {
+ public fun merge(other: PhotoMetadata?): PhotoMetadata {
if (other == null)
return this
@@ -157,8 +154,8 @@ data class PhotoMetadata(
)
}
- companion object {
+ public companion object {
- val emptyPhotoMetadata: PhotoMetadata = PhotoMetadata()
+ public val emptyPhotoMetadata: PhotoMetadata = PhotoMetadata()
}
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/model/PhotoRating.kt b/src/commonMain/kotlin/com/ashampoo/kim/model/PhotoRating.kt
index 5ff0e146..9732860b 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/model/PhotoRating.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/model/PhotoRating.kt
@@ -15,30 +15,30 @@
*/
package com.ashampoo.kim.model
-const val REJECTED_VALUE: Int = -1
-const val UNRATED_VALUE: Int = 0
-const val ONE_STAR_VALUE: Int = 1
-const val TWO_STARS_VALUE: Int = 2
-const val THREE_STARS_VALUE: Int = 3
-const val FOUR_STARS_VALUE: Int = 4
-const val FIVE_STARS_VALUE: Int = 5
+private const val REJECTED_VALUE: Int = -1
+private const val UNRATED_VALUE: Int = 0
+private const val ONE_STAR_VALUE: Int = 1
+private const val TWO_STARS_VALUE: Int = 2
+private const val THREE_STARS_VALUE: Int = 3
+private const val FOUR_STARS_VALUE: Int = 4
+private const val FIVE_STARS_VALUE: Int = 5
-const val REJECTED_STRING: String = "-----"
-const val UNRATED_STRING: String = "☆☆☆☆☆"
-const val ONE_STAR_STRING: String = "★☆☆☆☆"
-const val TWO_STARS_STRING: String = "★★☆☆☆"
-const val THREE_STARS_STRING: String = "★★★☆☆"
-const val FOUR_STARS_STRING: String = "★★★★☆"
-const val FIVE_STARS_STRING: String = "★★★★★"
+private const val REJECTED_STRING: String = "-----"
+private const val UNRATED_STRING: String = "☆☆☆☆☆"
+private const val ONE_STAR_STRING: String = "★☆☆☆☆"
+private const val TWO_STARS_STRING: String = "★★☆☆☆"
+private const val THREE_STARS_STRING: String = "★★★☆☆"
+private const val FOUR_STARS_STRING: String = "★★★★☆"
+private const val FIVE_STARS_STRING: String = "★★★★★"
/**
* This represents the XMP exif:Rating property,
* which is a 5-star-system with 0 for unrated
* and -1 for rejected images.
*/
-enum class PhotoRating(
- val value: Int,
- val string: String
+public enum class PhotoRating(
+ public val value: Int,
+ public val string: String
) {
REJECTED(REJECTED_VALUE, REJECTED_STRING),
@@ -49,12 +49,12 @@ enum class PhotoRating(
FOUR_STARS(FOUR_STARS_VALUE, FOUR_STARS_STRING),
FIVE_STARS(FIVE_STARS_VALUE, FIVE_STARS_STRING);
- companion object {
+ public companion object {
- val validIntRange: IntRange = REJECTED.value..FIVE_STARS.value
+ public val validIntRange: IntRange = REJECTED.value..FIVE_STARS.value
/* **Note:** Swift problems if parameter value is of type Int? */
- fun of(value: Int): PhotoRating? = when (value) {
+ public fun of(value: Int): PhotoRating? = when (value) {
REJECTED_VALUE -> REJECTED
UNRATED_VALUE -> UNRATED
ONE_STAR_VALUE -> ONE_STAR
@@ -65,7 +65,7 @@ enum class PhotoRating(
else -> null
}
- fun of(value: String?): PhotoRating? = when (value) {
+ public fun of(value: String?): PhotoRating? = when (value) {
"-1" -> REJECTED
"0" -> UNRATED
"1" -> ONE_STAR
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/model/TiffOrientation.kt b/src/commonMain/kotlin/com/ashampoo/kim/model/TiffOrientation.kt
index 241ea48e..712ccb6e 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/model/TiffOrientation.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/model/TiffOrientation.kt
@@ -16,7 +16,9 @@
package com.ashampoo.kim.model
@Suppress("MagicNumber")
-enum class TiffOrientation(val value: Int) {
+public enum class TiffOrientation(
+ public val value: Int
+) {
/** 1: The image is in its default orientation. */
STANDARD(1),
@@ -43,7 +45,7 @@ enum class TiffOrientation(val value: Int) {
ROTATE_LEFT(8);
/** Returns the orientation after rotating the image to the left. */
- fun rotateLeft(): TiffOrientation = when (this) {
+ public fun rotateLeft(): TiffOrientation = when (this) {
STANDARD -> ROTATE_LEFT
MIRROR_HORIZONTAL -> MIRROR_HORIZONTAL_AND_ROTATE_LEFT
UPSIDE_DOWN -> ROTATE_RIGHT
@@ -55,7 +57,7 @@ enum class TiffOrientation(val value: Int) {
}
/** Returns the orientation after rotating the image to the right. */
- fun rotateRight(): TiffOrientation = when (this) {
+ public fun rotateRight(): TiffOrientation = when (this) {
STANDARD -> ROTATE_RIGHT
MIRROR_HORIZONTAL -> MIRROR_HORIZONTAL_AND_ROTATE_RIGHT
UPSIDE_DOWN -> ROTATE_LEFT
@@ -67,7 +69,7 @@ enum class TiffOrientation(val value: Int) {
}
/** Returns the orientation after flipping the image horizontally. */
- fun flipHorizontally(): TiffOrientation = when (this) {
+ public fun flipHorizontally(): TiffOrientation = when (this) {
STANDARD -> MIRROR_HORIZONTAL
MIRROR_HORIZONTAL -> STANDARD
UPSIDE_DOWN -> MIRROR_VERTICAL
@@ -79,7 +81,7 @@ enum class TiffOrientation(val value: Int) {
}
/** Returns the orientation after flipping the image vertically. */
- fun flipVertically(): TiffOrientation = when (this) {
+ public fun flipVertically(): TiffOrientation = when (this) {
STANDARD -> MIRROR_VERTICAL
MIRROR_HORIZONTAL -> UPSIDE_DOWN
UPSIDE_DOWN -> MIRROR_HORIZONTAL
@@ -90,10 +92,10 @@ enum class TiffOrientation(val value: Int) {
ROTATE_LEFT -> MIRROR_HORIZONTAL_AND_ROTATE_LEFT
}
- companion object {
+ public companion object {
/** Returns the TiffOrientation enum value that corresponds to the given integer value. */
- fun of(value: Int?): TiffOrientation? = when (value) {
+ public fun of(value: Int?): TiffOrientation? = when (value) {
1 -> STANDARD
2 -> MIRROR_HORIZONTAL
3 -> UPSIDE_DOWN
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/output/BigEndianBinaryByteWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/output/BigEndianBinaryByteWriter.kt
index 490071b3..af3cf3d8 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/output/BigEndianBinaryByteWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/output/BigEndianBinaryByteWriter.kt
@@ -17,7 +17,7 @@
package com.ashampoo.kim.output
@Suppress("MagicNumber")
-class BigEndianBinaryByteWriter(byteWriter: ByteWriter) : BinaryByteWriter(byteWriter) {
+internal class BigEndianBinaryByteWriter(byteWriter: ByteWriter) : BinaryByteWriter(byteWriter) {
override fun write2Bytes(value: Int) {
write(0xFF and (value shr 8))
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/output/BinaryByteWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/output/BinaryByteWriter.kt
index d1879292..d788c37f 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/output/BinaryByteWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/output/BinaryByteWriter.kt
@@ -18,13 +18,15 @@ package com.ashampoo.kim.output
import com.ashampoo.kim.common.ByteOrder
-abstract class BinaryByteWriter(val byteWriter: ByteWriter) : ByteWriter {
+public abstract class BinaryByteWriter(
+ public val byteWriter: ByteWriter
+) : ByteWriter {
- abstract fun write2Bytes(value: Int)
+ public abstract fun write2Bytes(value: Int)
// abstract fun write3Bytes(value: Int)
- abstract fun write4Bytes(value: Int)
+ public abstract fun write4Bytes(value: Int)
override fun write(byte: Int) {
byteWriter.write(byte)
@@ -42,10 +44,10 @@ abstract class BinaryByteWriter(val byteWriter: ByteWriter) : ByteWriter {
byteWriter.close()
}
- companion object {
+ public companion object {
@kotlin.jvm.JvmStatic
- fun createBinaryByteWriter(byteWriter: ByteWriter, byteOrder: ByteOrder): BinaryByteWriter =
+ public fun createBinaryByteWriter(byteWriter: ByteWriter, byteOrder: ByteOrder): BinaryByteWriter =
when (byteOrder) {
ByteOrder.LITTLE_ENDIAN -> LittleEndianBinaryByteWriter(byteWriter)
ByteOrder.BIG_ENDIAN -> BigEndianBinaryByteWriter(byteWriter)
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/output/BufferByteWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/output/BufferByteWriter.kt
index d11d86dc..431de854 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/output/BufferByteWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/output/BufferByteWriter.kt
@@ -18,7 +18,7 @@ package com.ashampoo.kim.output
import com.ashampoo.kim.common.ImageWriteException
-class BufferByteWriter(
+internal class BufferByteWriter(
private val buffer: ByteArray,
private var index: Int
) : ByteWriter {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/output/ByteArrayByteWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/output/ByteArrayByteWriter.kt
index 7969d677..f3eb7fa7 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/output/ByteArrayByteWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/output/ByteArrayByteWriter.kt
@@ -19,7 +19,7 @@ package com.ashampoo.kim.output
import com.ashampoo.kim.input.Closeable
import com.ashampoo.kim.input.DEFAULT_BUFFER_SIZE
-class ByteArrayByteWriter : ByteWriter, Closeable {
+public class ByteArrayByteWriter : ByteWriter, Closeable {
private var bytes: ByteArray = ByteArray(DEFAULT_BUFFER_SIZE)
@@ -44,7 +44,7 @@ class ByteArrayByteWriter : ByteWriter, Closeable {
/* Nothing to do */
}
- fun toByteArray(): ByteArray = bytes.copyOfRange(0, position)
+ public fun toByteArray(): ByteArray = bytes.copyOfRange(0, position)
private fun ensureCapacity(requiredCapacity: Int) {
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/output/ByteWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/output/ByteWriter.kt
index 95aecb90..e4ab8d41 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/output/ByteWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/output/ByteWriter.kt
@@ -15,65 +15,14 @@
*/
package com.ashampoo.kim.output
-import com.ashampoo.kim.common.ByteOrder
import com.ashampoo.kim.input.Closeable
-interface ByteWriter : Closeable {
+public interface ByteWriter : Closeable {
- fun write(byte: Int)
+ public fun write(byte: Int)
- fun write(byteArray: ByteArray)
+ public fun write(byteArray: ByteArray)
- fun flush()
+ public fun flush()
- @Suppress("MagicNumber")
- fun writeInt(
- value: Int,
- byteOrder: ByteOrder
- ) {
-
- if (byteOrder == ByteOrder.BIG_ENDIAN) {
-
- write(0xFF and (value shr 24))
- write(0xFF and (value shr 16))
- write(0xFF and (value shr 8))
- write(0xFF and (value shr 0))
-
- } else {
-
- write(0xFF and (value shr 0))
- write(0xFF and (value shr 8))
- write(0xFF and (value shr 16))
- write(0xFF and (value shr 24))
- }
- }
-
- @Suppress("MagicNumber")
- fun writeLong(
- value: Long,
- byteOrder: ByteOrder
- ) {
- if (byteOrder == ByteOrder.BIG_ENDIAN) {
-
- write(0xFF and (value shr 56).toInt())
- write(0xFF and (value shr 48).toInt())
- write(0xFF and (value shr 40).toInt())
- write(0xFF and (value shr 32).toInt())
- write(0xFF and (value shr 24).toInt())
- write(0xFF and (value shr 16).toInt())
- write(0xFF and (value shr 8).toInt())
- write(0xFF and value.toInt())
-
- } else {
-
- write(0xFF and value.toInt())
- write(0xFF and (value shr 8).toInt())
- write(0xFF and (value shr 16).toInt())
- write(0xFF and (value shr 24).toInt())
- write(0xFF and (value shr 32).toInt())
- write(0xFF and (value shr 40).toInt())
- write(0xFF and (value shr 48).toInt())
- write(0xFF and (value shr 56).toInt())
- }
- }
}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/output/ByteWriterExtensions.kt b/src/commonMain/kotlin/com/ashampoo/kim/output/ByteWriterExtensions.kt
new file mode 100644
index 00000000..f4d9543d
--- /dev/null
+++ b/src/commonMain/kotlin/com/ashampoo/kim/output/ByteWriterExtensions.kt
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2024 Ashampoo GmbH & Co. KG
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ashampoo.kim.output
+
+import com.ashampoo.kim.common.ByteOrder
+
+/*
+ * For easier implementation of the [ByteWriter] in
+ * Java these functions are designed as extension functions.
+ */
+
+@Suppress("MagicNumber")
+internal fun ByteWriter.writeInt(
+ value: Int,
+ byteOrder: ByteOrder
+) {
+
+ if (byteOrder == ByteOrder.BIG_ENDIAN) {
+
+ write(0xFF and (value shr 24))
+ write(0xFF and (value shr 16))
+ write(0xFF and (value shr 8))
+ write(0xFF and (value shr 0))
+
+ } else {
+
+ write(0xFF and (value shr 0))
+ write(0xFF and (value shr 8))
+ write(0xFF and (value shr 16))
+ write(0xFF and (value shr 24))
+ }
+}
+
+@Suppress("MagicNumber")
+internal fun ByteWriter.writeLong(
+ value: Long,
+ byteOrder: ByteOrder
+) {
+ if (byteOrder == ByteOrder.BIG_ENDIAN) {
+
+ write(0xFF and (value shr 56).toInt())
+ write(0xFF and (value shr 48).toInt())
+ write(0xFF and (value shr 40).toInt())
+ write(0xFF and (value shr 32).toInt())
+ write(0xFF and (value shr 24).toInt())
+ write(0xFF and (value shr 16).toInt())
+ write(0xFF and (value shr 8).toInt())
+ write(0xFF and value.toInt())
+
+ } else {
+
+ write(0xFF and value.toInt())
+ write(0xFF and (value shr 8).toInt())
+ write(0xFF and (value shr 16).toInt())
+ write(0xFF and (value shr 24).toInt())
+ write(0xFF and (value shr 32).toInt())
+ write(0xFF and (value shr 40).toInt())
+ write(0xFF and (value shr 48).toInt())
+ write(0xFF and (value shr 56).toInt())
+ }
+}
diff --git a/src/commonMain/kotlin/com/ashampoo/kim/output/LittleEndianBinaryByteWriter.kt b/src/commonMain/kotlin/com/ashampoo/kim/output/LittleEndianBinaryByteWriter.kt
index f9f327b1..957f4ae7 100644
--- a/src/commonMain/kotlin/com/ashampoo/kim/output/LittleEndianBinaryByteWriter.kt
+++ b/src/commonMain/kotlin/com/ashampoo/kim/output/LittleEndianBinaryByteWriter.kt
@@ -17,7 +17,7 @@
package com.ashampoo.kim.output
@Suppress("MagicNumber")
-class LittleEndianBinaryByteWriter(byteWriter: ByteWriter) : BinaryByteWriter(byteWriter) {
+internal class LittleEndianBinaryByteWriter(byteWriter: ByteWriter) : BinaryByteWriter(byteWriter) {
override fun write2Bytes(value: Int) {
write(0xFF and value)
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/PreviewImageExtractionTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/PreviewImageExtractionTest.kt
index 8e9394c3..3a82f51f 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/PreviewImageExtractionTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/PreviewImageExtractionTest.kt
@@ -25,7 +25,7 @@ import kotlin.test.fail
class PreviewImageExtractionTest {
- val indicesWithPreviewImage = setOf(
+ val indicesWithPreviewImage: Set = setOf(
KimTestData.CR2_TEST_IMAGE_INDEX,
KimTestData.RAF_TEST_IMAGE_INDEX,
KimTestData.NEF_TEST_IMAGE_INDEX,
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/XmpExtractionTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/XmpExtractionTest.kt
index 8e6d2e94..bccd051a 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/XmpExtractionTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/XmpExtractionTest.kt
@@ -24,7 +24,7 @@ import kotlin.test.fail
class XmpExtractionTest {
- val indicesWithoutXmp = setOf(
+ val indicesWithoutXmp: Set = setOf(
2, 18, 20, 23, 30, 42, 43, 44, 45, 46, 47, 48,
KimTestData.HEIC_TEST_IMAGE_INDEX,
KimTestData.GIF_TEST_IMAGE_INDEX,
@@ -38,7 +38,7 @@ class XmpExtractionTest {
)
// TODO Support these files as they have XMP
- val indicesUnsupported = setOf(
+ val indicesUnsupported: Set = setOf(
59, 78, 79, 80
)
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/common/ZLibTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/common/ZLibTest.kt
index 4252124c..601bd2b3 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/common/ZLibTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/common/ZLibTest.kt
@@ -23,7 +23,7 @@ import kotlin.test.assertEquals
class ZLibTest {
- val zlibTestData = mapOf(
+ private val zlibTestData: Map = mapOf(
"Hello, World!" to byteArrayOf(
0x78.toByte(), 0x9c.toByte(), 0xf3.toByte(), 0x48.toByte(), 0xcd.toByte(), 0xc9.toByte(),
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegImageParserTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegImageParserTest.kt
index 06557f9b..8901529f 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegImageParserTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegImageParserTest.kt
@@ -89,7 +89,7 @@ class JpegImageParserTest {
val actualImageSize = JpegImageParser.getImageSize(byteReader)
assertEquals(
- expected = expectedImageSizesMap.get(index),
+ expected = expectedImageSizesMap[index],
actual = actualImageSize,
message = "Image size of $index is different."
)
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegOrientationOffsetFinderTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegOrientationOffsetFinderTest.kt
index 8a568e9e..97a892c1 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegOrientationOffsetFinderTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegOrientationOffsetFinderTest.kt
@@ -22,7 +22,7 @@ import kotlin.test.assertEquals
class JpegOrientationOffsetFinderTest {
- val expectedMap = mapOf(
+ val expectedMap: Map = mapOf(
1 to 72,
2 to 72,
15 to 85,
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegRewriterTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegRewriterTest.kt
index 37995639..9bfbeb5a 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegRewriterTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegRewriterTest.kt
@@ -49,6 +49,7 @@ class JpegRewriterTest {
8.239661
)
+ /* language=XML */
private val newXmp = """
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegSegmentAnalyzerTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegSegmentAnalyzerTest.kt
index fdbc2094..179a75c3 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegSegmentAnalyzerTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/format/jpeg/JpegSegmentAnalyzerTest.kt
@@ -24,631 +24,632 @@ import kotlin.test.assertEquals
class JpegSegmentAnalyzerTest {
- val expectedMap = mapOf>(
- 1 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 6650),
- JpegSegmentAnalyzer.JpegSegmentInfo(6670, 65517, 148),
- JpegSegmentAnalyzer.JpegSegmentInfo(6818, 65505, 11019),
- JpegSegmentAnalyzer.JpegSegmentInfo(17837, 65506, 8958),
- JpegSegmentAnalyzer.JpegSegmentInfo(26795, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(26864, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(26933, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(26952, 65476, 32),
- JpegSegmentAnalyzer.JpegSegmentInfo(26984, 65476, 83),
- JpegSegmentAnalyzer.JpegSegmentInfo(27067, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(27098, 65476, 73),
- JpegSegmentAnalyzer.JpegSegmentInfo(27171, 65498, 3938708),
- JpegSegmentAnalyzer.JpegSegmentInfo(3965879, 65497, 2),
- ),
- 2 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 10828),
- JpegSegmentAnalyzer.JpegSegmentInfo(10848, 65506, 690),
- JpegSegmentAnalyzer.JpegSegmentInfo(11538, 65517, 210),
- JpegSegmentAnalyzer.JpegSegmentInfo(11748, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(11817, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(11886, 65474, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(11905, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(11936, 65476, 28),
- JpegSegmentAnalyzer.JpegSegmentInfo(11964, 65498, 651073),
- JpegSegmentAnalyzer.JpegSegmentInfo(663037, 65497, 2),
- ),
- 3 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 13010),
- JpegSegmentAnalyzer.JpegSegmentInfo(13012, 65517, 12292),
- JpegSegmentAnalyzer.JpegSegmentInfo(25304, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(28466, 65505, 28164),
- JpegSegmentAnalyzer.JpegSegmentInfo(56630, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(56646, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(56715, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(56784, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(56803, 65476, 33),
- JpegSegmentAnalyzer.JpegSegmentInfo(56836, 65476, 90),
- JpegSegmentAnalyzer.JpegSegmentInfo(56926, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(56957, 65476, 58),
- JpegSegmentAnalyzer.JpegSegmentInfo(57015, 65498, 948898),
- JpegSegmentAnalyzer.JpegSegmentInfo(1005913, 65497, 2),
- ),
- 4 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 8670),
- JpegSegmentAnalyzer.JpegSegmentInfo(8672, 65517, 8052),
- JpegSegmentAnalyzer.JpegSegmentInfo(16724, 65506, 566),
- JpegSegmentAnalyzer.JpegSegmentInfo(17290, 65505, 14667),
- JpegSegmentAnalyzer.JpegSegmentInfo(31957, 65499, 134),
- JpegSegmentAnalyzer.JpegSegmentInfo(32091, 65501, 6),
- JpegSegmentAnalyzer.JpegSegmentInfo(32097, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(32113, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(32132, 65476, 154),
- JpegSegmentAnalyzer.JpegSegmentInfo(32286, 65498, 1170231),
- JpegSegmentAnalyzer.JpegSegmentInfo(1202517, 65497, 2),
- ),
- 5 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 13494),
- JpegSegmentAnalyzer.JpegSegmentInfo(13496, 65517, 12740),
- JpegSegmentAnalyzer.JpegSegmentInfo(26236, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(29398, 65505, 16372),
- JpegSegmentAnalyzer.JpegSegmentInfo(45770, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(45786, 65534, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(45840, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(45909, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(45978, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(45997, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(46027, 65476, 78),
- JpegSegmentAnalyzer.JpegSegmentInfo(46105, 65476, 28),
- JpegSegmentAnalyzer.JpegSegmentInfo(46133, 65476, 45),
- JpegSegmentAnalyzer.JpegSegmentInfo(46178, 65498, 1143108),
- JpegSegmentAnalyzer.JpegSegmentInfo(1189286, 65497, 2),
- ),
- 6 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 12186),
- JpegSegmentAnalyzer.JpegSegmentInfo(12188, 65517, 11592),
- JpegSegmentAnalyzer.JpegSegmentInfo(23780, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(26942, 65505, 13232),
- JpegSegmentAnalyzer.JpegSegmentInfo(40174, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(40190, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(40259, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(40328, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(40347, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(40378, 65476, 97),
- JpegSegmentAnalyzer.JpegSegmentInfo(40475, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(40506, 65476, 72),
- JpegSegmentAnalyzer.JpegSegmentInfo(40578, 65498, 1151436),
- JpegSegmentAnalyzer.JpegSegmentInfo(1192014, 65497, 2),
- ),
- 7 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 9384),
- JpegSegmentAnalyzer.JpegSegmentInfo(9386, 65517, 8900),
- JpegSegmentAnalyzer.JpegSegmentInfo(18286, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(21448, 65505, 18592),
- JpegSegmentAnalyzer.JpegSegmentInfo(40040, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(40056, 65499, 134),
- JpegSegmentAnalyzer.JpegSegmentInfo(40190, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(40209, 65501, 6),
- JpegSegmentAnalyzer.JpegSegmentInfo(40215, 65476, 420),
- JpegSegmentAnalyzer.JpegSegmentInfo(40635, 65498, 1095574),
- JpegSegmentAnalyzer.JpegSegmentInfo(1136209, 65497, 2),
- ),
- 10 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 15900),
- JpegSegmentAnalyzer.JpegSegmentInfo(15902, 65517, 15200),
- JpegSegmentAnalyzer.JpegSegmentInfo(31102, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(34264, 65505, 13675),
- JpegSegmentAnalyzer.JpegSegmentInfo(47939, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(47955, 65534, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(48009, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(48078, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(48147, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(48166, 65476, 32),
- JpegSegmentAnalyzer.JpegSegmentInfo(48198, 65476, 99),
- JpegSegmentAnalyzer.JpegSegmentInfo(48297, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(48327, 65476, 58),
- JpegSegmentAnalyzer.JpegSegmentInfo(48385, 65498, 1341725),
- JpegSegmentAnalyzer.JpegSegmentInfo(1390110, 65497, 2),
- ),
- 11 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 832),
- JpegSegmentAnalyzer.JpegSegmentInfo(834, 65517, 150),
- JpegSegmentAnalyzer.JpegSegmentInfo(984, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(4146, 65505, 5942),
- JpegSegmentAnalyzer.JpegSegmentInfo(10088, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(10104, 65534, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(10158, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(10227, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(10296, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(10315, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(10346, 65476, 79),
- JpegSegmentAnalyzer.JpegSegmentInfo(10425, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(10455, 65476, 58),
- JpegSegmentAnalyzer.JpegSegmentInfo(10513, 65498, 1542294),
- JpegSegmentAnalyzer.JpegSegmentInfo(1552807, 65497, 2),
- ),
- 12 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 12914),
- JpegSegmentAnalyzer.JpegSegmentInfo(12916, 65517, 12294),
- JpegSegmentAnalyzer.JpegSegmentInfo(25210, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(28372, 65505, 14097),
- JpegSegmentAnalyzer.JpegSegmentInfo(42469, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(42485, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(42554, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(42623, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(42642, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(42672, 65476, 80),
- JpegSegmentAnalyzer.JpegSegmentInfo(42752, 65476, 29),
- JpegSegmentAnalyzer.JpegSegmentInfo(42781, 65476, 51),
- JpegSegmentAnalyzer.JpegSegmentInfo(42832, 65498, 1148049),
- JpegSegmentAnalyzer.JpegSegmentInfo(1190881, 65497, 2),
- ),
- 13 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 214),
- JpegSegmentAnalyzer.JpegSegmentInfo(234, 65517, 162),
- JpegSegmentAnalyzer.JpegSegmentInfo(396, 65505, 2814),
- JpegSegmentAnalyzer.JpegSegmentInfo(3210, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(3279, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(3348, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(3367, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(3397, 65476, 79),
- JpegSegmentAnalyzer.JpegSegmentInfo(3476, 65476, 29),
- JpegSegmentAnalyzer.JpegSegmentInfo(3505, 65476, 58),
- JpegSegmentAnalyzer.JpegSegmentInfo(3563, 65498, 1049051),
- JpegSegmentAnalyzer.JpegSegmentInfo(1052614, 65497, 2),
- ),
- 14 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 76),
- JpegSegmentAnalyzer.JpegSegmentInfo(96, 65517, 112),
- JpegSegmentAnalyzer.JpegSegmentInfo(208, 65505, 2814),
- JpegSegmentAnalyzer.JpegSegmentInfo(3022, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(3091, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(3160, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(3179, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(3210, 65476, 84),
- JpegSegmentAnalyzer.JpegSegmentInfo(3294, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(3324, 65476, 55),
- JpegSegmentAnalyzer.JpegSegmentInfo(3379, 65498, 216298),
- JpegSegmentAnalyzer.JpegSegmentInfo(219677, 65497, 2),
- ),
- 15 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 36652),
- JpegSegmentAnalyzer.JpegSegmentInfo(36672, 65517, 76),
- JpegSegmentAnalyzer.JpegSegmentInfo(36748, 65505, 2947),
- JpegSegmentAnalyzer.JpegSegmentInfo(39695, 65506, 4096),
- JpegSegmentAnalyzer.JpegSegmentInfo(43791, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(43860, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(43929, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(43948, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(43978, 65476, 74),
- JpegSegmentAnalyzer.JpegSegmentInfo(44052, 65476, 28),
- JpegSegmentAnalyzer.JpegSegmentInfo(44080, 65476, 46),
- JpegSegmentAnalyzer.JpegSegmentInfo(44126, 65498, 1551863),
- JpegSegmentAnalyzer.JpegSegmentInfo(1595989, 65497, 2),
- ),
- 16 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 19000),
- JpegSegmentAnalyzer.JpegSegmentInfo(19002, 65517, 18424),
- JpegSegmentAnalyzer.JpegSegmentInfo(37426, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(40588, 65505, 15566),
- JpegSegmentAnalyzer.JpegSegmentInfo(56154, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(56170, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(56239, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(56308, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(56327, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(56357, 65476, 74),
- JpegSegmentAnalyzer.JpegSegmentInfo(56431, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(56461, 65476, 71),
- JpegSegmentAnalyzer.JpegSegmentInfo(56532, 65498, 1160100),
- JpegSegmentAnalyzer.JpegSegmentInfo(1216632, 65497, 2),
- ),
- 17 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 292),
- JpegSegmentAnalyzer.JpegSegmentInfo(294, 65505, 2999),
- JpegSegmentAnalyzer.JpegSegmentInfo(3293, 65517, 118),
- JpegSegmentAnalyzer.JpegSegmentInfo(3411, 65505, 46),
- JpegSegmentAnalyzer.JpegSegmentInfo(3457, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(3473, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(3542, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(3611, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(3630, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(3661, 65476, 93),
- JpegSegmentAnalyzer.JpegSegmentInfo(3754, 65476, 29),
- JpegSegmentAnalyzer.JpegSegmentInfo(3783, 65476, 55),
- JpegSegmentAnalyzer.JpegSegmentInfo(3838, 65498, 1203907),
- JpegSegmentAnalyzer.JpegSegmentInfo(1207745, 65497, 2),
- ),
- 20 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 6996),
- JpegSegmentAnalyzer.JpegSegmentInfo(7016, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(7085, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(7154, 65534, 122),
- JpegSegmentAnalyzer.JpegSegmentInfo(7276, 65474, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(7295, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(7325, 65476, 22),
- JpegSegmentAnalyzer.JpegSegmentInfo(7347, 65498, 5549),
- JpegSegmentAnalyzer.JpegSegmentInfo(12896, 65497, 2),
- ),
- 21 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 20881),
- JpegSegmentAnalyzer.JpegSegmentInfo(20883, 65517, 166),
- JpegSegmentAnalyzer.JpegSegmentInfo(21049, 65505, 13312),
- JpegSegmentAnalyzer.JpegSegmentInfo(34361, 65499, 134),
- JpegSegmentAnalyzer.JpegSegmentInfo(34495, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(34514, 65476, 420),
- JpegSegmentAnalyzer.JpegSegmentInfo(34934, 65498, 6291058),
- JpegSegmentAnalyzer.JpegSegmentInfo(6325992, 65497, 2),
- ),
- 22 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 8379),
- JpegSegmentAnalyzer.JpegSegmentInfo(8381, 65505, 8498),
- JpegSegmentAnalyzer.JpegSegmentInfo(16879, 65505, 2290),
- JpegSegmentAnalyzer.JpegSegmentInfo(19169, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(22331, 65517, 9392),
- JpegSegmentAnalyzer.JpegSegmentInfo(31723, 65517, 122),
- JpegSegmentAnalyzer.JpegSegmentInfo(31845, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(31861, 65534, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(31915, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(31984, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(32053, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(32072, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(32103, 65476, 78),
- JpegSegmentAnalyzer.JpegSegmentInfo(32181, 65476, 28),
- JpegSegmentAnalyzer.JpegSegmentInfo(32209, 65476, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(32263, 65498, 5038645),
- JpegSegmentAnalyzer.JpegSegmentInfo(5070908, 65497, 2),
- ),
- 23 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 535),
- JpegSegmentAnalyzer.JpegSegmentInfo(537, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(555, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(624, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(693, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(712, 65476, 33),
- JpegSegmentAnalyzer.JpegSegmentInfo(745, 65476, 183),
- JpegSegmentAnalyzer.JpegSegmentInfo(928, 65476, 33),
- JpegSegmentAnalyzer.JpegSegmentInfo(961, 65476, 183),
- JpegSegmentAnalyzer.JpegSegmentInfo(1144, 65498, 7709103),
- JpegSegmentAnalyzer.JpegSegmentInfo(7710247, 65497, 2),
- ),
- 24 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 11596),
- JpegSegmentAnalyzer.JpegSegmentInfo(11598, 65517, 10942),
- JpegSegmentAnalyzer.JpegSegmentInfo(22540, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(25702, 65505, 13902),
- JpegSegmentAnalyzer.JpegSegmentInfo(39604, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(39620, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(39689, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(39758, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(39777, 65476, 32),
- JpegSegmentAnalyzer.JpegSegmentInfo(39809, 65476, 102),
- JpegSegmentAnalyzer.JpegSegmentInfo(39911, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(39941, 65476, 76),
- JpegSegmentAnalyzer.JpegSegmentInfo(40017, 65498, 1286743),
- JpegSegmentAnalyzer.JpegSegmentInfo(1326760, 65497, 2),
- ),
- 25 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 7020),
- JpegSegmentAnalyzer.JpegSegmentInfo(7022, 65517, 8736),
- JpegSegmentAnalyzer.JpegSegmentInfo(15758, 65505, 18443),
- JpegSegmentAnalyzer.JpegSegmentInfo(34201, 65506, 578),
- JpegSegmentAnalyzer.JpegSegmentInfo(34779, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(34795, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(34864, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(34933, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(34952, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(34982, 65476, 89),
- JpegSegmentAnalyzer.JpegSegmentInfo(35071, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(35101, 65476, 58),
- JpegSegmentAnalyzer.JpegSegmentInfo(35159, 65498, 1517109),
- JpegSegmentAnalyzer.JpegSegmentInfo(1552268, 65497, 2),
- ),
- 26 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(20, 65517, 212),
- JpegSegmentAnalyzer.JpegSegmentInfo(232, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(3394, 65505, 832),
- JpegSegmentAnalyzer.JpegSegmentInfo(4226, 65505, 11239),
- JpegSegmentAnalyzer.JpegSegmentInfo(15465, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(15534, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(15603, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(15622, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(15653, 65476, 86),
- JpegSegmentAnalyzer.JpegSegmentInfo(15739, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(15769, 65476, 67),
- JpegSegmentAnalyzer.JpegSegmentInfo(15836, 65498, 810641),
- JpegSegmentAnalyzer.JpegSegmentInfo(826477, 65497, 2),
- ),
- 27 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 10636),
- JpegSegmentAnalyzer.JpegSegmentInfo(10638, 65517, 9956),
- JpegSegmentAnalyzer.JpegSegmentInfo(20594, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(23756, 65505, 11510),
- JpegSegmentAnalyzer.JpegSegmentInfo(35266, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(35282, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(35351, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(35420, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(35439, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(35470, 65476, 88),
- JpegSegmentAnalyzer.JpegSegmentInfo(35558, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(35588, 65476, 80),
- JpegSegmentAnalyzer.JpegSegmentInfo(35668, 65498, 1255701),
- JpegSegmentAnalyzer.JpegSegmentInfo(1291369, 65497, 2),
- ),
- 28 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 22208),
- JpegSegmentAnalyzer.JpegSegmentInfo(22210, 65517, 104),
- JpegSegmentAnalyzer.JpegSegmentInfo(22314, 65505, 2814),
- JpegSegmentAnalyzer.JpegSegmentInfo(25128, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(25197, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(25266, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(25285, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(25316, 65476, 75),
- JpegSegmentAnalyzer.JpegSegmentInfo(25391, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(25421, 65476, 61),
- JpegSegmentAnalyzer.JpegSegmentInfo(25482, 65498, 264305),
- JpegSegmentAnalyzer.JpegSegmentInfo(289787, 65497, 2),
- ),
- 29 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 5628),
- JpegSegmentAnalyzer.JpegSegmentInfo(5630, 65517, 7044),
- JpegSegmentAnalyzer.JpegSegmentInfo(12674, 65505, 13188),
- JpegSegmentAnalyzer.JpegSegmentInfo(25862, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(29024, 65518, 40),
- JpegSegmentAnalyzer.JpegSegmentInfo(29064, 65534, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(29118, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(29187, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(29256, 65474, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(29275, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(29305, 65476, 28),
- JpegSegmentAnalyzer.JpegSegmentInfo(29333, 65498, 1589969),
- JpegSegmentAnalyzer.JpegSegmentInfo(1619302, 65497, 2),
- ),
- 30 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 4842),
- JpegSegmentAnalyzer.JpegSegmentInfo(4844, 65505, 130),
- JpegSegmentAnalyzer.JpegSegmentInfo(4974, 65505, 130),
- JpegSegmentAnalyzer.JpegSegmentInfo(5104, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(8266, 65517, 9392),
- JpegSegmentAnalyzer.JpegSegmentInfo(17658, 65517, 122),
- JpegSegmentAnalyzer.JpegSegmentInfo(17780, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(17796, 65534, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(17850, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(17919, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(17988, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(18007, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(18038, 65476, 78),
- JpegSegmentAnalyzer.JpegSegmentInfo(18116, 65476, 28),
- JpegSegmentAnalyzer.JpegSegmentInfo(18144, 65476, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(18198, 65498, 5038645),
- JpegSegmentAnalyzer.JpegSegmentInfo(5056843, 65497, 2),
- ),
- 31 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 18040),
- JpegSegmentAnalyzer.JpegSegmentInfo(18042, 65517, 114),
- JpegSegmentAnalyzer.JpegSegmentInfo(18156, 65505, 2814),
- JpegSegmentAnalyzer.JpegSegmentInfo(20970, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(21039, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(21108, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(21127, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(21157, 65476, 88),
- JpegSegmentAnalyzer.JpegSegmentInfo(21245, 65476, 28),
- JpegSegmentAnalyzer.JpegSegmentInfo(21273, 65476, 46),
- JpegSegmentAnalyzer.JpegSegmentInfo(21319, 65498, 1751816),
- JpegSegmentAnalyzer.JpegSegmentInfo(1773135, 65497, 2),
- ),
- 32 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 9798),
- JpegSegmentAnalyzer.JpegSegmentInfo(9800, 65517, 9720),
- JpegSegmentAnalyzer.JpegSegmentInfo(19520, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(22682, 65505, 3447),
- JpegSegmentAnalyzer.JpegSegmentInfo(26129, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(26145, 65534, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(26199, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(26268, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(26337, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(26356, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(26386, 65476, 81),
- JpegSegmentAnalyzer.JpegSegmentInfo(26467, 65476, 29),
- JpegSegmentAnalyzer.JpegSegmentInfo(26496, 65476, 59),
- JpegSegmentAnalyzer.JpegSegmentInfo(26555, 65498, 933304),
- JpegSegmentAnalyzer.JpegSegmentInfo(959859, 65497, 2),
- ),
- 33 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 13748),
- JpegSegmentAnalyzer.JpegSegmentInfo(13750, 65517, 13028),
- JpegSegmentAnalyzer.JpegSegmentInfo(26778, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(29940, 65505, 11427),
- JpegSegmentAnalyzer.JpegSegmentInfo(41367, 65499, 134),
- JpegSegmentAnalyzer.JpegSegmentInfo(41501, 65501, 6),
- JpegSegmentAnalyzer.JpegSegmentInfo(41507, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(41523, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(41542, 65476, 195),
- JpegSegmentAnalyzer.JpegSegmentInfo(41737, 65498, 1498590),
- JpegSegmentAnalyzer.JpegSegmentInfo(1540327, 65497, 2),
- ),
- 34 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 12892),
- JpegSegmentAnalyzer.JpegSegmentInfo(12912, 65517, 102),
- JpegSegmentAnalyzer.JpegSegmentInfo(13014, 65505, 2814),
- JpegSegmentAnalyzer.JpegSegmentInfo(15828, 65506, 8702),
- JpegSegmentAnalyzer.JpegSegmentInfo(24530, 65514, 3670),
- JpegSegmentAnalyzer.JpegSegmentInfo(28200, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(28269, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(28338, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(28357, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(28387, 65476, 76),
- JpegSegmentAnalyzer.JpegSegmentInfo(28463, 65476, 29),
- JpegSegmentAnalyzer.JpegSegmentInfo(28492, 65476, 46),
- JpegSegmentAnalyzer.JpegSegmentInfo(28538, 65498, 1756223),
- JpegSegmentAnalyzer.JpegSegmentInfo(1784761, 65497, 2),
- ),
- 35 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 12526),
- JpegSegmentAnalyzer.JpegSegmentInfo(12528, 65517, 11826),
- JpegSegmentAnalyzer.JpegSegmentInfo(24354, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(27516, 65505, 14486),
- JpegSegmentAnalyzer.JpegSegmentInfo(42002, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(42018, 65534, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(42072, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(42141, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(42210, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(42229, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(42259, 65476, 77),
- JpegSegmentAnalyzer.JpegSegmentInfo(42336, 65476, 29),
- JpegSegmentAnalyzer.JpegSegmentInfo(42365, 65476, 57),
- JpegSegmentAnalyzer.JpegSegmentInfo(42422, 65498, 1215580),
- JpegSegmentAnalyzer.JpegSegmentInfo(1258002, 65497, 2),
- ),
- 36 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
- JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 1350),
- JpegSegmentAnalyzer.JpegSegmentInfo(1370, 65505, 4162),
- JpegSegmentAnalyzer.JpegSegmentInfo(5532, 65517, 626),
- JpegSegmentAnalyzer.JpegSegmentInfo(6158, 65506, 614),
- JpegSegmentAnalyzer.JpegSegmentInfo(6772, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(6841, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(6910, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(6929, 65476, 32),
- JpegSegmentAnalyzer.JpegSegmentInfo(6961, 65476, 91),
- JpegSegmentAnalyzer.JpegSegmentInfo(7052, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(7083, 65476, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(7152, 65498, 1628511),
- JpegSegmentAnalyzer.JpegSegmentInfo(1635663, 65497, 2),
- ),
- 37 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 2598),
- JpegSegmentAnalyzer.JpegSegmentInfo(2600, 65517, 43100),
- JpegSegmentAnalyzer.JpegSegmentInfo(45700, 65505, 38195),
- JpegSegmentAnalyzer.JpegSegmentInfo(83895, 65506, 578),
- JpegSegmentAnalyzer.JpegSegmentInfo(84473, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(84489, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(84558, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(84627, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(84646, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(84677, 65476, 82),
- JpegSegmentAnalyzer.JpegSegmentInfo(84759, 65476, 29),
- JpegSegmentAnalyzer.JpegSegmentInfo(84788, 65476, 61),
- JpegSegmentAnalyzer.JpegSegmentInfo(84849, 65498, 362619),
- JpegSegmentAnalyzer.JpegSegmentInfo(447468, 65497, 2),
- ),
- 38 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 11990),
- JpegSegmentAnalyzer.JpegSegmentInfo(11992, 65517, 13484),
- JpegSegmentAnalyzer.JpegSegmentInfo(25476, 65505, 13073),
- JpegSegmentAnalyzer.JpegSegmentInfo(38549, 65506, 578),
- JpegSegmentAnalyzer.JpegSegmentInfo(39127, 65518, 35),
- JpegSegmentAnalyzer.JpegSegmentInfo(39162, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(39231, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(39300, 65474, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(39319, 65476, 32),
- JpegSegmentAnalyzer.JpegSegmentInfo(39351, 65476, 29),
- JpegSegmentAnalyzer.JpegSegmentInfo(39380, 65498, 1317385),
- JpegSegmentAnalyzer.JpegSegmentInfo(1356765, 65497, 2),
- ),
- 39 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 22782),
- JpegSegmentAnalyzer.JpegSegmentInfo(22784, 65505, 2814),
- JpegSegmentAnalyzer.JpegSegmentInfo(25598, 65534, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(25652, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(25721, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(25790, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(25809, 65476, 31),
- JpegSegmentAnalyzer.JpegSegmentInfo(25840, 65476, 79),
- JpegSegmentAnalyzer.JpegSegmentInfo(25919, 65476, 28),
- JpegSegmentAnalyzer.JpegSegmentInfo(25947, 65476, 44),
- JpegSegmentAnalyzer.JpegSegmentInfo(25991, 65498, 1191901),
- JpegSegmentAnalyzer.JpegSegmentInfo(1217892, 65497, 2),
- ),
- 40 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 4388),
- JpegSegmentAnalyzer.JpegSegmentInfo(4390, 65517, 5864),
- JpegSegmentAnalyzer.JpegSegmentInfo(10254, 65505, 15566),
- JpegSegmentAnalyzer.JpegSegmentInfo(25820, 65506, 3162),
- JpegSegmentAnalyzer.JpegSegmentInfo(28982, 65518, 16),
- JpegSegmentAnalyzer.JpegSegmentInfo(28998, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(29067, 65499, 69),
- JpegSegmentAnalyzer.JpegSegmentInfo(29136, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(29155, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(29185, 65476, 74),
- JpegSegmentAnalyzer.JpegSegmentInfo(29259, 65476, 30),
- JpegSegmentAnalyzer.JpegSegmentInfo(29289, 65476, 59),
- JpegSegmentAnalyzer.JpegSegmentInfo(29348, 65498, 1651935),
- JpegSegmentAnalyzer.JpegSegmentInfo(1681283, 65497, 2),
- ),
- 48 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 13524),
- JpegSegmentAnalyzer.JpegSegmentInfo(13526, 65506, 554),
- JpegSegmentAnalyzer.JpegSegmentInfo(14080, 65499, 134),
- JpegSegmentAnalyzer.JpegSegmentInfo(14214, 65501, 6),
- JpegSegmentAnalyzer.JpegSegmentInfo(14220, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(14239, 65476, 420),
- JpegSegmentAnalyzer.JpegSegmentInfo(14659, 65498, 6790271),
- JpegSegmentAnalyzer.JpegSegmentInfo(6804930, 65497, 2),
- ),
- 49 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 20366),
- JpegSegmentAnalyzer.JpegSegmentInfo(20368, 65505, 2562),
- JpegSegmentAnalyzer.JpegSegmentInfo(22930, 65499, 134),
- JpegSegmentAnalyzer.JpegSegmentInfo(23064, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(23083, 65476, 420),
- JpegSegmentAnalyzer.JpegSegmentInfo(23503, 65498, 9266056),
- JpegSegmentAnalyzer.JpegSegmentInfo(9289559, 65497, 2),
- ),
- 50 to listOf(
- JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
- JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 65470),
- JpegSegmentAnalyzer.JpegSegmentInfo(65472, 65505, 12288),
- JpegSegmentAnalyzer.JpegSegmentInfo(77760, 65506, 138),
- JpegSegmentAnalyzer.JpegSegmentInfo(77898, 65506, 54),
- JpegSegmentAnalyzer.JpegSegmentInfo(77952, 65506, 44098),
- JpegSegmentAnalyzer.JpegSegmentInfo(122050, 65476, 420),
- JpegSegmentAnalyzer.JpegSegmentInfo(122470, 65499, 134),
- JpegSegmentAnalyzer.JpegSegmentInfo(122604, 65501, 6),
- JpegSegmentAnalyzer.JpegSegmentInfo(122610, 65472, 19),
- JpegSegmentAnalyzer.JpegSegmentInfo(122629, 65498, 14607244),
- JpegSegmentAnalyzer.JpegSegmentInfo(14729873, 65497, 2),
- ),
- )
+ val expectedMap: Map> =
+ mapOf>(
+ 1 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 6650),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6670, 65517, 148),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6818, 65505, 11019),
+ JpegSegmentAnalyzer.JpegSegmentInfo(17837, 65506, 8958),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26795, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26864, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26933, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26952, 65476, 32),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26984, 65476, 83),
+ JpegSegmentAnalyzer.JpegSegmentInfo(27067, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(27098, 65476, 73),
+ JpegSegmentAnalyzer.JpegSegmentInfo(27171, 65498, 3938708),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3965879, 65497, 2),
+ ),
+ 2 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 10828),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10848, 65506, 690),
+ JpegSegmentAnalyzer.JpegSegmentInfo(11538, 65517, 210),
+ JpegSegmentAnalyzer.JpegSegmentInfo(11748, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(11817, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(11886, 65474, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(11905, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(11936, 65476, 28),
+ JpegSegmentAnalyzer.JpegSegmentInfo(11964, 65498, 651073),
+ JpegSegmentAnalyzer.JpegSegmentInfo(663037, 65497, 2),
+ ),
+ 3 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 13010),
+ JpegSegmentAnalyzer.JpegSegmentInfo(13012, 65517, 12292),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25304, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28466, 65505, 28164),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56630, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56646, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56715, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56784, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56803, 65476, 33),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56836, 65476, 90),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56926, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56957, 65476, 58),
+ JpegSegmentAnalyzer.JpegSegmentInfo(57015, 65498, 948898),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1005913, 65497, 2),
+ ),
+ 4 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 8670),
+ JpegSegmentAnalyzer.JpegSegmentInfo(8672, 65517, 8052),
+ JpegSegmentAnalyzer.JpegSegmentInfo(16724, 65506, 566),
+ JpegSegmentAnalyzer.JpegSegmentInfo(17290, 65505, 14667),
+ JpegSegmentAnalyzer.JpegSegmentInfo(31957, 65499, 134),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32091, 65501, 6),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32097, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32113, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32132, 65476, 154),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32286, 65498, 1170231),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1202517, 65497, 2),
+ ),
+ 5 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 13494),
+ JpegSegmentAnalyzer.JpegSegmentInfo(13496, 65517, 12740),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26236, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29398, 65505, 16372),
+ JpegSegmentAnalyzer.JpegSegmentInfo(45770, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(45786, 65534, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(45840, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(45909, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(45978, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(45997, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(46027, 65476, 78),
+ JpegSegmentAnalyzer.JpegSegmentInfo(46105, 65476, 28),
+ JpegSegmentAnalyzer.JpegSegmentInfo(46133, 65476, 45),
+ JpegSegmentAnalyzer.JpegSegmentInfo(46178, 65498, 1143108),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1189286, 65497, 2),
+ ),
+ 6 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 12186),
+ JpegSegmentAnalyzer.JpegSegmentInfo(12188, 65517, 11592),
+ JpegSegmentAnalyzer.JpegSegmentInfo(23780, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26942, 65505, 13232),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40174, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40190, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40259, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40328, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40347, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40378, 65476, 97),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40475, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40506, 65476, 72),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40578, 65498, 1151436),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1192014, 65497, 2),
+ ),
+ 7 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 9384),
+ JpegSegmentAnalyzer.JpegSegmentInfo(9386, 65517, 8900),
+ JpegSegmentAnalyzer.JpegSegmentInfo(18286, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(21448, 65505, 18592),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40040, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40056, 65499, 134),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40190, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40209, 65501, 6),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40215, 65476, 420),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40635, 65498, 1095574),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1136209, 65497, 2),
+ ),
+ 10 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 15900),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15902, 65517, 15200),
+ JpegSegmentAnalyzer.JpegSegmentInfo(31102, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34264, 65505, 13675),
+ JpegSegmentAnalyzer.JpegSegmentInfo(47939, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(47955, 65534, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(48009, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(48078, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(48147, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(48166, 65476, 32),
+ JpegSegmentAnalyzer.JpegSegmentInfo(48198, 65476, 99),
+ JpegSegmentAnalyzer.JpegSegmentInfo(48297, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(48327, 65476, 58),
+ JpegSegmentAnalyzer.JpegSegmentInfo(48385, 65498, 1341725),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1390110, 65497, 2),
+ ),
+ 11 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 832),
+ JpegSegmentAnalyzer.JpegSegmentInfo(834, 65517, 150),
+ JpegSegmentAnalyzer.JpegSegmentInfo(984, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(4146, 65505, 5942),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10088, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10104, 65534, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10158, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10227, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10296, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10315, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10346, 65476, 79),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10425, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10455, 65476, 58),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10513, 65498, 1542294),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1552807, 65497, 2),
+ ),
+ 12 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 12914),
+ JpegSegmentAnalyzer.JpegSegmentInfo(12916, 65517, 12294),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25210, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28372, 65505, 14097),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42469, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42485, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42554, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42623, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42642, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42672, 65476, 80),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42752, 65476, 29),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42781, 65476, 51),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42832, 65498, 1148049),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1190881, 65497, 2),
+ ),
+ 13 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 214),
+ JpegSegmentAnalyzer.JpegSegmentInfo(234, 65517, 162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(396, 65505, 2814),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3210, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3279, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3348, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3367, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3397, 65476, 79),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3476, 65476, 29),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3505, 65476, 58),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3563, 65498, 1049051),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1052614, 65497, 2),
+ ),
+ 14 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 76),
+ JpegSegmentAnalyzer.JpegSegmentInfo(96, 65517, 112),
+ JpegSegmentAnalyzer.JpegSegmentInfo(208, 65505, 2814),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3022, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3091, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3160, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3179, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3210, 65476, 84),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3294, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3324, 65476, 55),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3379, 65498, 216298),
+ JpegSegmentAnalyzer.JpegSegmentInfo(219677, 65497, 2),
+ ),
+ 15 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 36652),
+ JpegSegmentAnalyzer.JpegSegmentInfo(36672, 65517, 76),
+ JpegSegmentAnalyzer.JpegSegmentInfo(36748, 65505, 2947),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39695, 65506, 4096),
+ JpegSegmentAnalyzer.JpegSegmentInfo(43791, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(43860, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(43929, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(43948, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(43978, 65476, 74),
+ JpegSegmentAnalyzer.JpegSegmentInfo(44052, 65476, 28),
+ JpegSegmentAnalyzer.JpegSegmentInfo(44080, 65476, 46),
+ JpegSegmentAnalyzer.JpegSegmentInfo(44126, 65498, 1551863),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1595989, 65497, 2),
+ ),
+ 16 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 19000),
+ JpegSegmentAnalyzer.JpegSegmentInfo(19002, 65517, 18424),
+ JpegSegmentAnalyzer.JpegSegmentInfo(37426, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40588, 65505, 15566),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56154, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56170, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56239, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56308, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56327, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56357, 65476, 74),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56431, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56461, 65476, 71),
+ JpegSegmentAnalyzer.JpegSegmentInfo(56532, 65498, 1160100),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1216632, 65497, 2),
+ ),
+ 17 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 292),
+ JpegSegmentAnalyzer.JpegSegmentInfo(294, 65505, 2999),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3293, 65517, 118),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3411, 65505, 46),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3457, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3473, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3542, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3611, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3630, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3661, 65476, 93),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3754, 65476, 29),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3783, 65476, 55),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3838, 65498, 1203907),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1207745, 65497, 2),
+ ),
+ 20 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 6996),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7016, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7085, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7154, 65534, 122),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7276, 65474, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7295, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7325, 65476, 22),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7347, 65498, 5549),
+ JpegSegmentAnalyzer.JpegSegmentInfo(12896, 65497, 2),
+ ),
+ 21 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 20881),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20883, 65517, 166),
+ JpegSegmentAnalyzer.JpegSegmentInfo(21049, 65505, 13312),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34361, 65499, 134),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34495, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34514, 65476, 420),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34934, 65498, 6291058),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6325992, 65497, 2),
+ ),
+ 22 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 8379),
+ JpegSegmentAnalyzer.JpegSegmentInfo(8381, 65505, 8498),
+ JpegSegmentAnalyzer.JpegSegmentInfo(16879, 65505, 2290),
+ JpegSegmentAnalyzer.JpegSegmentInfo(19169, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(22331, 65517, 9392),
+ JpegSegmentAnalyzer.JpegSegmentInfo(31723, 65517, 122),
+ JpegSegmentAnalyzer.JpegSegmentInfo(31845, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(31861, 65534, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(31915, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(31984, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32053, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32072, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32103, 65476, 78),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32181, 65476, 28),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32209, 65476, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(32263, 65498, 5038645),
+ JpegSegmentAnalyzer.JpegSegmentInfo(5070908, 65497, 2),
+ ),
+ 23 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 535),
+ JpegSegmentAnalyzer.JpegSegmentInfo(537, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(555, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(624, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(693, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(712, 65476, 33),
+ JpegSegmentAnalyzer.JpegSegmentInfo(745, 65476, 183),
+ JpegSegmentAnalyzer.JpegSegmentInfo(928, 65476, 33),
+ JpegSegmentAnalyzer.JpegSegmentInfo(961, 65476, 183),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1144, 65498, 7709103),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7710247, 65497, 2),
+ ),
+ 24 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 11596),
+ JpegSegmentAnalyzer.JpegSegmentInfo(11598, 65517, 10942),
+ JpegSegmentAnalyzer.JpegSegmentInfo(22540, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25702, 65505, 13902),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39604, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39620, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39689, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39758, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39777, 65476, 32),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39809, 65476, 102),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39911, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39941, 65476, 76),
+ JpegSegmentAnalyzer.JpegSegmentInfo(40017, 65498, 1286743),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1326760, 65497, 2),
+ ),
+ 25 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 7020),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7022, 65517, 8736),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15758, 65505, 18443),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34201, 65506, 578),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34779, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34795, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34864, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34933, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34952, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(34982, 65476, 89),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35071, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35101, 65476, 58),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35159, 65498, 1517109),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1552268, 65497, 2),
+ ),
+ 26 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20, 65517, 212),
+ JpegSegmentAnalyzer.JpegSegmentInfo(232, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(3394, 65505, 832),
+ JpegSegmentAnalyzer.JpegSegmentInfo(4226, 65505, 11239),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15465, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15534, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15603, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15622, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15653, 65476, 86),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15739, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15769, 65476, 67),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15836, 65498, 810641),
+ JpegSegmentAnalyzer.JpegSegmentInfo(826477, 65497, 2),
+ ),
+ 27 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 10636),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10638, 65517, 9956),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20594, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(23756, 65505, 11510),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35266, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35282, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35351, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35420, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35439, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35470, 65476, 88),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35558, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35588, 65476, 80),
+ JpegSegmentAnalyzer.JpegSegmentInfo(35668, 65498, 1255701),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1291369, 65497, 2),
+ ),
+ 28 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 22208),
+ JpegSegmentAnalyzer.JpegSegmentInfo(22210, 65517, 104),
+ JpegSegmentAnalyzer.JpegSegmentInfo(22314, 65505, 2814),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25128, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25197, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25266, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25285, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25316, 65476, 75),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25391, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25421, 65476, 61),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25482, 65498, 264305),
+ JpegSegmentAnalyzer.JpegSegmentInfo(289787, 65497, 2),
+ ),
+ 29 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 5628),
+ JpegSegmentAnalyzer.JpegSegmentInfo(5630, 65517, 7044),
+ JpegSegmentAnalyzer.JpegSegmentInfo(12674, 65505, 13188),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25862, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29024, 65518, 40),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29064, 65534, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29118, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29187, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29256, 65474, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29275, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29305, 65476, 28),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29333, 65498, 1589969),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1619302, 65497, 2),
+ ),
+ 30 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 4842),
+ JpegSegmentAnalyzer.JpegSegmentInfo(4844, 65505, 130),
+ JpegSegmentAnalyzer.JpegSegmentInfo(4974, 65505, 130),
+ JpegSegmentAnalyzer.JpegSegmentInfo(5104, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(8266, 65517, 9392),
+ JpegSegmentAnalyzer.JpegSegmentInfo(17658, 65517, 122),
+ JpegSegmentAnalyzer.JpegSegmentInfo(17780, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(17796, 65534, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(17850, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(17919, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(17988, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(18007, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(18038, 65476, 78),
+ JpegSegmentAnalyzer.JpegSegmentInfo(18116, 65476, 28),
+ JpegSegmentAnalyzer.JpegSegmentInfo(18144, 65476, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(18198, 65498, 5038645),
+ JpegSegmentAnalyzer.JpegSegmentInfo(5056843, 65497, 2),
+ ),
+ 31 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 18040),
+ JpegSegmentAnalyzer.JpegSegmentInfo(18042, 65517, 114),
+ JpegSegmentAnalyzer.JpegSegmentInfo(18156, 65505, 2814),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20970, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(21039, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(21108, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(21127, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(21157, 65476, 88),
+ JpegSegmentAnalyzer.JpegSegmentInfo(21245, 65476, 28),
+ JpegSegmentAnalyzer.JpegSegmentInfo(21273, 65476, 46),
+ JpegSegmentAnalyzer.JpegSegmentInfo(21319, 65498, 1751816),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1773135, 65497, 2),
+ ),
+ 32 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 9798),
+ JpegSegmentAnalyzer.JpegSegmentInfo(9800, 65517, 9720),
+ JpegSegmentAnalyzer.JpegSegmentInfo(19520, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(22682, 65505, 3447),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26129, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26145, 65534, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26199, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26268, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26337, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26356, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26386, 65476, 81),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26467, 65476, 29),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26496, 65476, 59),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26555, 65498, 933304),
+ JpegSegmentAnalyzer.JpegSegmentInfo(959859, 65497, 2),
+ ),
+ 33 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 13748),
+ JpegSegmentAnalyzer.JpegSegmentInfo(13750, 65517, 13028),
+ JpegSegmentAnalyzer.JpegSegmentInfo(26778, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29940, 65505, 11427),
+ JpegSegmentAnalyzer.JpegSegmentInfo(41367, 65499, 134),
+ JpegSegmentAnalyzer.JpegSegmentInfo(41501, 65501, 6),
+ JpegSegmentAnalyzer.JpegSegmentInfo(41507, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(41523, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(41542, 65476, 195),
+ JpegSegmentAnalyzer.JpegSegmentInfo(41737, 65498, 1498590),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1540327, 65497, 2),
+ ),
+ 34 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 12892),
+ JpegSegmentAnalyzer.JpegSegmentInfo(12912, 65517, 102),
+ JpegSegmentAnalyzer.JpegSegmentInfo(13014, 65505, 2814),
+ JpegSegmentAnalyzer.JpegSegmentInfo(15828, 65506, 8702),
+ JpegSegmentAnalyzer.JpegSegmentInfo(24530, 65514, 3670),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28200, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28269, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28338, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28357, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28387, 65476, 76),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28463, 65476, 29),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28492, 65476, 46),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28538, 65498, 1756223),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1784761, 65497, 2),
+ ),
+ 35 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 12526),
+ JpegSegmentAnalyzer.JpegSegmentInfo(12528, 65517, 11826),
+ JpegSegmentAnalyzer.JpegSegmentInfo(24354, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(27516, 65505, 14486),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42002, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42018, 65534, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42072, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42141, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42210, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42229, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42259, 65476, 77),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42336, 65476, 29),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42365, 65476, 57),
+ JpegSegmentAnalyzer.JpegSegmentInfo(42422, 65498, 1215580),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1258002, 65497, 2),
+ ),
+ 36 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65504, 18),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20, 65505, 1350),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1370, 65505, 4162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(5532, 65517, 626),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6158, 65506, 614),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6772, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6841, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6910, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6929, 65476, 32),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6961, 65476, 91),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7052, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7083, 65476, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(7152, 65498, 1628511),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1635663, 65497, 2),
+ ),
+ 37 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 2598),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2600, 65517, 43100),
+ JpegSegmentAnalyzer.JpegSegmentInfo(45700, 65505, 38195),
+ JpegSegmentAnalyzer.JpegSegmentInfo(83895, 65506, 578),
+ JpegSegmentAnalyzer.JpegSegmentInfo(84473, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(84489, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(84558, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(84627, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(84646, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(84677, 65476, 82),
+ JpegSegmentAnalyzer.JpegSegmentInfo(84759, 65476, 29),
+ JpegSegmentAnalyzer.JpegSegmentInfo(84788, 65476, 61),
+ JpegSegmentAnalyzer.JpegSegmentInfo(84849, 65498, 362619),
+ JpegSegmentAnalyzer.JpegSegmentInfo(447468, 65497, 2),
+ ),
+ 38 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 11990),
+ JpegSegmentAnalyzer.JpegSegmentInfo(11992, 65517, 13484),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25476, 65505, 13073),
+ JpegSegmentAnalyzer.JpegSegmentInfo(38549, 65506, 578),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39127, 65518, 35),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39162, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39231, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39300, 65474, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39319, 65476, 32),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39351, 65476, 29),
+ JpegSegmentAnalyzer.JpegSegmentInfo(39380, 65498, 1317385),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1356765, 65497, 2),
+ ),
+ 39 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 22782),
+ JpegSegmentAnalyzer.JpegSegmentInfo(22784, 65505, 2814),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25598, 65534, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25652, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25721, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25790, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25809, 65476, 31),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25840, 65476, 79),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25919, 65476, 28),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25947, 65476, 44),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25991, 65498, 1191901),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1217892, 65497, 2),
+ ),
+ 40 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 4388),
+ JpegSegmentAnalyzer.JpegSegmentInfo(4390, 65517, 5864),
+ JpegSegmentAnalyzer.JpegSegmentInfo(10254, 65505, 15566),
+ JpegSegmentAnalyzer.JpegSegmentInfo(25820, 65506, 3162),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28982, 65518, 16),
+ JpegSegmentAnalyzer.JpegSegmentInfo(28998, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29067, 65499, 69),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29136, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29155, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29185, 65476, 74),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29259, 65476, 30),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29289, 65476, 59),
+ JpegSegmentAnalyzer.JpegSegmentInfo(29348, 65498, 1651935),
+ JpegSegmentAnalyzer.JpegSegmentInfo(1681283, 65497, 2),
+ ),
+ 48 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 13524),
+ JpegSegmentAnalyzer.JpegSegmentInfo(13526, 65506, 554),
+ JpegSegmentAnalyzer.JpegSegmentInfo(14080, 65499, 134),
+ JpegSegmentAnalyzer.JpegSegmentInfo(14214, 65501, 6),
+ JpegSegmentAnalyzer.JpegSegmentInfo(14220, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(14239, 65476, 420),
+ JpegSegmentAnalyzer.JpegSegmentInfo(14659, 65498, 6790271),
+ JpegSegmentAnalyzer.JpegSegmentInfo(6804930, 65497, 2),
+ ),
+ 49 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 20366),
+ JpegSegmentAnalyzer.JpegSegmentInfo(20368, 65505, 2562),
+ JpegSegmentAnalyzer.JpegSegmentInfo(22930, 65499, 134),
+ JpegSegmentAnalyzer.JpegSegmentInfo(23064, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(23083, 65476, 420),
+ JpegSegmentAnalyzer.JpegSegmentInfo(23503, 65498, 9266056),
+ JpegSegmentAnalyzer.JpegSegmentInfo(9289559, 65497, 2),
+ ),
+ 50 to listOf(
+ JpegSegmentAnalyzer.JpegSegmentInfo(0, 65496, 2),
+ JpegSegmentAnalyzer.JpegSegmentInfo(2, 65505, 65470),
+ JpegSegmentAnalyzer.JpegSegmentInfo(65472, 65505, 12288),
+ JpegSegmentAnalyzer.JpegSegmentInfo(77760, 65506, 138),
+ JpegSegmentAnalyzer.JpegSegmentInfo(77898, 65506, 54),
+ JpegSegmentAnalyzer.JpegSegmentInfo(77952, 65506, 44098),
+ JpegSegmentAnalyzer.JpegSegmentInfo(122050, 65476, 420),
+ JpegSegmentAnalyzer.JpegSegmentInfo(122470, 65499, 134),
+ JpegSegmentAnalyzer.JpegSegmentInfo(122604, 65501, 6),
+ JpegSegmentAnalyzer.JpegSegmentInfo(122610, 65472, 19),
+ JpegSegmentAnalyzer.JpegSegmentInfo(122629, 65498, 14607244),
+ JpegSegmentAnalyzer.JpegSegmentInfo(14729873, 65497, 2),
+ ),
+ )
/**
* Regression test based on a fixed small set of test files.
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/format/jxl/JxlWriterTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/format/jxl/JxlWriterTest.kt
index ae4b8f63..4cd0469a 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/format/jxl/JxlWriterTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/format/jxl/JxlWriterTest.kt
@@ -35,6 +35,7 @@ import kotlin.test.fail
class JxlWriterTest {
+ /* language=XML */
private val expectedXmp = """
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/format/png/PngImageParserTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/format/png/PngImageParserTest.kt
index ffe3c253..fc8d2ca8 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/format/png/PngImageParserTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/format/png/PngImageParserTest.kt
@@ -43,9 +43,9 @@ class PngImageParserTest {
assertNotNull(chunks)
assertEquals(4, chunks.size)
- val exifTxtChunk = chunks.get(1) as? PngChunkZtxt
- val iptcTxtChunk = chunks.get(2) as? PngChunkZtxt
- val xmpTxtChunk = chunks.get(3) as? PngChunkItxt
+ val exifTxtChunk = chunks[1] as? PngChunkZtxt
+ val iptcTxtChunk = chunks[2] as? PngChunkZtxt
+ val xmpTxtChunk = chunks[3] as? PngChunkItxt
assertNotNull(exifTxtChunk)
assertEquals("Raw profile type exif", exifTxtChunk.keyword)
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/format/png/PngWriterTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/format/png/PngWriterTest.kt
index f36ea2f0..69021a37 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/format/png/PngWriterTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/format/png/PngWriterTest.kt
@@ -41,6 +41,7 @@ import kotlin.test.fail
class PngWriterTest {
+ /* language=XML */
private val expectedXmp = """
diff --git a/src/commonTest/kotlin/com/ashampoo/kim/format/webp/WebPWriterTest.kt b/src/commonTest/kotlin/com/ashampoo/kim/format/webp/WebPWriterTest.kt
index 9351a547..7905c893 100644
--- a/src/commonTest/kotlin/com/ashampoo/kim/format/webp/WebPWriterTest.kt
+++ b/src/commonTest/kotlin/com/ashampoo/kim/format/webp/WebPWriterTest.kt
@@ -35,6 +35,7 @@ import kotlin.test.fail
class WebPWriterTest {
+ /* language=XML */
private val expectedXmp = """
diff --git a/src/commonTest/resources/com/ashampoo/kim/testdata/xmp/acdsee_sample_mod.xmp b/src/commonTest/resources/com/ashampoo/kim/testdata/xmp/acdsee_sample_mod.xmp
index ccfe08d8..74a75317 100644
--- a/src/commonTest/resources/com/ashampoo/kim/testdata/xmp/acdsee_sample_mod.xmp
+++ b/src/commonTest/resources/com/ashampoo/kim/testdata/xmp/acdsee_sample_mod.xmp
@@ -1,5 +1,5 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+