|
@@ -18,9 +18,10 @@ object PdfMaker {
|
|
|
val height = 1080
|
|
|
val coverWidth = width / 2
|
|
|
emitter.onNext(progress++ / total)
|
|
|
- val front = drawFrontCover(coverWidth, height, project.name ?: "")
|
|
|
+ val front = drawFrontCover(coverWidth, height, project.name
|
|
|
+ ?: "", project.frontCoverColor.getColor(context))
|
|
|
emitter.onNext(progress++ / total)
|
|
|
- val back = drawBackCover(context, coverWidth, height)
|
|
|
+ val back = drawBackCover(context, coverWidth, height, project.backCoverColor.getColor(context))
|
|
|
emitter.onNext(progress++ / total)
|
|
|
val standardPdfWriter = StandardPdfWriter(file, front, back)
|
|
|
project.story?.scenes?.forEach {
|
|
@@ -43,10 +44,10 @@ object PdfMaker {
|
|
|
val author = project?.author ?: ""
|
|
|
emitter.onNext(progress++ / total)
|
|
|
/** front **/
|
|
|
- val front = drawFrontCover(width, height, name)
|
|
|
+ val front = drawFrontCover(width, height, name, project.frontCoverColor.getColor(context))
|
|
|
emitter.onNext(progress++ / total)
|
|
|
/** back **/
|
|
|
- val back = drawBackCover(context, width, height)
|
|
|
+ val back = drawBackCover(context, width, height, project.backCoverColor.getColor(context))
|
|
|
emitter.onNext(progress++ / total)
|
|
|
/** pages **/
|
|
|
val pdfBookWriter = PdfBookWriter(file, front, back)
|
|
@@ -60,7 +61,7 @@ object PdfMaker {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private fun drawFrontCover(width: Int, height: Int, name: String): Bitmap {
|
|
|
+ private fun drawFrontCover(width: Int, height: Int, name: String, coverColor: Int): Bitmap {
|
|
|
val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
|
color = Color.WHITE
|
|
|
textSize = 100f
|
|
@@ -69,7 +70,7 @@ object PdfMaker {
|
|
|
}
|
|
|
return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444).apply {
|
|
|
Canvas(this).apply {
|
|
|
- drawColor(Color.parseColor("#faa600"))
|
|
|
+ drawColor(coverColor)
|
|
|
val marginBottom = height / 20
|
|
|
val rect = Rect(0, height - height / 3 - marginBottom, width, height - marginBottom)
|
|
|
val p = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
@@ -82,10 +83,10 @@ object PdfMaker {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private fun drawBackCover(context: Context, width: Int, height: Int): Bitmap {
|
|
|
+ private fun drawBackCover(context: Context, width: Int, height: Int, coverColor: Int): Bitmap {
|
|
|
return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444).apply {
|
|
|
Canvas(this).apply {
|
|
|
- drawColor(Color.parseColor("#faa600"))
|
|
|
+ drawColor(coverColor)
|
|
|
val drawable = context.getDrawable(R.drawable.ic_logo_full_white)
|
|
|
val marginBottom = this.height / 10
|
|
|
val w = this.width / 3
|