image redrawing api
parent
9d4fc1980f
commit
90c0bf46f4
@ -0,0 +1,53 @@
|
|||||||
|
package org.koitharu.kotatsu.parsers.bitmap
|
||||||
|
|
||||||
|
import kotlinx.io.Sink
|
||||||
|
|
||||||
|
abstract class Bitmap {
|
||||||
|
abstract val width: Int
|
||||||
|
abstract val height: Int
|
||||||
|
|
||||||
|
enum class CompressFormat {
|
||||||
|
JPEG,
|
||||||
|
PNG,
|
||||||
|
WEBP_LOSSY,
|
||||||
|
WEBP_LOSSLESS,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class Config {
|
||||||
|
ALPHA_8,
|
||||||
|
RGB_565,
|
||||||
|
ARGB_8888,
|
||||||
|
RGBA_F16,
|
||||||
|
HARDWARE,
|
||||||
|
RGBA_1010102,
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract fun compress(
|
||||||
|
format: CompressFormat,
|
||||||
|
quality: Int,
|
||||||
|
sink: Sink
|
||||||
|
): Boolean
|
||||||
|
|
||||||
|
abstract fun getPixels(
|
||||||
|
/*@ColorInt*/
|
||||||
|
pixels: IntArray,
|
||||||
|
offset: Int,
|
||||||
|
stride: Int,
|
||||||
|
x: Int,
|
||||||
|
y: Int,
|
||||||
|
width: Int,
|
||||||
|
height: Int,
|
||||||
|
)
|
||||||
|
|
||||||
|
abstract fun drawBitmap(sourceBitmap: Bitmap, src: Rect, dst: Rect)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun createBitmap(width: Int, height: Int, config: Config): Bitmap {
|
||||||
|
throw NotImplementedError("createBitmap(width, height, config) is not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createBitmap(source: Bitmap, x: Int, y: Int, width: Int, height: Int): Bitmap {
|
||||||
|
throw NotImplementedError("createBitmap(source, x, y, width, height) is not implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package org.koitharu.kotatsu.parsers.bitmap
|
||||||
|
|
||||||
|
data class Rect(
|
||||||
|
val left: Int = 0,
|
||||||
|
val top: Int = 0,
|
||||||
|
val right: Int = 0,
|
||||||
|
val bottom: Int = 0,
|
||||||
|
) {
|
||||||
|
val width: Int
|
||||||
|
get() = right - left
|
||||||
|
val height: Int
|
||||||
|
get() = bottom - top
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue