simplify api
This commit is contained in:
@@ -44,4 +44,9 @@ abstract class MangaLoaderContext {
|
|||||||
response: Response,
|
response: Response,
|
||||||
redraw: (image: Bitmap) -> Bitmap
|
redraw: (image: Bitmap) -> Bitmap
|
||||||
): Response
|
): Response
|
||||||
|
|
||||||
|
abstract fun createBitmap(
|
||||||
|
width: Int,
|
||||||
|
height: Int
|
||||||
|
): Bitmap
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +1,8 @@
|
|||||||
package org.koitharu.kotatsu.parsers.bitmap
|
package org.koitharu.kotatsu.parsers.bitmap
|
||||||
|
|
||||||
import kotlinx.io.Sink
|
interface Bitmap {
|
||||||
|
val width: Int
|
||||||
|
val height: Int
|
||||||
|
|
||||||
abstract class Bitmap {
|
fun drawBitmap(sourceBitmap: Bitmap, src: Rect, dst: Rect)
|
||||||
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")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ class MangaReaderToParser(context: MangaLoaderContext) : PagedMangaParser(contex
|
|||||||
val width = bitmap.width
|
val width = bitmap.width
|
||||||
val height = bitmap.height
|
val height = bitmap.height
|
||||||
|
|
||||||
val result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
val result = context.createBitmap(width, height)
|
||||||
|
|
||||||
val pieces = ArrayList<Piece>()
|
val pieces = ArrayList<Piece>()
|
||||||
for (y in 0 until height step PIECE_SIZE) {
|
for (y in 0 until height step PIECE_SIZE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user